|
usinit(3p) -- shared arena initialization
|
usinit is used to initialize a shared arena from which related or unrelated processes may allocate and share semaphores, locks and memory. Locks, semaphores and memory can then be allocated using the usptr_t returned by usinit. More than one call can be made to usinit to create separate arenas of locks and semaphores. In fact, calls to usinit may be made on behalf of a process: when sproc(2) is called, an aren... |
usinitlock(3p) -- initializes a lock
|
usinitlock initializes the lock specified by lock. All previous information associated with the lock (metering, debugging) is reinitialized. usinitlock should only be used for previously allocated locks. Locks are allocated using usnewlock(3P). usinitlock will cause unpredictable results if lock does not point to a valid lock. |
|
usinitsema(3p) -- initialize a semaphore
|
usinitsema initializes the semaphore specified by sema. The count of the semaphore is set to the value specified by val. A value of 0 implies no available resources, and the first process that attempts a 'P' operation (via uspsema) will block. This can be viewed as a synchronizing semaphore, since the goal is to always have a process block until another has completed an operation that the first process requires. Positive values for val can be used for tracking a collection of resources. The si... |
usleep(3c) -- suspend execution for an interval
|
The usleep() function suspends the current thread from execution for the number of microseconds specified by the seconds argument. Because of other activity, or because of the time spent in processing the call, the actual suspension time may be longer than the amount of time specified. The seconds argument must be less than 1,000,000. If the value of seconds is 0, the call has no effect. The usleep() function uses the high resolution sleep function: nanosleep() to suspend execution of a thread.... |
usmalloc(3p) -- shared arena memory allocator
|
These routines provide a simple general-purpose memory allocation package that allows the user to allocate from a shared arena (see usinit(3P)). All these functions are MP safe, multiple threads/processes may access them simultaneously and are guaranteed correct behavior. More than one call can be made to usinit(3P) to set up separate malloc arenas. The file name passed to usinit(3P) is used as a key to allow shared arenas to be created for use amongst unrelated processes. Once the arena is set ... |
usnewlock(3p) -- allocate and initialize a lock
|
usnewlock allocates a lock from the arena designated by handle (returned from usinit(3P)) and initializes it and all associated data. There are different types of locks; by default the fastest lock type for the class of machine the process is running on is allocated. See usconfig(3P) for other specifiable lock types. Metering and debugging are only enabled if the locks are of the debugging type (see usconfig(3P). There is a limit of a maximum of 4096 locks per shared area (for hardware supported... |
usnewpollsema(3p) -- allocate and initialize a pollable semaphore
|
usnewpollsema allocates a semaphore and initializes its count to the value specified by val. Initially, metering and debugging are off (and can be turned on through a call to usctlsema(3P)) and the history logging mechanism is set according to the global setting (see usconfig(3P)). The semaphore is allocated from the shared arena designated by handle as returned from usinit(3P). Pollable semaphores never block the caller. If the semaphore is unavailable when uspsema(3P) is called, the caller is ... |
usnewsema(3p) -- allocate and initialize a semaphore
|
usnewsema allocates a semaphore and initializes its count to the value specified by val. Initially, metering and debugging are off (and can be turned on through a call to usctlsema(3P)) and the history logging mechanism is set according to the global setting (see usconfig(3P)). The semaphore is allocated from the shared arena designated by handle as returned from usinit(3P). A semaphore allocated via usnewsema is a blocking semaphore - if the semaphore is unavailable, the caller will block. A po... |
usopenpollsema(3p) -- attach a file descriptor to a pollable semaphore
|
usopenpollsema attaches a file descriptor to a pollable semaphore. The returned file descriptor is used when calling poll(2) or select(2) to acquire the semaphore after an unsuccessful uspsema(3P). If the caller is the first process to call usopenpollsema on sema then a new semaphore device is allocated (see usema(7M)). The user and group id of the semaphore device take on the effective user/group id of the caller. The access mode is set to acc(see chmod(2)). Calls to usopenpollsema on the same ... |
uspsema(3p) -- acquire a semaphore
|
uspsema decrements the count of the previously allocated semaphore specified by sema. If the count is then negative, the semaphore will logically block the calling process until the count is incremented due to a usvsema(3P) call made by another process. The count can be interpreted in the following way: if it is greater than zero, there are 'count' resources available, namely 'count' processes can call uspsema and not block; if the count is negative then the absolute value of count is the nu... |
ftn/ussetlock(3p) -- spinlock routines
|
This set of routines provide a standard test and set facility. If the lock is free then it is atomically locked, and control is returned to the caller. If the lock is already locked, the caller either spins waiting for the lock or gets queued. The locks are based in user address space thus avoiding any system call overhead in the case where the lock is available. The actual algorithm used to implement these functions depends on whether the system is a multiprocessor or a single processor. In the... |
ussetlock(3p) -- spinlock routines
|
This set of routines provide a standard test and set facility. If the lock is free then it is atomically locked, and control is returned to the caller. If the lock is already locked, the caller either spins waiting for the lock or gets queued. The locks are based in user address space thus avoiding any system call overhead in the case where the lock is available. The actual algorithm used to implement these functions depends on whether the system is a multiprocessor or a single processor. In the... |
ustestsema(3p) -- return the value of a semaphore
|
ustestsema returns the current value of the semaphore specified by sema. This should be viewed as a snapshot only, useful for debugging. |
usvsema(3p) -- release a semaphore
|
usvsema increments the count associated with sema. If there are any processes queued waiting for the semaphore the first one is awakened. usvsema uses the usema(7M) device to reactivate a suspended process. If the process to be awoken is no longer alive, usvsema will automatically attempt to awaken the next process waiting for the semaphore. In order to use a semaphore, the caller must have joined the shared arena out of which the semaphore is allocated (via usinit(3P)), and have a file descript... |
utimes(3c) -- set file times
|
The utimes call uses the "accessed" and "updated" times in that order from the tvp vector to set the corresponding recorded times for file. The caller must be the owner of the file or the super-user. The "inodechanged" time of the file is set to the current time. This routine emulates the 4.3BSD utimes system call. |