Linux IOCTL functions

Source: Internet
Author: User

Function prototypes

...);

The IOCTL () function manipulates the parameter special files of the underlying device.

Function parameter Description

...);第一个参数必须是一个打开的文件描述。第二个参数是设备相关的请求代码第三个参数是一个无类型的指针的内存。指针类型依赖第二个参数。

the corresponding relationship table of the second parameter of the IOCTL function and the third parameter pointer type

Ifconf Structural Body

struct ifconf  {    int ifc_len;            /* 缓冲区大小    */    union {        char *ifcu_buf;        struct ifreq *ifcu_req;    } ifc_ifcu;};#define ifc_buf ifc_ifcu.ifcu_buf       /* 缓冲区地址    */#define ifc_req ifc_ifcu.ifcu_req       /* ifreq的地址 */

Ifreq Structural Body

structIfreq {#define Ifhwaddrlen 6 //6-byte hardware address, ie mac         Union{CharIfrn_name[ifnamesiz];//network interface name} IFR_IFRN;Union{structSOCKADDR ifru_addr;//Local IP address                structSOCKADDR ifru_dstaddr;//Destination IP address                structSOCKADDR ifru_broadaddr;//Broadcast IP address                structSOCKADDR Ifru_netmask;//local subnet mask address                structSOCKADDR ifru_hwaddr;//Local MAC address                 ShortIfru_flags;//network interface Tag                intIfru_ivalue;//Different requests have different meanings                structIfmap Ifru_map;//network card address mapping                intIFRU_MTU;//MAX transmission Unit                CharIfru_slave[ifnamsiz];//Placeholder                CharIfru_newname[ifnamsize];//New name                void__user* Ifru_data;//user Data                structIf_settings ifru_settings;//Device protocol settings} Ifr_ifru;}#define IFR_NAME Ifr_ifrn.ifrn_name; //Interface name #define IFR_HWADDR ifr_ifru.ifru_hwaddr; //mac #define IFR_ADDR ifr_ifru.ifru_addr; //local IP #define IFR_DSTADDR ifr_ifru.dstaddr; //Destination IP #define IFR_BROADADDR ifr_ifru.broadaddr; //Broadcast IP #define IFR_NETMASK Ifr_ifru.ifru_netmask; //Subnet mask #define IFR_FLAGS Ifr_ifru.ifru_flags; //Logo #define Ifr_metric Ifr_ifru.ifru_ivalue; //Interface side degree #define IFR_MTU IFR_IFRU.IFRU_MTU; //MAX transmission Unit #define IFR_MAP Ifr_ifru.ifru_map; //Device address mapping #define Ifr_slave Ifr_ifru.ifru_slave; //Auxiliary equipment #define IFR_DATA Ifr_ifru.ifru_data; //interface use #define IFR_IFRINDEX Ifr_ifru.ifru_ivalue; //network interface serial number #define Ifr_bandwidth Ifr_ifru.ifru_ivalue; //Connection Bandwidth #define Ifr_qlen Ifr_ifru.ifru_ivalue; //transmission unit length #define IFR_NEWNAME Ifr_ifru.ifru_newname; //new name #define Ifr_seeting ifr_ifru.ifru_settings; //Device protocol settings 

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Linux IOCTL functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.