Você está na página 1de 3

_lwp_mutex_unlock NAME _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 execute 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.

Getrlimit System Calls getrlimit(2)

NAME getrlimit, setrlimit - control maximum system resource consumption SYNOPSIS #include <sys/resource.h> int getrlimit(int resource, struct rlimit *rlp); int setrlimit(int resource, const struct rlimit *rlp); DESCRIPTION Limits on the consumption of a variety of system resources by a process and each process it creates may be obtained with the getrlimit() and set with setrlimit() functions. Each call to either getrlimit() or setrlimit() identies a specic resource to be operated upon as well as a resource limit. A resource limit is a pair of values: one specifying the current (soft) limit, the other a maximum (hard) limit. Soft limits may be changed by a process to any value that is less than or equal to the hard limit. A process may (irreversibly) lower its hard limit to any value that is greater than or equal to the soft limit. Only a process with {PRIV_SYS_RESOURCE} asserted in the eective set can raise a hard limit. Both hard and soft limits can be changed in a single call to setrlimit() subject to the constraints described above. Limits may have an "innite" value of RLIM_INFINITY . The rlp argument is a pointer to struct rlimit that includes the following members: rlim_t rlim_t rlim_cur; rlim_max; /* current (soft) limit */ /* hard limit */

The type rlim_t is an arithmetic data type to which objects of type int, size_t, and o_t can be cast without loss of information. The possible resources, their descriptions, and the actions taken when the current limit is exceeded are summarized as follows: RLIMIT_CORE The maximum size of a core le in bytes

that may be created by a process. A limit of 0 will prevent the creation of a core le. The writing of a core le will terminate at this size. Setustack System Calls getustack(2)

NAME getustack, setustack - retrieve or change the address of per-LWP stack boundary information SYNOPSIS #include <ucontext.h> int getustack(stack_t **spp); int setustack(stack_t *sp); DESCRIPTION The getustack() function retrieves the address of per-LWP stack boundary information. The address is stored at the location pointed to by spp. If this address has not been dened using a previous call to setustack(), NULL is stored at the location pointed to by spp. The setustack() function changes the address of the current thread's stack boundary information to the value of sp.

Você também pode gostar