source: rtems/c/src/lib/libc/ioctl.c @ bde9bb5

4.104.114.84.95
Last change on this file since bde9bb5 was 9c49db4, checked in by Joel Sherrill <joel.sherrill@…>, on 01/08/01 at 18:26:44

2001-01-08 Ralf Corsepius <corsepiu@…>

  • configure.in: Add libc/config.h
  • libc/Makefile.am: Add INCLUDES += -I. to pickup config.h
  • libc/.cvsignore: Add config.h and stamp-h
  • libc/*.c: Add config.h support.
  • Property mode set to 100644
File size: 1.1 KB
Line 
1/*
2 *  ioctl() system call
3 *
4 *  This routine is not defined in the POSIX 1003.1b standard but is
5 *  commonly supported on most UNIX and POSIX systems.
6 *
7 *  COPYRIGHT (c) 1989-1999.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.OARcorp.com/rtems/license.html.
13 *
14 *  $Id$
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/libio_.h>
22
23#include <unistd.h>
24
25int ioctl(
26  int  fd,
27  int  command,
28  ...
29)
30{
31  va_list            ap;
32  rtems_status_code  rc;
33  rtems_libio_t     *iop;
34  void              *buffer;
35
36  rtems_libio_check_fd( fd );
37  iop = rtems_libio_iop( fd );
38  rtems_libio_check_is_open(iop);
39
40  va_start(ap, command);
41
42  buffer = va_arg(ap, void *);
43
44  /*
45   *  Now process the ioctl().
46   */
47
48  if ( !iop->handlers )
49    set_errno_and_return_minus_one( EBADF );
50
51  if ( !iop->handlers->ioctl_h )
52    set_errno_and_return_minus_one( ENOTSUP );
53
54  rc = (*iop->handlers->ioctl_h)( iop, command, buffer );
55
56  return rc;
57}
Note: See TracBrowser for help on using the repository browser.