fcntl.2 (2011 03)

f
fcntl(2) fcntl(2)
File Share Reservations
File share reservations are an advisory form of access control among cooperating processes, on both local
and remote machines. File share reservations are most commonly used by DOS or Windows emulators
and DOS based NFS clients. The fcntl() system call can be used to set file share reservations using
the F_SHARE command.
A share reservation is described by an fshare structure defined in
<sys/fcntl.h>
as follows:
struct fshare {
short f_access;
short f_deny;
long f_id;
};
The structure fshare describes the type of access (
f_access), to be requested on the open file descrip-
tor. If the command succeeds, it also specifies what type of access to deny other processes (
f_deny), A
single process on the same file can hold several non-conflicting reservations by specifying an identifier,
(
f_id), unique to the process with each share reservation request.
Valid
f_access values are:
F_RDACC Set a file share reservation for read-only access.
F_WRACC Set a file share reservation for write-only access.
F_RWACC Set a file share reservation for read-write access.
Valid
f_deny values are:
F_COMPAT Set a file share reservation to compatibility mode.
F_RDDNY Set a file share reservation to deny read access to other processes.
F_WRDNY Set a file share reservation to deny write access to other processes.
F_RWDNY Set a file share reservation to deny read and write access to other processes.
F_NODNY Set a file share reservation to not deny read or write access to other processes.
Oplocks
An oplock is a type of caching hint used mostly by CIFS clients so they can cache data locally. This cach-
ing helps increase performance by not having to read data across a network each time a le operation is
performed. The oplock guarantees that no other remote process is accessing the file in a way that might
lead to data inconsistencies.
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 can 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 fol-
lows:
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;
};
4 Hewlett-Packard Company 4 HP-UX 11i Version 3: March 2011