Bug 218452 - small clarification clock_getres HISTORY section
Summary: small clarification clock_getres HISTORY section
Status: RESOLVED CODE_FIX
Alias: None
Product: Documentation
Classification: Unclassified
Component: man-pages (show other bugs)
Hardware: All Linux
: P3 low
Assignee: documentation_man-pages@kernel-bugs.osdl.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-02 19:27 UTC by Enrique Garcia
Modified: 2024-03-04 12:05 UTC (History)
1 user (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Enrique Garcia 2024-02-02 19:27:48 UTC
In version 6.04 of the man pages, under the HISTORY section of clock_getres(2) it is mentioned the following:

"       On  POSIX  systems  on  which  these  functions  are  available, the symbol _POSIX_TIMERS is defined in <unistd.h> to a value greater than 0.  The symbols _POSIX_MONOTONIC_CLOCK,
       _POSIX_CPUTIME, _POSIX_THREAD_CPUTIME indicate that CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID are available.  (See also sysconf(3).)  POSIX.1-2008  makes
       these APIs mandatory.
"

At first read I got the impression that _POSIX_MONOTONIC_CLOCK,       _POSIX_CPUTIME, _POSIX_THREAD_CPUTIME are also mandatory. However only _POSIX_TIMERS is mandatory, while the others are still optional according to the the POSIX online documentation of the last standard ([1], under 2.1.3 POSIX Conformance).

I would suggest to change it slightly to make clear that only _POSIX_TIMERS is mandatory in POSIX.1-2008 but _POSIX_MONOTONIC_CLOCK,       _POSIX_CPUTIME, _POSIX_THREAD_CPUTIME are not and therefore portable applications cannot rely on those clocks to be available without checking for the corresponding symbols first.


[1] The Open Group Base Specifications Issue 7, 2018 edition https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap02.html
Comment 1 Alejandro Colomar 2024-03-04 12:05:40 UTC
Thanks for the report!  I'll push the following commit tomorrow.


commit 00dbc94dd2e0024c3d146ce990307ef048a93a72 (HEAD -> contrib)
Author: Alejandro Colomar <alx (at) kernel (dot) org>
Date:   Mon Mar 4 13:02:29 2024 +0100

    clock_getres.2: HISTORY: Clarify that POSIX.1-2008 only makes mandatory the functions
    
    The different clocks are still optional.
    
    Closes: <https://bugzilla.kernel.org/show_bug.cgi?id=218452>
    Fixes: 4131356cdab8 ("man*/, man-pages.7: VERSIONS, STANDARDS, HISTORY: Reorganize sections")
    Reported-by: Enrique Garcia <cquike (at) arcor (dot) de>
    Signed-off-by: Alejandro Colomar <alx (at) kernel (dot) org>

diff --git a/man2/clock_getres.2 b/man2/clock_getres.2
index 8457f6148..9c98d12e9 100644
--- a/man2/clock_getres.2
+++ b/man2/clock_getres.2
@@ -377,6 +377,8 @@ .SH HISTORY
 On POSIX systems on which these functions are available, the symbol
 .B _POSIX_TIMERS
 is defined in \fI<unistd.h>\fP to a value greater than 0.
+POSIX.1-2008 makes these functions mandatory.
+.P
 The symbols
 .BR _POSIX_MONOTONIC_CLOCK ,
 .BR _POSIX_CPUTIME ,
@@ -388,7 +390,6 @@ .SH HISTORY
 are available.
 (See also
 .BR sysconf (3).)
-POSIX.1-2008 makes these APIs mandatory.
 .\"
 .SS Historical note for SMP systems
 Before Linux added kernel support for

Note You need to log in before you can comment on or make changes to this bug.