Files
rtems/c/src/lib/libc/ioctl.c
Joel Sherrill 3ba74c733f 2000-11-01 Joel Sherrill <joel@OARcorp.com>
* include/Makefile.am, include/rtems/libio_.h, libc/Makefile.am,
	libc/assoc.c, libc/assocnamebad.c, libc/base_fs.c, libc/cfsetispeed.c,
	libc/cfsetospeed.c, libc/chdir.c, libc/chmod.c, libc/chown.c,
	libc/close.c, libc/closedir.c, libc/dup2.c, libc/error.c, libc/eval.c,
	libc/fchdir.c, libc/fchmod.c, libc/fcntl.c, libc/fdatasync.c,
	libc/fpathconf.c, libc/fstat.c, libc/fsync.c, libc/ftruncate.c,
	libc/getdents.c, libc/ioctl.c, libc/libio.c, libc/libio_sockets.c,
	libc/link.c, libc/lseek.c, libc/malloc.c, libc/mallocfreespace.c,
	libc/mknod.c, libc/mount.c, libc/newlibc.c, libc/no_libc.c,
	libc/open.c, libc/read.c, libc/readlink.c, libc/rmdir.c, libc/stat.c,
	libc/symlink.c, libc/tcsetattr.c, libc/telldir.c, libc/ttyname.c,
	libc/ttyname_r.c, libc/umask.c, libc/unlink.c, libc/unmount.c,
	libc/utime.c, libc/write.c:
	assoc.h, error.h, libio_.h, libio.h, and libcsupport.h moved
	from libc to lib/include/rtems and now must be referenced as
	<rtems/XXX.h>.
	* include/rtems/Makefile.am, include/rtems/.cvsignore: New file.
	* include/rtems/assoc.h, include/rtems/error.h,
	include/rtems/libcsupport.h, include/rtems/libio.h,
	include/rtems/libio_.h: New/moved files.
2000-11-01 21:08:14 +00:00

54 lines
1.0 KiB
C

/*
* ioctl() system call
*
* This routine is not defined in the POSIX 1003.1b standard but is
* commonly supported on most UNIX and POSIX systems.
*
* COPYRIGHT (c) 1989-1999.
* 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.OARcorp.com/rtems/license.html.
*
* $Id$
*/
#include <rtems/libio_.h>
#include <unistd.h>
int ioctl(
int fd,
int command,
...
)
{
va_list ap;
rtems_status_code rc;
rtems_libio_t *iop;
void *buffer;
rtems_libio_check_fd( fd );
iop = rtems_libio_iop( fd );
rtems_libio_check_is_open(iop);
va_start(ap, command);
buffer = va_arg(ap, void *);
/*
* Now process the ioctl().
*/
if ( !iop->handlers )
set_errno_and_return_minus_one( EBADF );
if ( !iop->handlers->ioctl_h )
set_errno_and_return_minus_one( ENOTSUP );
rc = (*iop->handlers->ioctl_h)( iop, command, buffer );
return rc;
}