linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* clock_settime(2) error for non-settable clocks
@ 2020-03-20 18:02 Eric Rannaud
  2020-03-21  3:56 ` Aleksa Sarai
  2020-03-26  8:37 ` Michael Kerrisk (man-pages)
  0 siblings, 2 replies; 15+ messages in thread
From: Eric Rannaud @ 2020-03-20 18:02 UTC (permalink / raw)
  To: linux-api, linux-man

If clock_id is a valid clock on the system (i.e. it can be passed to
clock_gettime(2)), clock_settime(clock_id, &ts) sets errno to, either:

  - EINVAL if CONFIG_POSIX_TIMERS is not enabled (kernel/posix-stubs.c);
  - EINVAL if CONFIG_POSIX_TIMERS is enabled (kernel/posix-timers.c)
and the k_clock has no set function (e.g. CLOCK_BOOTTIME);
  - EACCES for dynamic posix clock devices that lack F_WRITE
(kernel/posix-time.c);
  - EOPNOTSUPP for dynamic posix clock devices that have F_WRITE but
don't have a clock_settime op.
  - EOPNOTSUPP for drivers/ptp/ptp_kvm.c (they provide a clock_settime
op that returns -EOPNOTSUPP directly, rather than opt to leave
clock_settime NULL which would do the same thing, see previous point).

The manpage for clock_settime(2) is not very clear:

       EINVAL The clk_id specified is not supported on this system.

       EPERM  clock_settime() does not have permission to set the clock  indi‐
              cated.

To me, the manpage reads like EPERM should be expected when trying to
set a clock that is not settable.

Should we update the manpage to more fully explain the range of
possible errors or instead try to have more consistent errors? For
syscalls, what's the backward-compatibility contract for errno values?

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2020-04-20 11:13 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 18:02 clock_settime(2) error for non-settable clocks Eric Rannaud
2020-03-21  3:56 ` Aleksa Sarai
2020-03-26  8:37 ` Michael Kerrisk (man-pages)
2020-03-29 20:49   ` Michael Kerrisk (man-pages)
2020-04-02 11:48     ` Michael Kerrisk (man-pages)
2020-04-02 14:23       ` [PATCH 1/1] clock_getres.2: dynamic POSIX clock devices can return other errors Eric Rannaud
2020-04-02 19:55         ` Michael Kerrisk (man-pages)
2020-04-02 20:06         ` Eric Rannaud
2020-04-02 20:19           ` Michael Kerrisk (man-pages)
2020-04-02 20:49             ` Eric Rannaud
2020-04-02 20:50               ` Eric Rannaud
2020-04-03  7:02               ` Michael Kerrisk (man-pages)
2020-04-03 16:42                 ` Eric Rannaud
2020-04-20 11:13               ` Michael Kerrisk (man-pages)
2020-04-02 14:29       ` clock_settime(2) error for non-settable clocks Eric Rannaud

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).