<p>actually i dont see why there is a need to ptovide a lock by the kernel.<br>
the locking should be at userspace.<br>
you can test it by massive write to a file, that would demonstrat the kernel <br>
didnt confer a lock</p>
<p>sent from my samsung</p>
<div class="gmail_quot<blockquote class=" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,
<div><br></div><div>I was looking at how a syscall read/write was done, and i found this : </div><div><br></div><div> ....</div><div><div> loff_t pos = file_pos_read(f.file);</div><div> ret = vfs_read(f.file, buf, count, &pos);</div>
<div> file_pos_write(f.file, pos);</div><div> fdput(f);</div></div><div> ...</div><div><br></div><div>My questions are :</div><div><br></div><div>Where did the locking go? I would have imaginated something like :</div>
<div><br></div><div><div> ....</div><div> <b>lock(f);</b></div><div><div> loff_t pos = file_pos_read(f.file);</div><div> ret = vfs_read(f.file, buf, count, &pos);</div><div> file_pos_write(f.file, pos);</div>
<div> fdput(f);</div></div><div> <b>unlock(f);</b></div><div> ...</div></div><div><br></div><div>If multiple threads try to read/write at the same time, they could read/write at the same offset ?</div><div><br></div>
<div>If my understanding are correct, is this POSIX compliant ?</div><div><br></div><div><br></div><div>thanks.</div><div><br></div>
<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>