Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ dg_lcntl(2) — DG/UX 5.4.2A

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

fcntl(2)

lockf(3C)

fcntl(5)



dg_lcntl(2)                      DG/UX 5.4.2                     dg_lcntl(2)


NAME
       dglcntl - process a record lock request on a filehandle

SYNOPSIS
       #include <sys/fcntl.h>
       #include <sys/nfs.h>

       int dglcntl(cmd, fileptr, clientid, clientidinuseptr, flockptr)
       int            cmd;
       fhandlet *    fileptr;
       int            clientid;
       int *          clientidinuseptr;
       struct flock * flockptr;

   where:
       cmd                      A lock command
       fileptr                 An nfs file handle
       clientid                A client id for the lock
       clientidinuseptr      Whether lock client id is in use
       flockptr                Lock parameters

DESCRIPTION
       Dglcntl processes the cmd lock request on the file given by the file
       handle fileptr and lock client identifier clientid with the lock
       parameters given in flockptr.  Upon return, the value of
       clientidinuseptr equals 1 if the clientid currently holds any
       locks or lock requests, otherwise the value of clientidinuseptr
       equals 0.

       Dglcntl 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.  Cmd is the lock command to be performed on
       fileptr with clientid and flockptr specifying the lock parameters.
       The flockptr parameters are treated the same as the fcntl(2) lock
       parameters.  On return, clientidinuseptr specifies whether
       clientid holds any locks or pending lock requests.  The commands
       available are:

       DG_LCNTL_SETLK      Set or clear a file lock according to flockptr.
                           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, dglcntl 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, dglcntl 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



Licensed material--property of copyright holder(s)                         1




dg_lcntl(2)                      DG/UX 5.4.2                     dg_lcntl(2)


                           dglockwait(2) call.  If clientid already owns
                           a delayed lock request, then dglcntl returns -1
                           and errno is set to ENOLOCK.

       DG_LCNTL_GETLK      Get the first lock that blocks the lock
                           description specified by flockptr.  The
                           information retrieved overwrites the information
                           passed to dglcntl in flockptr.  If no lock is
                           found that would prevent this lock from being
                           set, then flockptr 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
                           flockptr.  If there is no delayed lock request,
                           then this command removes the lock specified by
                           flockptr.  This is the only command that may be
                           issued for clientid while a delayed lock request
                           exists for clientid.

       DG_LCNTL_RECLAIM    Set or clear a file lock according to flockptr.
                           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,
                           dglcntl 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.

RETURN VALUE
       0      The dglcntl operation was successful.

       -1     An error occurred.  errno indicates the error.

DIAGNOSTICS
       Errno may be set to one of the following error codes regardless of
       the value of cmd:

       EPERM          Must be super-user to use this system call.

       EINVAL         cmd is not one of the known values.

       EACCES         The cmd 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.




Licensed material--property of copyright holder(s)                         2




dg_lcntl(2)                      DG/UX 5.4.2                     dg_lcntl(2)


       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 the
                      lock request.

       EDEADLK        The cmd is DG_LCNTL_SETLKW or DG_LCNTL_SETLKD and a
                      deadlock would exist if the lock were granted or
                      allowed to pend.

       EINPROGRESS    The cmd is DG_LCNTL_SETLKD and the lock request can
                      not be granted immediately, but 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
                      dglockwait(2) call.

       ENOLCK         The cmd can not be satisfied because there are no more
                      record locks available.

       ENOLCK         The cmd is DG_LCNTL_SETLKD and the clientid already
                      has a pending lock request.

       ENOLCK         The cmd is DG_LCNTL_RECLAIM but the lock specified by
                      flockptr can not be granted.

SEE ALSO
       fcntl(2), dglockreset(2), dglockwait(2), lockf(3C), fcntl(5).


























Licensed material--property of copyright holder(s)                         3


Typewritten Software • bear@typewritten.org • Edmonds, WA 98026