_IOR (g, n, t) _IOC(IOC_OUT, (g), (n), sizeof(t))
Description
IO read.
Parameters
_IOW (g, n, t) _IOC(IOC_IN, (g), (n), sizeof(t))
Description
IO write.
Parameters
_IOWR (g, n, t) _IOC(IOC_INOUT, (g), (n), sizeof(t))
Description
IO read write.
Parameters
Interface status: |
externallyDefinedApi |
|
IMPORT_C int ioctl(int, unsigned long,...);
Description
#include < sys/ioctl.h >
The ioctl system call manipulates the underlying device parameters of special files. In particular, many operating characteristics
of character special files (e.g. terminals) may be controlled with ioctl requests. The argument aFid must be an open file
descriptor.
The third argument to ioctl is traditionally named char *argp . Most uses of ioctl in 3.0, however require the third argument
to be a caddr_t or an int.
An ioctl request has encoded in it whether the argument is an "in" argument or "out" argument, and the size of the argument
argp in bytes. Macros and defines used in specifying an ioctl request are located in the file #include <sys/ioctl.h >
Examples:
/* Detailed description : Sample usage of ioctl system call ,for command SIOCGIFINDEX
which gets socket interface index , by passing socket interface home.*/
# 36 "d:/EPOC/release/9.4/common/generic/openenv/core/include/sys/ioccom.dosc" 2
# 37 "d:/EPOC/release/9.4/common/generic/openenv/core/include/sys/ioccom.dosc" 2
# 38 "d:/EPOC/release/9.4/common/generic/openenv/core/include/sys/ioccom.dosc" 2
# 39 "d:/EPOC/release/9.4/common/generic/openenv/core/include/sys/ioccom.dosc" 2
int main()
{
int ret = 0;
struct ifreq ifr;
int sockfd;
sockfd = socket( 0x0800 , 2 , IPPROTO_UDP);
strncpy(ifr.ifr_name, "Ethernet with Daemon Dynamic IP", sizeof(ifr.ifr_name));
if (ioctl(sockfd, ((unsigned long)( ( 0x80000000 | 0x40000000 ) | (( sizeof( struct ifreq ) & 0x1fff ) << 16) | (( ( 's' ) ) << 8) | ( ( 6 ) ))) , 𝔦) != -1)
{
ret = -1;
}
close(sockfd);
return ret; }
Parameters
Return value
int |
If an error has occurred, a value of -1 is returned and errno is set to indicate the error.
|
|