lckpwdf(3)lckpwdf(3)NAME
lckpwdf, ulckpwdf - co-ordinates modification access to the password
file
SYNOPSIS
int lckpwdf( void ); int ulckpwdf( void );
LIBRARY
SVR4 Library (libsvr4)
DESCRIPTION
The /etc/.pwd.lock is the lock file. It is used to coordinate modifi‐
cation access to the password file /etc/passwd. lckpwdf() and ulckp‐
wdf() functions are routines that are used to gain modification access
to the password files, through the lock file. A process first uses
lckpwdf() function to lock the lock file and to block other threads
attempting to use lckpwdf() function, thereby gaining exclusive rights
to modify the /etc/passwd password file. Upon completing modifica‐
tions, a process should release the lock on the lock file and unblock a
waiting thread via ulckpwdf() function. This mechanism prevents simul‐
taneous modification of the password files.
lckpwdf() function locks out other threads and attempts to lock the
file /etc/.pwd.lock within 15 seconds. If unsuccessful, e.g.,
/etc/.pwd.lock is already locked, it unlocks the thread lock and
returns -1. If successful, a return code other than -1 is returned.
ulckpwdf() function attempts to unlock the file /etc/.pwd.lock. If
unsuccessful, e.g., /etc/.pwd.lock is already unlocked, it returns
-1. If successful, it unlocks the thread lock and returns 0.
The lckpwdf() function does not check for the /etc/.AM_is_running
file. This file is used by the Tru64 UNIX account management tools. A
developer using the lckpwdf() function should be aware that the lckp‐
wdf() function does not provide a comprehensive locking mechanism that
is integrated with the Tru64 UNIX account management tools.
RESTRICTIONS
Restricted Safe - safe for use in threaded applications except under
specified conditions.
Restriction: ulckpwdf() function must be called by the same thread that
called lckpwdf() function.
FILES
/etc/passwd
/etc/.pwd.lock
ERRORSlckpwdf()and ulckpwdf() functions return a null pointer on EOF or
error.
SEE ALSO
Routines: getpwent(3)lckpwdf(3)