Commit Graph

20676 Commits

Author SHA1 Message Date
Michael Kerrisk 47bffa173f Ready for 5.06 2020-04-11 22:08:12 +02:00
Michael Kerrisk 17b6812dae Changes: whitespace cleanups 2020-04-11 22:08:03 +02:00
Michael Kerrisk e8426ca2b4 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>
2020-04-11 22:07:24 +02:00
Michael Kerrisk fe3ade16ec Changes: Ready for 5.06
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-11 21:38:07 +02:00
Michael Kerrisk b258106ff9 proc.5: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-11 21:38:07 +02:00
Michael Kerrisk 68220f1c6a clock_getres.2: SEE ALSO: add time_namespaces(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-11 21:38:07 +02:00
Michael Kerrisk 5ea630a46a time.7: Add small subsection on clocks and time namespaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-11 21:38:07 +02:00
Michael Kerrisk 97460df5f6 setns.2: Document CLONE_NEWTIME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-11 21:38:07 +02:00
Michael Kerrisk beb5a76eb3 unshare.2: Add CLONE_NEWCGROUP and CLONE_NEWTIME to example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-11 21:38:07 +02:00
Michael Kerrisk e5a5efc8ba unshare.2: Document CLONE_NEWTIME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-11 21:38:07 +02:00
Michael Kerrisk 05d2e9d0ab 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>
2020-04-11 21:38:07 +02:00
Michael Kerrisk 19e8f797fc namespaces.7: Add time namespaces information
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-11 21:38:07 +02:00
Michael Kerrisk 0953c1b4b3 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>
2020-04-11 21:34:51 +02:00
Michael Kerrisk 3685736f10 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>
2020-04-10 10:14:29 +02:00
Michael Kerrisk cf40643937 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>
2020-04-10 10:14:29 +02:00
Michael Kerrisk 1840148b08 time_namespaces.7: Minor wording tweaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk 5bed06a99a 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>
2020-04-10 10:14:29 +02:00
Michael Kerrisk efbd39dfd8 dup.2: SEE ALSO: add pidfd_getfd(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk 6e91d3e290 pidfd_open.2: Mention pidfd_getfd(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk 8b4baee738 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>
2020-04-10 10:14:29 +02:00
Michael Kerrisk be04cb5051 pidfd_getfd.2: Note the parallels and differences with SCM_RIGHTS messages
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk 13aa2b3014 pidfd_getfd.2: New manual page documenting the pidfd_getfd() system call
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk 8de73d59bb strcmp.3: SEE ALSO: add ascii(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk 3ffa5156fe strcmp.3: Add an example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk 70920875ec strcmp.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk befaf7f4c7 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>
2020-04-10 10:14:29 +02:00
Michael Kerrisk fd2f02239f strcmp.3: Note that the comparison is done using unsigned char
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Mike Frysinger ee669ccaa7 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>
2020-04-10 10:14:21 +02:00
Julia Suvorova af23877392 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>
2020-04-10 09:41:55 +02:00
Zack Weinberg d128b5b7ee 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>
2020-04-10 09:41:55 +02:00
Michael Kerrisk 9b89b9dd7a 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>
2020-04-10 09:41:55 +02:00
Michael Kerrisk 38b0811829 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>
2020-04-10 09:41:55 +02:00
Michael Kerrisk ed09120acd 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>
2020-04-10 09:41:55 +02:00
Michael Kerrisk 96ef140634 arch_prctl.2: Minor fixes to Keno Fischer's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 09:41:55 +02:00
Michael Kerrisk 5c47b28dd9 arch_prctl.2: srcfix: rewrap source lines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 09:41:55 +02:00
Keno Fischer 8005280bf8 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>
2020-04-10 09:41:55 +02:00
Heinrich Schuchardt 18bbb297eb 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>
2020-04-06 13:55:25 +02:00
Michael Kerrisk f4ba6a215f 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>
2020-04-06 13:43:00 +02:00
Michael Kerrisk ed6fe0056d open.2: Note EINVAL error for invalid character in basename of 'pathname'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-06 11:37:01 +02:00
Michael Kerrisk 526d9962b3 ip.7, tcp.7, udp.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-06 10:44:12 +02:00
Michael Kerrisk 5039577811 tcp.7: SEE ALSO: mention Documentation/networking/ip-sysctl.txt
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-06 10:41:42 +02:00
Michael Kerrisk ff5de6ecc4 timerfd_create.2: Refer reader to clock_getres(2) for further details on the clocks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-06 10:24:47 +02:00
Michael Kerrisk 96d8887df7 timer_create.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-06 10:24:47 +02:00
Michael Kerrisk 65ff4e238d clock_getres.2: Minor clarification in description of CLOCK_BOOTTIME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-06 10:24:36 +02:00
Michael Kerrisk dd6b076aa6 socket.7: Note SCM message types for SO_TIMESTAMP and SO_TIMESTAMPNS
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-06 10:07:04 +02:00
Michael Kerrisk 3e472692a6 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>
2020-04-06 10:07:04 +02:00
Alejandro Colomar a47d370bb3 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>
2020-04-06 10:07:04 +02:00
Michael Kerrisk f3c29937e6 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>
2020-04-06 10:07:04 +02:00
Michael Kerrisk 22a2e0553b 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>
2020-04-06 10:06:56 +02:00
Michael Kerrisk ab366b4567 lseek.2: Minor fix to wording of ENXIO error
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-06 06:59:35 +02:00