"struct file" - per process per file?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux