Commit Graph

3720 Commits

Author SHA1 Message Date
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 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 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
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
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 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 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 6b6505af4d path_resolution.7: srcfix: semantic newlines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 22:36:13 +02:00
Aleksa Sarai 61d24bff30 path_resolution.7: Update to mention openat2(2) features
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 22:35:33 +02:00
Michael Kerrisk c1d6273963 signal.7: wfix
Reported-by: Pablo M. Ronchi <pmronchi@yahoo.com.ar>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-29 09:22:38 +02:00
Jakub Wilk 1662b235bc units.7: tfix
Escape hyphens.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-26 08:49:39 +01:00
Michael Kerrisk 9359ebce87 vsock.7: srcfix: semantic newlines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-14 19:43:04 +01:00
Michael Kerrisk 0a8a31e804 vsock.7: Minor tweaks to Stefano Garzarella's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-14 19:42:34 +01:00
Stefano Garzarella cab58dfe1e vsock.7: Add VMADDR_CID_LOCAL description
Linux 5.6 added the new well-known VMADDR_CID_LOCAL for
local communication.

This patch explains how to use it and removes the legacy
VMADDR_CID_RESERVED no longer available.

Reviewed-by: Jorgen Hansen <jhansen@vmware.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-14 19:41:57 +01:00
Jakub Wilk 165bef47be socket.7: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:16:48 +01:00
Michael Kerrisk 112e0e60b7 socket.7: Add more details on SO_SELECT_ERR_QUEUE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-28 21:42:29 +01:00
Michael Kerrisk cb1b0be683 socket.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-28 21:39:29 +01:00
Ricardo Biehl Pasquali 7ded63ef4c socket.7: Add description of SO_SELECT_ERR_QUEUE
Signed-off-by: Ricardo Biehl Pasquali <pasqualirb@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-28 21:39:29 +01:00
Michael Kerrisk 2aa31d7fef sysvipc.7: Rewrite this page as just a summary of the sysvipc APIs
All of the other details in this page have by now been moved into
the relevant *ctl(2) pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:55:33 +01:00
Bjarni Ingi Gislason 2fe33a0da7 man7/namespaces.7: srcfix: Make the number of .RS/.RE macros equal
Add a '.RE' macro to terminate the last .RS block.

There is no change in the output.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-24 09:00:08 +01:00
Michael Kerrisk 38c287b8c4 cgroups.7: Update list of cgroups v2 controllers
Update the list of cgroups v2 controllers (several controllers
were missing).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk cda7f4a31f cgroups.7: Put list of v2 controllers in alphabetical order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 9e18674a5b cgroups.7: Document the cgroups v2 'memory_localevents' mount option
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk efb9595454 cgroups.7: Add a subsection on cgroup v2 mount options and include 'nsdelegate'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk d4c9a84828 cgroups.7: SEE ALSO: add Documentation/admin-guide/cgroup-v2.rst
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 0019177eac getent.1, localedef.1, clock_nanosleep.2, fcntl.2, getitimer.2, getsockopt.2, inotify_init.2, ioctl.2, mlock.2, mprotect.2, quotactl.2, s390_sthyi.2, semctl.2, shmctl.2, shmget.2, wait.2, CPU_SET.3, aio_init.3, des_crypt.3, fmemopen.3, fopencookie.3, fts.3, getaddrinfo.3, getrpcent.3, lio_listio.3, posix_spawn.3, shm_open.3, st.4, elf.5, group.5, proc.5, services.5, aio.7, feature_test_macros.7, keyrings.7, man-pages.7, sigevent.7, tcp.7, udp.7: Global formatting fix: disfavor nonstandard .TP indents
In many cases, these don't improve readability, and (when stacked)
they sometimes have the side effect of sometimes forcing text
to be justified within a narrow column range.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 2fd2369549 epoll.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:22 +01:00
Michael Kerrisk ee5d5d33c5 epoll.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:22 +01:00
Michael Kerrisk 0a26e2d352 epoll.7: wfix: break a sentence up, for clarity
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:22 +01:00
Michael Kerrisk 6b621d05b3 _exit.2, capget.2, fcntl.2, futex.2, listen.2, memfd_create.2, modify_ldt.2, move_pages.2, open.2, perf_event_open.2, ptrace.2, set_thread_area.2, stime.2, syscall.2, sysctl.2, userfaultfd.2, cmsg.3, exit.3, ftime.3, getpt.3, malloc.3, console_codes.4, loop.4, inotify.7, netlink.7, packet.7, rtnetlink.7, tcp.7, unix.7, vsock.7, ldconfig.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-09 11:53:28 +01:00
Michael Kerrisk 1059ffb804 tcp.7: tcp_low_latency is ignored since Linux 4.14
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 16:11:46 +01:00
Michael Kerrisk 863d6b7de0 unix.7: The PID sent with SCM_CREDENTIALS must match an existing process
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-05 12:51:51 +01:00
Nick Shipp 5687d86fa5 inotify.7: Merge late perror() into fprintf()
fprintf() may have overridden errno before perror() could print
it in this example.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 20:45:24 +01:00
Jakub Wilk 91201f28d8 keyrings.7: ffix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 20:22:27 +01:00
Michael Kerrisk 9d7fb78448 epoll.7: wfix
Reported-by: John Jones <jmjatlanta@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 20:20:04 +01:00
Michael Kerrisk 0549038d6d uts_namespaces.7: wfix
Reported-by: Sam Varshavchik <mrsam@courier-mta.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 20:12:43 +01:00
Michael Kerrisk 1f294696f6 ipc_namespaces.7: wfix
Reported-by: Sam Varshavchik <mrsam@courier-mta.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 20:12:26 +01:00
Michael Kerrisk a0253f557d fanotify.7: srcfix
Reported-by: Sam Varshavchik <mrsam@courier-mta.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 20:11:17 +01:00
Michael Kerrisk f7d3e6aac1 sched.7: tfix
Reported-by: Will <cassis@tricolore.lu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-06 19:42:43 +01:00
Antonin Décimo ae10667d48 netlink.7: Fix alignment issue in example
PVS-Studio reports that in

    char buf[8192];
    /* ... */
    nh = (struct nlmsghdr *) buf,

the pointer 'buf' is cast to a more strictly aligned pointer type.
This is undefined behaviour. One possible solution to make sure
that buf is correctly aligned is to declare buf as an array of
struct nlmsghdr. Other solutions include allocating the array on
the heap, use an union, or stdalign features.  With this patch,
the buffer still contains 8192 bytes.

This was raised on Stack Overflow:
https://stackoverflow.com/questions/57745580/netlink-receive-buffer-alignment

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-30 19:49:08 +01:00
Antonin Décimo 7aec4106be rtnetlink.7: ifa_index is an unsigned int
See include/linux/if_addr.h.

struct ifaddrmsg {
    __u8        ifa_family;
    __u8        ifa_prefixlen;    /* The prefix length        */
    __u8        ifa_flags;    /* Flags            */
    __u8        ifa_scope;    /* Address scope        */
    __u32        ifa_index;    /* Link index            */
};

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-30 19:46:45 +01:00