Locks a conventional process lock.
#include <sys/types.h> #include <sys/errno.h> #include <sys/lockl.h>
int lockl (lock_word, flags) lock_t *lock_word; int flags;
|lock _word||Specifies the address of the lock word.|
|flags|| Specifies the flags that control waiting for a lock. The flags
parameter is used to control how signals affect waiting for a lock. The four flags are:
Note: The lockl kernel service is provided for compatibility only and should not be used in new code, which should instead use simple locks or complex locks.
The lockl kernel service locks a conventional lock
The lock word can be located in shared memory. It must be in the process's address space when the lockl or unlockl services are called. The kernel accesses the lock word only while executing under the caller's process.
The lock_word parameter is typically part of the data structure that describes the resource managed by the lock. This parameter must be initialized to the LOCK_AVAIL value before the first call to the lockl service. Only the lockl and unlockl services can alter this parameter while the lock is in use.
The lockl service is nestable. The caller should use the LOCK_SUCC value for determining when to call the unlockl service to unlock the conventional lock.
The lockl service temporarily assigns the owner the process priority of the most favored waiter for the lock.
A process must release all locks before terminating or leaving kernel mode. Signals are not delivered to kernel processes while those processes own any lock. "Understanding System Call Execution" in AIX Kernel Extensions and Device Support Programming Concepts discusses how system calls can use the lockl service when accessing global data.
The lockl kernel service can be called from the process environment only.
|LOCK_SUCC||Indicates that the process does not already own the lock or the lock is not owned by another process when the flags parameter is set to LOCK_NDELAY.|
|LOCK_NEST||Indicates that the process already owns the lock or the lock is not owned by another process when the flags parameter is set to LOCK_NDELAY.|
|LOCK_FAIL||Indicates that the lock is owned by another process when the flags parameter is set to LOCK_NDELAY.|
|LOCK_SIG||Indicates that the wait is terminated by a signal when the flags parameter is set to LOCK_SIGRET.|
The lockl kernel service is part of the Base Operating System (BOS) Runtime.
The unlockl kernel service.
Understanding Locking in AIX Kernel Extensions and Device Support Programming Concepts.
Locking Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts