<div dir="ltr">Correct :)<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 30, 2013 at 12:01 PM, Pranay Kumar Srivastava <span dir="ltr"><<a href="mailto:Pranay.Shrivastava@hcl.com" target="_blank">Pranay.Shrivastava@hcl.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
<br>
> -----Original Message-----<br>
> From: Rajat Sharma [mailto:<a href="mailto:fs.rajat@gmail.com">fs.rajat@gmail.com</a>]<br>
> Sent: Wednesday, January 30, 2013 11:16 AM<br>
> To: Pranay Kumar Srivastava<br>
> Cc: <a href="mailto:kernelnewbies@kernelnewbies.org">kernelnewbies@kernelnewbies.org</a><br>
> Subject: Re: Where does kernel store per task file position?<br>
><br>
> > I'm still not able to figure out where exactly is the position of file stored per<br>
> task_struct.<br>
> struct file * itself is per process (task_struct) so file->f_pos is file position per<br>
> process, if thats what you are looking for. I hope you haven't assumed that<br>
> struct file itself is unique for a file, i.e. per inode? Then that assumption is<br>
> wrong.<br>
> -Rajat<br>
<br>
</div>[Pranay Kumar Srivastava] That really was a stupid question, it says right there get_empty_filp() in do_sys_open. For forks the inherited file have common struct file [Correct?] but for the files opened after fork in child/parent will not have shared struct file[Correct?]. So the same dentry can be pointed to by multiple struct file[Correct?] that's why there's an increment of dentry while doing lookup[Correct?].<br>
<br>
Thanks a lot!<br>
<div class="HOEnZb"><div class="h5">><br>
> On Tue, Jan 29, 2013 at 6:38 PM, Pranay Kumar Srivastava<br>
> <<a href="mailto:Pranay.Shrivastava@hcl.com">Pranay.Shrivastava@hcl.com</a>> wrote:<br>
> Hi Everyone,<br>
><br>
> I was trying to find out where does Linux store per process file position?<br>
> Since struct file is allocated once when the file is first opened<br>
> (get_empty_filp() via do_sys_open) .I looked at these,<br>
><br>
> Copy_process--->copy_files-->dup_fd it seemed to allocate only (struct<br>
> file*)<br>
><br>
> struct files_struct , but I couldn't find any field that is actually being used to<br>
> store the file position.<br>
><br>
><br>
> I'm still not able to figure out where exactly is the position of file stored per<br>
> task_struct. Secondly even if this was being saved does the kernel changes<br>
> f_pos of struct file whenever a (read/write) is done? I don't that happens<br>
> [Correct?].<br>
><br>
> Regards,<br>
> Pranay Kumar Srivastava<br>
><br>
><br>
> ::DISCLAIMER::<br>
> ----------------------------------------------------------------------------------------------<br>
> ------------------------------------------------------<br>
><br>
> The contents of this e-mail and any attachment(s) are confidential and<br>
> intended for the named recipient(s) only.<br>
> E-mail transmission is not guaranteed to be secure or error-free as<br>
> information could be intercepted, corrupted, lost, destroyed, arrive late or<br>
> incomplete, or may contain viruses in transmission. The e mail and its<br>
> contents (with or without referred errors) shall therefore not attach any<br>
> liability on the originator or HCL or its affiliates.<br>
> Views or opinions, if any, presented in this email are solely those of the<br>
> author and may not necessarily reflect the views or opinions of HCL or its<br>
> affiliates. Any form of reproduction, dissemination, copying, disclosure,<br>
> modification, distribution and / or publication of this message without the<br>
> prior written consent of authorized representative of HCL is strictly<br>
> prohibited. If you have received this email in error please delete it and notify<br>
> the sender immediately.<br>
> Before opening any email and/or attachments, please check them for viruses<br>
> and other defects.<br>
><br>
> ----------------------------------------------------------------------------------------------<br>
> ------------------------------------------------------<br>
><br>
><br>
> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br>
</div></div></blockquote></div><br></div>