]> git.ipfire.org Git - thirdparty/man-pages.git/log
thirdparty/man-pages.git
5 years agoptrace.2: Minor tweaks to Joseph Sible's patch
Michael Kerrisk [Mon, 13 Apr 2020 08:36:43 +0000 (10:36 +0200)] 
ptrace.2: Minor tweaks to Joseph Sible's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoptrace.2: Document PTRACE_SET_SYSCALL
Joseph C. Sible [Mon, 13 Apr 2020 08:29:03 +0000 (10:29 +0200)] 
ptrace.2: Document PTRACE_SET_SYSCALL

Signed-off-by: Joseph C. Sible <josephcsible@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoproc.5: Minor tweaks to Keno Fischer's patch
Michael Kerrisk [Mon, 13 Apr 2020 07:25:02 +0000 (09:25 +0200)] 
proc.5: Minor tweaks to Keno Fischer's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoproc.5: Fix an outdated note about map_files
Keno Fischer [Sun, 12 Apr 2020 08:09:30 +0000 (04:09 -0400)] 
proc.5: Fix an outdated note about map_files

The restriction to CAP_SYS_ADMIN was removed from map_files in
2015 [1].  There was a fixme that indicted this might happen, but
the main text was never updated when this commit landed. While
we're at it, add a note about the ptrace access check that is
still required.

[1] https://github.com/torvalds/linux/commit/bdb4d100afe9818aebd1d98ced575c5ef143456c

Signed-off-by: Keno Fischer <keno@juliacomputing.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoopenat2.2: Various changes after feedback from Aleksa Sarai
Michael Kerrisk [Mon, 13 Apr 2020 07:21:20 +0000 (09:21 +0200)] 
openat2.2: Various changes after feedback from Aleksa Sarai

Reported-by: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoREADME: Remove "Man page overlap and duplication" section
Michael Kerrisk [Mon, 13 Apr 2020 07:06:45 +0000 (09:06 +0200)] 
README: Remove "Man page overlap and duplication" section

The info here is mostly ancient, certainly incomplete,
and is not consistently maintained. Best to remove it, I think.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoREADME: wfix
Michael Kerrisk [Mon, 13 Apr 2020 05:16:56 +0000 (07:16 +0200)] 
README: wfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoREADME: Add section on "Bug reports and contributing"
Michael Kerrisk [Sun, 12 Apr 2020 21:09:25 +0000 (23:09 +0200)] 
README: Add section on "Bug reports and contributing"

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoREADME: Move the "Home page" section to the top of the file
Michael Kerrisk [Sun, 12 Apr 2020 20:50:08 +0000 (22:50 +0200)] 
README: Move the "Home page" section to the top of the file

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agombind.2: Rework Li Xinhai's patch to note historical behavior
Michael Kerrisk [Mon, 6 Apr 2020 15:49:23 +0000 (17:49 +0200)] 
mbind.2: Rework Li Xinhai's patch to note historical behavior

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agombind.2: Remove note about MPOL_MF_STRICT been ignored
Li Xinhai [Fri, 14 Feb 2020 17:03:58 +0000 (17:03 +0000)] 
mbind.2: Remove note about MPOL_MF_STRICT been ignored

Current code ignores the MPOL_MF_STRICT when handling hugetlb
mapping, now patch([1]) handles MPOL_MF_STRICT in same semantic as
other mapping.  So, we can remove the note about 'MPOL_MF_STRICT
is ignored on huge page mappings', and no changes to other part of
man-page.

[1] https://lore.kernel.org/linux-mm/1581559627-6206-1-git-send-email-lixinhai.lxh@gmail.com/

Signed-off-by: Li Xinhai <lixinhai.lxh@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoChanges.old: Fixes to 5.06 change log
Michael Kerrisk [Sun, 12 Apr 2020 07:34:30 +0000 (09:34 +0200)] 
Changes.old: Fixes to 5.06 change log

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agostrcmp.3: Add license to example programs
Michael Kerrisk [Sun, 12 Apr 2020 07:04:33 +0000 (09:04 +0200)] 
strcmp.3: Add license to example programs

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoshm_open.3: Add license to example programs
Michael Kerrisk [Sun, 12 Apr 2020 07:03:25 +0000 (09:03 +0200)] 
shm_open.3: Add license to example programs

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoshmop.2: Add license to example programs
Michael Kerrisk [Sun, 12 Apr 2020 07:02:08 +0000 (09:02 +0200)] 
shmop.2: Add license to example programs

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agopoll.2: Add license to example program
Michael Kerrisk [Sun, 12 Apr 2020 07:00:00 +0000 (09:00 +0200)] 
poll.2: Add license to example program

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agosemget.2: Add license to example program
Michael Kerrisk [Sun, 12 Apr 2020 06:59:10 +0000 (08:59 +0200)] 
semget.2: Add license to example program

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotime_namespaces.7: Minor wording fix
Michael Kerrisk [Sun, 12 Apr 2020 06:44:50 +0000 (08:44 +0200)] 
time_namespaces.7: Minor wording fix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotime_namespaces.7: tfix
Michael Kerrisk [Sun, 12 Apr 2020 06:43:56 +0000 (08:43 +0200)] 
time_namespaces.7: tfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoStart of man-pages-5.07: updating Changes and Changes.old
Michael Kerrisk [Sun, 12 Apr 2020 06:32:06 +0000 (08:32 +0200)] 
Start of man-pages-5.07: updating Changes and Changes.old

5 years agoStart of man-pages-5.07: updating .Announce and .lsm files
Michael Kerrisk [Sun, 12 Apr 2020 06:32:06 +0000 (08:32 +0200)] 
Start of man-pages-5.07: updating .Announce and .lsm files

5 years agoStart of man-pages-5.07: renaming .Announce and .lsm files
Michael Kerrisk [Sun, 12 Apr 2020 06:32:06 +0000 (08:32 +0200)] 
Start of man-pages-5.07: renaming .Announce and .lsm files

5 years agoReady for 5.06
Michael Kerrisk [Sat, 11 Apr 2020 20:08:12 +0000 (22:08 +0200)] 
Ready for 5.06

5 years agopidfd_getfd.2, select.2, exit.3, time.7, time_namespaces.7: srcfix: Trim trailing...
Michael Kerrisk [Sat, 11 Apr 2020 20:32:33 +0000 (22:32 +0200)] 
pidfd_getfd.2, select.2, exit.3, time.7, time_namespaces.7: srcfix: Trim trailing white spaces

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoChanges: whitespace cleanups
Michael Kerrisk [Sat, 11 Apr 2020 20:08:03 +0000 (22:08 +0200)] 
Changes: whitespace cleanups

5 years agogetent.1, localedef.1, accept.2, arch_prctl.2, clock_getres.2, clock_nanosleep.2...
Michael Kerrisk [Sat, 11 Apr 2020 20:07:24 +0000 (22:07 +0200)] 
getent.1, localedef.1, accept.2, arch_prctl.2, clock_getres.2, clock_nanosleep.2, connect.2, dup.2, epoll_create.2, epoll_ctl.2, epoll_wait.2, execve.2, getitimer.2, getsockopt.2, gettid.2, inotify_add_watch.2, inotify_init.2, io_submit.2, ioctl.2, lseek.2, madvise.2, mlock.2, mmap.2, mprotect.2, msgctl.2, msgop.2, open_by_handle_at.2, openat2.2, pidfd_open.2, poll.2, prctl.2, quotactl.2, s390_sthyi.2, select.2, select_tut.2, semctl.2, semget.2, semop.2, setns.2, shmctl.2, shmget.2, shmop.2, sigaction.2, stat.2, statx.2, syscalls.2, timer_create.2, timerfd_create.2, unshare.2, wait.2, CPU_SET.3, aio_init.3, atoi.3, des_crypt.3, dirfd.3, fmemopen.3, fopencookie.3, ftok.3, fts.3, getaddrinfo.3, getifaddrs.3, getrpcent.3, gsignal.3, lio_listio.3, nl_langinfo.3, posix_memalign.3, posix_openpt.3, posix_spawn.3, scanf.3, sem_init.3, sem_post.3, shm_open.3, strcmp.3, strftime.3, st.4, elf.5, group.5, proc.5, services.5, aio.7, cgroups.7, feature_test_macros.7, keyrings.7, man-pages.7, namespaces.7, path_resolution.7, sigevent.7, signal.7, socket.7, sysvipc.7, time.7, udp.7: tstamp

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoChanges: Ready for 5.06
Michael Kerrisk [Fri, 10 Apr 2020 09:07:53 +0000 (11:07 +0200)] 
Changes: Ready for 5.06

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoproc.5: ffix
Michael Kerrisk [Fri, 10 Apr 2020 08:00:30 +0000 (10:00 +0200)] 
proc.5: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: SEE ALSO: add time_namespaces(7)
Michael Kerrisk [Sat, 4 Apr 2020 05:04:38 +0000 (07:04 +0200)] 
clock_getres.2: SEE ALSO: add time_namespaces(7)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotime.7: Add small subsection on clocks and time namespaces
Michael Kerrisk [Fri, 10 Apr 2020 07:38:39 +0000 (09:38 +0200)] 
time.7: Add small subsection on clocks and time namespaces

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agosetns.2: Document CLONE_NEWTIME
Michael Kerrisk [Sat, 4 Apr 2020 10:29:29 +0000 (12:29 +0200)] 
setns.2: Document CLONE_NEWTIME

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agounshare.2: Add CLONE_NEWCGROUP and CLONE_NEWTIME to example program
Michael Kerrisk [Sat, 4 Apr 2020 10:51:33 +0000 (12:51 +0200)] 
unshare.2: Add CLONE_NEWCGROUP and CLONE_NEWTIME to example program

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agounshare.2: Document CLONE_NEWTIME
Michael Kerrisk [Fri, 3 Apr 2020 18:19:30 +0000 (20:19 +0200)] 
unshare.2: Document CLONE_NEWTIME

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agonamespaces.7: Eliminate some superfluous info from display of /proc/PID/ns links
Michael Kerrisk [Fri, 3 Apr 2020 13:04:59 +0000 (15:04 +0200)] 
namespaces.7: Eliminate some superfluous info from display of /proc/PID/ns links

The display of the /proc/PID/ns renders very wide. Make it
narrower by eliminating some nonessential info via some
awk(1) filtering.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agonamespaces.7: Add time namespaces information
Michael Kerrisk [Fri, 3 Apr 2020 12:22:30 +0000 (14:22 +0200)] 
namespaces.7: Add time namespaces information

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotime_namespaces.7: Tweaks for symbolic clock-IDs in /proc/PID/timens_offsets
Michael Kerrisk [Sat, 11 Apr 2020 11:32:29 +0000 (13:32 +0200)] 
time_namespaces.7: Tweaks for symbolic clock-IDs in /proc/PID/timens_offsets

Andrei Vagin implemented a change I suggested:
clock-IDs are now be expressed in symbolic form (e.g.,
"monotonic") instead of numeric form (e.g., 1) when reading
/proc/PID/timerns_offsets, and can be expressed either
symbolically or numerically when writing to that file.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotime_namespaces.7: Add an ERRORS description for writes to timens_offsets
Michael Kerrisk [Tue, 7 Apr 2020 13:07:51 +0000 (15:07 +0200)] 
time_namespaces.7: Add an ERRORS description for writes to timens_offsets

In particular, note the ERANGE restrictions reported by
Thomas Gleixner.

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotime_namespaces.7: Updates after feedback from Andrei Vagin
Michael Kerrisk [Tue, 7 Apr 2020 12:45:00 +0000 (14:45 +0200)] 
time_namespaces.7: Updates after feedback from Andrei Vagin

Reported-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotime_namespaces.7: Minor wording tweaks
Michael Kerrisk [Mon, 6 Apr 2020 08:26:10 +0000 (10:26 +0200)] 
time_namespaces.7: Minor wording tweaks

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotime_namespaces.7: New page documenting time namespaces
Michael Kerrisk [Sat, 4 Apr 2020 09:23:02 +0000 (11:23 +0200)] 
time_namespaces.7: New page documenting time namespaces

Reviewed-by: Dmitry Safonov <dima@arista.com>
Reviewed-by: Andrei Vagin <avagin@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agodup.2: SEE ALSO: add pidfd_getfd(2)
Michael Kerrisk [Wed, 1 Apr 2020 04:46:55 +0000 (06:46 +0200)] 
dup.2: SEE ALSO: add pidfd_getfd(2)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agopidfd_open.2: Mention pidfd_getfd(2)
Michael Kerrisk [Tue, 31 Mar 2020 12:05:24 +0000 (14:05 +0200)] 
pidfd_open.2: Mention pidfd_getfd(2)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agopidfd_getfd.2: Additions and fixes after review by Christian Brauner
Michael Kerrisk [Wed, 8 Apr 2020 08:27:32 +0000 (10:27 +0200)] 
pidfd_getfd.2: Additions and fixes after review by Christian Brauner

Reported-by: Christian Brauner <christian@brauner.io>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agopidfd_getfd.2: Note the parallels and differences with SCM_RIGHTS messages
Michael Kerrisk [Wed, 1 Apr 2020 05:30:48 +0000 (07:30 +0200)] 
pidfd_getfd.2: Note the parallels and differences with SCM_RIGHTS messages

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agopidfd_getfd.2: New manual page documenting the pidfd_getfd() system call
Michael Kerrisk [Tue, 31 Mar 2020 12:01:58 +0000 (14:01 +0200)] 
pidfd_getfd.2: New manual page documenting the pidfd_getfd() system call

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agostrcmp.3: SEE ALSO: add ascii(7)
Michael Kerrisk [Thu, 9 Apr 2020 11:01:27 +0000 (13:01 +0200)] 
strcmp.3: SEE ALSO: add ascii(7)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agostrcmp.3: Add an example program
Michael Kerrisk [Thu, 9 Apr 2020 11:00:47 +0000 (13:00 +0200)] 
strcmp.3: Add an example program

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agostrcmp.3: wfix
Michael Kerrisk [Thu, 9 Apr 2020 10:32:13 +0000 (12:32 +0200)] 
strcmp.3: wfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agostrcmp.3: Rework text describing return value to be clearer
Michael Kerrisk [Thu, 9 Apr 2020 09:43:59 +0000 (11:43 +0200)] 
strcmp.3: Rework text describing return value to be clearer

Reported-by: Andrew Micallef <andrew.micallef@live.com.au>
Reported-by: Walter Harms <wharms@bfs.de>
Reviewed-by: Andrew Micallef <andrew.micallef@live.com.au>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agostrcmp.3: Note that the comparison is done using unsigned char
Michael Kerrisk [Thu, 9 Apr 2020 09:10:13 +0000 (11:10 +0200)] 
strcmp.3: Note that the comparison is done using unsigned char

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoproc.5: Clarify /proc/[pid]/cmdline mutability
Mike Frysinger [Fri, 10 Apr 2020 05:33:54 +0000 (07:33 +0200)] 
proc.5: Clarify /proc/[pid]/cmdline mutability

The cmdline file is a window into memory that is controlled by the
target process, and that memory may be changed arbitrarily, as can
the window via prctl settings.  Make sure people understand that
this file is all an illusion.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoio_submit.2: Add IOCB_CMD_POLL opcode
Julia Suvorova [Tue, 4 Jun 2019 15:05:53 +0000 (18:05 +0300)] 
io_submit.2: Add IOCB_CMD_POLL opcode

A new feature of one-shoot polling through io_submit was
introduced in bfe4037e722ec commit. Keep things up-to-date due
to changes in linux/aio_abi.h.

Signed-off-by: Julia Suvorova <jusual@mail.ru>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agosigaction.2, signal.7: Document kernel bugs in delivery of signals from CPU exceptions
Zack Weinberg [Mon, 23 Dec 2019 17:31:46 +0000 (12:31 -0500)] 
sigaction.2, signal.7: Document kernel bugs in delivery of signals from CPU exceptions

signal.7: Which signal is delivered in response to a CPU exception
is under-documented and does not always make sense.  See
<https://bugzilla.kernel.org/show_bug.cgi?id=205831> for an
example where it doesn’t make sense; per the discussion there,
this cannot be changed because of backward compatibility concerns,
so let’s instead document the problem.

sigaction.2: For related reasons, the kernel doesn’t always fill
in all of the fields of the siginfo_t when delivering signals from
CPU exceptions.  Document this as well.  I imagine this one
_could_ be fixed, but the problem would still be relevant to
anyone using an older kernel.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agofanotify_mark.2: wfix
Michael Kerrisk [Thu, 9 Apr 2020 19:51:31 +0000 (21:51 +0200)] 
fanotify_mark.2: wfix

After a comment from Matthew Bobrowski:

    Although, I would just have to point out that it doesn't
    necessarily have to be a "script" file, but rather a file of
    any type that can have its contents interpreted, which then
    results in a form of program execution i.e.

    $ /usr/lib64/ld-linux-x86-64.so.2 ./foo

    In this case, foo is not a "script" file.

Reported-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agomadvise.2: Incorporate some (ancient) comments about MADV_HUGEPAGE
Michael Kerrisk [Thu, 9 Apr 2020 19:43:29 +0000 (21:43 +0200)] 
madvise.2: Incorporate some (ancient) comments about MADV_HUGEPAGE

Back in 2011, a mail from Andrea Arcangeli noted some details
that I never got round to incorporating into the manual page.

Reported-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoaccept.2, epoll_create.2, inotify_add_watch.2, open.2, open_by_handle_at.2, pidfd_ope...
Michael Kerrisk [Wed, 8 Apr 2020 08:28:45 +0000 (10:28 +0200)] 
accept.2, epoll_create.2, inotify_add_watch.2, open.2, open_by_handle_at.2, pidfd_open.2, dirfd.3, posix_openpt.3, shm_open.3: Fix clumsy wording around "nonnegative file descriptors"

Reported-by: Christian Brauner <christian@brauner.io>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoarch_prctl.2: Minor fixes to Keno Fischer's patch
Michael Kerrisk [Tue, 7 Apr 2020 20:21:50 +0000 (22:21 +0200)] 
arch_prctl.2: Minor fixes to Keno Fischer's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoarch_prctl.2: srcfix: rewrap source lines
Michael Kerrisk [Tue, 7 Apr 2020 20:05:31 +0000 (22:05 +0200)] 
arch_prctl.2: srcfix: rewrap source lines

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoarch_prctl.2: Add ARCH_SET_CPUID subcommand
Keno Fischer [Mon, 16 Mar 2020 03:21:27 +0000 (23:21 -0400)] 
arch_prctl.2: Add ARCH_SET_CPUID subcommand

This subcommand was added a few years ago to support cpuid emulation
on x86 targets, but no changes to the man page appear to have been
made at the time. This commit adds a description for it and the
corresponding getter.

Signed-off-by: Keno Fischer <keno@juliacomputing.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agounix.7: Correct example
Heinrich Schuchardt [Wed, 27 Jun 2018 01:09:05 +0000 (03:09 +0200)] 
unix.7: Correct example

The example is misleading. It is not a good idea to unlink an
existing socket because we might try to start the server multiple
times. In this case it is preferable to receive an error.

We could add code that removes the socket when the server process
is killed but that would stretch the example too far.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoconnect.2: Update the details on AF_UNSPEC
Michael Kerrisk [Mon, 6 Apr 2020 11:43:00 +0000 (13:43 +0200)] 
connect.2: Update the details on AF_UNSPEC

Update the details on AF_UNSPEC and circumstances in which
socket can be reconnected.

From a mail conversation with Eric Dumazet:

> connect() man page seems obsolete or confusing :
>
>    Generally,  connection-based  protocol  sockets may successfully
>    connect() only once; connectionless protocol  sockets  may  use
>    connect()  multiple times  to  change  their association.
>    Connectionless sockets may dissolve the association by connecting to
>    an address with the sa_family  member  of sockaddr set to AF_UNSPEC
>    (supported on Linux since kernel 2.2).>
>
> 1) At least TCP has supported AF_UNSPEC thing forever.
> 2) By definition connectionless sockets do not have an association,
>    why would they call connect(AF_UNSPEC) to remove a connection
>    which does not exist ...

Calling connect() on a connectionless socket serves two purposes:
a) Assigns a default outgoing address for datagrams (sent using write(2)).
b) Causes datagrams sent from sources other than the peer address to be
   discarded.

Both of these things are true in AF_UNIX and the Internet domains.
Using connect(AF_UNSPEC) allows the local datagram socket to clear
this association (without having to connect() to a *different*
peer), so that now it can send datagrams to any peer and receive
datagrams for any peer, (I've just retested all of this.)

>
> Maybe we should rewrite this paragraph to match reality, since
> this causes confusion.
>
>
>    Some protocol sockets may successfully connect() only once.
>    Some protocol sockets may use connect() multiple times  to  change
>    their association.
>    Some protocol sockets may dissolve the association by connecting to
>    an address with the sa_family member of sockaddr set to AF_UNSPEC
>    (supported on Linux since kernel 2.2).

When I first saw your note, I was afraid that I had written
the offending text. But, I see it has been there since the
manual page was first added in 1992 (other than the piece
"(supported since on Linux since kernel 2.2)", which I added in
2007). Perhaps it was true in 1992.

Anyway, I confirm your statement about TCP sockets. The
connect(AF_UNSPEC) thing works; thereafter, the socket may be
connected to another socket.

Interestingly, connect(AF_UNSPEC) does not seem to work for
UNIX domain stream sockets. (My light testing gives an EINVAL
error on connect(AF_UNSPEC) of an already connected UNIX stream
socket. I could not easily spot where this error was being
generated in the kernel though.)

Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoopen.2: Note EINVAL error for invalid character in basename of 'pathname'
Michael Kerrisk [Mon, 6 Apr 2020 09:37:01 +0000 (11:37 +0200)] 
open.2: Note EINVAL error for invalid character in basename of 'pathname'

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoip.7, tcp.7, udp.7: ffix
Michael Kerrisk [Mon, 6 Apr 2020 08:42:03 +0000 (10:42 +0200)] 
ip.7, tcp.7, udp.7: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotcp.7: SEE ALSO: mention Documentation/networking/ip-sysctl.txt
Michael Kerrisk [Mon, 6 Apr 2020 08:41:42 +0000 (10:41 +0200)] 
tcp.7: SEE ALSO: mention Documentation/networking/ip-sysctl.txt

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotimerfd_create.2: Refer reader to clock_getres(2) for further details on the clocks
Michael Kerrisk [Mon, 6 Apr 2020 08:20:32 +0000 (10:20 +0200)] 
timerfd_create.2: Refer reader to clock_getres(2) for further details on the clocks

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotimer_create.2: wfix
Michael Kerrisk [Mon, 6 Apr 2020 08:17:09 +0000 (10:17 +0200)] 
timer_create.2: wfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: Minor clarification in description of CLOCK_BOOTTIME
Michael Kerrisk [Mon, 6 Apr 2020 08:14:28 +0000 (10:14 +0200)] 
clock_getres.2: Minor clarification in description of CLOCK_BOOTTIME

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agosocket.7: Note SCM message types for SO_TIMESTAMP and SO_TIMESTAMPNS
Michael Kerrisk [Mon, 6 Apr 2020 08:04:16 +0000 (10:04 +0200)] 
socket.7: Note SCM message types for SO_TIMESTAMP and SO_TIMESTAMPNS

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agosocket.7: Add some SO_TIMESTAMPNS details.
Michael Kerrisk [Mon, 6 Apr 2020 07:44:37 +0000 (09:44 +0200)] 
socket.7: Add some SO_TIMESTAMPNS details.

Note the kernel version that added SO_TIMESTAMPNS,
and (from the kernel commit) note tha SO_TIMESTAMPNS and
SO_TIMESTAMP are mutually exclusive.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agosocket.7: Document SO_TIMESTAMPNS
Alejandro Colomar [Mon, 6 Apr 2020 07:30:55 +0000 (09:30 +0200)] 
socket.7: Document SO_TIMESTAMPNS
===========
DESCRIPTION
===========

I added a paragraph for ``SO_TIMESTAMP``, and modified the
paragraph for ``SIOCGSTAMP`` in relation to ``SO_TIMESTAMPNS``.

I based the documentation on the existing ``SO_TIMESTAMP``
documentation, and
on my experience using ``SO_TIMESTAMPNS``.

I asked a question on stackoverflow, which helped me understand
``SO_TIMESTAMPNS``:

https://stackoverflow.com/q/60971556/6872717

Testing of the feature being documented
=======================================

I wrote a simple server and client test.

In the client side, I connected a socket specifying
``SOCK_STREAM`` and ``"tcp"``.

Then I enabled timestamp in ns:

.. code-block:: c

     int enable = 1;

     if (setsockopt(sd, SOL_SOCKET, SO_TIMESTAMPNS, &enable,
             sizeof(enable)))
         goto err;

Then I prepared the msg header:

.. code-block:: c

     char        buf[BUFSIZ];
     char        cbuf[BUFSIZ];
     struct msghdr    msg;
     struct iovec    iov;

     memset(buf, 0, ARRAY_BYTES(buf));
     iov.iov_len    = ARRAY_BYTES(buf) - 1;
     iov.iov_base    = buf;
     msg.msg_name    = NULL;
     msg.msg_iov    = &iov;
     msg.msg_iovlen    = 1;
     msg.msg_control    = cbuf;
     msg.msg_controllen = ARRAY_BYTES(cbuf);

And got some times before and after receiving the msg:

.. code-block:: c

     struct timespec    tm_before, tm_recvmsg, tm_after, tm_msg;

     clock_gettime(CLOCK_REALTIME, &tm_before);
     usleep(500000);
     clock_gettime(CLOCK_REALTIME, &tm_recvmsg);
     n = recvmsg(sd, &msg, MSG_WAITALL);
     if (n < 0)
         goto err;
     usleep(1000000);
     clock_gettime(CLOCK_REALTIME, &tm_after);

After that I read the timestamp of the msg:

.. code-block:: c

     struct cmsghdr *cmsg;

     for (cmsg = CMSG_FIRSTHDR(&msg); cmsg;
             cmsg = CMSG_NXTHDR(&msg, cmsg)) {
         if (cmsg->cmsg_level == SOL_SOCKET  &&
                     cmsg->cmsg_type == SO_TIMESTAMPNS) {
             memcpy(&tm_msg, CMSG_DATA(cmsg), sizeof(tm_msg));
             break;
         }
     }
     if (!cmsg)
         goto err;

And finally printed the results:

.. code-block:: c

     double tdiff;

     printf("%s\n", buf);
     tdiff = timespec_diff_ms(&tm_before, &tm_recvmsg);
     printf("tm_r - tm_b = %lf ms\n", tdiff);
     tdiff = timespec_diff_ms(&tm_before, &tm_after);
     printf("tm_a - tm_b = %lf ms\n", tdiff);
     tdiff = timespec_diff_ms(&tm_before, &tm_msg);
     printf("tm_m - tm_b = %lf ms\n", tdiff);

Which printed:

::

     asdasdfasdfasdfadfgdfghfthgujty 6, 0;
     tm_r - tm_b = 500.000000 ms
     tm_a - tm_b = 1500.000000 ms
     tm_m - tm_b = 18.000000 ms

System:

::

     Linux debian 5.4.0-4-amd64 #1 SMP Debian 5.4.19-1 (2020-02-13) x86_64
     GNU/Linux
     gcc (Debian 9.3.0-8) 9.3.0

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoprctl.2: Note semantics of IO_FLUSHER state with respect to fork(2) and execve(2)
Michael Kerrisk [Mon, 6 Apr 2020 05:50:41 +0000 (07:50 +0200)] 
prctl.2: Note semantics of IO_FLUSHER state with respect to fork(2) and execve(2)

Reported-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agolseek.2: ERRORS: ENXIO can also occur SEEK_DATA in middle of hole at end of file
Michael Kerrisk [Mon, 6 Apr 2020 05:06:15 +0000 (07:06 +0200)] 
lseek.2: ERRORS: ENXIO can also occur SEEK_DATA in middle of hole at end of file

Quoting Matthew Wilcox:

    The current text of the lseek manpage is ambiguous about
    the behaviour of lseek(SEEK_DATA) for a file which is
    entirely a hole (or the end of the file is a hole and the
    pos lies within the hole).  The draft POSIX language is
    specific (ENXIO is returned when whence is SEEK_DATA and
    offset lies within the final hole of the file).  Could I
    trouble you to wordsmith that in?

    If you want to look at the draft POSIX text, it's here:
    https://www.austingroupbugs.net/view.php?id=415

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agolseek.2: Minor fix to wording of ENXIO error
Michael Kerrisk [Mon, 6 Apr 2020 04:59:35 +0000 (06:59 +0200)] 
lseek.2: Minor fix to wording of ENXIO error

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: Minor tweaks to example
Michael Kerrisk [Sat, 4 Apr 2020 08:50:36 +0000 (10:50 +0200)] 
clock_getres.2: Minor tweaks to example

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: Clarify that CLOCK_MONOTONIC is system-wide
Michael Kerrisk [Sat, 4 Apr 2020 05:03:53 +0000 (07:03 +0200)] 
clock_getres.2: Clarify that CLOCK_MONOTONIC is system-wide

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: Clarify that CLOCK_TAI is nonsettable
Michael Kerrisk [Sat, 4 Apr 2020 05:00:45 +0000 (07:00 +0200)] 
clock_getres.2: Clarify that CLOCK_TAI is nonsettable

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: Add an example program
Michael Kerrisk [Sat, 4 Apr 2020 07:32:33 +0000 (09:32 +0200)] 
clock_getres.2: Add an example program

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: wfix: EOPNOTSUPP --> ENOTSUP
Michael Kerrisk [Thu, 2 Apr 2020 19:54:07 +0000 (21:54 +0200)] 
clock_getres.2: wfix: EOPNOTSUPP --> ENOTSUP

The two error codes are synonymous, but ENOTSUP is what is used
in other related pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: Dynamic POSIX clock devices can return other errors
Eric Rannaud [Thu, 2 Apr 2020 14:23:47 +0000 (07:23 -0700)] 
clock_getres.2: Dynamic POSIX clock devices can return other errors

See Linux source as of v5.4:
  kernel/time/posix-clock.c

Signed-off-by: Eric Rannaud <e@nanocritical.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotimerfd_create.2: Note a case where timterfd_settime() can fail with ECANCELED
Michael Kerrisk [Thu, 2 Apr 2020 13:11:32 +0000 (15:11 +0200)] 
timerfd_create.2: Note a case where timterfd_settime() can fail with ECANCELED

From email discussions with Thomas Gleixner:

======

Hello Thomas, et al,

Following on from our discussion of read() on a timerfd [1], I
happened to remember a Debian bug report [2] that points out that
timer_settime() can fail with the error ECANCELED, which is both
surprising and odd (because despite the error, the timer does get
updated).

The relevant kernel code (I think, from your commit [3]) seems to be
the following in timerfd_setup():

        if (texp != 0) {
                if (flags & TFD_TIMER_ABSTIME)
                        texp = timens_ktime_to_host(clockid, texp);
                if (isalarm(ctx)) {
                        if (flags & TFD_TIMER_ABSTIME)
                                alarm_start(&ctx->t.alarm, texp);
                        else
                                alarm_start_relative(&ctx->t.alarm, texp);
                } else {
                        hrtimer_start(&ctx->t.tmr, texp, htmode);
                }

                if (timerfd_canceled(ctx))
                        return -ECANCELED;
        }

Using a small test program [4] shows the behavior. The program loops,
repeatedly calling timerfd_settime() (with a delay of a few seconds
before each call). In another terminal window, enter the following
command a few times:

    $ sudo date -s "5 seconds"       # Add 5 secs to wall-clock time

I see behavior as follows (the /sudo date -s "5 seconds"/ command was
executed before loop iterations 0, 2, and 4):

[[
$ ./timerfd_settime_ECANCELED
0
Current time is 1585729978 secs, 868510078 nsecs
Timer value is now 0 secs, 0 nsecs
timerfd_settime() succeeded
Timer value is now 9 secs, 999991977 nsecs

1
Current time is 1585729982 secs, 716339545 nsecs
Timer value is now 6 secs, 152167990 nsecs
timerfd_settime() succeeded
Timer value is now 9 secs, 999992940 nsecs

2
Current time is 1585729991 secs, 567377831 nsecs
Timer value is now 1 secs, 148959376 nsecs
timerfd_settime: Operation canceled
Timer value is now 9 secs, 999976294 nsecs

3
Current time is 1585729995 secs, 405385503 nsecs
Timer value is now 6 secs, 161989917 nsecs
timerfd_settime() succeeded
Timer value is now 9 secs, 999993317 nsecs

4
Current time is 1585730004 secs, 225036165 nsecs
Timer value is now 1 secs, 180346909 nsecs
timerfd_settime: Operation canceled
Timer value is now 9 secs, 999984345 nsecs
]]

I note from the above.

(1) If the wall-clock is changed before the first timerfd_settime()
call, the call succeeds. This is of course expected.
(2) If the wall-clock is changed after a timerfd_settime() call, then
the next timerfd_settime() call fails with ECANCELED.
(3) Even if the timerfd_settime() call fails, the timer is still updated(!).

Some questions:
(a) What is the rationale for timerfd_settime() failing with ECANCELED
in this case? (Currently, the manual page says nothing about this.)
(b) It seems at the least surprising, but more likely a bug, that
timerfd_settime() fails with ECANCELED while at the same time
successfully updating the timer value.

Your thoughts?

Thanks,

Michael

[1] https://lore.kernel.org/lkml/3cbd0919-c82a-cb21-c10f-0498433ba5d1@gmail.com/

[2] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=947091

[3]
commit 99ee5315dac6211e972fa3f23bcc9a0343ff58c4
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Wed Apr 27 14:16:42 2011 +0200

    timerfd: Allow timers to be cancelled when clock was set

[4]
/* timerfd_settime_ECANCELED.c */
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <inttypes.h>
#include <sys/timerfd.h>

#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); } while (0)

int
main(int argc, char *argv[])
{
    struct itimerspec ts, gts;
    struct timespec start;

    int tfd = timerfd_create(CLOCK_REALTIME, 0);
    if (tfd == -1)
        errExit("timerfd_create");

    ts.it_interval.tv_sec = 0;
    ts.it_interval.tv_nsec = 10;

    int flags = TFD_TIMER_ABSTIME | TFD_TIMER_CANCEL_ON_SET;

    for (long j ; ; j++) {

        /* Inject a delay into each loop, by calling getppid()
           many times */

        for (int k = 0; k < 10000000; k++)
            getppid();

        if (j % 1 == 0)
            printf("%ld\n", j);

        /* Display the current wall-clock time */

        if (clock_gettime(CLOCK_REALTIME, &start) == -1)
            errExit("clock_gettime");
        printf("Current time is %ld secs, %ld nsecs\n",
                start.tv_sec, start.tv_nsec);

        /* Before resetting the timer, retrieve its current value
           so that after the timerfd_settime() call, we can see
           whether the the value has changed */

        if (timerfd_gettime(tfd, &gts) == -1)
            perror("timerfd_gettime");
        printf("Timer value is now %ld secs, %ld nsecs\n",
            gts.it_value.tv_sec, gts.it_value.tv_nsec);

        /* Reset the timer to now + 10 secs */

        ts.it_value.tv_sec = start.tv_sec + 10;
        ts.it_value.tv_nsec = start.tv_nsec;
        if (timerfd_settime(tfd, flags, &ts, NULL) == -1)
            perror("timerfd_settime");
        else
            printf("timerfd_settime() succeeded\n");

        /* Display the timer value once again */

        if (timerfd_gettime(tfd, &gts) == -1)
            perror("timerfd_gettime");
        printf("Timer value is now %ld secs, %ld nsecs\n",
            gts.it_value.tv_sec, gts.it_value.tv_nsec);

        printf("\n");
    }
}

=======

Subject: Re: timer_settime() and ECANCELED
Date: Wed, 01 Apr 2020 19:42:42 +0200
From: Thomas Gleixner <tglx@linutronix.de>

Michael,

"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> writes:
> Following on from our discussion of read() on a timerfd [1], I
> happened to remember a Debian bug report [2] that points out that
> timer_settime() can fail with the error ECANCELED, which is both
> surprising and odd (because despite the error, the timer does get
> updated).
...
> (1) If the wall-clock is changed before the first timerfd_settime()
> call, the call succeeds. This is of course expected.
> (2) If the wall-clock is changed after a timerfd_settime() call, then
> the next timerfd_settime() call fails with ECANCELED.
> (3) Even if the timerfd_settime() call fails, the timer is still updated(!).
>
> Some questions:
> (a) What is the rationale for timerfd_settime() failing with ECANCELED
> in this case? (Currently, the manual page says nothing about this.)
> (b) It seems at the least surprising, but more likely a bug, that
> timerfd_settime() fails with ECANCELED while at the same time
> successfully updating the timer value.

Really good question and TBH I can't remember why this is implemented in
the way it is, but I have a faint memory that at least (a) is
intentional.

After staring at the code for a while I came up with the following
answers:

(a): If the clock was set event ("date -s ...") which triggered the
     cancel was not yet consumed by user space via read(), then that
     information would get lost because arming the timer to the new
     value has to reset the state.

(b): Arming the timer in that case is indeed very questionable, but it
     could be argued that because the clock was set event happened with
     the old expiry value that the new expiry value is not affected.

     I'd be happy to change that and not arm the timer in the case of a
     pending cancel, but I fear that some user space already depends on
     that behaviour.

Thanks,

        tglx

======

Subject: Re: timer_settime() and ECANCELED
Date: Thu, 02 Apr 2020 10:49:18 +0200
From: Thomas Gleixner <tglx@linutronix.de>
To: Michael Kerrisk (man-pages) <mtk.manpages@gmail.com>

"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com> writes:
> On 4/1/20 7:42 PM, Thomas Gleixner wrote:
>> (b): Arming the timer in that case is indeed very questionable, but it
>>      could be argued that because the clock was set event happened with
>>      the old expiry value that the new expiry value is not affected.
>>
>>      I'd be happy to change that and not arm the timer in the case of a
>>      pending cancel, but I fear that some user space already depends on
>>      that behaviour.
>
> Yes, that's the risk, of course. So, shall we just document all
> this in the manual page?

I think so.

Thanks,

        tglx
======

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoprctl.2: Reword description of PR_GET_IO_FLUSHER
Michael Kerrisk [Thu, 2 Apr 2020 12:12:43 +0000 (14:12 +0200)] 
prctl.2: Reword description of PR_GET_IO_FLUSHER

Reported-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoprctl.2: Unused args must be zero for PR_GET_IO_FLUSHER and PR_SET_IO_FLUSHER
Michael Kerrisk [Thu, 2 Apr 2020 12:08:39 +0000 (14:08 +0200)] 
prctl.2: Unused args must be zero for PR_GET_IO_FLUSHER and PR_SET_IO_FLUSHER

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoprctl.2: f
Michael Kerrisk [Thu, 2 Apr 2020 12:07:12 +0000 (14:07 +0200)] 
prctl.2: f

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoprctl.2: Minor tweaks to Mike Christie's patch
Michael Kerrisk [Thu, 2 Apr 2020 12:06:28 +0000 (14:06 +0200)] 
prctl.2: Minor tweaks to Mike Christie's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoprctl.2: Document PR_SETIO_FLUSHER/GET_IO_FLUSHER
Mike Christie [Thu, 2 Apr 2020 02:08:50 +0000 (21:08 -0500)] 
prctl.2: Document PR_SETIO_FLUSHER/GET_IO_FLUSHER

This patch documents the PR_SET_IO_FLUSHER and PR_GET_IO_FLUSHER
prctl commands added to the linux kernel for 5.6 in commit:

    commit 8d19f1c8e1937baf74e1962aae9f90fa3aeab463
    Author: Mike Christie <mchristi@redhat.com>
    Date:   Mon Nov 11 18:19:00 2019 -0600

        prctl: PR_{G,S}ET_IO_FLUSHER to support controlling memory reclaim

Reviewed-by: Michal Hocko <mhocko@kernel.org>
Signed-off-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agopthread_getcpuclockid.3: Minor clarification to usage of 'clockid' argument
Michael Kerrisk [Thu, 2 Apr 2020 10:37:44 +0000 (12:37 +0200)] 
pthread_getcpuclockid.3: Minor clarification to usage of 'clockid' argument

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getcpuclockid.3, pthread_getcpuclockid.3: wfix: use 'clockid' rather than ...
Michael Kerrisk [Thu, 2 Apr 2020 10:36:11 +0000 (12:36 +0200)] 
clock_getcpuclockid.3, pthread_getcpuclockid.3: wfix: use 'clockid' rather than 'clock_id'

For consistency across pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: wfix: s/clk_id/clockid/ throughout
Michael Kerrisk [Thu, 2 Apr 2020 10:31:39 +0000 (12:31 +0200)] 
clock_getres.2: wfix: s/clk_id/clockid/ throughout

Most other manual pages use 'clockid' for the 'clockid_t'
argument.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_nanosleep.2: wfix: s/clock_id/clockid/ throughout
Michael Kerrisk [Thu, 2 Apr 2020 10:18:52 +0000 (12:18 +0200)] 
clock_nanosleep.2: wfix: s/clock_id/clockid/ throughout

Most other section 2 pages use 'clockid' as the name
of the 'clockid_t' argument.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_nanosleep.2, timer_create.2, timerfd_create.2: Add various missing errors
Michael Kerrisk [Thu, 2 Apr 2020 06:39:08 +0000 (08:39 +0200)] 
clock_nanosleep.2, timer_create.2, timerfd_create.2: Add various missing errors

Mostly verified by testing and reading the code.

There is unfortunately quite a bit of inconsistency across API~s:

                  clock_gettime  clock_settime  clock_nanosleep  timer_create  timerfd_create

CLOCK_BOOTTIME            y        n (EINVAL)     y                y             y
CLOCK_BOOTTIME_ALARM      y        n (EINVAL)     y [1]            y [1]         y [1]
CLOCK_MONOTONIC           y        n (EINVAL)     y                y             y
CLOCK_MONOTONIC_COARSE    y        n (EINVAL)     n (ENOTSUP)      n (ENOTSUP)   n (EINVAL)
CLOCK_MONOTONIC_RAW       y        n (EINVAL)     n (ENOTSUP)      n (ENOTSUP)   n (EINVAL)
CLOCK_REALTIME            y        y              y                y             y
CLOCK_REALTIME_ALARM      y        n (EINVAL)     y [1]            y [1]         y [1]
CLOCK_REALTIME_COARSE     y        n (EINVAL)     n (ENOTSUP)      n (ENOTSUP)   n (EINVAL)
CLOCK_TAI                 y        n (EINVAL)     y                y             n (EINVAL)
CLOCK_PROCESS_CPUTIME_ID  y        n (EINVAL)     y                y             n (EINVAL)
CLOCK_THREAD_CPUTIME_ID   y        n (EINVAL)     n (EINVAL [2])   y             n (EINVAL)
pthread_getcpuclockid()   y        n (EINVAL)     y                y             n (EINVAL)

[1] The caller must have CAP_WAKE_ALARM, or the error EPERM results.

[2] This error is generated in the glibc wrapper.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotimerfd_create.2: Rework text for EINVAL for invalid clock ID
Michael Kerrisk [Thu, 2 Apr 2020 10:12:11 +0000 (12:12 +0200)] 
timerfd_create.2: Rework text for EINVAL for invalid clock ID

The error description was crufty. There are more valid
clock IDs these days.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_nanosleep.2: srcfix
Michael Kerrisk [Thu, 2 Apr 2020 08:52:26 +0000 (10:52 +0200)] 
clock_nanosleep.2: srcfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_nanosleep.2: clock_nanosleep() can also sleep against CLOCK_TAI
Michael Kerrisk [Thu, 2 Apr 2020 08:49:26 +0000 (10:49 +0200)] 
clock_nanosleep.2: clock_nanosleep() can also sleep against CLOCK_TAI

Presumably since Linux 3.10, when CLOCK_TAI was added to the
kernel.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_nanosleep.2: srcfix
Michael Kerrisk [Thu, 2 Apr 2020 08:26:46 +0000 (10:26 +0200)] 
clock_nanosleep.2: srcfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: CLOCK_REALTIME_COARSE is not settable
Michael Kerrisk [Thu, 2 Apr 2020 08:11:15 +0000 (10:11 +0200)] 
clock_getres.2: CLOCK_REALTIME_COARSE is not settable

In kernel/time/posix-timers.c, 'CLOCK_REALTIME_COARSE' has
no 'timer_set' method.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: wfix
Michael Kerrisk [Thu, 2 Apr 2020 08:09:24 +0000 (10:09 +0200)] 
clock_getres.2: wfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: tfix
Michael Kerrisk [Thu, 2 Apr 2020 08:08:06 +0000 (10:08 +0200)] 
clock_getres.2: tfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agoclock_getres.2: Add CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM
Michael Kerrisk [Thu, 2 Apr 2020 07:28:57 +0000 (09:28 +0200)] 
clock_getres.2: Add CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotimer_create.2: timer_create(2) also supports CLOCK_TAI
Michael Kerrisk [Thu, 2 Apr 2020 07:02:30 +0000 (09:02 +0200)] 
timer_create.2: timer_create(2) also supports CLOCK_TAI

Presumably (and from a quick glance at the source code)
since Linux 3.10. when CLOCK_TAI was introduced.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 years agotimer_create.2: Mention clock_getres(2) for further details on the various clocks
Michael Kerrisk [Thu, 2 Apr 2020 07:00:11 +0000 (09:00 +0200)] 
timer_create.2: Mention clock_getres(2) for further details on the various clocks

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>