From nobody Tue Nov 17 01:09:53 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4jT68d5DGPz71Pth for ; Tue, 17 Nov 2026 01:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4jT68d26gRz3CcM for ; Tue, 17 Nov 2026 01:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794877793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fBLumTBNUC318HDepSsJxNwDK7GjcAxJVJwxIpTpllA=; b=B+dKd+OgVQ6RL+HMLCx3c7Ce3/OWsdKJjBw3i00t01bZyZiLUjtZXcaPpcEx8Kuu8sIlMs 5KaISDuv3HYw8ccZlbPhT6YJx0KKdVp2B4mBlXNXhTCXB9bq/aEcpwmgnAl7wwCeBIUw5q 6hJFxh83uiocnKZl2qwr7X4zg+EWWpjS1fkoiP2shW8k5nBYj8635JTSuQjn1VOJcsxDUJ 4DG+j+ZF1BpoLNPhRRKA5z/jWN3vWB0v9ury//Fbe+q5F40E7OAolK5vVcE4CypgK2H+Ay FWarDkLQ2b0wOkZQxlkCqG8aftqTxRqtrHJO0I3R4NqDRvKP5jESnxOFEOJiOA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1794877793; b=UJe8EZNVW2Fp8JAX0SxyRtH+n0xY4fuVYD1NHz280qmzW/Jl1FZj7CphlZrFNRSJQzLuGV wkNTO7wbXr8NzOcJJPyGGUPb+nDD4KlS2qdAAJwL5+fuplhvgFG3SmVfZbVGcOmRsTEK8N KdCPtfNS4EnC9v7jPQCt/pXtQDhH683EmkImO4FQOYerDJAWzmUx1PXMCYdLY1WHWkrDAB pzpWcb5+R+mGUMv3xC3bgVBd/M0pIhzt9Cnmj3VrsKFwFg7UyFkDc+GyHRUgaX0ZDGf7fI W4UILUhgqRRHOBpV2mAAiN591bt0eDmZQLe6K+IDgLrueScTJ5iX0QxpXXjJsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1794877793; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fBLumTBNUC318HDepSsJxNwDK7GjcAxJVJwxIpTpllA=; b=AtnHSELd+nYy8RT7xL6CPPvz7eSnvp9TbpFSloRfR9LOIoEg3ZA22dyNPOdke6O8S/pMQK dX64tEa8/ry1i/2WHKn6ewA+IpxB/Nkg50cXYPoiicLZW6cghRpw2dokCbRs1cYBzd7vWo wjFthGnD54qjdwTQUN6Py1JDi/PUekb+JPYcLyd9K2LvMfcx/pFCdEk5iqC/J1NANtzYel SOVk9bGiM6OebZx7/7LzR457qLV7dhB9XFyEJBNh/PUUtC0SK59yuQLT8XI1f9EqJHFjrd vbF1sOHo0nqDyCat6WsBw9+24/oDUDf6nr7jmSXzWjq2bhjCikDOwjhD9lPvtw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4jT68d1nXQzJF7 for ; Tue, 17 Nov 2026 01:09:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 192d by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 17 Nov 2026 01:09:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 829955f12df4 - stable/15 - pthread_rwlock_clock{rd,wr}lock(3): document List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all X-BeenThere: dev-commits-src-all@freebsd.org List-Id: Commit messages for all branches of the src repository List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 829955f12df43b758dc8e6e1d25799d98357cc2b Auto-Submitted: auto-generated Date: Tue, 17 Nov 2026 01:09:53 +0000 Message-Id: <6afba961.192d.7c791dac@gitrepo.freebsd.org> The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=829955f12df43b758dc8e6e1d25799d98357cc2b commit 829955f12df43b758dc8e6e1d25799d98357cc2b Author: Konstantin Belousov AuthorDate: 2026-11-05 22:40:23 +0000 Commit: Konstantin Belousov CommitDate: 2026-11-17 00:25:03 +0000 pthread_rwlock_clock{rd,wr}lock(3): document (cherry picked from commit 522407f54078e986bca5a74c8335881c6a1afe81) --- share/man/man3/Makefile | 2 + share/man/man3/pthread_rwlock_timedrdlock.3 | 62 ++++++++++++++++++++--------- share/man/man3/pthread_rwlock_timedwrlock.3 | 62 ++++++++++++++++++++--------- 3 files changed, 88 insertions(+), 38 deletions(-) diff --git a/share/man/man3/Makefile b/share/man/man3/Makefile index 4d80fea05b88..7893193fe357 100644 --- a/share/man/man3/Makefile +++ b/share/man/man3/Makefile @@ -530,6 +530,8 @@ PTHREAD_MLINKS+=pthread_mutexattr.3 pthread_mutexattr_destroy.3 \ PTHREAD_MLINKS+=pthread_mutexattr_getkind_np.3 pthread_mutexattr_setkind_np.3 PTHREAD_MLINKS+=pthread_rwlock_rdlock.3 pthread_rwlock_tryrdlock.3 PTHREAD_MLINKS+=pthread_rwlock_wrlock.3 pthread_rwlock_trywrlock.3 +PTHREAD_MLINKS+=pthread_rwlock_timedwrlock.3 pthread_rwlock_clockwrlock.3 +PTHREAD_MLINKS+=pthread_rwlock_timedrdlock.3 pthread_rwlock_clockrdlock.3 PTHREAD_MLINKS+=pthread_schedparam.3 pthread_getschedparam.3 \ pthread_schedparam.3 pthread_setschedparam.3 PTHREAD_MLINKS+=pthread_set_name_np.3 pthread_get_name_np.3 \ diff --git a/share/man/man3/pthread_rwlock_timedrdlock.3 b/share/man/man3/pthread_rwlock_timedrdlock.3 index 4feb6c9910a0..778c61b1349e 100644 --- a/share/man/man3/pthread_rwlock_timedrdlock.3 +++ b/share/man/man3/pthread_rwlock_timedrdlock.3 @@ -26,6 +26,7 @@ .Dt PTHREAD_RWLOCK_TIMEDRDLOCK 3 .Os .Sh NAME +.Nm pthread_rwlock_clockrdlock , .Nm pthread_rwlock_timedrdlock .Nd "acquire a read-write lock for reading or give up after a specified period" .Sh LIBRARY @@ -33,19 +34,32 @@ .Sh SYNOPSIS .In pthread.h .Ft int +.Fo pthread_rwlock_clockrdlock +.Fa "pthread_rwlock_t *restrict rwlock" +.Fa "clockid_t clockid" +.Fa "const struct timespec *restrict abs_timeout" +.Fc +.Ft int .Fo pthread_rwlock_timedrdlock .Fa "pthread_rwlock_t *restrict rwlock" .Fa "const struct timespec *restrict abs_timeout" .Fc .Sh DESCRIPTION -This function acquires a read lock on the read-write lock +These functions acquire a read lock on the read-write lock .Fa rwlock . However, if the lock cannot be acquired without waiting for another thread to unlock the lock, -this wait shall be terminated when +this wait is terminated when .Fa abs_timeout expires. +The +.Fa abs_timeout +value is an absolute time, measured on +.Fa clockid +for the clock variant and on +.Dv CLOCK_REALTIME +for the timed variant. .Pp A thread may hold multiple concurrent read locks. The @@ -53,38 +67,30 @@ The function must be called once for each lock acquired. .Pp If the thread should be interrupted by a signal, -the -.Fn pthread_rwlock_timedrdlock -function will be automatically restarted after the thread returns from -the signal handler. +the functions are automatically restarted after the thread +returns from the signal handler. .Pp The calling thread may deadlock if at the time the call is made it holds a write lock on .Fa rwlock . -The results are undefined if this function is called with +The results are undefined if these functions are called with an uninitialized read-write lock. .Sh IMPLEMENTATION NOTES To prevent writer starvation, writers are favored over readers. .Sh RETURN VALUES -If successful, the -.Fn pthread_rwlock_timedrdlock -function will return zero. +If successful, the functions will return zero. Otherwise, an error number will be returned to indicate the error. .Pp -This function shall not return an error code of +These functions do not return an error code of .Er EINTR . .Sh ERRORS -The -.Fn pthread_rwlock_timedrdlock -function will fail if: +The functions will fail if: .Bl -tag -width Er .It Bq Er ETIMEDOUT The lock could not be acquired before the specified timeout expired. .El .Pp -The -.Fn pthread_rwlock_timedrdlock -function may fail if: +The functions may fail if: .Bl -tag -width Er .It Bq Er EAGAIN The read lock could not be @@ -101,7 +107,17 @@ does not refer to an initialized read-write lock object, or the .Fa abs_timeout nanosecond value is less than zero or -greater than or equal to 1 billion. +greater than or equal to 1 billion, or the +.Fa clockid +parameter is invalid. +.Pp +The +.Dv CLOCK_REALTIME +and +.Dv CLOCK_MONOTONIC +clocks are always supported; see +.Xr _umtx_op 2 +for the full list of accepted clocks. .El .Sh SEE ALSO .Xr pthread_rwlock_init 3 , @@ -110,10 +126,18 @@ greater than or equal to 1 billion. .Sh STANDARDS The .Fn pthread_rwlock_timedrdlock -function is expected to conform to +function conforms to .St -p1003.1-96 . +The +.Fn pthread_rwlock_clockrdlock +function conforms to +.St -p1003.1-2024 . .Sh HISTORY The .Fn pthread_rwlock_timedrdlock function first appeared in .Fx 5.2 . +The +.Fn pthread_rwlock_clockrdlock +function first appeared in +.Fx 16.0 . diff --git a/share/man/man3/pthread_rwlock_timedwrlock.3 b/share/man/man3/pthread_rwlock_timedwrlock.3 index c3267d694534..89d76d42834f 100644 --- a/share/man/man3/pthread_rwlock_timedwrlock.3 +++ b/share/man/man3/pthread_rwlock_timedwrlock.3 @@ -26,6 +26,7 @@ .Dt PTHREAD_RWLOCK_TIMEDWRLOCK 3 .Os .Sh NAME +.Nm pthread_rwlock_clockwrlock , .Nm pthread_rwlock_timedwrlock .Nd "acquire a read-write lock for writing or give up after a specified period" .Sh LIBRARY @@ -33,53 +34,58 @@ .Sh SYNOPSIS .In pthread.h .Ft int +.Fo pthread_rwlock_clockwrlock +.Fa "pthread_rwlock_t *restrict rwlock" +.Fa "clockid_t clockid" +.Fa "const struct timespec *restrict abs_timeout" +.Fc +.Ft int .Fo pthread_rwlock_timedwrlock .Fa "pthread_rwlock_t *restrict rwlock" .Fa "const struct timespec *restrict abs_timeout" .Fc .Sh DESCRIPTION -This function acquires a write lock on the read-write lock +These functions acquire a write lock on the read-write lock .Fa rwlock . However, if the lock cannot be acquired without waiting for another thread to unlock the lock, -this wait shall be terminated when +this wait is terminated when .Fa abs_timeout expires. +The +.Fa abs_timeout +value is an absolute time, measured on +.Fa clockid +for the clock variant and on +.Dv CLOCK_REALTIME +for the timed variant. .Pp If the thread should be interrupted by a signal, -the -.Fn pthread_rwlock_timedwrlock -function will be automatically restarted after the thread returns from -the signal handler. +the functions are automatically restarted after the thread +returns from the signal handler. .Pp The calling thread may deadlock if at the time the call is made it holds .Fa rwlock . -The results are undefined if this function is called with +The results are undefined if these functions are called with an uninitialized read-write lock. .Sh IMPLEMENTATION NOTES To prevent writer starvation, writers are favored over readers. .Sh RETURN VALUES -If successful, the -.Fn pthread_rwlock_timedwrlock -function will return zero. +If successful, the functions will return zero. Otherwise, an error number will be returned to indicate the error. .Pp -This function shall not return an error code of +These functions do not return an error code of .Er EINTR . .Sh ERRORS -The -.Fn pthread_rwlock_timedwrlock -function shall fail if: +The functions will fail if: .Bl -tag -width Er .It Bq Er ETIMEDOUT The lock could not be acquired before the specified timeout expired. .El .Pp -The -.Fn pthread_rwlock_timedwrlock -function may fail if: +The functions may fail if: .Bl -tag -width Er .It Bq Er EDEADLK The calling thread already holds @@ -91,7 +97,17 @@ does not refer to an initialized read-write lock object, or the .Fa abs_timeout nanosecond value is less than zero or -greater than or equal to 1 billion. +greater than or equal to 1 billion, or the +.Fa clockid +parameter is invalid. +.Pp +The +.Dv CLOCK_REALTIME +and +.Dv CLOCK_MONOTONIC +clocks are always supported; see +.Xr _umtx_op 2 +for the full list of accepted clocks. .El .Sh SEE ALSO .Xr pthread_rwlock_init 3 , @@ -100,10 +116,18 @@ greater than or equal to 1 billion. .Sh STANDARDS The .Fn pthread_rwlock_timedwrlock -function is expected to conform to +function conforms to .St -p1003.1-96 . +The +.Fn pthread_rwlock_clockwrlock +function conforms to +.St -p1003.1-2024 . .Sh HISTORY The .Fn pthread_rwlock_timedwrlock function first appeared in .Fx 5.2 . +The +.Fn pthread_rwlock_clockwrlock +function first appeared in +.Fx 16.0 .