TIP: Click on subject to list as thread! ANSI
echo: cis.os9.68000.osk
to: Bob van der Poel 76510,2203 (X)
from: Kim Kempf 71161,3221
date: 1995-01-13 00:28:27
subject: #20687-unix functions

#: 20701 S12/OS9/68000 (OSK)
    13-Jan-95  00:28:27
Sb: #20687-unix functions
Fm: Kim Kempf 71161,3221
To: Bob van der Poel 76510,2203 (X)

 >> Does anyone happen to know what the functions lockf() or flock() do in the
unix environment? Is there an equivalent OS9ism? <<

 RBF provides implicit locks when a file is opened for update (read/write).
When a process does a read() when the file is opened for update the bytes in
the file that were read are implicitly "locked".  If another process (or the
same process on a different path) tries to read or write within the locked byte
range, the call will block until the reading process performs a write(),
another read() or _ss_lock(0).
 An explicit lock can be set with _ss_lock(len) which will lock the bytes from
the current file position for "len" bytes.  If len == ~0, then the entire file
is locked.  A program can limit the time it's blocked waiting for the lock by
calling _ss_tiks(val) where "val" is the maximum number of ticks to wait for
the lock before returning E_LOCK.  E_DEADLK is returned when two locks by the
same or different processes would result in a "deadly-embrace".

 That was the one paragraph dissertation on OS-9/RBF record locking.  There is
also a special EOF lock.  If anyone is interested, I can give a one paragraph
dissertation on that, too!

SOURCE: compuserve via textfiles.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.