2001-12-06 21:18:43

by Nav Mundi

[permalink] [raw]
Subject: 'fd' file descriptor help

Does anyone know what the file descriptor 'fd' pointer does? My module makes
a system call [sys_open] to the kernal which then returns a fd value but I
don't know what this value means or how it gets it. Does the fd value
signify a specific device or is it random? Any ideas?

Thanks for your help in advance.

-Nav


2001-12-06 21:54:05

by Chris Wright

[permalink] [raw]
Subject: Re: 'fd' file descriptor help

* Nav Mundi ([email protected]) wrote:
> Does anyone know what the file descriptor 'fd' pointer does? My module makes
> a system call [sys_open] to the kernal which then returns a fd value but I
> don't know what this value means or how it gets it. Does the fd value
> signify a specific device or is it random? Any ideas?

fd is a handle for the kernel file struct representing the file you
opened. read include/linux/file.h::fd_install() to understand where
it's put, and include/linux/file.h::fcheck() as an example of retrieving
kernel object from the handle.

cheers,
-chris