<br><br><div class="gmail_quote">2013/1/29 Tobias Boege <span dir="ltr"><<a href="mailto:tobias@gambas-buch.de" target="_blank">tobias@gambas-buch.de</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, 29 Jan 2013, Karaoui mohamed lamine wrote:<br>
> Hello,<br>
><br>
> I was looking at how a syscall read/write was done, and i found this :<br>
><br>
> ....<br>
> loff_t pos = file_pos_read(f.file);<br>
> ret = vfs_read(f.file, buf, count, &pos);<br>
> file_pos_write(f.file, pos);<br>
> fdput(f);<br>
> ...<br>
><br>
> My questions are :<br>
><br>
> Where did the locking go? I would have imaginated something like :<br>
><br>
> ....<br>
</div>> *lock(f);*<br>
<div class="im">> loff_t pos = file_pos_read(f.file);<br>
> ret = vfs_read(f.file, buf, count, &pos);<br>
> file_pos_write(f.file, pos);<br>
> fdput(f);<br>
</div>> *unlock(f);*<br>
<div class="im">> ...<br>
><br>
> If multiple threads try to read/write at the same time, they could<br>
> read/write at the same offset ?<br>
><br>
<br>
</div>Look some lines above:<br>
<br>
struct fd f = fdget(fd);<br></blockquote><div><br></div><div>This function is supposed to return the file reference, does do the locking ?</div><div>It seems that i can't find the lock instruction( with all those rcu instructions, i am little lost), can you guide me throught ?</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Regards,<br>
Tobi<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>
</blockquote></div><br>