作者piimaila (haha)
看板LinuxDev
标题Re: [问题] 请问应用程式如何取得网路装置
时间Fri Oct 19 16:55:28 2007
※ 引述《ILYUJING (蟹)》之铭言:
基本上
建议你去参考现有的工具如
ethtool 的原始码 内容非常的完整
把你要的剪贴一下就可以了
去google 打一下
ethtool-2-1tr.src.rpm
就可以找到档案了
: 我想在user-space下利用ioctl取得网路装置的资讯
: ioctl的系统呼叫如下:
: int ioctl( int fd, int cmd, ...);
: 关於fd我应该怎麽取得?
: 我的意思是我怎麽在应用程式下开启网路装置?
: 以及我需要include哪些lib?
: #include<stdio.h>
: ?
: int main() {
: int fd = ?
: struct ifreq data;
: ....
: ioctl(fd,cmd,&data);
: return 0;
: }
: ※ 编辑: ILYUJING 来自: 140.124.183.77 (10/18 20:47)
: → prudent:网路的fd,不就是用 socket 函式吗! 是指这个吗? 10/18 23:36
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.128.252.130