Thread (4 messages) 4 messages, 3 authors, 2014-08-19

fd type from number

From: Loris Degioanni <hidden>
Date: 2014-08-19 16:36:25

On 8/19/2014 9:10 AM, Greg KH wrote:
On Tue, Aug 19, 2014 at 08:38:24AM -0700, Loris Degioanni wrote:
quoted
(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.
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help