4.104.114.84.95
Last change
on this file since cca4400 was
cca4400,
checked in by Joel Sherrill <joel.sherrill@…>, on 12/10/98 at 23:31:54
|
Merged Eric Norum's select patch that was based on 4.0 and resolved
all conflicts.
|
-
Property mode set to
100644
|
File size:
1.3 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-1998. |
---|
8 | * On-Line Applications Research Corporation (OAR). |
---|
9 | * Copyright assigned to U.S. Government, 1994. |
---|
10 | * |
---|
11 | * The license and distribution terms for this file may be |
---|
12 | * found in the file LICENSE in this distribution or at |
---|
13 | * http://www.OARcorp.com/rtems/license.html. |
---|
14 | * |
---|
15 | * $Id$ |
---|
16 | */ |
---|
17 | |
---|
18 | #include "libio_.h" |
---|
19 | |
---|
20 | int ioctl( |
---|
21 | int fd, |
---|
22 | unsigned32 command, |
---|
23 | void * buffer |
---|
24 | ) |
---|
25 | { |
---|
26 | rtems_status_code rc; |
---|
27 | rtems_libio_t *iop; |
---|
28 | |
---|
29 | rtems_libio_check_fd( fd ); |
---|
30 | iop = rtems_libio_iop( fd ); |
---|
31 | |
---|
32 | /* |
---|
33 | * If this file descriptor is mapped to an external set of handlers, |
---|
34 | * then pass the request on to them. |
---|
35 | */ |
---|
36 | |
---|
37 | if ( iop->flags & LIBIO_FLAGS_HANDLER_MASK ) { |
---|
38 | rtems_libio_ioctl_t fp; |
---|
39 | |
---|
40 | fp = rtems_libio_handlers[ |
---|
41 | (iop->flags >> LIBIO_FLAGS_HANDLER_SHIFT) - 1].ioctl; |
---|
42 | if ( fp == NULL ) |
---|
43 | set_errno_and_return_minus_one( EBADF ); |
---|
44 | |
---|
45 | return (*fp)( fd, command, buffer ); |
---|
46 | } |
---|
47 | |
---|
48 | /* |
---|
49 | * Now process the ioctl(). |
---|
50 | */ |
---|
51 | |
---|
52 | if ( !iop->handlers->ioctl ) |
---|
53 | set_errno_and_return_minus_one( ENOTSUP ); |
---|
54 | |
---|
55 | rc = (*iop->handlers->ioctl)( iop, command, buffer ); |
---|
56 | |
---|
57 | return rc; |
---|
58 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.