os/ossrv/genericopenlibs/openenvcore/include/sys/ioccom.dosc
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /** @file ../include/sys/ioccom.h
     2 @internalComponent
     3 */
     4 
     5 /** @fn  ioctl(int aFid, unsigned long aCmd, ...)
     6 @param aFid
     7 @param aCmd
     8 @param ...
     9 @return   If an error has occurred, a value of -1 is returned and errno is set to indicate the error.
    10 
    11 @code
    12   #include < sys/ioctl.h >
    13 @endcode
    14   The ioctl system call manipulates the underlying device parameters of special files.
    15 In particular, many operating
    16 characteristics of character special files (e.g. terminals)
    17 may be controlled with ioctl requests.
    18 The argument aFid
    19  must be an open file descriptor.
    20 
    21  The third argument to ioctl is traditionally named char *argp .
    22 Most uses of ioctl in 3.0,
    23 however require the third argument to be a caddr_t
    24 or an int.
    25 
    26  An ioctl request has encoded in it whether the argument is an "in"
    27 argument
    28 or "out"
    29 argument, and the size of the argument argp in bytes.
    30 Macros and defines used in specifying an ioctl request are located in the file  \#include \<sys/ioctl.h \>
    31 
    32 Examples:
    33 @code
    34  /* Detailed description  : Sample usage of ioctl system call ,for command SIOCGIFINDEX 
    35   * which gets socket interface index , by passing socket interface home.*/
    36 #include <sys/types.h>
    37 #include <sys/socket.h>
    38 #include <stdio.h>
    39 #include <sys/ioctl.h>
    40 int main()
    41 {
    42   int ret = 0;
    43         struct ifreq ifr;
    44         int sockfd;
    45                 
    46         sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);      
    47         strncpy(ifr.ifr_name, "Ethernet with Daemon Dynamic IP", sizeof(ifr.ifr_name));
    48         
    49                 if (ioctl(sockfd, SIOCGIFINDEX, &ifr;) != -1)
    50                 {
    51                 ret = -1;
    52                 }
    53                 
    54         close(sockfd);
    55         return ret; }
    56 
    57 @endcode
    58 @see fcntl()
    59 
    60 
    61 
    62 @capability Deferred @ref Rsocket::Open
    63 
    64 @publishedAll
    65 @externallyDefinedApi
    66 */
    67 
    68 /** @def _IOR(g,n,t)
    69 
    70 IO read.
    71 
    72 @publishedAll
    73 @released
    74 */
    75 
    76 /** @def _IOW(g,n,t)
    77 
    78 IO write.
    79 
    80 @publishedAll
    81 @released
    82 */
    83 
    84 /** @def _IOWR(g,n,t)
    85 
    86 IO read write.
    87 
    88 @publishedAll
    89 @released
    90 */
    91 
    92