[PATCH 1/2] Add support for posix_devctl()

Gedare Bloom gedare at rtems.org
Wed Jan 11 01:36:58 UTC 2017


two typos below:

On Tue, Jan 10, 2017 at 6:57 PM, Joel Sherrill <joel at rtems.org> wrote:
> ---
>  cpukit/libcsupport/Makefile.am                    |    3 +-
>  cpukit/libcsupport/src/devctl.c                   |   72 ++++++++++++++++++
>  cpukit/posix/src/sysconf.c                        |    2 +
>  testsuites/psxtests/Makefile.am                   |    3 +
>  testsuites/psxtests/configure.ac                  |    1 +
>  testsuites/psxtests/psxdevctl01/Makefile.am       |   23 ++++++
>  testsuites/psxtests/psxdevctl01/main.c            |   50 +++++++++++++
>  testsuites/psxtests/psxdevctl01/psxdevctl01.doc   |   23 ++++++
>  testsuites/psxtests/psxdevctl01/psxdevctl01.scn   |    4 +
>  testsuites/psxtests/psxdevctl01/test.c            |   81 +++++++++++++++++++++
>  testsuites/psxtests/psxhdrs/Makefile.am           |    3 +
>  testsuites/psxtests/psxhdrs/devctl/posix_devctl.c |   37 ++++++++++
>  12 files changed, 301 insertions(+), 1 deletions(-)
>  create mode 100644 cpukit/libcsupport/src/devctl.c
>  create mode 100644 testsuites/psxtests/psxdevctl01/Makefile.am
>  create mode 100644 testsuites/psxtests/psxdevctl01/main.c
>  create mode 100644 testsuites/psxtests/psxdevctl01/psxdevctl01.doc
>  create mode 100644 testsuites/psxtests/psxdevctl01/psxdevctl01.scn
>  create mode 100644 testsuites/psxtests/psxdevctl01/test.c
>  create mode 100644 testsuites/psxtests/psxhdrs/devctl/posix_devctl.c
>
> diff --git a/cpukit/libcsupport/Makefile.am b/cpukit/libcsupport/Makefile.am
> index bf78fa0..c9d2c7b 100644
> --- a/cpukit/libcsupport/Makefile.am
> +++ b/cpukit/libcsupport/Makefile.am
> @@ -138,7 +138,8 @@ libcsupport_a_SOURCES += src/printertask.c
>  libcsupport_a_SOURCES += $(LIBC_GLUE_C_FILES) $(PASSWORD_GROUP_C_FILES) \
>      $(TERMINAL_IDENTIFICATION_C_FILES) $(SYSTEM_CALL_C_FILES) \
>      $(DIRECTORY_SCAN_C_FILES) $(ID_C_FILES) src/envlock.c \
> -    $(TERMIOS_C_FILES) src/getpagesize.c src/getrusage.c
> +    $(TERMIOS_C_FILES) src/getpagesize.c src/getrusage.c src/devctl.c
> +
>
>  libcsupport_a_SOURCES += src/flockfile.c src/funlockfile.c src/ftrylockfile.c
>
> diff --git a/cpukit/libcsupport/src/devctl.c b/cpukit/libcsupport/src/devctl.c
> new file mode 100644
> index 0000000..353e0a5
> --- /dev/null
> +++ b/cpukit/libcsupport/src/devctl.c
> @@ -0,0 +1,72 @@
> +/*
> + * Copyright (c) 2016 Joel Sherrill <joel at rtems.org>.  All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions
> + * are met:
> + * 1. Redistributions of source code must retain the above copyright
> + *    notice, this list of conditions and the following disclaimer.
> + * 2. Redistributions in binary form must reproduce the above copyright
> + *    notice, this list of conditions and the following disclaimer in the
> + *    documentation and/or other materials provided with the distribution.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
> + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
> + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
> + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
> + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
> + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
> + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +
> +#if HAVE_CONFIG_H
> +#include "config.h"
> +#endif
> +
> +#define _POSIX_26_C_SOURCE
> +
> +#include <devctl.h>
> +#include <sys/ioctl.h>
> +#include <rtems/seterr.h>
> +
> +int posix_devctl(
> +  int            fd,
> +  int            dcmd,
> +  void *restrict dev_data_ptr,
> +  size_t         nbyte,
> +  int *restrict  dev_info_ptr
> +)
> +{
> +  /*
> +   * The POSIX 1003.26 standard allows for library implementations
> +   * that implement posix_devctl() using ioctl(). In this case,
> +   * the extra parameters are largely ignored.
> +   *
> +   * The FACE Technical Standard requires only that FIONBIO
> +   * be supported for sockets.
> +   *
> +   * This method appears to be rarely implemented and there are
> +   * no known required use cases for this method beyond those
> +   * from ther FACE Technical Standard.
typo: ther -> the

> diff --git a/testsuites/psxtests/psxdevctl01/psxdevctl01.doc b/testsuites/psxtests/psxdevctl01/psxdevctl01.doc
> new file mode 100644
> index 0000000..606e0d5
> --- /dev/null
> +++ b/testsuites/psxtests/psxdevctl01/psxdevctl01.doc
> @@ -0,0 +1,23 @@
> +#  COPYRIGHT (c) 2016.
> +#  On-Line Applications Research Corporation (OAR).
> +#
> +#  The license and distribution terms for this file may be
> +#  found in the file LICENSE in this distribution or at
> +#  http://www.rtems.org/license/LICENSE.
> +#
> +
> +This file describes the directives and concepts tested by this test set.
> +
> +test set name:  psxdevctl01
> +
> +directives:
> +
> +  posix_devctl
> +
> +concepts:
> +
> ++ Ensure that proper error values result when passing different combinations of
> +  arguments to posix_devctl().
> +
> ++ Ensure that a requestion is passed through the underlying ioctl() operation
typo: requestion -> request

> +  to the console device driver and flagged as an error.



More information about the devel mailing list