Welcome! Log In Create A New Profile

Advanced

question about open() system call, file descriptor, and inode

Posted by wx672 
question about open() system call, file descriptor, and inode
November 19, 2010 11:27AM
Hi,

As we know, you have to open a file before you do something to it. And the open() system call is like this:

int open(const char *pathname, int flags);

The return value is a file descriptor. Can anyone tell me why doesn't it return an inode number instead?

Thanks in advance!

Xiaolin
Re: question about open() system call, file descriptor, and inode
November 20, 2010 03:58AM
Perhaps my question was not very clear. I mean according to the current design of the EXT2 file system, we have to use the file descriptor returned by the open() syscall to find the corresponding inode of the file. And three in-core tables are needed for this file-descriptor -> inode-number mapping process,
- an per-process user file descriptor table,
- a global open file table, and
- an inode table

If the open() syscall can return inode number directly, we don't need so many tables any longer. Is it feasible?
Author:

Your Email:


Subject:


Spam prevention:
Please, solve the mathematical question and enter the answer in the input field below. This is for blocking bots that try to post this form automatically.
Question: how much is 25 plus 21?
Message: