os/ossrv/genericopenlibs/openenvcore/include/sys/ioccom.dosc
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/openenvcore/include/sys/ioccom.dosc	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,92 @@
     1.4 +/** @file ../include/sys/ioccom.h
     1.5 +@internalComponent
     1.6 +*/
     1.7 +
     1.8 +/** @fn  ioctl(int aFid, unsigned long aCmd, ...)
     1.9 +@param aFid
    1.10 +@param aCmd
    1.11 +@param ...
    1.12 +@return   If an error has occurred, a value of -1 is returned and errno is set to indicate the error.
    1.13 +
    1.14 +@code
    1.15 +  #include < sys/ioctl.h >
    1.16 +@endcode
    1.17 +  The ioctl system call manipulates the underlying device parameters of special files.
    1.18 +In particular, many operating
    1.19 +characteristics of character special files (e.g. terminals)
    1.20 +may be controlled with ioctl requests.
    1.21 +The argument aFid
    1.22 + must be an open file descriptor.
    1.23 +
    1.24 + The third argument to ioctl is traditionally named char *argp .
    1.25 +Most uses of ioctl in 3.0,
    1.26 +however require the third argument to be a caddr_t
    1.27 +or an int.
    1.28 +
    1.29 + An ioctl request has encoded in it whether the argument is an "in"
    1.30 +argument
    1.31 +or "out"
    1.32 +argument, and the size of the argument argp in bytes.
    1.33 +Macros and defines used in specifying an ioctl request are located in the file  \#include \<sys/ioctl.h \>
    1.34 +
    1.35 +Examples:
    1.36 +@code
    1.37 + /* Detailed description  : Sample usage of ioctl system call ,for command SIOCGIFINDEX 
    1.38 +  * which gets socket interface index , by passing socket interface home.*/
    1.39 +#include <sys/types.h>
    1.40 +#include <sys/socket.h>
    1.41 +#include <stdio.h>
    1.42 +#include <sys/ioctl.h>
    1.43 +int main()
    1.44 +{
    1.45 +  int ret = 0;
    1.46 +        struct ifreq ifr;
    1.47 +        int sockfd;
    1.48 +                
    1.49 +        sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);      
    1.50 +        strncpy(ifr.ifr_name, "Ethernet with Daemon Dynamic IP", sizeof(ifr.ifr_name));
    1.51 +        
    1.52 +                if (ioctl(sockfd, SIOCGIFINDEX, &ifr;) != -1)
    1.53 +                {
    1.54 +                ret = -1;
    1.55 +                }
    1.56 +                
    1.57 +        close(sockfd);
    1.58 +        return ret; }
    1.59 +
    1.60 +@endcode
    1.61 +@see fcntl()
    1.62 +
    1.63 +
    1.64 +
    1.65 +@capability Deferred @ref Rsocket::Open
    1.66 +
    1.67 +@publishedAll
    1.68 +@externallyDefinedApi
    1.69 +*/
    1.70 +
    1.71 +/** @def _IOR(g,n,t)
    1.72 +
    1.73 +IO read.
    1.74 +
    1.75 +@publishedAll
    1.76 +@released
    1.77 +*/
    1.78 +
    1.79 +/** @def _IOW(g,n,t)
    1.80 +
    1.81 +IO write.
    1.82 +
    1.83 +@publishedAll
    1.84 +@released
    1.85 +*/
    1.86 +
    1.87 +/** @def _IOWR(g,n,t)
    1.88 +
    1.89 +IO read write.
    1.90 +
    1.91 +@publishedAll
    1.92 +@released
    1.93 +*/
    1.94 +
    1.95 +