Socket-level operations  [include/linux/sockios.h], [include/asm-i386/sockios.h]

FIOSETOWN Set the process ID or process group ID that is to receive the SIGIO and SIGURG signals.
edx should contain a pointer to a singed integer specifying the process ID or the process group ID to which the socket should send asynchronous signals such as SIGURG. A process ID is specified as a positive integer, and a process group ID is specified as a negative integer. Specifying a 0 value resets the socket such that no asynchronous signals will be delivered. Specifying a process ID or a process group ID requests that sockets begin sending the SIGURG signal to the specified ID when out-of-band data arrives on the socket.
SIOCSPGRP This command is equal to FIOSETOWN.
FIOGETOWN Get the process ID or process group ID that is to receive the SIGIO and SIGURG signals.
edx should contain a pointer to a signed integer that will contain the process ID or the process group ID to which the socket is currently sending asynchronous signals such as SIGURG. A process ID is returned as a positive integer, and a process group ID is specified as a negative integer. A 0 value returned indicates that no asynchronous signals can be generated by the socket. A positive or a negative value indicates that the socket has been set to generate SIGURG signals.
SIOCGPGRP This command is equal to FIOGETOWN
SIOCATMARK Return the value indicating whether socket's read pointer is currently at the out-of-band mark.
edx should contain a pointer to an integer flag. If the socket's read pointer is currently at the out-of-band mark, the flag is set to a nonzero value. If it is not, the flag is set to zero.
SIOCGSTAMP Get time stamp. edx should point to a timeval structure which will receive the information:

struc timeval
{
.tv_sec  rd 1
.tv_usec rd 1
}
SIOCINQ This IOCTL is identical to FIONREAD (See Terminal IOCTLs).
SIOCOUTQ This IOCTL is identical to TIOCOUTQ (See Terminal IOCTLs).
SIOCADDRT Add a routing entry in the routing table. Valid for sockets with address family of AF_INET (also requires super user privileges). edx should point to a properly initialized rtentry structure:

struc rtentry
{
rt_pad1    rd 1
rt_dst     sockaddr
rt_gateway sockaddr
rt_genmask sockaddr
rt_flags   rw 1
rt_pad2    rw 1
rt_pad3    rd 1
rt_pad4    rd 1
rt_metric  rw
rt_dev     rd 1
rt_mtu     rd 1
rt_window  rd 1
rt_irtt    rw 1
}

rtentry
members:

rt_pad1
Not used.
rt_dst
Route destination address. This member must be set in order to add a new route.
rt_gateway
Gateway address. This member must be set in order to add a new route.
rt_genmask
Route address mask. This member must be set in order to add a new route.
rt_flags
Some information about a route (for example, whether the route was created dynamically, whether the route is usable, type of route, and so on).
rt_pad2
Not used.
rt_pad3
Not used.
rt_pad4
Not used.
rt_metric
Metric specific to a route.
rt_dev
Pointer to a null terminated device name string (e.g. "eth0")
rt_mtu
MTU specific to a route.
rt_window
Window clamping specific to a route.
rt_irtt
Initial round trip time (RTT).

In case of success return value is 0, otherwise return value is one of the following errno values:
-ENETUNREACH Cannot reach the destination network.
-EAGAIN *to be documented*
-EEXIST Routing table entry already exists.
SIOCDELRT Delete a routing entry from the routing table. Valid for sockets with address family of AF_INET (also requires super user privileges). edx should point to a properly initialized rtentry structure. See above.
SIOCRTMSG No longer supported.
SIOCGIFNAME Retrieve the name of a particular interface. edx should point to a ifreq structure with ifru_ivalue member set to desired interface index. ifrn_name array will be filled with name information upon return. ifreq defined as follows:

struc ifreq
{
.ifrn_name       rb 16
.ifru_addr:      ;sockaddr
.ifru_dstaddr:   ;sockaddr
.ifru_broadaddr: ;sockaddr
.ifru_netmask:   ;sockaddr
.ifru_hwaddr:    ;sockaddr
.ifru_flags:     ;rw 1
.ifru_ivalue:    ;rd 1
.ifru_mtu:       ;rd 1
.ifru_map:       ;if_map
.ifru_slave:     ;rb 16
.ifru_data:      ;rd 1
.ifru_settings:  ;if_settings
.ifru_newname    rb 16
}

where ifmap and if_settings are defined as follows:

struc ifmap
{
.mem_start    rd 1
.long mem_end rd 1
.base_addr    rw 1
.irq          rb 1
.dma          rb 1
.port         rb 1
}
struc if_settings
{
.type         rd 1
.size         rd 1
.raw_hdlc:    ;rd 1
.cisco:       ;rd 1
.fr:          ;rd 1
.fr_pvc:      ;rd 1
.fr_pvc_info: ;rd 1
.sync:        ;rd 1
.te1          rd 1
}
SIOCSIFLINK Not supported. Will always return -EINVAL.
SIOCGIFCONF Retrieve interface configuration. edx should point to a ifconf structure, with ifcu_req and if_len members properly initialized:

struc ifconf
{
.ifc_len   rd 1
.ifcu_buf: ;rd 1
.ifcu_req  rd 1
}

ifconf members:

if_len
Size in byte of the array pointed by ifcu_req.
ifcu_req
Pointer to an array of ifreq structures.

Function will fail with -EFAULT if edx or ifcu_req don't contain a valid pointers.
SIOCGIFFLAGS Retrieve interface flags for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to desired interface name. Upon return ifru_flags will contain interface flags (see below)
SIOCSIFFLAGS Set interface flags for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to desired interface name. ifru_flags may contain following flags:

IFF_UP          - Interface is up
IFF_BROADCAST   - broadcast address valid
IFF_DEBUG       - turn on debugging
IFF_LOOPBACK    - is a loopback net
IFF_POINTOPOINT - interface is has p-p link
IFF_NOTRAILERS  - avoid use of trailers
IFF_RUNNING     - interface RFC2863 OPER_UP
IFF_NOARP       - no ARP protocol
IFF_PROMISC     - receive all packets
IFF_ALLMULTI    - receive all multicast packets
IFF_MASTER      - master of a load balancer
IFF_SLAVE       - slave of a load balancer
IFF_MULTICAST   - Supports multicast
IFF_PORTSEL     - can set media type
IFF_AUTOMEDIA   - auto media select active
IFF_DYNAMIC     - dialup device with changing addresses
IFF_LOWER_UP    - driver signals L1 up
IFF_DORMANT     - driver signals dormant
SIOCGIFADDR Retrieve interface address for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name. Upon return ifru_addr will contain the address.
SIOCSIFADDR Set interface address for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name and ifru_addr containing the new address.
This operation is privileged.
SIOCGIFDSTADDR Retrieve destination address for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name. Upon return ifru_dstaddr will contain the address.
SIOCSIFDSTADDR Set destination address for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name and ifru_dstaddr containing the new address.
This operation is privileged.
SIOCGIFBRDADDR Retrieve broadcast address for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name. Upon return ifru_broadaddr will contain the address.
SIOCSIFBRDADDR Set broadcast address for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name and ifru_broadaddr containing the new address.
This operation is privileged.
SIOCGIFNETMASK Retrieve network mask for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name. Upon return ifru_netmask will contain the address.
SIOCSIFNETMASK Set network mask for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name and ifru_netmask containing the new address.
This operation is privileged.
SIOCGIFMETRIC Retrieve metric for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name. Upon return ifru_ivalue will contain the metric.
SIOCSIFMETRIC Set metric for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name and ifru_ivalue containing the new metric.
This operation is privileged.
SIOCGIFMEM Not supported. Will always return -EINVAL.
SIOCSIFMEM Not supported. Will always return -EINVAL.
SIOCGIFMTU Retrieve Maximum Transfer Unit (MTU) size for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name. Upon return ifru_mtu will contain the metric.
SIOCSIFMTU Set Maximum Transfer Unit (MTU) size for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name and ifru_mtu containing the new MTU size.
This operation is privileged.
SIOCSIFNAME Change the name of the indicated interface. edx should point to a ifreq structure with ifrn_ivalue member set to the desired interface index and ifru_newname containg the new name.
SIOCSIFHWADDR Set hardware address (MAC) for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name and ifru_hwaddr containing the new address.
This operation is privileged.
SIOCGIFENCAP *to be documented*
SIOCSIFENCAP *to be documented*
SIOCGIFHWADDR Retrieve hardware address (MAC) for the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name. Upon return ifru_hwaddr will contain the address.
SIOCGIFSLAVE *to be documented*
SIOCSIFSLAVE *to be documented*
SIOCADDMULTI *to be documented*
SIOCDELMULTI *to be documented*
SIOCGIFINDEX Retrieve interface index. edx should point to a ifreq structure with ifrn_name member set to the desired interface name. Upon return ifru_ivalue will contain the index.
SIOCSIFPFLAGS *to be documented*
SIOCGIFPFLAGS *to be documented*
SIOCDIFADDR *to be documented*
SIOCSIFHWBROADCAST *to be documented*
SIOCGIFCOUNT Not implemented.
SIOCGIFBR *to be documented*
SIOCSIFBR *to be documented*
SIOCGIFTXQLEN Retrieve transmit queue length of the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name. Upon return ifru_ival will contain the length.
SIOCSIFTXQLEN Set transmit queue length of the indicated interface. edx should point to a ifreq structure with ifrn_name member set to the desired interface name and ifru_ivalue containing the new length.
This operation is privileged.
SIOCGIFDIVERT *to be documented*
SIOCSIFDIVERT *to be documented*
SIOCETHTOOL *to be documented*
SIOCGMIIPHY *to be documented*
SIOCGMIIREG *to be documented*
SIOCSMIIREG *to be documented*
SIOCWANDEV *to be documented*
SIOCDARP Delete ARP mapping. Available for all PF_INET sockets. edx should point to a properly initialized arpreq structure:

struc arpreq
{
.arp_pa      sockaddr
.arp_ha      sockaddr
.arp_flags   rd 1
.arp_netmask sockaddr
.arp_dev     rb 16
}

arpreq members:

arp_pa
Protocol address. Must be AF_INET socket.
arp_ha
Hardware address. Must be same type as the device specified by arp_dev.
arp_flags
Flags:

ATF_COM         - Completed entry (lookup complete).
ATF_PERM        - Permanent entry.
ATF_PUBL        - Publish entry.
ATF_USETRAILERS - Has requested trailers.
ATF_NETMASK     - Use a netmask.
ATF_DONTPUB     - Don't answer this addresses.
arp_netmask
Netmask (only for proxy entries). Valid if ATF_NETMASK is set, Ignored otherwise.
arp_dev
Null terminated device name.

This operation is privileged.
SIOCGARP Get ARP mapping. Available for all PF_INET sockets. edx should point to a properly initialized arpreq structure (see above).
SIOCSARP Set ARP mapping. Available for all PF_INET sockets. edx should point to a properly initialized arpreq structure (see above). This operation is privileged.
SIOCDRARP *to be documented*
SIOCGRARP *to be documented*
SIOCSRARP *to be documented*
SIOCGIFMAP Retrieve interface's hardware parameters. edx should point to an ifreq structure with ifru_map member properly initialized (see SIOCGIFNAME).
SIOCSIFMAP Set interface's hardware parameters. edx should point to an ifreq structure with ifru_map member properly initialized (see SIOCGIFNAME). This operation is privileged.
SIOCADDDLCI *to be documented*
SIOCDELDLCI *to be documented*
SIOCGIFVLAN *to be documented*
SIOCSIFVLAN *to be documented*
SIOCBONDENSLAVE *to be documented*
SIOCBONDRELEASE *to be documented*
SIOCBONDSETHWADDR *to be documented*
SIOCBONDSLAVEINFOQUERY *to be documented*
SIOCBONDINFOQUERY *to be documented*
SIOCBONDCHANGEACTIVE *to be documented*
SIOCBRADDBR *to be documented*
SIOCBRDELBR *to be documented*
SIOCBRADDIF *to be documented*
SIOCBRDELIF *to be documented*