LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 09-03-2009, 04:33 AM   #1
alankar
LQ Newbie
 
Registered: Sep 2009
Posts: 1

Rep: Reputation: 0
how kernel resolves file descriptors when you do open() or read()


Hi,
I am new to this comunity.
my question is: how in kernel level file descriptors are resolved after open() is called
Also what is difference between fd and file pointer
Thanks in advance.
alankar
 
Old 09-03-2009, 11:58 PM   #2
jrtayloriv
Member
 
Registered: Jun 2004
Location: Inland NW, US
Distribution: Ubuntu
Posts: 363
Blog Entries: 1

Rep: Reputation: 44
As far as what open() does, see /usr/src/linux/fs/open.c

As far as the difference between a file descriptor and a FILE *, type info libc in your shell and read the section called I/O Overview

--jrtayloriv
 
Old 09-04-2009, 12:35 AM   #3
praveen24
LQ Newbie
 
Registered: Jan 2009
Posts: 13

Rep: Reputation: 0
File

[QUOTE=alankar;3667974]Hi,
I am new to this comunity.
my question is: how in kernel level file descriptors are resolved after open() is called
------------------------------------------------------------------------
User Levelpen(---)
Kernel Level :sys_open() this function does so many following things.
(1)read file pathname
(2)calls some kernel function to get an fd
(3)calls filp_open() which performs some operation like checking the existence of file ,its current permission,file locking status,etc.
(4)dentry_open is called to create file object and it calls some function to set up methods that operates on file plus some more operations
(5)return fd.
------------------------------------------------------------------------

Also what is difference between fd and file pointer ?
File pointer is a kind of opaque data type. It means you donot have to bother the inside of this structure.It will point itself to the required position inside the file depending upon the C routine.There are some more things.....

------------------------------------------------------------------------
 
  


Reply


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
LXer: Finding The Number Of Open File Descriptors Per Process On Linux And Unix LXer Syndicated Linux News 1 11-25-2009 09:07 AM
Max open file descriptors stuck at 1024? ravindra.j21 Linux - Newbie 1 06-12-2009 05:03 AM
POSIX-portable (i.e. glibc) way to list all open file descriptors? ta0kira Programming 2 07-22-2007 01:09 PM
How to find out the number of open file descriptors? skie_knite007 Programming 2 12-11-2005 10:23 PM
unix file descriptors versus c FILE pointers nodger Programming 9 11-25-2004 07:02 AM


All times are GMT -5. The time now is 10:27 AM.

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