dglcntl(2) DG/UX 4.30 dglcntl(2)
NAME
dg_lcntl - Process a record lock request on a filehandle.
SYNOPSIS
#include <sys/fcntl.h>
#include <sys/nfs.h>
int dg_lcntl (command, file_ptr, client_id, client_id_in_use_ptr, flock_ptr)
int command;
fhandle_t * file_ptr;
int client_id;
int * client_id_in_use_ptr;
struct flock * flock_ptr;
PARAMETERS
command A lock command.
file_ptr An nfs file handle.
client_id A client id for the lock.
client_id_in_use_ptr
Whether lock client id is in use.
flock_ptr Lock parameters.
DESCRIPTION
Process the <command> lock request on the file given by the
file handle <file_ptr> and lock client identifier
<client_id> with the lock parameters given in <flock_ptr>.
Upon return, the value of <client_id_in_use_ptr> equals 1 if
the <client_id> currently holds any locks or lock requests,
otherwise the value of <client_id_in_use_ptr> equals 0.
Dg_lcntl provides a variety of lock operations on file
handles. It is similar to fcntl(2), but takes a file handle
argument rather than a file descriptor, and a lock client
identifier rather than using the process id of the caller.
A lock client id is a small integer specified by the caller.
<Command> is the lock command to be performed on <file_ptr>
with <client_id> and <flock_ptr> specifying the lock
parameters. The <flock_ptr> parameters are treated the same
as the fcntl(2) lock parameters. On return,
<client_id_in_use> specifies whether <client_id> holds any
locks or pending lock requests. The commands available are:
DG_LCNTL_SETLK
Licensed material--property of copyright holder(s) Page 1
dglcntl(2) DG/UX 4.30 dglcntl(2)
Set or clear a file lock according to <flock_ptr>.
DG_LCNTL_SETLK is used to set read and write locks, or
remove either type of lock. If a read or a write lock
cannot be set, dg_lcntl returns immediately with the
value -1 and errno set to EACCES. (See the fcntl(2)
command F_SETLK.)
DG_LCNTL_SETLKD
This command is the same as DG_LCNTL_SETLK except if a
read or write lock is blocked by other locks, dg_lcntl
queues a delayed lock request and returns with the
value -1, and errno set to EINPROGRESS. The lock
request is attempted when the blocking lock is
released. The results of the delayed request are
returned by the dg_lock_wait(2) call. If <client_id>
already owns a delayed lock request, then dg_lcntl
returns -1 and errno is set to ENOLOCK.
DG_LCNTL_GETLK
Get the first lock that blocks the lock description
specified by <flock_ptr>. The information retrieved
overwrites the information passed to dg_lcntl in
<flock_ptr>. If no lock is found that would prevent
this lock from being set, then <flock_ptr> is
unchanged, except for the lock type, which is set to
DG_LCNTL_UNLCK. (See the fcntl(2) command F_GETLK.)
DG_LCNTL_CANCEL
Remove the delayed lock request specified by
<flock_ptr>. If there is no delayed lock request, then
this command removes the lock specified by <flock_ptr>.
This is the only command that may be issued for
<client_id> while a delayed lock request exists for
<client_id>.
DG_LCNTL_RECLAIM
Set or clear a file lock according to <flock_ptr>.
DG_LCNTL_RECLAIM is used during the system restart
grace period to reclaim read and write locks. If a
read or a write lock cannot be set, dg_lcntl returns
immediately with the value -1, and errno is set to
ENOLINK.
The only process that uses this function is the network lock
server, rpc.lockd.
ACCESS CONTROL
The caller must be super-user.
Licensed material--property of copyright holder(s) Page 2
dglcntl(2) DG/UX 4.30 dglcntl(2)
RETURN VALUE
0 The dg_lcntl operation was successful.
-1 An error occurred. Errno indicates the
error.
EXCEPTIONS
Errno may be set to one of the following error codes
regardless of the value of <command>:
EPERM Must be super-user to use this system call.
EINVAL <Command> is not one of the known values.
EACCES The <command> is DG_LCNTL_SETLK and the type
of lock sought is a read lock
(DG_LCNTL_RDLCK) or write lock
(DG_LCNTL_WRLCK), and either the segment of a
file to be locked is already write-locked by
another process, or the type is a write lock
and the segment of a file to be locked is
already read-locked or write-locked by
another process.
EFAULT One of the arguments points outside of the
process's readable address space.
ESTALE The filehandle specified in the request is no
longer valid.
EINTR The process received a signal while
processing
EINTR The process received a signal while
processing the lock request.
EDEADLK The <command> is DG_LCNTL_SETLKW or
DG_LCNTL_SETLKD and a deadlock would exist if
the lock were granted or allowed to pend.
EINPROGRESS The <command> is DG_LCNTL_SETLKD and the lock
request can not be granted immediately, but
Licensed material--property of copyright holder(s) Page 3
dglcntl(2) DG/UX 4.30 dglcntl(2)
has been queued for later completion. When
the lock currently blocking the request is
released, the request will be retried. The
results of the delayed request are returned
by the dg_lock_wait(2) call.
ENOLCK The <command> can not be satisfied because
there are no more record locks available.
ENOLCK The <command> is DG_LCNTL_SETLKD and the
<client_id> already has a pending lock
request.
ENOLCK The <command> is DG_LCNTL_RECLAIM but the
lock specified by <flock_ptr> can not be
granted.
SEE ALSO
The related manual sections: fcntl(2), dg_lock_reset(2),
dg_lock_wait(2),
lockf(3),
fcntl(5)
Licensed material--property of copyright holder(s) Page 4