我想确定struct fdtable
或struct file
的哪个成员可以让我确定一个打开的文件是套接字还是管道。
我能找到的唯一途径是:
struct file f ....;
f.path->mnt->mnt_devname
这会返回挂载点处的设备名称,所有socket/pipe显然分别属于sockfs或pipefs。
有没有一种更快的方法,使用struct file或fdtable的其他成员来检查打开的文件是否为socket或pipe?
注意:我正在使用2.6.24内核定义。