lckpwdf(3C)
NAME
lckpwdf, ulckpwdf − manipulate shadow password database lock file
SYNOPSIS
#include <shadow.h>
int lckpwdf(void);
int ulckpwdf(void);
MT-LEVEL
MT-Safe
DESCRIPTION
lckpwdf() and ulckpwdf() are routines that are used to gain modification access to the password databases, through the lock file. A process first uses lckpwdf() to lock the lock file, thereby gaining exclusive rights to modify the /etc/passwd or /etc/shadow password database. Upon completing modifications, a process should release the lock on the lock file using ulckpwdf(). This mechanism prevents simultaneous modification of the password databases. /etc/.pwd.lock is the lock file. It is used to coordinate modification access to the password databases /etc/passwd and /etc/shadow.
lckpwdf() attempts to lock the file /etc/.pwd.lock within 15 seconds. If unsuccessful, for example, /etc/.pwd.lock is already locked, it returns −1. If successful, a return code other than −1 is returned.
ulckpwdf() attempts to unlock the file /etc/.pwd.lock. If unsuccessful, for example, /etc/.pwd.lock is already unlocked, it returns −1. If successful, it returns 0.
RETURN VALUES
lckpwdf() and ulckpwdf() return −1 on failure, and 0 otherwise.
FILES
/etc/shadow
/etc/passwd
/etc/.pwd.lock
SEE ALSO
NOTES
These routines are for internal use only; compatibility is not guaranteed.
SunOS 5.5/x86 — Last change: 30 Aug 1991