Linux-man Archive on
 help / color / Atom feed
From: Eric Rannaud <>
Subject: clock_settime(2) error for non-settable clocks
Date: Fri, 20 Mar 2020 11:02:24 -0700
Message-ID: <> (raw)

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
  - 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‐

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?

             reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-20 18:02 Eric Rannaud [this message]
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)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='' \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-man Archive on

Archives are clonable:
	git clone --mirror linux-man/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-man linux-man/ \
	public-inbox-index linux-man

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone