kern_umtx.c: validate clockid used for _umtx_op(2) timeouts
Only allow clocks that make sense for the umtx_sleep().
While there, do not ignore errors from kern_clock_gettime(). The invalid
clock ids are filtered, but if the clock can't be read (CLOCK_TAI before
the TAI-UTC offset is known), the functions operate on uninitialized
memory.
_umtx_op.2: correct the description of the valid _clockid for _umtx_time
And remove the duplicated list from the description of the condition
variable.
umtxq_sleep(): do not wait forever for zero absolute timeouts
For msleep(), zero sbt means no timeout. If the timeout was specified as
absolute {0, 0} on MONOTONIC/UPTIME clocks, consider the call timed out
immediately, instead of sleeping until a signal is delivered.
lib/libthr: add helper to check valid clockid to use with _umtx_op(2)
pthread_cond_clockwait(3): explicitly reject unacceptable clockids
Otherwise they are rejected by kernel in do_wait(), reached through
_thr_sleep()/UMTX_OP_WAIT_UINT_PRIVATE on the user-mode path. Then,
since cond_wait_user() only leaves its loop on a wakeup, a cancellation
or ETIMEDOUT, the EINVAL from do_wait() results in a loop.
If hit, this indicates a bug in user code, but the system library
must be resilient to such misuse.
libthr cond_wait_user(): do not loop forever on clock error
pthread_mutex_timedlock(3): return EDEADLK on detected recursion attempt
for ERRORCHECK and ADAPTIVE_NP mutexes, instead of ETIMEDOUT. This is
explicitly specified by POSIX.
libthr: add pthread_mutex_clocklock(3)
libthr: add pthread_rwlock_clock{rd,wr}lock(3)
pthread_cond_timedwait.3: list pthread_cond_clockwait as .Nm
pthread_*_timed*lock.3: switch to .Fo/Fc
pthread_mutex_clocklock.3: document
pthread_rwlock_clock{rd,wr}lock(3): document
pthread_cond_timedwait.3: split STANDARDS and HISTORYDetails
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped