source: rtems/cpukit/libcsupport/src/ioctl.c @ 9012db8

5
Last change on this file since 9012db8 was 9012db8, checked in by Sebastian Huber <sebastian.huber@…>, on 09/13/17 at 09:33:25

libio: LIBIO_GET_IOP() LIBIO_GET_IOP_WITH_ACCESS()

Replace rtems_libio_check_fd(), rtems_libio_iop(),
rtems_libio_check_open() and rtems_libio_check_permissions()
combinations with new LIBIO_GET_IOP() and LIBIO_GET_IOP_WITH_ACCESS()
macros.

Update #3132.

  • Property mode set to 100644
File size: 989 bytes
Line 
1/**
2 * @file
3 *
4 * @brief ioctl() system call
5 * @ingroup libcsupport
6 */
7
8/*
9 *  This routine is not defined in the POSIX 1003.1b standard but is
10 *  commonly supported on most UNIX and POSIX systems.
11 *
12 *  COPYRIGHT (c) 1989-1999.
13 *  On-Line Applications Research Corporation (OAR).
14 *
15 *  The license and distribution terms for this file may be
16 *  found in the file LICENSE in this distribution or at
17 *  http://www.rtems.org/license/LICENSE.
18 */
19
20#if HAVE_CONFIG_H
21#include "config.h"
22#endif
23
24#include <stdarg.h>
25
26#include <rtems/libio_.h>
27#include <rtems/seterr.h>
28
29#include <unistd.h>
30
31int ioctl(
32  int  fd,
33  ioctl_command_t  command,
34  ...
35)
36{
37  va_list            ap;
38  int                rc;
39  rtems_libio_t     *iop;
40  void              *buffer;
41
42  LIBIO_GET_IOP( fd, iop );
43
44  va_start(ap, command);
45
46  buffer = va_arg(ap, void *);
47
48  /*
49   *  Now process the ioctl().
50   */
51  rc = (*iop->pathinfo.handlers->ioctl_h)( iop, command, buffer );
52
53  va_end( ap );
54  return rc;
55}
Note: See TracBrowser for help on using the repository browser.