[PATCH] manual: Correct return value description of 'clock_nanosleep'

Florian Weimer fweimer@redhat.com
Mon Jun 2 08:07:12 GMT 2025


* Arjun Shankar:

> @@ -3232,19 +3232,14 @@ The @code{nanosleep} function is declared in @file{time.h}.
>  @deftypefun int clock_nanosleep (clockid_t @var{clock}, int @var{flags}, const struct timespec *@var{requested_time}, struct timespec *@var{remaining_time})
>  @standards{POSIX.1-2001, time.h}
>  @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
> +This function is similar to @code{nanosleep} while additionally providing
> +the caller with a way to specify the clock to be used to measure elapsed
> +time and express the sleep interval in absolute or relative terms.  It
> +returns zero when returning because the interval is over, and a positive
> +error number corresponding to the error encountered otherwise.  This is
> +different from @code{nanosleep}, which returns @math{-1} upon failure and
> +sets the global variable @code{errno} according to the error encountered
> +instead.
>  
>  The @var{clock} argument specifies the clock to use.
>  @xref{Getting the Time}, for the @code{clockid_t} type and possible values
> @@ -3261,9 +3256,8 @@ call the value requested is less than or equal to the clock specified, then
>  the function returns right away.  When @var{flags} is @code{TIMER_ABSTIME},
>  @var{remaining_time} is not updated.
>  
> +The error conditions for @code{clock_nanosleep} are the same as for
> +@code{nanosleep}, with the following conditions additionally defined:
>  
>  @table @code
>  @item EINVAL

Maybe repeat that the return value is used for error reporting?

  The @code{clock_nanosleep} function returns error codes as positive
  return values.  The error conditions for @code{clock_nanosleep} are
  the same as for @code{nanosleep}, with the following conditions
  additionally defined:

Thanks,
Florian



More information about the Libc-alpha mailing list