Commit Graph

22943 Commits

Author SHA1 Message Date
Michael Kerrisk a9db6c1ba3 open.2: Clarify that openat()'s dirfd must be opened with O_RDONLY or O_PATH
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 56dddcbad5 open.2: Reorder list of cases for 'dirfd' argument of openat()
In preparation for subsequent commits

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 5241f3cce5 open.2: Minor reworking of the description of the 'dirfd' argument of openat()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:16 +02:00
Michael Kerrisk a1508e361f capabilities.7: Add a reference to user_namespaces(7) for CAP_SETFCAP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-11 12:10:10 +02:00
Michael Kerrisk ab4c4b2fbb user_namespaces.7: Improve description of the CAP_SETFCAP requirement when mapping UID 0
Kir Kolyshkin made a start, but I think much more needs to
be said...

Reviewed-by: Serge E. Hallyn <serge@hallyn.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-11 12:09:55 +02:00
Michael Kerrisk 9f275af155 syscalls.2: Add quotactl_fd(); remove quotactl_path()
quotactl_path() was never wired up in Linux 5.13.
It was replaced instead by quotactl_fd(),

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-11 04:40:43 +02:00
Michael Kerrisk ed655e3c21 sigaction.2: Add kernel version for SA_UNSUPPORTED flag
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-11 03:31:52 +02:00
Michael Kerrisk 2d369e8e5d wait.2: ERRORS: document EAGAIN for waitid() on a PID file descriptor
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-11 02:01:46 +02:00
Michael Kerrisk 2430d2a7b3 pidfd_open.2: Document PIDFD_NONBLOCK
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-11 01:48:02 +02:00
Michael Kerrisk 5303eb87ee mount_setattr.2: Minor fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-11 00:45:58 +02:00
Michael Kerrisk 70a9d0fe1b mount_setattr.2: Changes after review feedback from Christian Brauner
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 23:01:29 +02:00
Michael Kerrisk f22c1e6c20 ioctl_tty.2: Remove duplicated text
Somehow I applied Pali Rohár's patch "Document ioctls: TCGETS2,
TCSETS2, TCSETSW2, TCSETSF2" twice...

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 21:26:04 +02:00
Michael Kerrisk 44a16bcb61 pthread_setname_np.3: EXAMPLES: remove a bug by simplify the code
From an email conversation with Alexis:

Hello Alexis,

On 8/6/21 7:06 PM, Alexis Wilke wrote:
> Hi guys,
>
> The pthread_setname_np(3) manual page has an example where the second
> argument is used to get a size of the thread name.
>
> https://man7.org/linux/man-pages/man3/pthread_setname_np.3.html#EXAMPLES
>
> The current code:
>
>            rc = pthread_getname_np(thread, thread_name,
>                                    (argc > 2) ? atoi(argv[1]) : NAMELEN);
>
> The suggested code:
>
>            rc = pthread_getname_np(thread, thread_name,
>                                    (argc > 2) ? atoi(argv[2]) : NAMELEN);

I agree that there's a problem, but I think we could go even simpler:

     rc = pthread_getname_np(thread, thread_name, NAMELEN);

> I'm thinking that maybe the author meant to compute the length like so:
>
>            rc = pthread_getname_np(thread, thread_name,
>                                    (argc > 2) ? strlen(argv[1]) + 1 :
> NAMELEN);
>
> But I think that the atoi() points to using argv[2] as a number
> representing the length.
>
> (Of course, it should be tested against NAMELEN as a maximum, but I
> understand that examples do not always show how to verify each possible
> error).

I imagine that the author's intention was to allow the user to do
experiments where argv[2] specified a number less than NAMELEN,
in order to see the resulting ERANGE error. But, that experiment
is of limited value, and complicates the code unnecessarily, IMO,
so that's why I made the change above.

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

Reported-by: Alexis Wilke <alexis@m2osw.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 11:11:40 +02:00
Michael Kerrisk d27bcddc11 mount_setattr.2: Rework the discussion of MOUNT_ATTR__ATIME
Phrases such as "In the new mount API" will date fast. Remove it.
Also:
* Make it clear that MOUNT_ATTR__ATIME expresses a bit field.
* Replace 'enum' with 'enumeration'.
* Clarify what is meant by "partially" set MOUNT_ATTR__ATIME.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 10:45:18 +02:00
Michael Kerrisk 705bf534bb mount_setattr.2: Remove description of propagation types
These types are already well described in mount_namespaces(7);
indeed, much of the text from that page seems to have just been
cut and pasted into this page! Simply referring the reader to
mount_namespaces(7) is sufficient.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 09:23:08 +02:00
Michael Kerrisk 29fdc88d6e mount_setattr.2: Reword the description of the 'propagation field'
Point out that this field can have the value zero, meaning
no change. And avoid discussions of 'enum', and simply say
that otherwise the field has one of the MS_* values.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 09:13:56 +02:00
Jakub Wilk c61a1c396e wcstok.3: Fix type mismatch in the example
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 08:41:40 +02:00
Michael Kerrisk d96bf5f5bf man-pages.7: wfix: s/null character/null byte/
Reported-by: Stefan Kanthak <stefan.kanthak@nexgo.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 08:31:25 +02:00
Eric W. Biederman 8e5918c2ec seccomp.2: Clarify that bad system calls kill the thread
Reported-by: Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 08:00:45 +02:00
Michael Kerrisk bb75585de6 unicode.7: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:52:08 +02:00
Michael Kerrisk 3e3764560d signal.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:45:55 +02:00
Michael Kerrisk 0e8a773e53 mount_setattr.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk 538a491e06 mount_setattr.2: Move the discussion of ID-mapped mounts to NOTES
Having this discussion under DESCRIPTION clutters that section,
and has the effect of burying the discussion of propagation. Move
the discussion to NOTES, to make the page more readable.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk 38635f0bc4 mount_setattr.2: Add a reference to mount_namespaces(7) in discussion of propagation types
The mount_namespaces(7) page has some further relevant details.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk 30397d7dd0 mount_setattr.2: Rename 'dfd' to 'dirfd'
'dirfd' is the name consistently used in other pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk 91ce7d5f0a mount_setattr.2: Remove some unnecessary intermediate variables
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk f606879ab1 mount_setattr.2: Minor clean-ups in example program
- Change some instances of "-" to "\"
- Use C99 style (declare variables nearer use in code)
- Add a bit of white space
- Remove one 'const...const' added by Alex that caused
  compiler warnings
- Use "reverse Christmas tree" form for declarations in main()
- Other minor changes

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk 8c67481023 mount_setattr.2: SEE ALSO: place entries in correct order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk 5c3a06ed01 mount_setattr.2: SEE ALSO: remove unneeded entries
We don't really need ext4(5) and xfs(5) here. They provide
no further info that is directly relevant to the reader of
mount_setattr(2).

clone3(2) isn't necessary because it is the same page as clone(2).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk 133e6b161c mount_setattr.2: Minor wording, grammar, and formatting fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk 3643106e2c mount_setattr.2: wfix: "idmapped/idmapping" is not natural English
Let's use ID mapped, ID mapping, etc.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk 736498624f mount_setattr.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk 03cd41e922 mount_setattr.2: Minor formatting fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Alejandro Colomar 63097cb7be mount_setattr.2: Minor tweaks to Christian's patch
- Fix SYNOPSIS to fit in 78 columns

  Also, we don't show when an include is included for a specific type,
  unless that header is included _only_ for the type,
  or there might be confusion (e.g., termios).
  Instead, that type should be documented in system_data_types(7),
  with a link page mount_attr-struct(3).

- Fix references to mount_setattr().  See man-pages(7):

       Any reference to the subject of the current manual page should be writ‐
       ten with the name in bold followed by a pair of  parentheses  in  Roman
       (normal)  font.   For  example, in the fcntl(2) man page, references to
       the subject of the page would be written as:  fcntl().   The  preferred
       way to write this in the source file is:

           .BR fcntl ()

- Fix line breaks according to semantic newline rules (and add some commas)
- Fix wrong usage of .IR when .RI should have been used
- Fix formatting of variable part in FOO<number>:
  - Make italic the variable part (as groff_man(7) recommends)
  - Remove <>
  - Use syntax recommended by G. Branden Robinson (groff)

- Fix unnecessary uses of .BR or .IR when .B or .I would suffice
- Fix formatting of punctuation

  In some cases, it was in italics or bold, and it should always be in roman.

- Use uppercase to begin text, even in bullet points, since those were
  multi-sentence.

- Simplify usage of .RS/.RE in combination with .IP
- s/fat/FAT/ as fs(7) does
- Slightly reword some sentences for consistency
- Use Linux-specific for consistency with other pages (in VERSIONS)
- EXAMPLES: Place the return type in a line of its own (as in other pages)
- Fix alignment of code
- Replace unnecessary use of the GNU extension ({}) by do {} while (0)

  In that case, there was no return value (moreover, it's a noreturn).

- Break complex declaration lines into a line for each variable

  The variables were being initialized, some to non-zero values,
  so for clarity, a line for each one seems more appropriate.

- Add const to pointers when possible
- s/\\/\e/
- Remove unmatched groff commands

Cc: Christian Brauner <brauner@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Christian Brauner f3a5ba3f01 mount_setattr.2: New manual page documenting the mount_setattr() system call
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 03:29:39 +02:00
Michael Kerrisk 69bc3836cc futex.2: Rework the description of FUTEX_LOCK_PI2
Note the use of FUTEX_CLOCK_REALTIME for selecting the clock,
and eliminate repetition of details already covered in the
description of FUTEX_LOCK_PI.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 11:44:12 +02:00
Alejandro Colomar eeeee81162 futex.2: Minor tweaks to Kurt's patch
Cc: Kurt Kanzenbach <kurt@linutronix.de>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 11:44:12 +02:00
Kurt Kanzenbach e79977aeec futex.2: Document FUTEX_LOCK_PI2
FUTEX_LOCK_PI2 is a new futex operation which was recently introduced into the
Linux kernel. It works exactly like FUTEX_LOCK_PI. However, it has support for
selectable clocks for timeouts. By default CLOCK_MONOTONIC is used. If
FUTEX_CLOCK_REALTIME is specified then the timeout is measured against
CLOCK_REALTIME.

This new operation addresses an inconsistency in the futex interface:
FUTEX_LOCK_PI only works with timeouts based on CLOCK_REALTIME in contrast to
all the other PI operations.

Document the FUTEX_LOCK_PI2 command.

Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 11:44:12 +02:00
Alejandro Colomar 7fc5fc967d path_resolution.7: tfix + srcfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 11:44:12 +02:00
Michael Kerrisk c2d505de65 syscalls.2: Add system calls that are new in 5.13
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:36:13 +02:00
Michael Kerrisk eb0ea88505 sigaction.2: Minor reworking of Alejandro Colomar's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Michael Kerrisk ef0350ce4c sigaction.2: Minor tweaks to the code example
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Michael Kerrisk 1875f17753 sigaction.2: Minor clean-ups to Peter Collingbourne's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Alejandro Colomar 4e7bd2d06b sigaction.2: Minor tweaks to Peter's patch
- Move example program to a new EXAMPLES section
- Invert logic in the handler to have the failure in the
  conditional path, and the success out of any conditionals.
- Use NULL, EXIT_SUCCESS, and EXIT_FAILURE instead of magic numbers
- Separate declarations from code
- Put function return type on its own line
- Put function opening brace on its line

Cc: Peter Collingbourne <pcc@google.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Peter Collingbourne 7dd4af5158 sigaction.2: Document SA_EXPOSE_TAGBITS and the flag support detection protocol
Signed-off-by: Peter Collingbourne <pcc@google.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Michael Kerrisk 9b6cce9936 path_resolution.7: Improve description of trailin slashes
See https://bugzilla.kernel.org/show_bug.cgi?id=212385

some/path/dir/ is not always the same as some/path/dir/:

$ mkdir u
$ rmdir u/.
rmdir: failed to remove 'u/.': Invalid argument
$ rmdir u
$

The text in POSIX.1-2018 Section 4.13 ("Pathname Resolution")
is helpful in pointing to a better wording.

Reported-by: Askar Safin <safinaskar@mail.ru>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Alejandro Colomar 06501029e1 ldd.1: Fix example command
Emanuele Torre via linux-man@:

[
I was reading the man page for ldd(1)[1]; and I read this in the first
paragraph of the DECRIPTION section:

 ldd prints the shared objects (shared libraries) required by each
 program or shared object specified on the command line.  An
 example of its use and output (using sed(1) to trim leading white
 space for readability in this page) is the following:

     $ ldd /bin/ls | sed 's/^ */    /'
         linux-vdso.so.1 (0x00007ffcc3563000)
         libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f87e5459000)
         libcap.so.2 => /lib64/libcap.so.2 (0x00007f87e5254000)
         libc.so.6 => /lib64/libc.so.6 (0x00007f87e4e92000)
         libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f87e4c22000)
         libdl.so.2 => /lib64/libdl.so.2 (0x00007f87e4a1e000)
         /lib64/ld-linux-x86-64.so.2 (0x00005574bf12e000)
         libattr.so.1 => /lib64/libattr.so.1 (0x00007f87e4817000)
         libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f87e45fa000)

This is a little confusing though since that sed(1) command does not
seem to work. (and also potentially misleading for someone who is trying
figure out how to parse ldd(1)'s output.)

ldd(1) prepends a TAB character (0x09) to each line, not spaces:

 $ ldd /bin/ls | xxd | head -1
 00000000: 096c 696e 7578 2d76 6473 6f2e 736f 2e31  .linux-vdso.so.1

I read ldd(1)'s source code[2] (it is part of glibc) and it seems to be
a bash script that tries to use different rtld programs ( ld.so(8) )
from an RTLDLIST.

Those, on my system, are:

 * /usr/lib/ld-linux.so.2
 * /usr/lib64/ld-linux-x86-64.so.2
 * /usr/libx32/ld-linux-x32.so.2

And they all seem to also be part of glibc.

I have tried to follow the git history of glibc to see when the switch
from spaces to the TAB character occured, but, to me, it seems like
glibc.git/elf/rtld.c has always used '\t'; at since
6a76c115150318eae5d02eca76f2fc03be7bd029[3] (358th commit since glibc
started using the git repository repository - Nov 18th 1995): before
that commit there are not any results for `git grep '\\t'` in the elf
directory and I did not investigate further.

Still, at the time of that commit, glibc did not seem to have an ldd(1)
utility.

Perhaps the man page is old and its original author was using and
documenting an ldd(1) utility that was not part of glibc when he was
writing it.

Anyhow, since I think that sed(1) command will not work on any system
that uses, at least, the most recent version of glibc (because lld(1)
and the ld.so(8) programs it depends on are all part of glibc), I think
that that example should be changed to avoid confusions.

The output format of ldd(1) does not seem to be clearly defined, so I
think this would be a good option:

 $ ldd /bin/ls | sed 's/^[[:space:]]*/    /'

NB: ^\s* should also work on most GNU/Linux systems, but \s is
    non-standard or documented so I don not suggest using it in the man
    page.

Another option could be to remove "the pipe to sed(1)" part and the note
in parentheses that explains why it was used by the original author.

Cheers.
 emanuele6

[1]: https://man7.org/linux/man-pages/man1/ldd.1.html
[2]: https://sourceware.org/git/?p=glibc.git;a=blob;f=elf/ldd.bash.in;h=ba736464ac5e4a9390b1b6a39595035238250232;hb=5188a9d0265cc6f7235a8af1d31ab02e4a24853d
[3]: https://sourceware.org/git/?p=glibc.git;a=commit;h=6a76c115150318eae5d02eca76f2fc03be7bd029

///////

 $ uname -a
 Linux t420 5.10.54-1-lts #1 SMP Wed, 28 Jul 2021 15:05:20 +0000
x86_64 GNU/Linux
 $ pacman -Qo ldd
 /usr/bin/ldd is owned by glibc 2.33-5
 $ pacman -Qo /usr/share/man/man1/ldd.1.gz
 /usr/share/man/man1/ldd.1.gz is owned by man-pages 5.12-2
 $ pacman -Qo /usr/lib/ld-linux.so.2
 /usr/lib/ld-linux.so.2 is owned by lib32-glibc 2.33-5
 $ pacman -Qo /usr/lib64/ld-linux-x86-64.so.2
 /usr/lib/ld-linux-x86-64.so.2 is owned by glibc 2.33-5
 $ pacman -F /usr/libx32/ld-linux-x32.so.2 || echo not available on arch linux.
 not available on arch linux.
]

Reported-by: EmanueleTorre <torreemanuele6@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Michael Kerrisk 5e833e276d localedef.1, access.2, ioctl_console.2, ioctl_fslabel.2, openat2.2, write.2, dlsym.3, getopt.3, nl_langinfo.3, termios.3, xcrypt.3, hosts.equiv.5, nsswitch.conf.5, cgroups.7, man-pages.7, netlink.7, system_data_types.7: srcfix: semantic newlines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Michael Kerrisk e6b7a7b823 nl_langinfo.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Alejandro Colomar c6d8334b58 getopt.3: Minor tweak to James's patch
Cc: James O. D. Hunt <jamesodhunt@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00