I am trying to find what member(s) of the struct fdtable or struct file will let me determine whether or not an open file is a socket or a pipe.
the only path I can seem to find is:
struct file f ....;
f.path->mnt->mnt_devname
This returns the device name at the mountpoint, all sockets/pipes apparently belong to sockfs or pipefs respectively.
Is there a faster way to check to see if an open file is a socket or pipe using a different member of the struct file or fdtable?
Note: I am using the kernel definitions from 2.6.24
There are special macro definitions at linux/stat.h that checks
inode->i_mode:It seems that you’ll need to use 2 of them –
S_ISFIFOandS_ISSOCKin a such way: