Subject: Re: What does POSIX say about this?
To: None <,>
From: None <>
List: current-users
Date: 06/14/1994 08:15:26
First of all, F_UNLCK is a locking mode for the F_SETLK and F_GETLK
fcntl()s.  Thus, the following paragraph (from page 271 of my
ISO/IEC 9945-1: 1990 spec) applies:

`Before successful return from a F_SETLK or F_SETLKW request, the
previous lock type for each byte in the specified region shall be
replaced by the new lock type.  [more about regions being split and
exceeding the maximum lock limit]'

Now, given that it doesn't *really* say, it's *really* a matter of
interpretation, but from what I can tell:

* POSIX considers F_UNLCK to be just another locking type; you're not
`removing' the lock region, per se, but modifying its type.
Conceptually, there is always one lock region for every file, by
default of type F_UNLCK and covering the whole file.

* EINVAL is not actually defined for the F_SETLK and F_SETLKW fcntl()s,
but then a sufficient amount of it is deemed system-dependent that this
doesn't mean much.

For past precedent, I checked my 1988 copy of SVID, and it has this to

`EINVAL     if cmd is F_GETLK, F_SETLK, or F_SETLKW and the data arg
            points to is not valid.'

This is slightly ambiguous, but I believe it agrees with my reading of