On 8/19/2014 9:10 AM, Greg KH wrote: > On Tue, Aug 19, 2014 at 08:38:24AM -0700, Loris Degioanni wrote: >> (resending making sure this is not part of another thread) >> >> I'm looking for an efficient way to determine the type of an fd (file, >> socket...) given its number, from a kernel module. > You don't have a "number" from within the kernel, you have a pointer to > the full file descriptor structure, right? If so, what is missing from > that structure that you can not find? I do have the FD number, because it's coming from intercepting a system call. > >> The closest thing I found by looking at the kernel sources is >> sockfd_lookup(), which works but is limited to telling me if the fd is a >> socket or not. >> >> Is there something else I can look at? > What exactly are you trying to do with this? And what does it matter > what "type" of thing a file descriptor is? What can you do with that > information? I just sent another email with some explanation. Loris > > thanks, > > greg k-h _______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies