Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

_lwp_create(2) [netbsd man page]

_LWP_CREATE(2)						      BSD System Calls Manual						    _LWP_CREATE(2)

_lwp_create -- create a new light-weight process LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <lwp.h> int _lwp_create(ucontext_t *context, unsigned long flags, lwpid_t *new_lwp); DESCRIPTION
_lwp_create() causes creation of a new light-weight process, or LWP, and adds it to the current process. The context argument specifies the initial execution context for the new LWP including signal mask, stack, and machine registers. If this context specifies invalid register values (for example priviledge escalation by setting machine dependend bits forbidden for user processes), or does not specify cpu register values (uc_flags does not have the _UC_CPU bit set), the call will fail and errno will be set to EINVAL. The following flags affect the creation of the new LWP: LWP_DETACHED The LWP is created detached. The resources associated with a detached LWP will be automatically reclaimed by the system when the LWP exits. Otherwise, a terminated LWP's resources will not be reclaimed until its status is reported to another LWP via _lwp_wait(2). LWP_SUSPENDED The LWP is created suspended, and will not begin execution until it is resumed by another LWP via _lwp_continue(2). The LWP ID of the new LWP is stored in the location pointed to by new_lwp. RETURN VALUES
Upon successful completion, _lwp_create() returns a value of 0. Otherwise, a value of -1 is returned and errno is set to one of the values documented below. ERRORS
_lwp_create() will fail and no LWP will be created if: [EAGAIN] The system-imposed limit on the total number of LWPs under execution would be exceeded. This limit is configuration-dependent. [ENOMEM] There is insufficient swap space for the new LWP. [EFAULT] The address pointed to by context or new_lwp is outside the process's allocated address space. [EINVAL] The ucontext_t passed is invalid. SEE ALSO
_lwp_continue(2), _lwp_exit(2), _lwp_wait(2), _lwp_makecontext(3) HISTORY
The _lwp_create() system call first appeared in NetBSD 2.0. BSD
January 13, 2003 BSD

Check Out this Related Man Page

_lwp_mutex_lock(2)						   System Calls 						_lwp_mutex_lock(2)

_lwp_mutex_lock, _lwp_mutex_unlock, _lwp_mutex_trylock - mutual exclusion SYNOPSIS
#include <sys/lwp.h> int _lwp_mutex_lock(lwp_mutex_t *mp); int _lwp_mutex_trylock(lwp_mutex_t *mp); int _lwp_mutex_unlock(lwp_mutex_t *mp); DESCRIPTION
These functions serialize the execution of lightweight processes. They are useful for ensuring that only one lightweight process can exe- cute a critical section of code at any one time (mutual exclusion). LWP mutexes must be initialized to 0 before use. The _lwp_mutex_lock() function locks the LWP mutex pointed to by mp. If the mutex is already locked, the calling LWP blocks until the mutex becomes available. When _lwp_mutex_lock() returns, the mutex is locked and the calling LWP is the "owner". The _lwp_mutex_trylock() function attempts to lock the mutex. If the mutex is already locked it returns with an error. If the mutex is unlocked, it is locked and _lwp_mutex_trylock() returns. The _lwp_mutex_unlock() function unlocks a locked mutex. The mutex must be locked and the calling LWP must be the one that last locked the mutex (the owner). If any other LWPs are waiting for the mutex to become available, one of them is unblocked. RETURN VALUES
Upon successful completion, 0 is returned. A non-zero value indicates an error. ERRORS
If any of the following conditions are detected, _lwp_mutex_lock(), _lwp_mutex_trylock(), and _lwp_mutex_unlock() fail and return the cor- responding value: EINVAL The mp argument points to an invalid LWP mutex. EFAULT The mp argument points to an illegal address. If any of the following conditions occur, _lwp_mutex_trylock() fails and returns the corresponding value: EBUSY The mp argument points to a locked mutex. SEE ALSO
intro(2), _lwp_cond_wait(2) SunOS 5.10 30 Jul 1992 _lwp_mutex_lock(2)
Man Page