atomic_op(2)atomic_op(2)Nameatomic_op - perform test and set operation.
Syntax
#include <sys/lock.h>
int atomic_op(op, addr)
int op;
int *addr;
Arguments
op This argument is the operation type. If the operation
type is ATOMIC_SET, this call specifies the test and set
operation on location addr. If the operation type is
ATOMIC_CLEAR, this call specifies the clear operation on
location addr.
addr This is the target address of the operation.
Description
The call provides test and set operation at a user address.
For RISC systems, is executed as a system call. For VAX systems, a
system call is not executed for this library function.
Return Values
If the atomic_op operation succeeds, then 0 is returned. Otherwise a
-1 is returned, and a more specific error code is stored in errno.
Diagnostics
[EBUSY] The location specified by addr is already set.
[EINVAL] The op is not a valid operation type.
[EACCES] The address specified in addr is not write accessible.
[EALIGN] The addr is not on an integer boundary.
atomic_op(2)