manual: Document clock_nanosleep

Message ID 20250114193219.378409-1-arjun@redhat.com (mailing list archive)
State New
Headers
Series manual: Document clock_nanosleep |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Build passed
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Test passed

Commit Message

Arjun Shankar Jan. 14, 2025, 7:32 p.m. UTC
  ---
 manual/time.texi | 56 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 56 insertions(+)
  

Patch

diff --git a/manual/time.texi b/manual/time.texi
index 90bc9a2566..830a09ad9d 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -3195,3 +3195,59 @@  be protected using cancellation handlers.
 
 The @code{nanosleep} function is declared in @file{time.h}.
 @end deftypefun
+
+@deftypefun int clock_nanosleep (clockid_t @var{clock}, int @var{flags}, const struct timespec *@var{requested_time}, struct timespec *@var{remaining})
+@standards{POSIX.1-2001, time.h}
+@c This function is a syscall on Linux
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+This function is like @code{nanosleep}, except that it allows the caller to
+specify the clock to be used to measure elapsed time and supports specifying
+the sleep interval in absolute or relative terms.  The argument @code{clock}
+is used to specify the clock to be used and supports the following values on
+Linux:
+
+@table @code
+@item CLOCK_REALTIME
+A system-wide clock that measures wall-clock time.
+
+@item CLOCK_TAI
+A system-wide clock derived from wall-clock time that accounts for leap
+seconds.
+
+@item CLOCK_MONOTONIC
+
+A system-wide clock that represents monotonically non-decreasing time.  This
+clock is not affected by discontinuous jumps in system time and is
+guaranteed to not go backwards on consecutive calls.  However, it does not
+count time for which the system is suspended.
+
+@item CLOCK_BOOTTIME
+A system-wide clock that is identical to CLOCK_MONOTONIC except that it also
+counts time for which the system is suspended.
+
+@item CLOCK_PROCESS_CPUTIME_ID
+A clock that measures CPU time consumed by all threads in the calling
+process.
+@end table
+
+The @code{flags} argument is either @code{0} or @code{TIMER_ABSTIME}.  If
+@code{flags} is @code{0}, then @code{clock_nanosleep} interprets
+@code{requested_time} as an interval relative to the current time specified
+by @code{clock}.  If it is @code{TIMER_ABSTIME} instead,
+@code{requested_time} is interpreted as an absolute time measured by
+@code{clock}.
+
+Compared to @code{nanosleep}, the following additional error conditions can
+occur:
+
+@table @code
+@item EINVAL
+The @var{clock} argument is not a valid clock.
+
+@item ENOTSUP
+The @var{clock} argument is not supported by the kernel.
+
+@item EPERM
+This process does not have permission to use this @code{clock}.
+@end table
+@end deftypefun