osf1 man page for msem_lock

Query: msem_lock

OS: osf1

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

msem_lock(3)						     Library Functions Manual						      msem_lock(3)

NAME
msem_lock - Locks a semaphore
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
#include <sys/mman.h> int msem_lock ( msemaphore *sem, int condition );
PARAMETERS
Points to an msemaphore structure which specifies the semaphore to be locked. Determines whether the msem_lock() function waits for a cur- rently locked semaphore to unlock.
DESCRIPTION
The msem_lock() function attempts to lock a binary semaphore. If the semaphore is not currently locked, it is locked and the msem_lock() function returns successfully. If the semaphore is currently locked, and the condition parameter is MSEM_IF_NOWAIT, then the msem_lock() function returns with an error. If the semaphore is currently locked, and the condition parameter is 0 (zero), then msem_lock() will not return until either the calling process is able to successfully lock the semaphore, or an error condition occurs. All calls to msem_lock() and msem_unlock() by multiple processes sharing a common msemaphore structure behave as if the calls were serial- ized. If the msemaphore structure contains any value not resulting from a call to msem_init() followed by a (possibly empty) sequence of calls to msem_lock() and msem_unlock(), the results are undefined. The address of an msemaphore structure may be significant. If the msemaphore structure contains any value copied from an msemaphore structure at a different address, the result is undefined.
NOTES
Trial use
RETURN VALUES
On successful completion, the msem_lock() function returns 0 (zero). On error, the msem_lock() function returns -1 and sets errno to indi- cate the error.
ERRORS
If the msem_lock() function fails, errno may be set to one of the following values: MSEM_IF_NOWAIT was specified and the semaphore was already locked. The sem parameter points to an msemaphore structure which specifies a semaphore which has been removed, or the condition parameter is invalid. The msem_lock() function was interrupted by a signal which was caught.
RELATED INFORMATION
Functions: msem_init(3), msem_remove(3), msem_unlock(3) delim off msem_lock(3)
Related Man Pages
sem_reltimedwait_np(3c) - opensolaris
msem_init(2) - hpux
msem_unlock(3) - osf1
sem_wait(3) - osf1
sem_timedwait(3) - freebsd
Similar Topics in the Unix Linux Community
File Locks
Can Mutex be replaced with anything?
Day 5 of the SCO v. Novell Trial and Some Help for Journalists Covering the Trial - Updated
Who locked my id?