Skip to contentSkip to conversation

"struct file" - per process per file?

DISCUSSION Rajat Jain 1 participant 1 message Mar 29, 2007

lore
Share & tools
lore

Rajat Jain

author
#0 lore raw

Hi,

This has reference to LDD3 chap3 - Char drivers (Pg 60).

The following is my understanding which seems to be incorrect. Can somebody please point out what am I missing?

LDD3 states that the fops->open() and fops->release() methods are called only when "struct file" is created / destroyed. It further says that "struct file" is created ONLY when a process calls open() system all on a file. To give an example, it also says that if process 1 opens file A and then forks another process B, then A and B will share the same struct file??

This seems quite strange to me as I had an understanding that two processes working on the same file will always have different file structure. Also, this would mean that a read by one of the processes on the file would affect the file position pointer in the other process?

I am sure I am missing something here. What is it?

Thanks,

Rajat

--
To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to [email protected] Please read the FAQ at http://kernelnewbies.org/FAQ