atomic_op(2) — System Calls
Digital
NAME
atomic_op − perform test and set operation.
SYNOPSIS
#include <sys/lock.h>
int atomic_op(op, addr)
int op;
int ∗addr;
PARAMETERS
opThis 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.
addrThis is the target address of the operation.
DESCRIPTION
The atomic_op call provides test and set operation at a user address.
Whether or not this function is executed as a system call is hardware-dependent.
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.
ERRORS
[EBUSY] The location specified by addr is already set.
[EINVAL] The op is not a valid operation type, or addr is not aligned on an integer boundary.
[EACCES] The address specified in addr is not write accessible.
[EFAULT] An error occurred during reading or writing the location specified by addr.