быстрая блокировка пользовательского пространства (fast user-space locking)
Ошибки (Error)
EACCES
No read access to the memory of a futex word.
EAGAIN
(FUTEX_WAIT
, FUTEX_WAIT_BITSET
, FUTEX_WAIT_REQUEUE_PI
) The
value pointed to by uaddr was not equal to the expected
value val at the time of the call.
Note
: on Linux, the symbolic names EAGAIN
and EWOULDBLOCK
(both of which appear in different parts of the kernel
futex code) have the same value.
EAGAIN
(FUTEX_CMP_REQUEUE
, FUTEX_CMP_REQUEUE_PI
) The value
pointed to by uaddr is not equal to the expected value
val3.
EAGAIN
(FUTEX_LOCK_PI
, FUTEX_LOCK_PI2
, FUTEX_TRYLOCK_PI
,
FUTEX_CMP_REQUEUE_PI
) The futex owner thread ID of uaddr
(for FUTEX_CMP_REQUEUE_PI
: uaddr2) is about to exit, but
has not yet handled the internal state cleanup. Try
again.
EDEADLK
(FUTEX_LOCK_PI
, FUTEX_LOCK_PI2
, FUTEX_TRYLOCK_PI
,
FUTEX_CMP_REQUEUE_PI
) The futex word at uaddr is already
locked by the caller.
EDEADLK
(FUTEX_CMP_REQUEUE_PI
) While requeueing a waiter to the PI
futex for the futex word at uaddr2, the kernel detected a
deadlock.
EFAULT
A required pointer argument (i.e., uaddr, uaddr2, or
timeout) did not point to a valid user-space address.
EINTR
A FUTEX_WAIT
or FUTEX_WAIT_BITSET
operation was
interrupted by a signal (see signal(7)). In kernels
before Linux 2.6.22, this error could also be returned for
a spurious wakeup; since Linux 2.6.22, this no longer
happens.
EINVAL
The operation in futex_op is one of those that employs a
timeout, but the supplied timeout argument was invalid
(tv_sec was less than zero, or tv_nsec was not less than
1,000,000,000).
EINVAL
The operation specified in futex_op employs one or both of
the pointers uaddr and uaddr2, but one of these does not
point to a valid object—that is, the address is not four-
byte-aligned.
EINVAL
(FUTEX_WAIT_BITSET
, FUTEX_WAKE_BITSET
) The bit mask
supplied in val3 is zero.
EINVAL
(FUTEX_CMP_REQUEUE_PI
) uaddr equals uaddr2 (i.e., an
attempt was made to requeue to the same futex).
EINVAL
(FUTEX_FD
) The signal number supplied in val is invalid.
EINVAL
(FUTEX_WAKE
, FUTEX_WAKE_OP
, FUTEX_WAKE_BITSET
,
FUTEX_REQUEUE
, FUTEX_CMP_REQUEUE
) The kernel detected an
inconsistency between the user-space state at uaddr and
the kernel state—that is, it detected a waiter which waits
in FUTEX_LOCK_PI
or FUTEX_LOCK_PI2
on uaddr.
EINVAL
(FUTEX_LOCK_PI
, FUTEX_LOCK_PI2
, FUTEX_TRYLOCK_PI
,
FUTEX_UNLOCK_PI
) The kernel detected an inconsistency
between the user-space state at uaddr and the kernel
state. This indicates either state corruption or that the
kernel found a waiter on uaddr which is waiting via
FUTEX_WAIT
or FUTEX_WAIT_BITSET
.
EINVAL
(FUTEX_CMP_REQUEUE_PI
) The kernel detected an
inconsistency between the user-space state at uaddr2 and
the kernel state; that is, the kernel detected a waiter
which waits via FUTEX_WAIT
or FUTEX_WAIT_BITSET
on uaddr2.
EINVAL
(FUTEX_CMP_REQUEUE_PI
) The kernel detected an
inconsistency between the user-space state at uaddr and
the kernel state; that is, the kernel detected a waiter
which waits via FUTEX_WAIT
or FUTEX_WAIT_BITSET
on uaddr.
EINVAL
(FUTEX_CMP_REQUEUE_PI
) The kernel detected an
inconsistency between the user-space state at uaddr and
the kernel state; that is, the kernel detected a waiter
which waits on uaddr via FUTEX_LOCK_PI
or FUTEX_LOCK_PI2
(instead of FUTEX_WAIT_REQUEUE_PI
).
EINVAL
(FUTEX_CMP_REQUEUE_PI
) An attempt was made to requeue a
waiter to a futex other than that specified by the
matching FUTEX_WAIT_REQUEUE_PI
call for that waiter.
EINVAL
(FUTEX_CMP_REQUEUE_PI
) The val argument is not 1.
EINVAL
Invalid argument.
ENFILE
(FUTEX_FD
) The system-wide limit on the total number of
open files has been reached.
ENOMEM
(FUTEX_LOCK_PI
, FUTEX_LOCK_PI2
, FUTEX_TRYLOCK_PI
,
FUTEX_CMP_REQUEUE_PI
) The kernel could not allocate memory
to hold state information.
ENOSYS
Invalid operation specified in futex_op.
ENOSYS
The FUTEX_CLOCK_REALTIME
option was specified in futex_op,
but the accompanying operation was neither FUTEX_WAIT
,
FUTEX_WAIT_BITSET
, FUTEX_WAIT_REQUEUE_PI
, nor
FUTEX_LOCK_PI2
.
ENOSYS
(FUTEX_LOCK_PI
, FUTEX_LOCK_PI2
, FUTEX_TRYLOCK_PI
,
FUTEX_UNLOCK_PI
, FUTEX_CMP_REQUEUE_PI
,
FUTEX_WAIT_REQUEUE_PI
) A run-time check determined that
the operation is not available. The PI-futex operations
are not implemented on all architectures and are not
supported on some CPU variants.
EPERM
(FUTEX_LOCK_PI
, FUTEX_LOCK_PI2
, FUTEX_TRYLOCK_PI
,
FUTEX_CMP_REQUEUE_PI
) The caller is not allowed to attach
itself to the futex at uaddr (for FUTEX_CMP_REQUEUE_PI
:
the futex at uaddr2). (This may be caused by a state
corruption in user space.)
EPERM
(FUTEX_UNLOCK_PI
) The caller does not own the lock
represented by the futex word.
ESRCH
(FUTEX_LOCK_PI
, FUTEX_LOCK_PI2
, FUTEX_TRYLOCK_PI
,
FUTEX_CMP_REQUEUE_PI
) The thread ID in the futex word at
uaddr does not exist.
ESRCH
(FUTEX_CMP_REQUEUE_PI
) The thread ID in the futex word at
uaddr2 does not exist.
ETIMEDOUT
The operation in futex_op employed the timeout specified
in timeout, and the timeout expired before the operation
completed.