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>