06.08.2013 Views

pSOSystem System Calls - Read

pSOSystem System Calls - Read

pSOSystem System Calls - Read

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

lock_f pHILE+ <strong>System</strong> <strong>Calls</strong><br />

lock_f Locks or unlocks part or all of an open file.<br />

#include <br />

unsigned long lock_f(<br />

unsigned long fid, /* file identifier */<br />

unsigned long startpos, /* starting lock position */<br />

unsigned long bcount /* number of bytes to lock */<br />

)<br />

Volume Types<br />

Description<br />

Arguments<br />

Return Value<br />

pHILE+ formatted volumes.<br />

lock_f() locks or unlocks part or all of an open file. Following a lock_f() system<br />

call, only the task that set the lock can access the locked bytes and only through the<br />

connection (the file identifier) used to set the lock.<br />

A lock_f() call replaces any previous locks it set through the same connection<br />

with the new lock. Thus, only one lock per connection can be set. lock_f() with<br />

bcount = 0 is used to remove a lock.<br />

A file can have as many locks as it has connections if the locks do not overlap. If a<br />

task attempts to lock a region already locked through a different connection, an<br />

error is returned, even if the two connections are from the same task.<br />

fid Specifies the file identifier of the file to lock.<br />

startpos Specifies the starting byte of the locked region.<br />

bcount Specifies the length of the locked region in bytes.<br />

This system call returns 0 on success or an error code on failure.<br />

2-56 <strong>pSO<strong>System</strong></strong> <strong>System</strong> <strong>Calls</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!