HP-UX Reference (11i v3 07/02) - 2 System Calls (vol 5)

f
fcntl(2) fcntl(2)
The following arguments are supported for oplocks.
F_SETOPLOCK Requests an opportunistic lock reservation (oplock) on a file. The supported
oplock types are defined in <sys/oplock.h>
.
F_SETOPLOCKW Requests an opportunistic lock reservation (oplock) on a file and will wait (in
other words, block) until the request may be granted.
F_REMOVEOPLOCK
Removes all oplocks by pid.
F_HAVEOPLOCK Checks to see if an oplock is present on a file. The possible returns values are
one of the oplock types defined in
<sys/oplock.h>.
An oplock request is described by an
oplock
structure which is defined in <sys/oplock.h>
as follows:
struct oplock{
int64_t o_owner;
sysid_t o_member_id;
int64_t o_type;
sysid_t o_sysid;
pid_t o_pid;
int64_t o_flags;
int64_t o_retry;
int64_t o_timeout;
int64_t o_sig_val;
};
The structure oplock describes the details of the lock being requested on the opened file descriptor. If
the command succeeds it also contains the owner ID (o_owner) of the process as well as the type of oplock
(o_type) being requested. The o_sysid may also be specified. The process ID (
o_pid) is the request-
ing process with which to associate the oplock. Optional flags
o_flags, o_timeout , and signal value
(
o_sig_val) may also be specified.
The only field in this structure which must be assigned is o_type. The other fields are either optional or
not used and should be initialized to zero (0).
The fields in the oplock structure are described here:
o_owner Owner type. Any integer; however, 0x8000 is reserved.
o_member_id Member ID. Any unique integer of type sysid_t.
o_type Type of oplock. May be one of these values:
VFS_OPLOCK_NONE Removes an oplock.
VFS_OPLOCK_SHARED
Request a shared oplock.
VFS_OPLOCK_EXCLUSIVE
Request an exclusive oplock.
VFS_OPLOCK_BATCH
Request a batch oplock. (Requires CIFS stacked
file system support)
o_sysid The system ID of the locking process. This is an optional value.
o_pid The process ID of the process that owns the oplock. This does not need to be
filled in by the application, as this is done internally.
o_flags This field is not currently used and is here for future needs. It is recommended
this be initialized to zero (0).
o_retry This field is the number of retries to gracefully request that an oplock be broken.
After the number of retries are exhausted, then the oplock will be removed
without acknowledgment from the process that owns it.
o_timeout This value represents the wait time in seconds that the kernel will wait before
re-sending the oplock break signal. The total time that an application may wait
for an oplock is (
o_retry+1) multiplied by o_timeout seconds.
o_sig_val A value to be sent with signal to a process upon an oplock being broken.
106 Hewlett-Packard Company 4 HP-UX 11i Version 3: February 2007