| 网站首页 | 文学 | 小说 | 动漫 | 论文 | 军事 | 科技 | 图片 | 教育 | 哲学 | 历史 | 英语 | 
首页>>计算机 >>程序编程 用户登录 新用户注册
Linux ioctl() Primer

Linux ioctl() Primer

Vipul Gupta

In general an ioctl call in a user program looks like ioctl(int fd, int command, (char *) argstruct). For ioctl calls related to the networking code (these are the only ones we will deal with in this note), the file descriptor fd is actually a socket descriptor returned by the socket() system call. The command could be any one of those listed in /usr/include/linux/sockios.h. These commands are subdivided into a number of categories depending on what aspect of networking they deal with:

changing the routing table (e.g. SIOCADDRT, SIOCDELRT),
reading/updating the ARP/RARP caches (e.g. SIOCDARP, SIOCSRARP),
generic functions related to network interfaces (e.g. SIOCGIFNAME, SIOCSIFADDR etc)
The Goodies directory contains a number of sample programs illustrating the use of networking ioctl calls. As you look at these programs, notice how the structure used for argstruct depends on the ioctl command type. For example, routing table related ioctls use the rte
< 1 >   < 2

在百度搜索:Linux ioctl() Primer
推 荐
相 关 文 章
  • 谈谈代码风格──谈谈缩进
  • 小软件项目开发的管理
  • TCP/IP 协议
  • 高级套接字函数
  • 用户数据报发送
  • 完整的读写函数
  • 服务器和客户机的信息函数
  • 第六篇:从程序员到系统分析员之一
  • 第七篇:从程序员到系统分析员之二
  • 第五篇:达到目标必经的路 之三