Download your favorite Linux distribution at LQ ISO.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-09-2004, 08:16 AM   #1
Registered: Jul 2004
Posts: 72

Rep: Reputation: 15
difference between fget(fd) and current->files->fd[fd]

Can anyone please tell me the difference between
fget(filedesriptor) and current->files->fd[filedescriptor].
Does both return the same file pointer.
Old 08-09-2004, 08:46 AM   #2
Senior Member
Registered: Jan 2004
Location: Oregon, USA
Distribution: Slackware
Posts: 1,246

Rep: Reputation: 59
I have no idea what fget() is, but it isn't a standard function. What's it supposed do (on your system)?
Old 08-09-2004, 08:54 AM   #3
Registered: Jul 2004
Posts: 72

Original Poster
Rep: Reputation: 15
Yes, it is not a part of libc function. fget is part of system function.
I am writing a kernel module and want to get information about a file reference count using the filedescriptor.I thought about getting the pointer to 'struct file' structure and there on i can get the other details about the file.
Old 08-09-2004, 10:46 AM   #4
Registered: Mar 2003
Posts: 804

Rep: Reputation: 30
well look at the code! fget() makes sure the fd is within the limit of max_open files, and if the process actually has that descriptor open. if it does, the reference count is incremented and the file structure is returned.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to extract difference between two files? Marshalle Linux - General 8 01-05-2011 12:45 PM
Difference between 10.1 and current distro? moffen Slackware 4 05-18-2005 09:58 PM
.rar files versus .iso files the difference? dolphans1 Mandriva 14 01-31-2005 09:33 AM
lost files in current kde 3.2.2 czar Slackware 1 04-24-2004 04:03 AM
list only files in current directory xscousr Programming 8 09-22-2003 07:35 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:52 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration