> Is there any standard rule to decide which locking system ATK should try
> to use to maintain compatibility with AFS?  For example, on AIX 3 it
> seems that only lockf resulted in real locking on AFS.

Heh.  There are two problems here.

First, AFS supports only whole-file locking.  On systems that support
flock(2), that should work.  On systems that have only byte-range
locking (lockf or fcntl), you should be able to use that, IF you
specify the entire file as the range to be locked (usually, this
means starting position and offset are both zero).

Secondly, there's an error number problem.  The fileserver supports only
non-blocking locks; blocking locks are done entirely within the fileserver.
First, let's assume the simple case - you want to do a non-blocking lock.
You call flock/lockf/fcntl, and expect to get back either success or
EWOULDBLOCK.  The problem is, no one does error code translation, so you
get back the SERVER's value for EWOULDBLOCK.  If the server and client
aren't using the same value, you get confused.

To make life even more fun, the cache manager implements blocking locks
by retrying the lock periodically, as long as it gets EWOULDBLOCK.  If
it gets some other error code, that gets returned to you.  Net result:
blocking locks are impossible if the fileserver and client don't use
the same value for EWOULDBLOCK.

Values for EWOULDBLOCK from some popular OS's:

*_mach       35
alpha_osf20  35
hp700_ux90   246
pmax_ul43a   35
rs_aix32     54
sgi_53       1101
sun4c_411    35
sun4c_54     11

Anyone see a problem here?

-- Jeff

Reply via email to