Compare commits

...

3055 Commits

Author SHA1 Message Date
Michael Kerrisk ae6b221882 prctl.2: Rewrite the description of PR_SET_SECCOMP to defer to seccomp(2)
There is a lot of unnecessary duplication of content of the seccomp
material in prctl(2) and seccomp(2).  Trevor Woerner also noted that
there is an error in prctl(2), where it says that the filters
"are run in order until the first non-allow result is seen", which
contradicts the correct statement in seccomp(2) that *all* filters
are executed.

So, rewrite the seccomp material in prctl(2) to strip out most of
the content duplicated in seccomp(2), and replace the removed
text with statements deferring to to seccomp(2).

Reported-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-09-02 00:15:52 +02:00
Michael Kerrisk 2da936fe2b prctl.2: Note that seccomp(2) is preferred over prctl(2) for setting seccomp mode
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-09-01 23:57:17 +02:00
Michael Kerrisk e186261405 malloc.3: Clarify that realloc() may move the memory block
Make it clearer, early in the discussion, that realloc()
may move the block.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:02:29 +02:00
Michael Kerrisk f1d01de4c8 malloc.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:02:29 +02:00
Michael Kerrisk 1949f76560 malloc.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:02:29 +02:00
Michael Kerrisk 5d46c7a934 malloc.3: Add some structuring to improve readability
Add some subsection (.SS) headings and paragraph breaks in
DESCRIPTION, to make the page more easily readable.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:02:25 +02:00
Paul Eggert ddc5192f0c malloc_hook.3: Modernize for glibc 2.34
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:01:01 +02:00
Paul Eggert cfc381be29 malloc.3: Modernize for glibc 2.34
glibc has tightened up its rules for replacing the memory
allocator.  I went through the malloc man page and looked for how
it documented malloc() and related functions, and fixed
discrepancies with glibc malloc() documentation and/or
implementation.  I also reorganized the portability discussion so
that portability issues can be seen more clearly.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:00:56 +02:00
Michael Kerrisk 77a4c23215 mount_namespaces.7: Update references to Documentation/filesystems/sharedsubtree.rst
Documentation/filesystems/sharedsubtree.txt has changed to
Documentation/filesystems/sharedsubtree.rst.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 03:06:52 +02:00
Michael Kerrisk 8a5fc410a9 proc.5: Fixes various references to kernel docs in Documentation/
Especially the change to .rst format in the kernel Documentation/
tree has rendered many of the references in this manual page
obsolete. Fix them.

Reported-by: Vito Caputo <vcaputo@pengaru.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 03:06:45 +02:00
Alejandro Colomar 77251857af operator.7: Reorder symbols as in the standard (C11)
This makes it easier to compare this page to the standard,
to get more details about the rules between operators.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 02:30:21 +02:00
Alejandro Colomar 9c9a5acaa2 operator.7: Fix precedence of the 'cast operator'
Unary operators are mentioned in C11::6.5.3, and casts are in
C11::6.5.4 (they are mentioned in order of precedence).

And from note 85 (in section 6.5) in that same C11 standard, major
subsections 6.5.X are sorted by precedence.

As an example (from Jakub), `sizeof(int)+1` is interpreted as
`(sizeof(int))+1`, and not `sizeof((int)+1)`.

I used C11 and not C18 (the latest) because at least in the draft
copy of C18 that I have, there are a few important typos in that
section, while the draft copy of C11 that I have is free of those
typos.  And C11 and C18 are almost identical, with no major
changes to the language.

Reported-by: David Sletten <david.paul.sletten@gmail.com>
Cc: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 02:30:21 +02:00
Pali Rohár 15af0ac10a termios.3: Use bold style for B0
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 02:30:21 +02:00
Michael Kerrisk 847487d17f termios.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 02:30:21 +02:00
Pali Rohár 4d3e4af379 termios.3: Clarify zero argument for cfsetispeed()
Zero in this case refers to literal constant 0 and not symbolic
constant B0.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 02:30:21 +02:00
Michael Kerrisk f45affce7f Changes.old: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 02:30:21 +02:00
Michael Kerrisk bf4f7a7867 exit_group.2: Remove a confusing reference to _exit(2) in DESCRIPTION
As noted by Jakub:

    BTW, the exit_group.2 man page could use an update (possibly
    by merging it into exit.2): it says that the "system
    call is is equivalent to _exit(2) except that it terminates
    not only the calling thread, but all threads in the calling
    process's thread group", which isn't helpful these days.

Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 01:21:39 +02:00
Michael Kerrisk db141dbfca exit_group.2: SEE ALSO: s/exit(2)/_exit(2)/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 01:21:38 +02:00
Michael Kerrisk d99b5be0d8 _exit.2: Clarify the distinction between the raw syscall and the wrapper function
Further clarify the difference between the raw _exit() system call
and the C library wrapper.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 01:21:36 +02:00
Pali Rohár 44803dd03b ioctl_tty.2: TIOCGSID is equivalent to tcgetsid()
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-30 23:15:14 +02:00
Michael Kerrisk daa754a4d6 Changes.old: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 23:13:58 +02:00
Michael Kerrisk fabb1a2a0b syscalls.2: Add Linux 5.14 system calls
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 22:43:25 +02:00
Michael Kerrisk d5ee9f931e memfd_secret.2: SEE ALSO: add memfd_create(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 22:43:25 +02:00
Michael Kerrisk e817f70a5f memfd_create.2: SEE ALSO: add memfd_secret(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 22:43:25 +02:00
Michael Kerrisk 84a2ce0f18 memfd_secret.2: Minor edits to Mike Rapoport's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 22:43:25 +02:00
Michael Kerrisk eabb03a4d2 memfd_secret.2: wfix
Added "RAM-based" after consultation with Mike Rapoport

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 22:43:19 +02:00
Mike Rapoport ac5edfeb1d memfd_secret.2: New page describing memfd_secret() system call
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 22:40:49 +02:00
Michael Kerrisk 824b408b7d Changes.old: tfix in 5.13 changelog
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 22:32:40 +02:00
Michael Kerrisk 4aa8739e0f Changes.old: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 22:24:57 +02:00
Michael Kerrisk 03564de187 Changes.old: Add missing entry in 5.13 changelog
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 22:15:28 +02:00
Michael Kerrisk 2af47cd371 Start of man-pages-5.14: updating Changes and Changes.old 2021-08-27 22:13:35 +02:00
Michael Kerrisk 333691eb13 Start of man-pages-5.14: updating .Announce and .lsm files 2021-08-27 22:13:35 +02:00
Michael Kerrisk 48cbf99783 Start of man-pages-5.14: renaming .Announce and .lsm files 2021-08-27 22:13:35 +02:00
Michael Kerrisk 091fbf1fef Ready for 5.13 2021-08-27 02:50:30 +02:00
Michael Kerrisk 6e00b7a858 iconv.1, ldd.1, accept.2, access.2, add_key.2, arch_prctl.2, bpf.2, chmod.2, chown.2, close_range.2, copy_file_range.2, execve.2, execveat.2, fanotify_mark.2, futex.2, futimesat.2, getpriority.2, intro.2, ioctl_tty.2, keyctl.2, link.2, membarrier.2, mkdir.2, mknod.2, mlock.2, mount.2, mount_setattr.2, open.2, open_by_handle_at.2, perf_event_open.2, pidfd_open.2, readlink.2, readv.2, rename.2, request_key.2, seccomp.2, sigaction.2, stat.2, statx.2, symlink.2, syscalls.2, umount.2, unlink.2, utimensat.2, wait.2, bsearch.3, fflush.3, getaddrinfo.3, getauxval.3, getopt.3, getsubopt.3, mkfifo.3, pthread_mutex_consistent.3, pthread_setname_np.3, pthread_tryjoin_np.3, scandir.3, sem_wait.3, stailq.3, strlen.3, strstr.3, termios.3, tsearch.3, wcslen.3, wcstok.3, wordexp.3, proc.5, capabilities.7, cgroups.7, fanotify.7, mount_namespaces.7, namespaces.7, path_resolution.7, pipe.7, posixoptions.7, user_namespaces.7, vdso.7, iconvconfig.8, ld.so.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 02:44:07 +02:00
Michael Kerrisk a7846609db Changes: Ready for 5.13
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 02:11:10 +02:00
Alejandro Colomar fb74563941 getaddrinfo.3: Note that 'errno' is set in parallel with EAI_SYSTEM
The previous wording wasn't very explicit, leaving room for
believing that 'errno' may be 0 after returning EAI_SYSTEM.

Use a wording similar to other pages, for added consistency.

[mtk: edited commit message title; also, POSIX notes that
'errno' is set in this case.]

Reported-by: Cristian Morales Vega <christian.morales.vega@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 01:17:59 +02:00
Michael Kerrisk 111ccf7e90 iconv.1, iconvconfig.8: FILES: note that files may be under /usr/lib64 rather than /lib/64
See https://bugzilla.kernel.org/show_bug.cgi?id=214163

Reported-by: Christopher Yeleighton <giecrilj@stegny.2a.pl>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-24 23:37:55 +02:00
Michael Kerrisk 9428bb9d8a mount_namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-22 23:47:32 +02:00
Michael Kerrisk 24483c2782 mount_namespaces.7: Minor wording fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-22 23:45:08 +02:00
Michael Kerrisk ababc346b3 mount_namespaces.7: wfix: use numbered cross-references in list of restrictions in NOTES
Done to make the list easier to navigate.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-21 00:49:05 +02:00
Michael Kerrisk 906ab4945c mount_namespaces.7: Rewrite locked mounts examples to use/etc/shadow
See https://lore.kernel.org/linux-man/20210817140649.7pmz5qcelgjzgxtz@wittgenstein/
    Subject: Re: [PATCHi, man-pages] mount_namespaces.7: More clearly explain "locked mounts"
    Date: Tue, 17 Aug 2021 16:06:49 +0200
    Message-ID: <20210817140649.7pmz5qcelgjzgxtz@wittgenstein>

Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk ebc82e00ee mount_namespaces.7: Note that it is possible to stack a mount on top of a locked mount
Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk f6aaf493f8 mount_namespaces.7: wfix
Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk 2433a20ce1 mount_namespaces.7: Minor wording clean-ups in discussion of less privileged namespaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk 82357e60d7 mount_namespaces.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk 8c9a827429 mount_namespaces.7: Terminology clean-up: "mount point" ==> "mount"
Many times, this page use the terminology "mount point", where
"mount" would be better. A "mount point" is the location at which
a mount is attached. A "mount" is an association between a
filesystem and a mount point.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk 5aea19ed35 mount_namespaces.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk aa62e72ded mount_namespaces.7: wfix
The correct terminology is "less privileged mount namespace"
(not "less privileged user namespace").

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk a66648bbd1 mount_namespaces.7: Relocate the "Restrictions on mount namespaces" subsection
The "Restrictions on mount namespaces" subsection belongs lower in
the page, following the discussion of concepts (e.g., shared
subtrees and propagation) that are discussed elsewhere in the page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk 44f2a6b8cd mount_namespaces.7: Repair earlier text after injection of new list item in previous commit
The previous commit injected a large block of text into a list,
separating one example in the previous list item from a
"continuation" in the following list item. repair that.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk 88ebfb241b mount_namespaces.7: Add further details on locked mounts in a less-privileged user namespace
Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk ee54e5d5cc mount_namespaces.7: More clearly explain the notion of locked mounts
For a long time, this manual page has had a brief discussion of
"locked" mounts, without clearly saying what this concept is, or
why it exists. Expand the discussion with an explanation of what
locked mounts are, why mounts are locked, and some examples of the
effect of locking.

Thanks to Christian Brauner for a lot of help in understanding
these details.

Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk 74ed673c59 mount.2: ERRORS: add EPERM error for case where a mount is locked
Refer the reader to mount_namespaces(7) for details.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk b3987057c6 umount.2: ERRORS: add EINVAL for case where mount is locked
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-20 23:37:47 +02:00
Michael Kerrisk 3d892e9692 getumask.3: Remove page
This function was never implemented on Linux. It seems pointless to
retain such a page 20 years after it was written.
2021-08-20 23:14:46 +02:00
Michael Kerrisk f9f75be088 user_namespaces.7: Add a definition of "global root"
Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-19 02:29:15 +02:00
Michael Kerrisk 7127973e0c add_key.2, keyctl.2, request_key.2: Note that the "libkeyutils" package provides <keyutils.h>
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=992377

Reported-by: Dominique Brazziel <dbrazziel@snet.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 11:45:20 +02:00
Michael Kerrisk 7b7252ed41 fanotify_mark.2: Revert cruft added in commit 717c3a7dcf
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 10:10:52 +02:00
Michael Kerrisk a98bd2de56 strsignal.3: wfix
In NAME line, one of the instances of "sigdescr_np" should be
"sigabbrev_np".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 09:57:04 +02:00
Michael Kerrisk f589f0e1b8 strsignal.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 08:02:35 +02:00
Michael Kerrisk 5478b148a1 tsearch.3: NAME: add twalk_r
This function is described in the page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 08:00:43 +02:00
Michael Kerrisk 28d0f81e1c sigqueue.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 07:59:32 +02:00
Michael Kerrisk f99cea2c35 prctl.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 07:46:16 +02:00
Michael Kerrisk dae872dd27 readv.2, pthread_tryjoin_np.3, stailq.3, strlen.3, wcslen.3: Arrange .SH sections in correct order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 07:38:15 +02:00
Michael Kerrisk 85a7ae7344 intro.2, mount_setattr.2, seccomp_unotify.2, fflush.3, pthread_mutex_consistent.3: Place SEE ALSO entries in correct order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 07:30:52 +02:00
Michael Kerrisk 90879cbd20 chmod.2, chown.2, open.2, mkdir.2, mknod.2, readlink.2, stat.2, symlink.2, mkfifo.3, scandir.3, sem_wait.3: ERRORS: combine errors into a single alphabetic list
These pages split out extra errors for some APIs into a separate
list.  Probably, the pages are easier to ready if all errors are
combined into a single list.

Note that there still remain a few pages where the errors are
listed separately for different APIs. For the moment, it seems
best to leave those pages as is, since the error lists are
largely distinct in those pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 03:47:26 +02:00
Michael Kerrisk 97e2d8e602 arch_prctl.2, perf_event_open.2, pthread_tryjoin_np.3: ERRORS: correct alphabetic order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 03:46:58 +02:00
Michael Kerrisk 18ce9c4a1b accept.2, access.2, getpriority.2, mlock.2: ERRORS: combine errors into a single list
These split out errors into separate lists (perhaps per API,
perhaps "may" vs "shall", perhaps "Linux-specific" vs
standard(??)), but there's no good reason to do this.  It makes
the error list harder to read, and is inconsistent with other
pages. So, combine the errors into a single list.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 01:38:14 +02:00
Michael Kerrisk cfda555640 getpass.3: wfix
Remove redundant phrase.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 01:38:14 +02:00
Michael Kerrisk 65f96dae10 shmop.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 01:38:14 +02:00
Michael Kerrisk dd0ccf19b2 proc.5: Remove duplicated /proc/[pid]/gid_map entry
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 01:38:14 +02:00
Michael Kerrisk 8273bf01f9 proc.5: Add /proc/PID/projid_map, referring reader to user_namespaces(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 01:38:14 +02:00
Michael Kerrisk 9ae13fffd2 user_namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 01:38:14 +02:00
Michael Kerrisk 213e259e97 user_namespaces.7: Document /proc/PID/projid_map
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 01:38:14 +02:00
Michael Kerrisk 6486faa956 user_namespaces.7: Minor wording improvement
Mainly in preparation for the following patch on project IDs maps.
Add some words that will make the parallels between the rules for
updating uid_map and projid_map clearer.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 01:38:14 +02:00
Michael Kerrisk 525a8b5461 fanotify_mark.2, link.2, mount.2, umount.2, proc.5, cgroups.7, fanotify.7: Terminology clean-up: "mount point" ==> "mount"
Many times, these pages use the terminology "mount point", where
"mount" would be better. A "mount point" is the location at which
a mount is attached. A "mount" is an association between a
filesystem and a mount point.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 01:38:14 +02:00
Michael Kerrisk 7ccfe34995 rename.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 01:38:14 +02:00
Michael Kerrisk 4d7a648597 mount_namespaces.7: SEE ALSO: add mount_setattr(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-13 01:21:53 +02:00
Michael Kerrisk 053132a882 statx.2: srcfix: semantic newlines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-13 01:21:53 +02:00
NeilBrown 728009a474 statx.2: Document STATX_MNT_ID
Linux 5.8 adds STATX_MNT_ID and stx_mnt_id.
Add description to statx.2

Signed-off-by: NeilBrown <neilb@suse.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-13 01:21:53 +02:00
Michael Kerrisk 4c313d979d mount_setattr.2: srcfix: add note explaining Christian's use of -ve dirfd values
From email with Christian Brauner:

>>>>>>           int fd_tree = open_tree(-EBADF, source,
>>>>>>                        OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC |
>>>>>>                        AT_EMPTY_PATH | (recursive ? AT_RECURSIVE : 0));
>>>>>
>>>>> ???
>>>>> What is the significance of -EBADF here? As far as I can tell, it
>>>>> is not meaningful to open_tree()?
>>>>
>>>> I always pass -EBADF for similar reasons to [2]. Feel free to just use -1.
>>>
>>> ????
>>> But here, both -EBADF and -1 seem to be wrong. This argument
>>> is a dirfd, and so should either be a file descriptor or the
>>> value AT_FDCWD, right?
>>
>> [1]: In this code "source" is expected to be absolute. If it's not
>>      absolute we should fail. This can be achieved by passing -1/-EBADF,
>>      afaict.
>
> D'oh! Okay. I hadn't considered that use case for an invalid dirfd.
> (And now I've done some adjustments to openat(2),which contains a
> rationale for the *at() functions.)
>
> So, now I understand your purpose, but still the code is obscure,
> since
>
> * You use a magic value (-EBADF) rather than (say) -1.
> * There's no explanation (comment about) of the fact that you want
>   to prevent relative pathnames.
>
> So, I've changed the code to use -1, not -EBADF, and I've added some
> comments to explain that the intent is to prevent relative pathnames.
> Okay?

Sounds good.

>
> But, there is still the meta question: what's the problem with using
> a relative pathname?

Nothing per se. Ok, you asked so it's your fault:
When writing programs I like to never use relative paths with AT_FDCWD
because. Because making assumptions about the current working directory
of the calling process is just too easy to get wrong; especially when
pivot_root() or chroot() are in play.
My absolut preference (joke intended) is to open a well-known starting
point with an absolute path to get a dirfd and then scope all future
operations beneath that dirfd. This already works with old-style
openat() and _very_ cautious programming but openat2() and its
resolve-flag space have made this **chef's kiss**.
If I can't operate based on a well-known dirfd I use absolute paths with
a -EBADF dirfd passed to *at() functions.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-13 01:21:46 +02:00
Michael Kerrisk 669d6302cb fanotify_mark.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-13 01:21:08 +02:00
Michael Kerrisk d53b1b1730 open.2: Add mount_setattr(2) to list of 'dirfd' APIs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-13 01:21:08 +02:00
Michael Kerrisk af35474e4f mount_setattr.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-13 01:21:08 +02:00
Michael Kerrisk a3ade5b2b1 mount.2: SEE ALSO: add mount_setattr(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-13 01:21:01 +02:00
Michael Kerrisk 9e11604c6c mount_setattr.2: Further tweaks after feedback from Christian Brauner
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 07:33:53 +02:00
Michael Kerrisk 20e6e6ed79 mount_setattr.2: Clarify the description of "detached" mounts
From email:

>> Thanks. I made it "detached". Elsewhere, the page already explains
>> that a detached mount is one that:
>>
>>           must have been created by calling open_tree(2) with the
>>           OPEN_TREE_CLONE flag and it must not already have been
>>           visible in the filesystem.
>>
>> Which seems a fine explanation.
>>
>> ????
>> But, just a thought... "visible in the filesystem" seems not quite accurate.
>> What you really mean I guess is that it must not already have been
>> /visible in the filesystem hierarchy/previously mounted/something else/,
>> right?
I suppose that I should have clarified that my main problem was
that you were using the word "filesystem" in a way that I find
unconventional/ambiguous. I mean, I normally take the term
"filesystem" to be "a storage system for folding files".
Here, you are using "filesystem" to mean something else, what
I might call like "the single directory hierarchy" or "the
filesystem hierarchy" or "the list of mount points".

> A detached mount is created via the OPEN_TREE_CLONE flag. It is a
> separate new mount so "previously mounted" is not applicable.
> A detached mount is _related_ to what the MS_BIND flag gives you with
> mount(2). However, they differ conceptually and technically. A MS_BIND
> mount(2) is always visible in the fileystem when mount(2) returns, i.e.
> it is discoverable by regular path-lookup starting within the
> filesystem.
>
> However, a detached mount can be seen as a split of MS_BIND into two
> distinct steps:
> 1. fd_tree = open_tree(OPEN_TREE_CLONE): create a new mount
> 2. move_mount(fd_tree, <somewhere>):     attach the mount to the filesystem
>
> 1. and 2. together give you the equivalent of MS_BIND.
> In between 1. and 2. however the mount is detached. For the kernel
> "detached" means that an anonymous mount namespace is attached to it
> which doen't appear in proc and has a 0 sequence number (Technically,
> there's a bit of semantical argument to be made that "attached" and
> "detached" are ambiguous as they could also be taken to mean "does or
> does not have a parent mount". This ambiguity e.g. appears in
> do_move_mount(). That's why the kernel itself calls it an "anonymous
> mount". However, an OPEN_TREE_CLONE-detached mount of course doesn't
> have a parent mount so it works.).
>
> For userspace it's better to think of detached and attached in terms of
> visibility in the filesystem or in a mount namespace. That's more
> straightfoward, more relevant, and hits the target in 90% of the cases.
>
> However, the better and clearer picture is to say that a
> OPEN_TREE_CLONE-detached mount is a mount that has never been
> move_mount()ed. Which in turn can be defined as the detached mount has
> never been made visible in a mount namespace. Once that has happened the
> mount is irreversibly an attached mount.
>
> I keep thinking that maybe we should just say "anonymous mount"
> everywhere. So changing the wording to:
I'm not against the word "detached". To user space, I think it is a
little more meaningful than "anonymous". For the moment, I'll stay with
"detached", but if you insist on "anonymous", I'll probably change it.

> [...]
> EINVAL The mount that is to be ID mapped is not an anonymous mount;
> that is, the mount has already been visible in a mount namespace.
I like that text *a lot* better! Thanks very much for suggesting
wordings. It makes my life much easier.

I've made the text:

       EINVAL The mount that is to be ID mapped is not a detached
              mount; that is, the mount has not previously been
              visible in a mount namespace.

> [...]
> The mount must be an anonymous mount; that is, it must have been
> created by calling open_tree(2) with the OPEN_TREE_CLONE flag and it
> must not already have been visible in a mount namespace, i.e. it must
> not have been attached to the filesystem hierarchy with syscalls such
> as move_mount() syscall.
And that too! I've made the text:

       •  The mount must be a detached mount; that is, it must have
          been created by calling open_tree(2) with the
          OPEN_TREE_CLONE flag and it must not already have been
          visible in a mount namespace.  (To put things another way:
          the mount must not have been attached to the filesystem
          hierarchy with a system call such as move_mount(2).)

Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 07:33:53 +02:00
Michael Kerrisk 45ea537cf2 mount_setattr.2: EXAMPLES: use -1 rather than -EBADF
From email with Christian Braner:

> [1]: In this code "source" is expected to be absolute. If it's not
>      absolute we should fail. This can be achieved by passing -1/-EBADF,
>      afaict.
D'oh! Okay. I hadn't considered that use case for an invalid dirfd.
(And now I've done some adjustments to openat(2),which contains a
rationale for the *at() functions.)

So, now I understand your purpose, but still the code is obscure,
since

* You use a magic value (-EBADF) rather than (say) -1.
* There's no explanation (comment about) of the fact that you want
  to prevent relative pathnames.

So, I've changed the code to use -1, not -EBADF, and I've added some
comments to explain that the intent is to prevent relative pathnames.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 07:33:53 +02:00
Michael Kerrisk faf2534942 mount_namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 07:33:53 +02:00
Michael Kerrisk 717c3a7dcf fanotify_mark.2, futimesat.2, mount_setattr.2, statx.2, symlink.2, mkfifo.3: Refer the reader to openat(2) for explanation of why 'dirfd' is useful
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 3c39ce8598 fanotify_mark.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 0a5c96dbc4 open.2: Minor tweaks to list of functions that take a dirfd argument
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 401819295b scandir.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 6bd4cf741c mkfifo.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 9f4e736ad0 access.2, chmod.2, chown.2, execveat.2, futimesat.2, link.2, mkdir.2, mknod.2, mount_setattr.2, open.2, open_by_handle_at.2, readlink.2, rename.2, stat.2, statx.2, symlink.2, unlink.2, utimensat.2, mkfifo.3, scandir.3: Fix EBADF error description
Make the description of the EBADF error for invalid 'dirfd' more
uniform. In particular, note that the error only occurs when the
pathname is relative, and that it occurs when the 'dirfd' is
neither valid *nor* has the value AT_FDCWD.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 38a350061e fanotify_mark.2: ERRORS: add missing EBADF error for invalid 'dirfd'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 2b7b1f385e open_by_handle_at.2: ERRORS: add missing EBADF error for invalid 'dirfd'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 5a9ebeba72 mount_setattr.2: Rename 'path' to 'pathname'
For consistency with other pages

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 73434f4003 open.2: Explicitly describe the EBADF error that can occur with openat()
In particular, specifying an invalid file descriptor number
in 'dirfd' can be used as a check that 'pathname' is absolute.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
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
James O. D. Hunt 87ce949275 getopt.3: Further clarification of optstring
Explain that `optstring` cannot contain a semi-colon (`;`)
character.
[mtk: verified with a small test program; see also posix/getopt.c
in the glibc sources:

    if (temp == NULL || c == ':' || c == ';')
      {
        if (print_errors)
          fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c);
        d->optopt = c;
        return '?';
      }
]

Also explain that `optstring` can include `+` as an option
character, possibly in addition to that character being used as
the first character in `optstring` to denote `POSIXLY_CORRECT`
behaviour.
[mtk: verified with a small test program.]

Test program below. Example runs:

$ ./a.out -+
opt = 43 (+); optind = 2
Got plus
$ ./a.out -';'
./a.out: invalid option -- ';'
opt = 63 (?); optind = 2; optopt = 59 (;)
Unrecognized option (-;)
Usage: ./a.out [-p arg] [-x]

Signed-off-by: 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>

8x---8x---8x---8x---8x---8x---8x---8x---8x---8x---8x---
#include <ctype.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#define printable(ch) (isprint((unsigned char) ch) ? ch : '#')

static void             /* Print "usage" message and exit */
usageError(char *progName, char *msg, int opt)
{
    if (msg != NULL && opt != 0)
        fprintf(stderr, "%s (-%c)\n", msg, printable(opt));
    fprintf(stderr, "Usage: %s [-p arg] [-x]\n", progName);
    exit(EXIT_FAILURE);
}

int
main(int argc, char *argv[])
{
    int opt, xfnd;
    char *pstr;

    xfnd = 0;
    pstr = NULL;

    while ((opt = getopt(argc, argv, "p:x+;")) != -1) {
        printf("opt =%3d (%c); optind = %d", opt, printable(opt), optind);
        if (opt == '?' || opt == ':')
            printf("; optopt =%3d (%c)", optopt, printable(optopt));
        printf("\n");

        switch (opt) {
        case 'p': pstr = optarg;                break;
        case 'x': xfnd++;                       break;
        case ';': printf("Got semicolon\n");    break;
        case '+': printf("Got plus\n"); break;
        case ':': usageError(argv[0], "Missing argument", optopt);
        case '?': usageError(argv[0], "Unrecognized option", optopt);
        default:
                  printf("Unexpected case in switch()\n");
                  exit(EXIT_FAILURE);
        }
    }

    if (xfnd != 0)
        printf("-x was specified (count=%d)\n", xfnd);
    if (pstr != NULL)
        printf("-p was specified with the value \"%s\"\n", pstr);
    if (optind < argc)
        printf("First nonoption argument is \"%s\" at argv[%d]\n",
                argv[optind], optind);
    exit(EXIT_SUCCESS);
}
2021-08-09 02:32:37 +02:00
Alejandro Colomar 71a62d6c3c close_range.2: Glibc added a wrapper recently
Fixes: c2356ba085
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 c8219af767 ioctl_tty.2: Note kernel version that added TCGETS2, TCSETS2, TCSETSW2, and TCSETSF2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Michael Kerrisk 5d9f0bc6c5 ioctl_tty.2: Minor wording clean-ups
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Pali Rohár 572422a678 ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
Signed-off-by: Pali Rohár <pali@kernel.org>
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
Pali Rohár aad1f0e890 ioctl_tty.2: Document ioctls: TCGETS2, TCSETS2, TCSETSW2, TCSETSF2
Signed-off-by: Pali Rohár <pali@kernel.org>
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
Pali Rohár 95dedaa061 ioctl_tty.2: Update DTR example
Do not include unused (and incompatible) header file termios.h and
include required header files for puts() and close() functions.

Signed-off-by: Pali Rohár <pali@kernel.org>
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 d192b1c7b4 termios.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Pali Rohár 19ddd96b52 termios.3: SPARC architecture has 4 different Bnnn constants
SPARC is special, it does not have Bnnn constants for baud rates above
2000000. Instead it defines 4 Bnnn constants with smaller baud rates.

This difference between SPARC and non-SPARC architectures is present in
both glibc API (termios.h) and also kernel ioctl API (asm/termbits.h).

Signed-off-by: Pali Rohár <pali@kernel.org>
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
Alejandro Colomar a53fba5e42 termios.3: ffix
Format variable parts of words referring to a group of identifiers
in italics, following groff_man(7) recommendations.

Also srcfix surrounding uses of \f escape sequences to use macros

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
Pali Rohár 4e972a7c84 termios.3: Add information how to set baud rate to any other value
Signed-off-by: Pali Rohár <pali@kernel.org>
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
Pali Rohár 69452aadaf termios.3: Use bold style for Bnn and EXTn macro constants
Signed-off-by: Pali Rohár <pali@kernel.org>
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
Pali Rohár b9a8ee5a97 termios.3: Document missing baud-rate constants
These baud-rate macro constants are defined in bits/termios.h and are
already supported.

Signed-off-by: Pali Rohár <pali@kernel.org>
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
Štěpán Němec dbba2b268b unix.7: tfix
Signed-off-by: Štěpán Němec <stepnem@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
наб dc2c64be7a regex.3: wfix
"address of regcomp() initialized buffer" ->
"address of regcomp()-initialized buffer"

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
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
G. Branden Robinson c99dbb2776 man-pages.7: wfix
Saw this while preparing the "switch to \~" change Alex invited.

Signed-off-by: G. Branden Robinson <g.branden.robinson@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:36 +02:00
Michael Weiß 1b8089e1d1 namespaces.7: ffix
Signed-off-by: Michael Weiß <michael.weiss@aisec.fraunhofer.de>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:36 +02:00
Michael Kerrisk 9b94b63df5 readv.2, pipe.7: Make text on pipe writes more general to avoid a confusion in writev(2)
After a patch proposal from наб triggered by concerns that, when
talking about PIPE_BUF, pipe(7) explicitly mentions write(2) but
not writev(2), I've concluded that the reference in writev(2) to
pipe(7) is not needed (mea culpa; I added that text), and I think
the text in pipe(7) could be written to be closer to the POSIX
spec, which doesn't talk about "write() calls", but simply about
"writes".

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:36 +02:00
Michael Kerrisk bd62f2240b capabilities.7, user_namespaces.7: Minor tweaks (part 2) to Kir Kolyshkin's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 05:02:41 +02:00
Alejandro Colomar c83edb030c capabilities.7: Minor tweaks to Kir's patch
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 04:56:49 +02:00
Kir Kolyshkin 29c1f3cf96 capabilities.7, user_namespaces.7: Describe CAP_SETFCAP
mtk: The kernel commit message is quite enlihtening:

    commit db2e718a47984b9d71ed890eb2ea36ecf150de18
    Author: Serge E. Hallyn <serge@hallyn.com>
    Date:   Tue Apr 20 08:43:34 2021 -0500

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 04:50:12 +02:00
Michael Kerrisk 76dec7bbd4 readv.2: Minor fixes (part 2) to Will Manley's patch
Mainly: I generally don't want us to be including URLs to mailing
list discussions in a manual page. Either, the issue in the
discussion is worth writing up in the manual page (so that
the reader doesn't have to look elsewhere), or the details
are less important, in which case it is sufficient to note the
existence of the bug. I think this is an example of the latter.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 04:41:04 +02:00
Alejandro Colomar f09b616d07 readv.2: Minor tweaks to Will Manley's patch
Cc: Will Manley <will@williammanley.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 04:40:57 +02:00
Will Manley f2ec5c2b1a readv2: Note preadv2(..., RWF_NOWAIT) bug in BUGS section
To save the next person before they fall foul of it.  See
<https://lore.kernel.org/linux-fsdevel/fea8b16d-5a69-40f9-b123-e84dcd6e8f2e@www.fastmail.com/T/#u>
and <https://github.com/tokio-rs/tokio/issues/3803> for more information.

Signed-off-by: Will Manley <will@williammanley.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 04:29:03 +02:00
Michael Kerrisk ae5cc0dc57 vdso.7: Minor tweak to Alejandro Colomar's patch
The correct kernel version seems to 5.11, not 5.10:

$ git describe --contains d0e3fc69d00d
v5.11-rc1~76^2~251

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 04:22:49 +02:00
Alejandro Colomar 7a398162a8 vdso.7: Add y2038 compliant gettime for ppc/32
Christophe Leroy via Bugzilla:
https://bugzilla.kernel.org/show_bug.cgi?id=213421

[
In ppc32 functions section, the Y2038 compliant function
__kernel_clock_gettime64() is missing.

It was added by commit d0e3fc69d00d
("powerpc/vdso: Provide __kernel_clock_gettime64() on vdso32")
]

.../linux$ git describe d0e3fc69d00d
v5.10-rc2-76-gd0e3fc69d00d

Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 04:20:53 +02:00
Michael Kerrisk afaa08a481 strlen.3, wcslen.3: Recommend alternatives where input buffer might not be null-terminated
Reported-by: Jonny Grant <jg@jguk.org>
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 04:16:15 +02:00
Michael Kerrisk 21b8af1f3c execve.2: The pathname given to interpreter is not necessarily absolute
As pointed out by Nora, the example shown in the manual
page already demonstrates that the pathname is not absolute!

Reported-by: Nora Platiel <nplatiel@gmx.us>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 04:01:21 +02:00
Michael Kerrisk dc3037bf4d getauxval.3: SEE ALSO: add execve(2)
Since this page discusses program execution, a link to execve(2)
seems appropriate.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 03:58:01 +02:00
Michael Kerrisk 8a7dd01825 execve.2: SEE ALSO: getauxval(3)
getauxval(3) is useful background regarding execve(2).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 03:55:54 +02:00
Jakub Wilk 515fa99a9a seccomp_unotify.2: tfix
Remove duplicated word.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 03:13:31 +02:00
Michael Kerrisk 54ae7ac441 seccomp_unotify.2: Minor tweaks (part 2) to Rodrigo's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 03:12:43 +02:00
Alejandro Colomar 1cca69d3a7 seccomp_unotify.2: Minor tweaks to Rodrigo's patch
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 03:02:59 +02:00
Rodrigo Campos 3e2656812f seccomp_unotify.2: Document SECCOMP_ADDFD_FLAG_SEND
This flag was recently added to Linux 5.14 by a patch I wrote:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0ae71c7720e3ae3aabd2e8a072d27f7bd173d25c

This patch adds documentation for the flag, the error code that the flag
added and explains in the caveat when it is useful.

Signed-off-by: Rodrigo Campos <rodrigo@kinvolk.io>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 03:00:30 +02:00
Dan Robertson 6131983d24 man2/fallocate.2: tfix documentation of shared blocks
Fix a typo in the documentation of using fallocate to allocate shared
blocks. The flag FALLOC_FL_UNSHARE should instead be documented as
FALLOC_FL_UNSHARE_RANGE.

Fixes: 63a599c657 ("man2/fallocate.2: Document behavior with shared blocks")
Signed-off-by: Dan Robertson <dan@dlrobertson.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 02:53:50 +02:00
Alejandro Colomar 20c2c5ced3 posixoptions.7: Fix legacy functions list (s/getcwd/getwd/)
Alan:

[
The on-line copy of the manual page "posixoptions(7)" dated
2018-04-30 has an entry for "getcwd()" in the section headed
"XSI - _XOPEN_LEGACY - _SC_XOPEN_LEGACY".
I believe that entry should be "getwd()" as that is the API call
which was present in X/Open-6 but withdrawn in X/Open-7.
]

mtk: confirmed by reviewing the table ("Removed Functions and
Symbols in Issue 7") at the end of Section B.1.1 on page
3564 of IEEE Std 1003.1, 2016 Edition.

Reported-by: Alan Peakall <Alan.Peakall@helpsystems.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 02:50:05 +02:00
Michael Kerrisk f5dfd9a032 vdso.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 02:16:30 +02:00
Michael Kerrisk 5fc054ecd9 vdso.7: Update CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE info for powerpc
See https://bugzilla.kernel.org/show_bug.cgi?id=213419
ppc/32 and ppc/64 sections both have the following note:

    The CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE clocks are
    not supported by the __kernel_clock_getres and
    __kernel_clock_gettime interfaces; the kernel falls back to the
    real system call

This note has been wrong from quite some time now, since commit
654abc69ef2e ("powerpc/vdso32: Add support for
CLOCK_{REALTIME/MONOTONIC}_COARSE") and commit
5c929885f1bb ("powerpc/vdso64: Add support for
CLOCK_{REALTIME/MONOTONIC}_COARSE")

Reported-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 02:13:49 +02:00
Viet Than c9992ba76c time.2: wfix regarding year-2038
Signed-off-by: Viet Than <thanhoangviet@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:58:24 +02:00
Michael Kerrisk f95aa6f05b strstr.3: wfix
Remove text that is probably redundant.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:52:08 +02:00
Alejandro Colomar ec415ad970 strstr.3: Document special case for empty needle
Reported-by: Stefan Kanthak <stefan.kanthak@nexgo.de>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:50:20 +02:00
Štěpán Němec f05d7043fe namespaces.7: Fix confusion caused by text reorganization
Since commit ee81d7e418, the flags list has been (only) above, not
below, these references.

(The flags table was added even before that, in commit 0b497138b9
("namespaces.7: Add table of namespaces to top of page"))

Fixes: ee81d7e418 ("namespaces.7: Include manual page references in the summary table of namespace types")
Signed-off-by: Štěpán Němec <stepnem@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:47:59 +02:00
Michael Kerrisk 6b1817e09d printf.3: tfix
Reported-by: Sergey Petrakov <kr@spmail.info>
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:08:01 +02:00
Michael Kerrisk a42acb62df wait.2: Minor fixes to Richard Palethorpe's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:04:04 +02:00
Richard Palethorpe 136ae439fb wait.2: Add ESRCH for when pid == INT_MIN
Please see upstream commit:

 commit dd83c161fbcc5d8be637ab159c0de015cbff5ba4
 Author: zhongjiang <zhongjiang@huawei.com>
 Date:   Mon Jul 10 15:53:01 2017 -0700

     kernel/exit.c: avoid undefined behaviour when calling wait4()

It avoids negating INT_MIN by returning early with ESRCH.

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:02:32 +02:00
Jakub Wilk bd9aa1b762 proc.5: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:02:32 +02:00
Sagar Patel 85ac075357 tkill.2: tfix
Correct function signature by adding missing parenthesis.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:02:32 +02:00
Jakub Wilk 1d32ab01fc scripts/bash_aliases: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:02:32 +02:00
наб 33e2aa41ff ascii.7: ffix: add vertical rule to separate the two columns
I regularly get mildly lost in this table (and, indeed, didn't realise
it had two columns the first few times I used it to look at something
from the left column) ‒ separating the two columns improves clarity,
and makes which soup of numbers belongs to which character
much more obvious

Other encodings don't need this as they don't use double-columnated
tables

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:02:24 +02:00
kXuan 5612f82093 recv.2: tfix
The recv.2 misspelled `SO_EE_OFFENDER` to `SOCK_EE_OFFENDER`.

This patch fix this typo.

Signed-off-by: kXuan <kxuanobj@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-07 23:42:41 +02:00
Kir Kolyshkin 57fb49f9ae user_namespaces.7: Fix a reference to a kernel document
The file being referred to no longer exists, as it was moved to
*.rst first (commit 20a78ae9ed297f2) and then to under
admin-guide (commit bf6b7a742e3f82b). Both those commits
are from 2019 (Linux 5.3).

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-07 23:40:29 +02:00
Kir Kolyshkin 36e6250f14 capabilities.7: tfix
Add a missing comma.

Fixes: 3dcdef9437
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-07 23:39:02 +02:00
Štěpán Němec 2f05137b6a path_resolution.7: tfix
Signed-off-by: Štěpán Němec <stepnem@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-07 23:36:17 +02:00
Thomas Voss aa1f53ccf9 Various pages: Consistently use '*argv[]'
Scripted change:

$ find man? -type f \
  | sed -i 's/int argc, char \*\*argv/int argc, char \*argv\[\]/';

Signed-off-by: Thomas Voss <thomasavoss@protonmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-07 23:34:45 +02:00
Michael Kerrisk fbe71b1b79 ioctl_tty.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk 1d9a03e993 ioctl_tty.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk aceee9e827 ioctl_tty.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk 1af74b2a96 ioctl_tty.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk 025a34a66f ioctl_tty.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk 5f6ad97119 mmap.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk 9340c160e2 rmdir.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk c60f2657f1 shmop.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk f6b0b0eb6c rename.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk a45168bfb1 proc.5: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk 3de2205aa1 sync.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk 302df5d8a2 sysvipc.7: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk f8b45652ca hier.7: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk eeb1ae037f environ.7: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk 17a4cff3e4 crypt.3: ffix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk c1b81aa8dd console_codes.4: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk 81b2a338db unicode.7: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk 2d72d4897f uri.7: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:48 +02:00
Michael Kerrisk bffbd4d0e2 bzero.3: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-25 22:29:27 +02:00
Michael Kerrisk 444cf9b152 atanh.3: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-25 22:28:18 +02:00
Michael Kerrisk 067c60a72e pid_namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-25 22:26:35 +02:00
Michael Kerrisk a96c61dd3b perf_event_open.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-25 22:26:01 +02:00
Michael Kerrisk 0eadc752da chmod.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-25 22:25:30 +02:00
Michael Kerrisk 4438c392d8 bdflush.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-25 22:25:10 +02:00
Michael Kerrisk c2356ba085 close_range.2: Glibc 2.34 has added a close_range() wrapper
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-12 03:23:46 +02:00
Michael Kerrisk 001439834b ld.so.8: Document --list-tunables option added in glibc 2.33
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-05 09:33:57 +12:00
Michael Kerrisk 33248cfe50 Start of man-pages-5.13: updating Changes and Changes.old 2021-06-22 13:04:07 +12:00
Michael Kerrisk d49f2ba785 Start of man-pages-5.13: updating .Announce and .lsm files 2021-06-22 13:04:07 +12:00
Michael Kerrisk 8861087af1 Start of man-pages-5.13: renaming .Announce and .lsm files 2021-06-22 13:04:07 +12:00
Michael Kerrisk cf0eb47aaa Ready for 5.12 2021-06-22 12:58:31 +12:00
Michael Kerrisk d597316503 exit_group.2, ioprio_set.2, process_madvise.2, seccomp_unotify.2, set_mempolicy.2, set_tid_address.2, bswap.3, kernel_lockdown.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-22 12:58:31 +12:00
Michael Kerrisk a23b0c5a5c Changes: Ready for 5.12
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-22 12:58:31 +12:00
Michael Kerrisk 41343ba512 ioctl_fideduperange.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 17:22:04 +12:00
Michael Kerrisk c49a3b60d4 Changes: Change release location
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 15:56:16 +12:00
Michael Kerrisk 9593da4de3 mount.2: Minor fixes to Topi Miettinen's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 15:54:10 +12:00
Topi Miettinen a4173b878c mount.2: document SELinux use of MS_NOSUID mount flag
Using mount flag `MS_NOSUID` also affects SELinux domain transitions but
this has not been documented well.

Signed-off-by: Topi Miettinen <toiwoton@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 15:53:07 +12:00
Alejandro Colomar 0c292c5f93 strcmp.3: tfix
With a simple backslash, '\0' ended up as ' ' in the man output.

Reported-by: Štěpán Němec <stepnem@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 15:49:15 +12:00
thomasavoss 53de89a5fa ferror.3: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 15:49:10 +12:00
наб 8b97c4f875 getline.3: !*lineptr is sufficient
No implementation or spec requires *n to be 0 to allocate a new buffer:
  * musl checks for !*lineptr
    (and sets *n=0 for later allocations)
  * glibc checks for !*lineptr || !*n
    (but only because it allocates early)
  * NetBSD checks for !*lineptr
    (and sets *n=0 for later allocations)
    (but specifies *n => mlen(*lineptr) >= *n as a precondition,
     to which this appears to be an exception)
  * FreeBSD checks for !*lineptr and sets *n=0
    (and specifies !*lineptr as sufficient)
  * Lastly, POSIX.1-2017 specifies:
    > If *n is non-zero, the application shall ensure that *lineptr
    > either points to an object of size at least *n bytes,
    > or is a null pointer.

The new wording matches POSIX, even if it arrives at the point slightly
differently

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 15:49:02 +12:00
Alejandro Colomar e4728a8566 wait4.2: SYNOPSIS: Remove includes
Don't document includes that provide types; only those that
provide prototypes and constants.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar be26e6997a wait.2: Remove <sys/types.h>
The types that need <sys/types.h> are better documented in
system_data_types(7).  Let's keep only the includes for the
prototypes and the constants.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 3afef2975a vmsplice.2: Remove unneeded include
'struct iovec' is defined in <bits/types/struct_iovec.h>,
which is included by <sys/io.h>, but it is also included by
<bits/fcntl-linux.h>, which is in the end included by <fcntl.h>.
Given that we already include <fcntl.h>, we don't need any more
includes.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 96fd3196fa utimensat.2: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar f2683df9b0 utime.2: SYNOPSIS: Fix includes
'struct utimbuf' is provided by <utime.h>.
There's no need for <sys/types.h>.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar e1960e7e7e userfaultfd.2: Use syscall(SYS_...); for system calls without a wrapper; fix includes too
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 6aaa1bc40b userfaultfd.2: Remove unused includes
<sys/types.h> makes no sense for a function that only uses 'int'.
The flags used by this function are provided by <fcntl.h>
(or others), but not by <linux/userfaultfd.h>.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 75ec634383 unlink.2: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar a0df596de3 umask.2: Remove <sys/types.h>
'mode_t', which is the only reason this might have been ever
needed, is provided by <sys/stat.h> since POSIX.1-2001.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 321752842f truncate.2: Remove <sys/types.h>
'off_t', which is the only reason this might have been ever
needed, is provided by <unistd.h> since POSIX.1-2001.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar d96a43d419 tkill.2: Use syscall(SYS_...); for system calls without a wrapper; fix includes too
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 9a52fd2eec s390_sthyi.2: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 0183313510 s390_runtime_instr.2: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 1e0c5058c6 s390_guarded_storage.2: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar fb7e9f208d timer_create.2: SYNOPSIS: Document why more than one header is needed
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar e5a1738291 syslog.2: Use syscall(SYS_...); for raw system calls
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 635975d6c6 syscall.2: wfix + ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 010ed24fd6 symlink.2: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar c1f09e08b8 swapon.2: SYNOPSIS: Fix includes
There seems to be no reason to include <unistd.h>.
<sys/swap.h> already provides both the function prototypes and the
SWAP_* constants.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar c237072776 subpage_prot.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar c9f3f8494c statx.2: SYNOPSIS: Fix includes
<unistd.h> doesn't seem to be needed:
  AT_* constants come from <fcntl.h>
  STATX_* constants come from <sys/stat.h>
  'struct statx' comes from <sys/stat.h>

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar c8b91df19e stat.2: SYNOPSIS: Fix includes
Remove <sys/types.h>; ffix too

<sys/types.h> is only needed for 'struct stat'.
That is better documented in system_data_types(7).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 841f16a21e spu_run.2: Use syscall(SYS_...), for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 52b92a2ad7 pipe.2: SYNOPSIS: Fix incorrect prototype
A function declarator with empty parentheses, which is not a
prototype, is an obsolescent feature of C (See C17 6.11.6.1), and
doesn't mean 0 parameters, but instead that no information about
the parameters is provided (See C17 6.5.2.2).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 7b7831c24f spu_create.2: Use syscall(SYS_...), for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar bf3ed1d4f6 spu_create.2: Remove <sys/types.h>
It's only needed for getting 'mode_t'.
But that type is better documented in system_data_types(7).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 5945cd7bd3 seccomp.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Alejandro Colomar 292583e25b seccomp.2: Document why each header is needed
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Tyler Hicks <tyhicks@canonical.com>
Cc: Will Drewry <wad@chromium.org>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:43:43 +12:00
Michael Kerrisk aa111fa58e MIN.3: New link to MIN.3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:20:38 +12:00
Alejandro Colomar 5fa6eb2473 MAX.3: New page to document MAX() and MIN()
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 14:20:21 +12:00
Michael Kerrisk 911789ee76 seccomp_unotify.2: Add caveats regarding emulation of blocking system calls
Reported-by: Sargun Dhillon <sargun@sargun.me>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 1b5592f534 seccomp_unotify.2: Reformat ioctls as subsections rather than hanging list
Doing so decreases the degree to which text is indented, and
thus avoids short, poorly wrapped lines.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk d1c8db825a seccomp_unotify.2: Document the SECCOMP_IOCTL_NOTIF_ADDFD ioctl()
Starting from some notes by Sargun Dhillon.

Reported-by: Sargun Dhillon <sargun@sargun.me>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk c13b1b2bdd seccomp_unotify.2: EXAMPLES: simplify logic in getTargetPathname()
And reword some comments there.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk f8899e1c88 seccomp_unotify.2: EXAMPLES: fix a file descriptor leak
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 8760bd15a1 seccomp_unotify.2: EXAMPLES: some code modularity improvements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 8bae56c220 seccomp_unotify.2: Minor cleanup fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 40fdc84999 seccomp_unotify.2: Change name of SECCOMP_IOCTL_NOTIF_ID_VALID function
Give this function a shorter, slightly easier to read name.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk b4763b6e61 seccomp_unotify.2: Fixes after review comments from Christian Brauner
Reported-by: Christian Brauner <christian.brauner@canonical.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk a46a1879c5 seccomp_unotify.2: A cookie check is also required after reading target's memory
Quoting Jann Horn:

[[
As discussed at
<https://lore.kernel.org/r/CAG48ez0m4Y24ZBZCh+Tf4ORMm9_q4n7VOzpGjwGF7_Fe8EQH=Q@mail.gmail.com>,
we need to re-check checkNotificationIdIsValid() after reading remote
memory but before using the read value in any way. Otherwise, the
syscall could in the meantime get interrupted by a signal handler, the
signal handler could return, and then the function that performed the
syscall could free() allocations or return (thereby freeing buffers on
the stack).

In essence, this pread() is (unavoidably) a potential use-after-free
read; and to make that not have any security impact, we need to check
whether UAF read occurred before using the read value. This should
probably be called out elsewhere in the manpage, too...

Now, of course, **reading** is the easy case. The difficult case is if
we have to **write** to the remote process... because then we can't
play games like that. If we write data to a freed pointer, we're
screwed, that's it. (And for somewhat unrelated bonus fun, consider
that /proc/$pid/mem is originally intended for process debugging,
including installing breakpoints, and will therefore happily write
over "readonly" private mappings, such as typical mappings of
executable code.)

So, uuuuh... I guess if anyone wants to actually write memory back to
the target process, we'd better come up with some dedicated API for
that, using an ioctl on the seccomp fd that magically freezes the
target process inside the syscall while writing to its memory, or
something like that? And until then, the manpage should have a big fat
warning that writing to the target's memory is simply not possible
(safely).
]]

and
<https://lore.kernel.org/r/CAG48ez0m4Y24ZBZCh+Tf4ORMm9_q4n7VOzpGjwGF7_Fe8EQH=Q@mail.gmail.com>:

[[
The second bit of trouble is that if the supervisor is so oblivious
that it doesn't realize that syscalls can be interrupted, it'll run
into other problems. Let's say the target process does something like
this:

int func(void) {
  char pathbuf[4096];
  sprintf(pathbuf, "/tmp/blah.%d", some_number);
  mount("foo", pathbuf, ...);
}

and mount() is handled with a notification. If the supervisor just
reads the path string and immediately passes it into the real mount()
syscall, something like this can happen:

target: starts mount()
target: receives signal, aborts mount()
target: runs signal handler, returns from signal handler
target: returns out of func()
supervisor: receives notification
supervisor: reads path from remote buffer
supervisor: calls mount()

but because the stack allocation has already been freed by the time
the supervisor reads it, the supervisor just reads random garbage, and
beautiful fireworks ensue.

So the supervisor *fundamentally* has to be written to expect that at
*any* time, the target can abandon a syscall. And every read of remote
memory has to be separated from uses of that remote memory by a
notification ID recheck.

And at that point, I think it's reasonable to expect the supervisor to
also be able to handle that a syscall can be aborted before the
notification is delivered.
]]

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 8742c19c9f seccomp_unotify.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 589a15959f seccomp_unotify.2: EXAMPLES: make SECCOMP_IOCTL_NOTIF_ID_VALID function return bool
- Rename the function that does the SECCOMP_IOCTL_NOTIF_ID_VALID
  check.
- Make that function return a 'bool' rather than terminating the
  process.
- Use that return value in the calling function.
- Rework/improve various related comments.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 6f0ca7da71 seccomp_unotify.2: EXAMPLES: Improve comments describing checkNotificationIdIsValid()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 8a7703864c seccomp_unotify.2: EXAMPLES: make getTargetPathname() a bit more generically useful
Allow the caller to specify which system call argument should
be looked up as a pathname.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk dbcc2ad691 seccomp_unotify.2: SEE ALSO: add pidfd_open(2) and pidfd_getfd(2)
pidfd_open(2) and pidfd_getfd(2) presumably have use cases
with the user-space notification feature.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 9688ea78cb seccomp_unotify.2: NOTES: describe an example use-case
The container manager use case was the original motivation
for this feature.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk b8360d3701 seccomp_unotify.2: Remove FIXME asking about usefulness of POLLOUT/EPOLLOUT
According to Tycho Andersen, he had no particular use case
in mind when building this detail into the API.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk b183b6503c seccomp_unotify.2: srcfix: Add a further FIXME relating to SA_RESTART behavior
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 191350e602 seccomp_unotify.2: Various fixes after review comments from Kees Cook
Reported-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 16ba7af469 seccomp_unotify.2: Update a FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 7a27538327 cmsg.3, unix.7: Refer to seccomp_unotify(2) for an example of SCM_RIGHTS usage
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 730a8d48d1 signal.7: Add reference to seccomp_unotify(2)
The seccomp user-space notification feature can cause changes in
the semantics of SA_RESTART with respect to system calls that
would never normally be restarted. Point the reader to the page
that provide further details.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk fd1295e8f1 seccomp_unotify.2: Describe the interaction with SA_RESTART signal handlers
And, as noted by Jann Horn, note how the user-space notification
mechanism causes a small breakage in the user-space API with
respect to nonrestartable system calls.

====

From the email discussion with Jann Horn

> >> So, I partially demonstrated what you describe here, for two example
> >> system calls (epoll_wait() and pause()). But I could not exactly
> >> demonstrate things as I understand you to be describing them. (So,
> >> I'm not sure whether I have not understood you correctly, or
> >> if things are not exactly as you describe them.)
> >>
> >> Here's a scenario (A) that I tested:
> >>
> >> 1. Target installs seccomp filters for a blocking syscall
> >>    (epoll_wait() or pause(), both of which should never restart,
> >>    regardless of SA_RESTART)
> >> 2. Target installs SIGINT handler with SA_RESTART
> >> 3. Supervisor is sleeping (i.e., is not blocked in
> >>    SECCOMP_IOCTL_NOTIF_RECV operation).
> >> 4. Target makes a blocking system call (epoll_wait() or pause()).
> >> 5. SIGINT gets delivered to target; handler gets called;
> >>    ***and syscall gets restarted by the kernel***
> >>
> >> That last should never happen, of course, and is a result of the
> >> combination of both the user-notify filter and the SA_RESTART flag.
> >> If one or other is not present, then the system call is not
> >> restarted.
> >>
> >> So, as you note below, the UAPI gets broken a little.
> >>
> >> However, from your description above I had understood that
> >> something like the following scenario (B) could occur:
> >>
> >> 1. Target installs seccomp filters for a blocking syscall
> >>    (epoll_wait() or pause(), both of which should never restart,
> >>    regardless of SA_RESTART)
> >> 2. Target installs SIGINT handler with SA_RESTART
> >> 3. Supervisor performs SECCOMP_IOCTL_NOTIF_RECV operation (which
> >>    blocks).
> >> 4. Target makes a blocking system call (epoll_wait() or pause()).
> >> 5. Supervisor gets seccomp user-space notification (i.e.,
> >>    SECCOMP_IOCTL_NOTIF_RECV ioctl() returns
> >> 6. SIGINT gets delivered to target; handler gets called;
> >>    and syscall gets restarted by the kernel
> >> 7. Supervisor performs another SECCOMP_IOCTL_NOTIF_RECV operation
> >>    which gets another notification for the restarted system call.
> >>
> >> However, I don't observe such behavior. In step 6, the syscall
> >> does not get restarted by the kernel, but instead returns -1/EINTR.
> >> Perhaps I have misconstructed my experiment in the second case, or
> >> perhaps I've misunderstood what you meant, or is it possibly the
> >> case that things are not quite as you said?
>
> Thanks for the code, Jann (including the demo of the CLONE_FILES
> technique to pass the notification FD to the supervisor).
>
> But I think your code just demonstrates what I described in
> scenario A. So, it seems that I both understood what you
> meant (because my code demonstrates the same thing) and
> also misunderstood what you said (because I thought you
> were meaning something more like scenario B).

Ahh, sorry, I should've read your mail more carefully. Indeed, that
testcase only shows scenario A. But the following shows scenario B...

[Below, two pieces of code from Jann, with a lot of
cosmetic changes by mtk.]

====

[And from a follow-up in the same email thread:]

> If userspace relies on non-restarting behavior, it should be using
> something like epoll_pwait(). And that stuff only unblocks signals
> after we've already past the seccomp checks on entry.
Thanks for elaborating that detail, since as soon as you talked
about "enlarging a preexisting race" above, I immediately wondered
sigsuspend(), pselect(), etc.

(Mind you, I still wonder about the effect on system calls that
are normally nonrestartable because they have timeouts. My
understanding is that the kernel doesn't restart those system
calls because it's impossible for the kernel to restart the call
with the right timeout value. I wonder what happens when those
system calls are restarted in the scenario we're discussing.)

Anyway, returning to your point... So, to be clear (and to
quickly remind myself in case I one day reread this thread),
there is not a problem with sigsuspend(), pselect(), ppoll(),
and epoll_pwait() since:

* Before the syscall, signals are blocked in the target.
* Inside the syscall, signals are still blocked at the time
  the check is made for seccomp filters.
* If a seccomp user-space notification  event kicks, the target
  is put to sleep with the signals still blocked.
* The signal will only get delivered after the supervisor either
  triggers a spoofed success/failure return in the target or the
  supervisor sends a CONTINUE response to the kernel telling it
  to execute the target's system call. Either way, there won't be
  any restarting of the target's system call (and the supervisor
  thus won't see multiple notifications).

====

Scenario A

$ ./seccomp_unotify_restart_scen_A
C: installed seccomp: fd 3
C: woke 1 waiters
	P: child installed seccomp fd 3
C: About to call pause(): Success
	P: going to send SIGUSR1...
C: sigusr1_handler handler invoked
	P: about to terminate
C: got pdeath signal on parent termination
C: about to terminate

/* Modified version of code from Jann Horn */

#define _GNU_SOURCE
#include <stdio.h>
#include <signal.h>
#include <err.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sched.h>
#include <stddef.h>
#include <limits.h>
#include <sys/mman.h>
#include <sys/syscall.h>
#include <sys/prctl.h>
#include <linux/seccomp.h>
#include <linux/filter.h>
#include <linux/futex.h>

struct {
    int seccomp_fd;
} *shared;

static void
sigusr1_handler(int sig, siginfo_t * info, void *uctx)
{
    printf("C: sigusr1_handler handler invoked\n");
}

static void
sigusr2_handler(int sig, siginfo_t * info, void *uctx)
{
    printf("C: got pdeath signal on parent termination\n");
    printf("C: about to terminate\n");
    exit(0);
}

int
main(void)
{
    setbuf(stdout, NULL);

    /* Allocate memory that will be shared by parent and child */

    shared = mmap(NULL, 0x1000, PROT_READ | PROT_WRITE,
                  MAP_ANONYMOUS | MAP_SHARED, -1, 0);
    if (shared == MAP_FAILED)
        err(1, "mmap");
    shared->seccomp_fd = -1;

    /* glibc's clone() wrapper doesn't support fork()-style usage */
    /* Child process and parent share file descriptor table */

    pid_t child = syscall(__NR_clone, CLONE_FILES | SIGCHLD,
                          NULL, NULL, NULL, 0);
    if (child == -1)
        err(1, "clone");

    /* CHILD */

    if (child == 0) {
        /* don't outlive the parent */
        prctl(PR_SET_PDEATHSIG, SIGUSR2);

        if (getppid() == 1)
            exit(0);

        /* Install seccomp filter */

        prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
        struct sock_filter insns[] = {
            BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
                     offsetof(struct seccomp_data, nr)),
            BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_pause, 0, 1),
            BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_USER_NOTIF),
            BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW)
        };
        struct sock_fprog prog = {
            .len = sizeof(insns) / sizeof(insns[0]),
            .filter = insns
        };
        int seccomp_ret = syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER,
                                  SECCOMP_FILTER_FLAG_NEW_LISTENER, &prog);
        if (seccomp_ret < 0)
            err(1, "install");
        printf("C: installed seccomp: fd %d\n", seccomp_ret);

        /* Place the notifier FD number into the shared memory */

        __atomic_store(&shared->seccomp_fd, &seccomp_ret,
                       __ATOMIC_RELEASE);

        /* Wake the parent */

        int futex_ret =
            syscall(__NR_futex, &shared->seccomp_fd, FUTEX_WAKE,
                    INT_MAX, NULL, NULL, 0);
        printf("C: woke %d waiters\n", futex_ret);

        /* Establish SA_RESTART handler for SIGUSR1 */

        struct sigaction act = {
            .sa_sigaction = sigusr1_handler,
            .sa_flags = SA_RESTART | SA_SIGINFO
        };
        if (sigaction(SIGUSR1, &act, NULL))
            err(1, "sigaction");

        struct sigaction act2 = {
            .sa_sigaction = sigusr2_handler,
            .sa_flags = 0
        };
        if (sigaction(SIGUSR2, &act2, NULL))
            err(1, "sigaction");

        /* Make a blocking system call */

        perror("C: About to call pause()");
        pause();
        perror("C: pause returned");

        exit(0);
    }

    /* PARENT */

    /* Wait for futex wake-up from child */

    int futex_ret = syscall(__NR_futex, &shared->seccomp_fd, FUTEX_WAIT,
                            -1, NULL, NULL, 0);
    if (futex_ret == -1 && errno != EAGAIN)
        err(1, "futex wait");

    /* Get notification FD from the child */

    int fd = __atomic_load_n(&shared->seccomp_fd, __ATOMIC_ACQUIRE);
    printf("\tP: child installed seccomp fd %d\n", fd);

    sleep(1);

    printf("\tP: going to send SIGUSR1...\n");
    kill(child, SIGUSR1);

    sleep(1);
    printf("\tP: about to terminate\n");

    exit(0);
}

====

Scenario B

$ ./seccomp_unotify_restart_scen_B
C: installed seccomp: fd 3
C: woke 1 waiters
C: About to call pause()
	P: child installed seccomp fd 3
	P: about to SECCOMP_IOCTL_NOTIF_RECV
	P: got notif: id=17773741941218455591 pid=25052 nr=34
	P: about to send SIGUSR1 to child...
	P: about to SECCOMP_IOCTL_NOTIF_RECV
C: sigusr1_handler handler invoked
	P: got notif: id=17773741941218455592 pid=25052 nr=34
	P: about to send SIGUSR1 to child...
	P: about to SECCOMP_IOCTL_NOTIF_RECV
C: sigusr1_handler handler invoked
	P: got notif: id=17773741941218455593 pid=25052 nr=34
	P: about to send SIGUSR1 to child...
	P: about to SECCOMP_IOCTL_NOTIF_RECV
C: sigusr1_handler handler invoked
	P: got notif: id=17773741941218455594 pid=25052 nr=34
	P: about to send SIGUSR1 to child...
C: sigusr1_handler handler invoked
C: got pdeath signal on parent termination
C: about to terminate

/* Modified version of code from Jann Horn */

#define _GNU_SOURCE
#include <stdio.h>
#include <signal.h>
#include <err.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#include <sched.h>
#include <stddef.h>
#include <string.h>
#include <limits.h>
#include <inttypes.h>
#include <sys/mman.h>
#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <sys/prctl.h>
#include <linux/seccomp.h>
#include <linux/filter.h>
#include <linux/futex.h>

struct {
    int seccomp_fd;
} *shared;

static void
sigusr1_handler(int sig, siginfo_t * info, void *uctx)
{
    printf("C: sigusr1_handler handler invoked\n");
}

static void
sigusr2_handler(int sig, siginfo_t * info, void *uctx)
{
    printf("C: got pdeath signal on parent termination\n");
    printf("C: about to terminate\n");
    exit(0);
}

static size_t
max_size(size_t a, size_t b)
{
    return (a > b) ? a : b;
}

int
main(void)
{
    setbuf(stdout, NULL);

    /* Allocate memory that will be shared by parent and child */

    shared = mmap(NULL, 0x1000, PROT_READ | PROT_WRITE,
                  MAP_ANONYMOUS | MAP_SHARED, -1, 0);
    if (shared == MAP_FAILED)
        err(1, "mmap");
    shared->seccomp_fd = -1;

    /* glibc's clone() wrapper doesn't support fork()-style usage */
    /* Child process and parent share file descriptor table */
    pid_t child = syscall(__NR_clone, CLONE_FILES | SIGCHLD,
                          NULL, NULL, NULL, 0);
    if (child == -1)
        err(1, "clone");

    /* CHILD */

    if (child == 0) {
        /* don't outlive the parent */
        prctl(PR_SET_PDEATHSIG, SIGUSR2);
        if (getppid() == 1)
            exit(0);

        /* Install seccomp filter */

        prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0);
        struct sock_filter insns[] = {
            BPF_STMT(BPF_LD | BPF_W | BPF_ABS,
                     offsetof(struct seccomp_data, nr)),
            BPF_JUMP(BPF_JMP | BPF_JEQ | BPF_K, __NR_pause, 0, 1),
            BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_USER_NOTIF),
            BPF_STMT(BPF_RET | BPF_K, SECCOMP_RET_ALLOW)
        };
        struct sock_fprog prog = {
            .len = sizeof(insns) / sizeof(insns[0]),
            .filter = insns
        };
        int seccomp_ret = syscall(__NR_seccomp, SECCOMP_SET_MODE_FILTER,
                                  SECCOMP_FILTER_FLAG_NEW_LISTENER, &prog);
        if (seccomp_ret < 0)
            err(1, "install");
        printf("C: installed seccomp: fd %d\n", seccomp_ret);

        /* Place the notifier FD number into the shared memory */

        __atomic_store(&shared->seccomp_fd, &seccomp_ret,
                       __ATOMIC_RELEASE);

        /* Wake the parent */

        int futex_ret =
            syscall(__NR_futex, &shared->seccomp_fd, FUTEX_WAKE,
                    INT_MAX, NULL, NULL, 0);
        printf("C: woke %d waiters\n", futex_ret);

        /* Establish SA_RESTART handler for SIGUSR1 */

        struct sigaction act = {
            .sa_sigaction = sigusr1_handler,
            .sa_flags = SA_RESTART | SA_SIGINFO
        };
        if (sigaction(SIGUSR1, &act, NULL))
            err(1, "sigaction");

        struct sigaction act2 = {
            .sa_sigaction = sigusr2_handler,
            .sa_flags = 0
        };
        if (sigaction(SIGUSR2, &act2, NULL))
            err(1, "sigaction");

        /* Make a blocking system call */

        printf("C: About to call pause()\n");
        pause();
        perror("C: pause returned");

        exit(0);
    }

    /* PARENT */

    /* Wait for futex wake-up from child */

    int futex_ret = syscall(__NR_futex, &shared->seccomp_fd, FUTEX_WAIT,
                            -1, NULL, NULL, 0);
    if (futex_ret == -1 && errno != EAGAIN)
        err(1, "futex wait");

    /* Get notification FD from the child */

    int fd = __atomic_load_n(&shared->seccomp_fd, __ATOMIC_ACQUIRE);
    printf("\tP: child installed seccomp fd %d\n", fd);

    /* Discover seccomp buffer sizes and allocate notification buffer */

    struct seccomp_notif_sizes sizes;
    if (syscall(__NR_seccomp, SECCOMP_GET_NOTIF_SIZES, 0, &sizes))
        err(1, "notif_sizes");
    struct seccomp_notif *notif =
        malloc(max_size(sizeof(struct seccomp_notif),
                        sizes.seccomp_notif));
    if (!notif)
        err(1, "malloc");

    for (int i = 0; i < 4; i++) {
        printf("\tP: about to SECCOMP_IOCTL_NOTIF_RECV\n");
        memset(notif, '\0', sizes.seccomp_notif);
        if (ioctl(fd, SECCOMP_IOCTL_NOTIF_RECV, notif))
            err(1, "notif_recv");
        printf("\tP: got notif: id=%llu pid=%u nr=%d\n",
               notif->id, notif->pid, notif->data.nr);
        sleep(1);
        printf("\tP: about to send SIGUSR1 to child...\n");
        kill(child, SIGUSR1);
    }
    sleep(1);

    exit(0);
}

====

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 1661264841 seccomp_unotify.2: EXAMPLE: correct the check for NUL in buffer returned by read()
In the usual case, read(fd, buf, PATH_MAX) will return PATH_MAX
bytes that include trailing garbage after the pathname. So the
right check is to scan from the start of the buffer to see if
there's a NUL, and error if there is not.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk d1774d6af8 seccomp_unotify.2: Better handling of invalid target pathname
After some discussions with Jann Horn, perhaps a better way of
dealing with an invalid target pathname is to trigger an
error for the system call.

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 47056412d7 seccomp_unotify.2: EXAMPLE: rename a variable
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 2f37aeb620 seccomp_unotify.2: EXAMPLE: Improve allocation of response buffer
From a conversation with Jann Horn:

[[
>>>>            struct seccomp_notif_resp *resp = malloc(sizes.seccomp_notif_resp);
>>>
>>> This should probably do something like max(sizes.seccomp_notif_resp,
>>> sizeof(struct seccomp_notif_resp)) in case the program was built
>>> against new UAPI headers that make struct seccomp_notif_resp big, but
>>> is running under an old kernel where that struct is still smaller?
>>
>> I'm confused. Why? I mean, if the running kernel says that it expects
>> a buffer of a certain size, and we allocate a buffer of that size,
>> what's the problem?
>
> Because in userspace, we cast the result of malloc() to a "struct
> seccomp_notif_resp *". If the kernel tells us that it expects a size
> smaller than sizeof(struct seccomp_notif_resp), then we end up with a
> pointer to a struct that consists partly of allocated memory, partly
> of out-of-bounds memory, which is generally a bad idea - I'm not sure
> whether the C standard permits that. And if userspace then e.g.
> decides to access some member of that struct that is beyond what the
> kernel thinks is the struct size, we get actual OOB memory accesses.
Got it. (But gosh, this seems like a fragile API mess.)

I added the following to the code:

    /* When allocating the response buffer, we must allow for the fact
       that the user-space binary may have been built with user-space
       headers where 'struct seccomp_notif_resp' is bigger than the
       response buffer expected by the (older) kernel. Therefore, we
       allocate a buffer that is the maximum of the two sizes. This
       ensures that if the supervisor places bytes into the response
       structure that are past the response size that the kernel expects,
       then the supervisor is not touching an invalid memory location. */

    size_t resp_size = sizes.seccomp_notif_resp;
    if (sizeof(struct seccomp_notif_resp) > resp_size)
        resp_size = sizeof(struct seccomp_notif_resp);

    struct seccomp_notif_resp *resp = malloc(resp_size);
]]

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk bf892a6527 seccomp_unotify.2: EXAMPLE: ensure path read() by the supervisor is null-terminated
From a conversation with Jann Horn:

    >> We should probably make sure here that the value we read is actually
    >> NUL-terminated?
    >
    > So, I was curious about that point also. But, (why) are we not
    > guaranteed that it will be NUL-terminated?

    Because it's random memory filled by another process, which we don't
    necessarily trust. While seccomp notifiers aren't usable for applying
    *extra* security restrictions, the supervisor will still often be more
    privileged than the supervised process.

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk e4db7ae69d seccomp_unotify.2: wfix in example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 5c12cebdf2 seccomp_unotify.2: Small wording fix
Change "read(2) will return 0" to "read(2) may return 0".

Quoting Jann Horn:

    Maybe make that "may return 0" instead of "will return 0" -
    reading from /proc/$pid/mem can only return 0 in the
    following cases AFAICS:

    1. task->mm was already gone at open() time
    2. mm->mm_users has dropped to zero (the mm only has lazytlb
       users; page tables and VMAs are being blown away or have
       been blown away)
    3. the syscall was called with length 0

    When a process has gone away, normally mm->mm_users will
    drop to zero, but someone else could theoretically still be
    holding a reference to the mm (e.g. someone else in the
    middle of accessing /proc/$pid/mem).  (Such references
    should normally not be very long-lived though.)

    Additionally, in the unlikely case that the OOM killer just
    chomped through the page tables of the target process, I
    think the read will return -EIO (same error as if the
    address was simply unmapped) if the address is within a
    non-shared mapping. (Maybe that's something procfs could do
    better...)

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk e06808b4b1 seccomp_unotify.2: Minor wording change + add a FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk bcfeed7d4e seccomp_unotify.2: User-space notification can't be used to implement security policy
Add some strongly worded text warning the reader about the correct
uses of seccomp user-space notification.

Reported-by: Jann Horn <jannh@google.com>
Cowritten-by: Christian Brauner <christian@brauner.io>
Cowritten-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 03e4237409 seccomp_unotify.2: Fixes after review comments from Christian Brauner
Reported-by: Christian Brauner <christian@brauner.io>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk fd376c6b2a seccomp.2, seccomp_unotify.2: Clarify that there can be only one SECCOMP_FILTER_FLAG_NEW_LISTENER
Reported-by: Christian Brauner <christian@brauner.io>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk cd3224b7df seccomp_unotify.2: Note when FD indicates EOF/(E)POLLHUP in (e)poll/select
Verified by experiment.

Reported-by: Christian Brauner <christian.brauner@canonical.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 6048506c77 seccomp_unotify.2: Note when notification FD indicates as writable by select/poll/epoll
Reported-by: Tycho Andersen <tycho@tycho.pizza>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk ea4d03e6b0 seccomp_unotify.2: Minor fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk a08715b41e seccomp_unotify.2: Fixes after review comments by Jann Horn
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk d85217eff7 seccomp_unotify.2: Add BUGS section describing SECCOMP_IOCTL_NOTIF_RECV bug
Tycho Andersen confirmed that this issue is present.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 72a8602617 seccomp_unotify.2: srcfix: remove bogus FIXME
Pathname arguments are limited to PATH_MAX bytes.

Reported-by: Tycho Andersen <tycho@tycho.pizza>
Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 391194cd52 seccomp_unotify.2: Changes after feed back from Tycho Andersen
Reported-by: Tycho Andersen <tycho@tycho.pizza>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk a9a8e35644 seccomp_unotify.2: Document the seccomp user-space notification mechanism
The APIs used by this mechanism comprise not only seccomp(2), but
also a number of ioctl(2) operations. And any useful example
demonstrating these APIs is will necessarily be rather long.
Trying to cram all of this into the seccomp(2) page would make
that page unmanageably long. Therefore, let's document this
mechanism in a separate page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 0a86ac9c9b seccomp.2: Note that SECCOMP_RET_USER_NOTIF can be overridden
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 8459e46597 seccomp.2: wfix: mention term "supervisor" in description of SECCOMP_RET_USER_NOTIF
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 1741f7fc2e seccomp.2: SEE ALSO: add seccomp_unotify(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk 2bbe9bd9ae seccomp.2: Rework SECCOMP_GET_NOTIF_SIZES somewhat
The existing text says the structures (plural!) contain a 'struct
seccomp_data'. But this is only true for the received notification
structure (seccomp_notif). So, reword the sentence to be more
general, noting simply that the structures may evolve over time.

Add some comments to the structure definition.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk b723c6d8dd seccomp.2: Add some details for SECCOMP_FILTER_FLAG_NEW_LISTENER
Rework the description a little, and note that the close-on-exec
flag is set for the returned file descriptor.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:17 +12:00
Michael Kerrisk d7a3918456 seccomp.2: Minor edits to Tycho's SECCOMP_FILTER_FLAG_NEW_LISTENER patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:16 +12:00
Tycho Andersen b9395f4a3e seccomp.2: Document SECCOMP_FILTER_FLAG_NEW_LISTENER
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:16 +12:00
Michael Kerrisk 8fa47f3ae4 seccomp.2: Reorder list of SECCOMP_SET_MODE_FILTER flags alphabetically
(No content changes.)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:16 +12:00
Michael Kerrisk 3bed246e7e seccomp.2: Some reworking of Tycho's SECCOMP_RET_USER_NOTIF patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:16 +12:00
Tycho Andersen c734bbd265 seccomp.2: Document SECCOMP_RET_USER_NOTIF
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:16 +12:00
Michael Kerrisk 6fc8b8a0a1 seccomp.2: Minor edits to Tycho Andersen's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:16 +12:00
Tycho Andersen 9bc48145a6 seccomp.2: Document SECCOMP_GET_NOTIF_SIZES
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
CC: Kees Cook <keescook@chromium.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:40:16 +12:00
Michael Kerrisk 408483bd31 socketcall.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar b6687e3971 socketcall.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar 1b4d275a0e sigprocmask.2: Use syscall(SYS_...); for raw system calls
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar aa03a4e732 shmop.2: Remove unused include
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar 1cd36d9dea sgetmask.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar 18e21e1e4c set_tid_address.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar ba4d34a16d set_thread_area.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar 9202a1eb8e rt_sigqueueinfo.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar 5e9623f3b9 open.2: Remove unused <sys/stat.h>
I can't see a reason to include it.  <fcntl.h> provides O_*
constants for 'flags', S_* constants for 'mode', and mode_t.

Probably a long time ago, some of those weren't defined in
<fcntl.h>, and both headers needed to be included, or maybe it's
a historical error.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Michael Kerrisk 0ba6b2966c system_data_types.7: Minor enhancement of description of mode_t
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar 0ace616cf8 mode_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar e0b6220511 system_data_types.7: Add 'mode_t'
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar 6c2508dc6f blksize_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar 111ad1edd5 system_data_types.7: Add 'blksize_t'
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar acb5994605 cc_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar f71cb14dcb system_data_types.7: Add 'cc_t'
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar d9e9879139 blkcnt_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
Alejandro Colomar 8d1df7f260 system_data_types.7: Add 'blkcnt_t'
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:46 +12:00
dann frazier 9d39058523 kernel_lockdown.7: Remove additional text alluding to lifting via SysRq
My previous patch intended to drop the docs for the lockdown lift
SysRq, but it missed this other section that refers to lifting it
via a keyboard - an allusion to that same SysRq.

Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:37:17 +12:00
dann frazier a989677777 kernel_lockdown.7: Remove description of lifting via SysRq (not upstream)
The patch that implemented lockdown lifting via SysRq ended up
getting dropped[*] before the feature was merged upstream. Having
the feature documented but unsupported has caused some confusion
for our users.

[*] http://archive.lwn.net:8080/linux-kernel/CACdnJuuxAM06TcnczOA6NwxhnmQUeqqm3Ma8btukZpuCS+dOqg@mail.gmail.com/

Signed-off-by: dann frazier <dann.frazier@canonical.com>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>
Cc: David Howells <dhowells@redhat.com>
Cc: Pedro Principeza <pedro.principeza@canonical.com>
Cc: Randy Dunlap <rdunlap@infradead.org>
Cc: Kyle McMartin <kyle@redhat.com>
Cc: Matthew Garrett <mjg59@google.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:33:07 +12:00
Alejandro Colomar 336ae0d258 Makefile, README: Break installation into a target for each mandir
Instead of having a monolithic 'make install', break it into
multiple targets such as 'make install-man3'.  This simplifies
packaging, for example in Debian, where they break this project
into several packages: 'manpages' and 'manpages-dev', each
containing different mandirs.

The above allows for multithread installation: 'make -j'

Also, don't overwrite files that don't need to be overwritten, by
having a target for files, which makes use of make's timestamp
comparison.

This allows for much faster installation times.

For comparison, on my laptop (i7-8850H; 6C/12T):

Old Makefile:
	~/src/linux/man-pages$ time sudo make >/dev/null

	real	0m7.509s
	user	0m5.269s
	sys	0m2.614s

	The times with the old makefile, varied a lot, between
	5 and 10 seconds.  The times after applying this patch
	are much more consistent.  BTW, I compared these times to
	the very old Makefile of man-pages-5-09, and those were
	around 3.5 s, so it was a bit of my fault to have such a
	slow Makefile, when I changed the Makefile some weeks ago.

New Makefile (full clean install):
	~/src/linux/man-pages$ time sudo make >/dev/null

	real	0m5.160s
	user	0m4.326s
	sys	0m1.137s
	~/src/linux/man-pages$ time sudo make -j2 >/dev/null

	real	0m1.602s
	user	0m2.529s
	sys	0m0.289s
	~/src/linux/man-pages$ time sudo make -j >/dev/null

	real	0m1.398s
	user	0m2.502s
	sys	0m0.281s

	Here we can see that 'make -j' drops times drastically,
	compared to the old monolithic Makefile.  Not only that,
	but since when we are working with the man pages there
	aren't many pages involved, times will be even better.

	Here are some times with a single page changed (touched):

New Makefile (one page touched):
	~/src/linux/man-pages$ touch man2/membarrier.2
	~/src/linux/man-pages$ time sudo make install
	-	INSTALL	/usr/local/share/man/man2/membarrier.2

	real	0m0.988s
	user	0m0.966s
	sys	0m0.025s
	~/src/linux/man-pages$ touch man2/membarrier.2
	~/src/linux/man-pages$ time sudo make install -j
	-	INSTALL	/usr/local/share/man/man2/membarrier.2

	real	0m0.989s
	user	0m0.943s
	sys	0m0.049s

Also, modify the output of the make install and uninstall commands
so that a line is output for each file or directory that is
installed, similarly to the kernel's Makefile.  This doesn't apply
to html targets, which haven't been changed in this commit.

Also, make sure that for each invocation of $(INSTALL_DIR), no
parents are created, (i.e., avoid `mkdir -p` behavior).  The GNU
make manual states that it can create race conditions.  Instead,
declare as a prerequisite for each directory its parent directory,
and let make resolve the order of creation.

Also, use ':=' instead of '=' to improve performance, by
evaluating each assignment only once.

Ensure than the shell is not called when not needed, by removing
all ";" and quotes in the commands.

See also: <https://stackoverflow.com/q/67862417/6872717>

Specify conventions and rationales used in the Makefile in a comment.

Add copyright.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-10 10:32:59 +12:00
Michael Kerrisk 14987c153f setresuid.2: tfix (Oxford comma)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-21 20:19:28 +12:00
Michael Kerrisk e4a403876d select.2: Strengthen the warning regarding the low value of FD_SETSIZE
All modern code should avoid select(2) in favor of poll(2)
or epoll(7).

For a long history of this problem, see:

https://marc.info/?l=bugtraq&m=110660879328901
    List:       bugtraq
    Subject:    SECURITY.NNOV: Multiple applications fd_set structure bitmap array index overflow
    From:       3APA3A <3APA3A () security ! nnov ! ru>
    Date:       2005-01-24 20:30:08

https://sourceware.org/legacy-ml/libc-alpha/2003-05/msg00171.html
    User-settable FD_SETSIZE and select()
    From: mtk-lists at gmx dot net
    To: libc-alpha at sources dot redhat dot com
    Date: Mon, 19 May 2003 14:49:03 +0200 (MEST)
    Subject: User-settable FD_SETSIZE and select()

https://sourceware.org/bugzilla/show_bug.cgi?id=10352

http://0pointer.net/blog/file-descriptor-limits.html
https://twitter.com/pid_eins/status/1394962183033868292

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-20 11:00:11 +12:00
Michael Kerrisk 2a1ba6ae7f select.2: Relocate sentence about the fd_set value-result arguments to BUGS
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-20 09:49:09 +12:00
Alejandro Colomar 65dfda3dd1 sched_setattr.2: Use syscall(SYS_...); for system calls without a wrapper
Document also why each header is required

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar d4d006687d s390_sthyi.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar c6450cf82b s390_sthyi.2: Replace numeric constant by its name (macro)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Eugene Syromyatnikov <evgsyr@gmail.com>
Cc: QingFeng Hao <haoqf@linux.vnet.ibm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar cca4e32eb3 s390_runtime_instr.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar f908665187 s390_pci_mmio_write.2: Use syscall(SYS_...); for system calls without a wrapper; fix includes too
This function doesn't use any flags or special types, so there's
no reason to include <asm/unistd.h>; remove it.  Add the includes
needed for syscall(2) only.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar 56cfe81cfb s390_guarded_storage.2: Use syscall(SYS_...); for system calls without a wrapper
Also document why each header is needed.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 20:04:30 +12:00
Alejandro Colomar cc6f5bf20f rename.2: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 16:44:37 +12:00
Michael Kerrisk 090fdddb43 memfd_create.2, mmap.2, shmget.2: Document the EPERM for huge page allocations
This error can occur if the caller is does not have CAP_IPC_LOCK
and is not a member of the sysctl_hugetlb_shm_group.

Reported-by: Yang Xu <xuyang2018.jy@fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 15:42:04 +12:00
Michael Kerrisk 6cee0ddeb4 proc.5: Document /proc/sys/vm/sysctl_hugetlb_shm_group
As a deprecated feature, it appears that the RLIMIT_MEMLOCK
can also be used to permit huge page allocation, but let's
not document that for now.

In the Linux 5.12, see fs/hugetlbfs/inode.c.

static int can_do_hugetlb_shm(void)
{
        kgid_t shm_group;
        shm_group = make_kgid(&init_user_ns, sysctl_hugetlb_shm_group);
        return capable(CAP_IPC_LOCK) || in_group_p(shm_group);
}

...

struct file *hugetlb_file_setup(const char *name, size_t size,
                                vm_flags_t acctflag, struct user_struct **user,
                                int creat_flags, int page_size_log)
{
        ...
        if (creat_flags == HUGETLB_SHMFS_INODE && !can_do_hugetlb_shm()) {
                *user = current_user();
                if (user_shm_lock(size, *user)) {
                        task_lock(current);
                        pr_warn_once("%s (%d): Using mlock ulimits for SHM_HUGETLB is deprecated\n",
                                current->comm, current->pid);
                        task_unlock(current);
                } else {
                        *user = NULL;
                        return ERR_PTR(-EPERM);
                }
        }
        ...
}

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 15:38:39 +12:00
Michael Kerrisk 3dcdef9437 capabilities.7: CAP_IPC_LOCK also governs memory allocation using huge pages
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 14:08:37 +12:00
Alejandro Colomar f603c6f39d console_codes.4: tfix
The correct meaning of SGR is "Select Graphic Rendition".

See:
<https://www.ecma-international.org/wp-content/uploads/ECMA-48_5th_edition_june_1991.pdf>
<https://nvlpubs.nist.gov/nistpubs/Legacy/FIPS/fipspub86.pdf>
<https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_(Select_Graphic_Rendition)_parameters>

Reported-by: Christoph Anton Mitterer <calestyo@scientia.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 13:18:34 +12:00
Michael Kerrisk 20f1ee9317 ctime.3: Restore documentation of 'tm_gmtoff' field
Accidentally deleted in commit ba39b288ab.

Reported-by: Katsuhiro Numata <byakkomon@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-17 12:56:46 +12:00
Alejandro Colomar d25b924662 README: Update installation path
The installation path was changed recently (See 'prefix' in the
Makefile).  I forgot to update the README with those changes.
Fix it.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-12 04:53:57 +12:00
Akihiro Motoki 9cf9ba4aa3 expm1.3: tfix
Signed-off-by: Akihiro Motoki <amotoki@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-12 04:52:40 +12:00
Akihiro Motoki dc6b48de4d sigvec.3: tfix
Signed-off-by: Akihiro Motoki <amotoki@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-12 04:52:40 +12:00
Akihiro Motoki 5d63eed891 capabilities.7: ffix
Signed-off-by: Akihiro Motoki <amotoki@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-12 04:52:40 +12:00
Akihiro Motoki 5a172e4d48 ttyslot.3: tfix
Signed-off-by: Akihiro Motoki <amotoki@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-12 04:52:40 +12:00
Akihiro Motoki d6a6c16f80 tgamma.3: tfix
Signed-off-by: Akihiro Motoki <amotoki@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-12 04:52:40 +12:00
Michael Kerrisk 66c743b191 getdents.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar fac7dabcd1 reboot.2: Use syscall(SYS_...); for system calls without a wrapper
Explain also why headers are needed.
And some ffix.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 71b08c22b5 readlink.2: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 8f33ee075a readdir.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 05214ec7ba quotactl.2: Better detail why <xfs/xqm.h> is included
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 4e8ac36900 process_madvise.2: Use syscall(SYS_...); for system calls without a wrapper. Fix includes too.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar e393b243c0 poll.2: Remove <signal.h>
It is only used for providing 'sigset_t'.  We're only documenting
(with some exceptions) the includes needed for constants and the
prototype itself.  And 'sigset_t' is better documented in
system_data_types(7).  Remove that include.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 3e67d1a76b pivot_root.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 5a24cb274f pipe.2: wfix
For consistency with other pages.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 94df87ef9b pidfd_send_signal.2: Use syscall(SYS_...); for system calls without a wrapper. Fix includes too
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 46227ba213 pidfd_open.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 13cf4fc78a pidfd_getfd.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar e691579150 perf_event_open.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 10f4414ccb openat2.2: Use syscall(SYS_...); for system calls without a wrapper; fix includes too
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar bc2813df5e alloc_hugepages.2, arch_prctl.2, capget.2, clone.2, delete_module.2, exit_group.2, get_robust_list.2, getunwind.2, init_module.2: Add note about the use of syscall(2)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar a39bcd0b85 mq_getsetattr.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 57d2facb78 modify_ldt.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 0eefb56c95 mmap2.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:45 +12:00
Alejandro Colomar 01ee7ce9b7 mknod.2: Remove unused includes
All of the constants used by mknod() are defined in <sys/stat.h>.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:28:38 +12:00
Alejandro Colomar c88fc2baad mincore.2: Remove unused include
AFAICS, there's no use for <unistd.h> here.  The prototype is
declared in <sys/mman.h>, and there are no constants needed.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 39df5bd6bc membarrier.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 3977e9ff1f lookup_dcookie.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar aecad91d0b llseek.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar f1d0eaf52b link.2: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 5b013bd50f keyctl.2: Use syscall(SYS_...); for system calls without a glibc wrapper
Remove the libkeyutils prototype from the synopsis, which isn't
documented in the rest of the page, and as NOTES says, it's
probably better to use the various library functions.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 1ad9eda841 scripts/bash_aliases: man_lsfunc(): Extract syscall name from syscall(SYS_...)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar e59830eda9 kexec_load.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar b5c3fcdb65 kcmp.2: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 2f4306b033 kcmp.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar e3e30ce1bd ipc.2: Add needed include
The constants needed for using this function are defined in
<linux/ipc.h>.  Add the include, even when those constants are not
mentioned in this manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar acb2e04c24 ipc.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 0d961e8818 ioprio_set.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 2f8cb589fb ioperm.2: Remove obvious comment
Of course that is for the glibc wrapper.  As all of the other
pages that don't explicitly say otherwise.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 8b4c942c50 io_getevents.2: Use syscall(SYS_...); for system calls without a wrapper
In this case there's a wrapper provided by libaio,
but this page documents the raw syscall.

Also remove <linux/time.h> from the includes: 'struct timespec'
is already documented in system_data_types(7), where the
information is more up to date.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 950d1738ef io_destroy.2: Use syscall(SYS_...); for system calls without a wrapper
In this case there's a wrapper provided by libaio,
but this page documents the raw syscall.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar cac89bc794 ioctl_userfaultfd.2: SYNOPSIS: Add <linux/userfaultfd.h>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 70f9a4edb3 ioctl_tty.2: Fix includes
<sys/ioctl.h> is needed for the prototype of ioctl().  That header
also provides most of the constants used by the function.  Only a
few of those constants are not provided by that header, and need
<termios.h>; clarify which constants do need that include.

......

$ <man2/ioctl_tty.2 \
  sed -n '/^.SH DESCRIPTION/,/^.SH/p' \
  |grep -e '^\.B' -e TIOCM \
  |sed 's/^\.B[^ ]* //' \
  |awk '{print $1}' \
  |grep '^[[:upper:]]' \
  |grep -v -e '^CAP' -e '^E' -e '^SIG' -e '^O_' -e '^[TR]XD$' -e '^POLL' \
  |sort \
  |uniq \
  |while read f; do \
	find /usr/include/ -type f \
	|xargs grep -l "define\s$f" \
	|grep -q ioctl.*.h \
	||echo $f \
	|while read ff; do \
		echo "============ $ff"; \
		find /usr/include/ -type f \
		|xargs grep -n "define\s$ff"; \
	done; \
  done;
============ CLOCAL
/usr/include/asm-generic/termbits.h:142:#define CLOCAL	0004000
/usr/include/gphoto2/gphoto2-port-portability.h:127:#   define CLOCAL  0x00000800
/usr/include/x86_64-linux-gnu/bits/termios-c_cflag.h:34:#define CLOCAL	0004000
============ TCIFLUSH
/usr/include/asm-generic/termbits.h:191:#define	TCIFLUSH	0
/usr/include/x86_64-linux-gnu/bits/termios.h:70:#define	TCIFLUSH	0
============ TCIOFF
/usr/include/asm-generic/termbits.h:187:#define	TCIOFF		2
/usr/include/x86_64-linux-gnu/bits/termios.h:66:#define	TCIOFF		2
============ TCIOFLUSH
/usr/include/asm-generic/termbits.h:193:#define	TCIOFLUSH	2
/usr/include/x86_64-linux-gnu/bits/termios.h:72:#define	TCIOFLUSH	2
============ TCION
/usr/include/asm-generic/termbits.h:188:#define	TCION		3
/usr/include/x86_64-linux-gnu/bits/termios.h:67:#define	TCION		3
============ TCOFLUSH
/usr/include/asm-generic/termbits.h:192:#define	TCOFLUSH	1
/usr/include/x86_64-linux-gnu/bits/termios.h:71:#define	TCOFLUSH	1
============ TCOOFF
/usr/include/asm-generic/termbits.h:185:#define	TCOOFF		0
/usr/include/x86_64-linux-gnu/bits/termios.h:64:#define	TCOOFF		0
============ TCOON
/usr/include/asm-generic/termbits.h:186:#define	TCOON		1
/usr/include/x86_64-linux-gnu/bits/termios.h:65:#define	TCOON		1
============ TIOCREMOTE
============ TIOCSTART
============ TIOCSTOP
============ TIOCTTYGSTRUCT
============ TIOCUCNTL

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 4b63cf3ca7 getdents.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 0aa385fe25 futex.2: Use syscall(SYS_...); for system calls without a wrapper
At the same time, document only headers that are required
for calling the function, or those that are specific to the
function:

<unistd.h> is required for the syscall() prototype.
<sys/syscall.h> is required for the syscall name SYS_xxx.
<linux/futex.h> is specific to this syscall.

However, uint32_t is generic enough that it shouldn't be
documented here.  The system_data_types(7) page already documents
it, and is more precise about it.  The same goes for timespec.

As a general rule a man[23] page should document the header that
includes the prototype, and all of the headers that define macros
that should be used with the call.  However, the information about
types should be restricted to system_data_types(7) (and that page
should probably be improved by adding types), except for types
that are very specific to the call.  Otherwise, we're duplicating
info and it's then harder to maintain, and probably outdated in
the future.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 17:18:08 +12:00
Alejandro Colomar 1cf69258ad execveat.2: Remove unused include
This complements commit e3eba861bd.

Since we don't need syscall(2) anymore, we don't need SYS_* definitions.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 05:06:23 +12:00
Michael Kerrisk e43e45b477 Makefile: Remove shebang line
On 5/10/21 7:13 PM, Alejandro Colomar (man-pages) wrote:
> Hi Michael,
>
> On 5/10/21 1:39 AM, Michael Kerrisk (man-pages) wrote:
>>> - Specify shebang
>>
>> Why? It's not quite obvious to me, and the commit message
>> should really explain...
>
> Hmmm.  I have some minor reasons to add it, but not a really good one.
>
> * Some editors don't recognize 'Makefile' as a special name, so the
> shebang helps detecting which language the file is using (e.g., for
> coloring).
>
> * I tend to subdivide a big Makefile into a small Makefile and many
> submakefiles stored in <./libexec/>.  Those obviously need different
> names, and given that the makefile extension is not very standard (I use
> .mk), having a shebang helps knowing what the file is.  After that, I
> also have it on the main Makefile for consistency.   But here we only
> have one Makefile, so it doesn apply very much.

I think I'll remove it. It is kind of idiosyncratic, leaves the
reader asking "why?".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 04:34:03 +12:00
Michael Kerrisk 80a45bed73 .gitignore: Tweaks to Alex's .gitignore
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 04:34:03 +12:00
Alejandro Colomar 0fbec630fd .gitignore: Add file
Ignore everything new by default.

This avoids having to update the .gitignore when we need to ignore
something new.  It also avoids accidents that may add an unwanted
temporary file.

Cc: Debian man-pages <manpages@packages.debian.org>
Cc: Dr. Tobias Quathamer <toddy@debian.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 04:34:03 +12:00
Alejandro Colomar 3bbc7a7554 fflush.3: SEE ALSO: Add fpurge(3)
fpurge(i_stream) does the same as fflush(i_stream), AFAIK.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 04:34:03 +12:00
Alejandro Colomar 1c55195743 open.2: Fix bug in linkat(2) call example
AT_EMPTY_PATH works with empty strings (""), but not with NULL
(or at least it's not obvious).

The relevant kernel code is the following:

linux$ sed -n 189,198p fs/namei.c
	result->refcnt = 1;
	/* The empty path is special. */
	if (unlikely(!len)) {
		if (empty)
			*empty = 1;
		if (!(flags & LOOKUP_EMPTY)) {
			putname(result);
			return ERR_PTR(-ENOENT);
		}
	}

Reported-by: Walter Harms <wharms@bfs.de>
Cc: Theodore Ts'o <tytso@mit.edu>
Cc: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-11 04:34:03 +12:00
Michael Kerrisk 3eb81f5117 basename.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:07:24 +12:00
Alejandro Colomar 58d7a46ccb bswap.3: bswap_*() are implemented using functions
See <bits/byteswap.h> in glibc.
These macros call functions of the form __bswap_N(),
which use uintN_t.

Even though it's true that they are macros,
it's transparent to the user.

The user will see their results casted to unsigned types
after the conversion due to the underlying functions,
so it's better to document these as the underlying functions,
specifying the types.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:07:02 +12:00
Alejandro Colomar 5175f162a3 pthread_attr_setschedparam.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in
pthread_attr_getschedparam(), pthread_attr_setschedparam().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getschedparam
sysdeps/htl/pthread.h:102:
extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
				       struct sched_param *__restrict __param)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:294:
extern int pthread_attr_getschedparam (const pthread_attr_t *__restrict __attr,
				       struct sched_param *__restrict __param)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype pthread_attr_setschedparam
sysdeps/htl/pthread.h:107:
extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
				       const struct sched_param *__restrict
				       __param) __THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:299:
extern int pthread_attr_setschedparam (pthread_attr_t *__restrict __attr,
				       const struct sched_param *__restrict
				       __param) __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 161c0ae7a6 pthread_attr_setinheritsched.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in
pthread_attr_getinheritsched().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getinheritsched
sysdeps/htl/pthread.h:90:
extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict __attr,
					 int *__restrict __inheritsched)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:313:
extern int pthread_attr_getinheritsched (const pthread_attr_t *__restrict
					 __attr, int *__restrict __inherit)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 099b33fbff epoll_wait.2: Move subsection to NOTES from BUGS
'C library/kernel differences' was added to BUGS incorrectly.
Fix it

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 2ce1caae32 xdr.3: SYNOPSIS: Fix prototype types
Use the same types glibc uses, and add a missing 'const'.

.../glibc$ grep_glibc_prototype xdr_union
sunrpc/rpc/xdr.h:315:
extern bool_t xdr_union (XDR *__xdrs, enum_t *__dscmp, char *__unp,
			 const struct xdr_discrim *__choices,
			 xdrproc_t __dfault) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 3126777905 rpc.3: SYNOPSIS: Fix prototypes (misc.)
Fix the types for the following functions:

authunix_create(),
callrpc(),
clnt_create(),
clnt_pcreateerror(),
clnt_perror(),
clnt_spcreateerror(),
clnt_sperror(),
pmap_set(),
svc_register(),
svcerr_progvers().

.../glibc$ grep_glibc_prototype authunix_create
sunrpc/rpc/auth.h:158:
extern AUTH *authunix_create (char *__machname, __uid_t __uid, __gid_t __gid,
			      int __len, __gid_t *__aup_gids);
.../glibc$ grep_glibc_prototype callrpc
sunrpc/rpc/clnt.h:359:
extern int callrpc (const char *__host, const u_long __prognum,
		    const u_long __versnum, const u_long __procnum,
		    const xdrproc_t __inproc, const char *__in,
		    const xdrproc_t __outproc, char *__out) __THROW;
.../glibc$ grep_glibc_prototype clnt_create
sunrpc/rpc/clnt.h:291:
extern CLIENT *clnt_create (const char *__host, const u_long __prog,
			    const u_long __vers, const char *__prot)
     __THROW;
.../glibc$ grep_glibc_prototype clnt_pcreateerror
sunrpc/rpc/clnt.h:368:
extern void clnt_pcreateerror (const char *__msg);	/* stderr */
.../glibc$ grep_glibc_prototype clnt_perror
sunrpc/rpc/clnt.h:379:
extern void clnt_perror (CLIENT *__clnt, const char *__msg);
.../glibc$ grep_glibc_prototype clnt_spcreateerror
sunrpc/rpc/clnt.h:369:
extern char *clnt_spcreateerror(const char *__msg) __THROW;	/* string */
.../glibc$ grep_glibc_prototype clnt_sperror
sunrpc/rpc/clnt.h:381:
extern char *clnt_sperror (CLIENT *__clnt, const char *__msg) __THROW;
.../glibc$ grep_glibc_prototype pmap_set
sunrpc/rpc/pmap_clnt.h:69:
extern bool_t pmap_set (const u_long __program, const u_long __vers,
			int __protocol, u_short __port) __THROW;
.../glibc$ grep_glibc_prototype svc_register
sunrpc/rpc/svc.h:188:
extern bool_t svc_register (SVCXPRT *__xprt, rpcprog_t __prog,
			    rpcvers_t __vers, __dispatch_fn_t __dispatch,
			    rpcprot_t __protocol) __THROW;
.../glibc$ grep_glibc_prototype svcerr_progvers
sunrpc/rpc/svc.h:253:
extern void	svcerr_progvers (SVCXPRT *__xprt, rpcvers_t __low_vers,
				 rpcvers_t __high_vers) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 54dde4f8e3 cpow.3: Use 'complex' after the type consistently
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 7dfd227b7e system_data_types.7: tfix
Those pages didn't exist.  Fix the section number.
I noticed the typo thanks to the HTML pages on man7.org.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar 881f51062f Makefile: Fix bug when running in parallel
Prerequisites can run in parallel.  This wouldn't make any sense
when uninstalling and installing again.

For that, use consecutive commands, which run one after the other
even with multiple cores.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:42 +12:00
Alejandro Colomar e4b890cdb8 Makefile: Use standard features (IMPORTANT: default prefix changed)
IMPORTANT for distributions:
This changes prefix to be '/usr/local' as is expected by default,
instead of the old '/usr' value.

- Use standard variables:
    - prefix should be '/usr/local'
    - mandir (instead of MANDIR)
    - htmldir (instead of HTDIR)
    - ...
    see <https://www.gnu.org/software/make/manual/html_node/Directory-Variables.html>

- Use standard targets:
    - html (build html files; don't install them)
    - install-html (instead of html)
    - installdirs (instead of 'mkdir -p'/'install -d' inside other targets)
    - ...
    see <https://www.gnu.org/software/make/manual/html_node/Standard-Targets.html#Standard-Targets>

- Use .PHONY

- ?= is not needed.  User input overrides any assignment.  Use =

- Use standard command variables, instead of directly calling commands.
    - $(INSTALL_DATA) (instead of install -m 644)
    - $(INSTALL_DIR) (instead of install -d -m 755 or mkdir -p)
    see <https://www.gnu.org/software/make/manual/html_node/Command-Variables.html#Command-Variables>

- Specify SHELL = /bin/bash

- Specify shebang

- Allow variable html extension (or no extension at all)

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 13:05:36 +12:00
Alejandro Colomar 5f9596780c Makefile: html: Simplify target
mkdir -p doesn't fail if the directory already exists.
Remove redundant checks.

Use .html as default HTDIR.
Remove checks for undefined HTDIR.

Show what the target does, as with other targets (remove '@').

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:35:11 +12:00
Alejandro Colomar 34afcb0dad scripts/bash_aliases: srcfix
I clarified the code about two things:

- Checking how many arguments are being passed.
    Here, some functions didn't reject extra arguments when they
    weren't being used.  Fix that.
    I also changed the code to use $#, which is more explicit.
    And use arithmetic expressions, which better indicate that
    we're dealing with numbers.

- Remove unneeded options from sort.
    Reported-by: Stefan Puiu <stefan.puiu@gmail.com>
    After Stefan asked about why am I using 'sort -V',
    I noticed that I really don't need '-V', and it may confuse
    people trying to understand the script, so even though I
    slightly prefer the output of 'sort -V', in this case, it's
    better to use the simpler 'sort' (yet I need 'sort', to
    maintain consistency in the results (find is quite random)).

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:33:51 +12:00
Alejandro Colomar 94bf02f41b scripts/bash_aliases: Fix error messages
Fix the error messages to clearly show that both dirs and manual
pages are accepted, and that more than one argument is accepted.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:33:27 +12:00
Alejandro Colomar a3ccd456f3 scripts/bash_aliases: man_section(): Accept multiple sections
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:33:10 +12:00
Alejandro Colomar 3a42b0815e scripts/bash_aliases: Add man_lsvar(), similar to man_lsfunc() but lists variables
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:32:42 +12:00
Alejandro Colomar 5ae99ccb42 scripts/bash_aliases: Make man_lsfunc() more robust; Add sed_rm_ccomments().
This patch makes man_lsfunc() search for the function prototypes,
instead of relying on the current manual page formatting,
which might change in the future, and break this function.

It also simplifies the code, by reusing man_section().

Create a new function sed_rm_ccomments(), which is needed by
man_lsfunc(), and may also be useful in other cases.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:32:17 +12:00
Alejandro Colomar b08daf3c0c scripts/bash_aliases: man_gitstaged(): Script around a porcelain git command
The output of 'git status' is not stable.

The more stable 'git status --porcelain' is more complex,
and scripting around it would be more complex.

However, 'git diff --staged --name-only' produces
the output that we were lookiong for.

Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:27:19 +12:00
Alejandro Colomar f493a71fe1 scripts/bash_aliases, scripts/modified_pages.sh: Move scripts/modified_pages.sh to a function man_gitstaged()
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:27:12 +12:00
Alejandro Colomar bacf09154d dladdr.3: SYNOPSIS: Add missing 'const'
Glibc uses 'const' for the 1st parameter of these functions.
Fix the prototypes.

......

.../glibc$ grep_glibc_prototype dladdr
dlfcn/dlfcn.h:98:
extern int dladdr (const void *__address, Dl_info *__info)
     __THROW __nonnull ((2));
.../glibc$ grep_glibc_prototype dladdr1
dlfcn/dlfcn.h:102:
extern int dladdr1 (const void *__address, Dl_info *__info,
		    void **__extra_info, int __flags) __THROW __nonnull ((2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:20:21 +12:00
Alejandro Colomar 4cc91169d0 sched_get_priority_max.2, open_memstream.3: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:19:29 +12:00
Alejandro Colomar c20d4d883c pthread_getattr_default_np.3: SYNOPSIS: Add missing 'const'
glibc uses 'const' in pthread_setattr_default_np().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_setattr_default_np
sysdeps/nptl/pthread.h:406:
extern int pthread_setattr_default_np (const pthread_attr_t *__attr)
     __THROW __nonnull ((1));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:18:44 +12:00
Alejandro Colomar f750ab384c pthread_mutexattr_setrobust.3: SYNOPSIS: Remove incorrect 'const'
Neither POSIX or glibc use 'const' in
pthread_mutexattr_setrobust().
Remove it.

.../glibc$ grep_glibc_prototype pthread_mutexattr_setrobust
sysdeps/htl/pthread.h:355:
extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
					int __robustness)
     __THROW __nonnull ((1));
sysdeps/nptl/pthread.h:888:
extern int pthread_mutexattr_setrobust (pthread_mutexattr_t *__attr,
					int __robustness)
     __THROW __nonnull ((1));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:17:53 +12:00
Alejandro Colomar fe10d82f6e clone.2: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:17:11 +12:00
Alejandro Colomar 2faa0fbddf tzset.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:15:15 +12:00
Alejandro Colomar a2d963a81c strsignal.3: SYNOPSIS: Add missing 'const'
glibc uses 'const' in sigdescr_np(), sigabbrev_np().
Let's use it here too.

.../glibc$ grep_glibc_prototype sigdescr_np
string/string.h:469:
extern const char *sigdescr_np (int __sig) __THROW;
.../glibc$ grep_glibc_prototype sigabbrev_np
string/string.h:466:
extern const char *sigabbrev_np (int __sig) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:15:15 +12:00
Alejandro Colomar ea2807f8af strsignal.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:14:12 +12:00
Alejandro Colomar 6e7a60c016 __ppc_get_timebase.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:13:33 +12:00
Alejandro Colomar 27931e4a6b perror.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:11:21 +12:00
Alejandro Colomar d62694cc6e on_exit.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:10:59 +12:00
Alejandro Colomar 8632f524ef getutmp.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:10:35 +12:00
Alejandro Colomar 27398f1b64 malloc_usable_size.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 11:10:06 +12:00
Akihiro Motoki 19063c3c07 signalfd.2: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Akihiro Motoki 15b9b432d2 fanotify.7: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Akihiro Motoki a128697221 semctl.2: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Akihiro Motoki 4f060b5467 move_pages.2: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Štěpán Němec 85102346e3 execve.2: tfix
Signed-off-by: Štěpán Němec <stepnem@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Vishwajith K 5974cc557f shmop.2: tfix
Signed-off-by: Vishwajith K <vishuvikas1996@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Alejandro Colomar 60b2fa370a getopt.3: Minor tweaks to James' patch
The rest of the page writes the characters without naming them.
Follow that convention.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
James O. D. Hunt dfa1ee2040 getopt.3: Clarify behaviour
Improved the `getopt(3)` man page in the following ways:

1) Defined the existing term "legitimate option character".
2) Added an additional NOTE stressing that arguments are parsed in strict
   order and the implications of this when numeric options are utilised.

Signed-off-by: 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-05-10 09:09:11 +12:00
Alejandro Colomar f729c4f36e sigwaitinfo.2: tfix
Fix wording issue introduced in commit
bf1298c9e5.

Reported-by: Chris Keilbart <keilbartchris@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Jakub Wilk ba48f20bc4 exit_group.2, getunwind.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Jakub Wilk c9ad020677 Changes.old: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Dmitry V. Levin 8bc6f5fdea ptrace.2: mention PTRACE_GET_SYSCALL_INFO in RETURN VALUE section
Mirror the wording about PTRACE_GET_SYSCALL_INFO return value semantics
from "DESCRIPTION" section to "RETURN VALUE" section.

Reported-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Complements: fc91449cb "ptrace.2: Document PTRACE_GET_SYSCALL_INFO"
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Dmitry V. Levin 4d95a1eef3 move_pages.2: ffix
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Johannes Berg 1874ca39ba clone.2: tfix
Despite my mention of this spawning a hilarious discussion
on IRC, this alignment restriction should be 128-bit, not
126-bit.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Alejandro Colomar b46edd9161 setbuf.3: tfix
Reported-by: Zhiheng Li <phoenix_lzh@sina.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Borislav Petkov 67238a538d sigaltstack.2: tfix
Add a missing "to" in an "in order to" formulation.

Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Aurelien Aptel 334ed9799d flock.2: add CIFS details
CIFS flock() locks behave differently than the standard. Give overview
of those differences.

Here is the rendered text:

CIFS details
  In Linux kernels up to 5.4, flock() is not propagated over SMB.  A file
  with such locks will not appear locked for remote clients.

  Since Linux 5.5, flock() locks are emulated with SMB  byte-range  locks
  on  the  entire  file.   Similarly to NFS, this means that fcntl(2) and
  flock() locks interact with one another.  Another important side-effect
  is  that  the  locks  are not advisory anymore: any IO on a locked file
  will always fail with EACCES when done from a separate file descriptor.
  This  difference  originates from the design of locks in the SMB proto-
  col, which provides mandatory locking semantics.

  Remote and mandatory locking semantics  may  vary  with  SMB  protocol,
  mount options and server type.  See mount.cifs(8) for additional infor-
  mation.

Signed-off-by: Aurelien Aptel <aaptel@suse.com>
Discussion: linux-man <https://lore.kernel.org/linux-man/20210302154831.17000-1-aaptel@suse.com/>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Alejandro Colomar dffa597887 Various pages: Remove unused <sys/ipc.h> (and <sys/types.h>)
In b0b19983d9 we removed
<sys/types.h>.  For the same reasons there, remove now <sys/ipc.h>
from many pages.

If someone wonders why <sys/ipc.h> was needed, the reason was to
get all the definitions of IPC_* constants.  However, that header
is now included by <sys/msg.h>, so it's not needed anymore to
explicitly include it.  Quoting POSIX: "In addition, the
<sys/msg.h> header shall include the <sys/ipc.h> header."

There were some remaining cases where I forgot to remove
<sys/types.h>; remove them now too.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 07:47:06 +12:00
Alejandro Colomar a484b43bde open_by_handle_at.2: Remove unused <sys/stat.h>
AFAICS, all types and constants used by these functions are
defined in <fcntl.h>.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 06:10:12 +12:00
Michael Kerrisk eb2b1b990d syscalls.2: perfmonctl(2) was removed in Linux 5.10
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 06:08:38 +12:00
Michael Kerrisk 9c6ca43e91 perfmonctl.2: This system call was removed in Linux 5.10
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 06:08:38 +12:00
Akihiro Motoki c339f05436 shm_overview.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 04:28:14 +12:00
Michael Kerrisk 707da0b585 pthread_yield.3: Note that this function is deprecated since glibc 2.34
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 04:19:32 +12:00
Michael Kerrisk 9c463934b9 pthread_mutexattr_setrobust.3: Note that the *_np() APIs are deprecated since glibc 2.34
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 04:16:42 +12:00
Michael Kerrisk bda2573478 pthread_mutex_consistent.3: Note that pthread_mutexattr_setrobust() is now deprecated
Deprecated since glibc 2.34.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 04:16:42 +12:00
Michael Kerrisk e3eba861bd execveat.2: Library support has been added in glibc 2.34
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 04:16:42 +12:00
Michael Kerrisk afcddad555 pthread_mutex_consistent.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 04:16:39 +12:00
Michael Kerrisk ba93f72c44 syscalls.2: SEE ALSO: add ausyscall(1)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-29 21:14:59 +02:00
Michael Kerrisk 2673a70a57 get_mempolicy.2, mq_getsetattr.2, poll.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-06 13:44:48 +02:00
Michael Kerrisk 92a4b09356 pipe.2: Rearrange SYNOPSIS so that minority version pipe() is at end
A few architectures have a different call signature for pipe().
Since those architectures are the minority, place the prototype
at the end of the SYNOPSIS, rather than the start.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-06 13:44:48 +02:00
Michael Kerrisk 3ab99460db mount.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-06 13:44:48 +02:00
Michael Kerrisk 9ae36f1824 userfaultfd.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-06 13:44:48 +02:00
Michael Kerrisk 1cf1ada55a ioctl_userfaultfd.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-06 13:44:48 +02:00
Michael Kerrisk 88b0e0e01d mount_namespaces.7, namespaces.7: Relocate reference to pam_namespace(8)
SEE ALSO: move pam_namespace(8) from namespaces(7) to
mount_namespaces(7) (since pam_namespace(8) makes use of
mount namespaces specifically).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-06 12:24:33 +02:00
Michael Kerrisk 241c425113 vsock.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-06 10:37:04 +02:00
Alyssa Ross 99880a6727 vsock.7: ioctls are on /dev/vsock, not sockets
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-06 10:18:14 +02:00
Michael Kerrisk 7a3d084504 ioctl_userfaultfd.2, userfaultfd.2: Minor tweaks to Peter Xu's patches
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-06 10:04:46 +02:00
Peter Xu f559fa36a6 ioctl_userfaultfd.2: Add write-protect mode docs
Userfaultfd write-protect mode is supported starting from Linux 5.7.

Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
[alx: ffix + srcfix]
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 22:02:44 +02:00
Peter Xu fbda69bbdd ioctl_userfaultfd.2: Add UFFD_FEATURE_THREAD_ID docs
UFFD_FEATURE_THREAD_ID is supported in Linux 4.14.

Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 22:02:05 +02:00
Peter Xu 4b338b38e6 userfaultfd.2: Add write-protect mode
Write-protect mode is supported starting from Linux 5.7.

Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 22:00:21 +02:00
Peter Xu e70f957d81 userfaultfd.2: Add UFFD_FEATURE_THREAD_ID docs
UFFD_FEATURE_THREAD_ID is supported since Linux 4.14.

Acked-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
[alx: srcfix]
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 21:48:53 +02:00
Alyssa Ross d9cacda7fc scanf.3: Clarify that %n supports type modifiers
My initial reading of this was that type modifiers were probably
not supported.  But they are, and this is actually documented
further up, in the type modifiers documentation.  But to make it
clearer, let's copy the language that printf(3) has in its %n
section.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 21:47:25 +02:00
Michael Kerrisk 2b95ad349b shm_open.3: wfix
Reported-by: Jon Murphy <jonmurphy1618@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 21:41:24 +02:00
Alejandro Colomar 0bdc3187ec io_cancel.2: Use syscall(SYS_...); for system calls without a wrapper
In this case there's a wrapper provided by libaio,
but this page documents the raw kernel syscall.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:44:48 +02:00
Alejandro Colomar d9f8238d37 init_module.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:44:48 +02:00
Alejandro Colomar 4695076306 delete_module.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:44:48 +02:00
Michael Kerrisk 843c01931c get_robust_list.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:44:48 +02:00
Alejandro Colomar eb4a40e023 get_robust_list.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:44:48 +02:00
Alejandro Colomar a2fe65bc36 getunwind.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:44:48 +02:00
Alejandro Colomar 73f2d2ba11 exit_group.2: Use syscall(SYS_...); for system calls without a wrapper
<linux/unistd.h> is not needed.  We need <unistd.h> for syscall(),
and <sys/syscall.h> for SYS_exit_group.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:44:48 +02:00
Alejandro Colomar 86970bf4d3 execveat.2: Use syscall(SYS_...); for system calls without a wrapper
Add <linux/fcntl.h>, which contains AT_* definitions used by
execveat().

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:44:48 +02:00
Alejandro Colomar a380538369 clone.2: Use syscall(SYS_...); for system calls without a wrapper
The CLONE_* constants seem to be available from either
<linux/sched.h> or <sched.h>, and since clone3() already
includes <linux/sched.h> for 'struct clone_args', <sched.h>
is not really needed, AFAICS; however, to avoid confusion,
I also included <sched.h> for clone3() for consistency:

clone() is getting CLONE_* from <sched.h>, and it would confuse
the reader if clone3() got the same CLONE_* constants from a
different header.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:44:42 +02:00
Michael Kerrisk 74ddb3019f capget.2: Minor tweaks to Alex Colomar's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:29:05 +02:00
Alejandro Colomar 00e4779ad7 capget.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:26:53 +02:00
Alejandro Colomar 149eb741d7 arch_prctl.2: SYNOPSIS: Remove unused includes
AFAICS, there's no reason to include that.
All of the macros that this function uses
are already defined in the other headers.

Cc: glibc <libc-alpha@sourceware.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:25:23 +02:00
Alejandro Colomar a9a96d8a5b arch_prctl.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:25:14 +02:00
Alejandro Colomar 58d15b72da alloc_hugepages.2: Use syscall(SYS_...); for system calls without a wrapper
The page didn't specify includes, and the syscalls are extinct, so
instead of adding incomplete information about includes, just
leave it without any includes.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:23:06 +02:00
Alejandro Colomar 4175b08beb access.2: Use syscall(SYS_...); for system calls without a wrapper
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:17:25 +02:00
Michael Kerrisk fa1755e4be ioctl_fideduperange.2: Minor tweaks to Alex Colomar's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:15:31 +02:00
Alejandro Colomar 0fdaa53806 ioctl_fideduperange.2: Make clear why exactly is each header needed
Only the include that provides the prototype doesn't need a comment.

Also sort the includes alphabetically.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:13:57 +02:00
Alejandro Colomar 40798f5b45 ioctl_ficlonerange.2: Make clear why is each header exactly needed.
Only the one that provides the prototype doesn't need a comment.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:13:00 +02:00
Alejandro Colomar f72f6f260b ioctl_fslabel.2: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:10:31 +02:00
Michael Kerrisk 5aed5c683e ioctl_getfsmap.2: Minor tweaks to Alex Colomar's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:08:58 +02:00
Alejandro Colomar 2ef3cedaf4 ioctl_getfsmap.2: Make clear why exactly is each header needed
<linux/fs.h> doesn't seem to be needed!
Only the include that provides the prototype doesn't need a comment.

Also sort the includes alphabetically.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:05:44 +02:00
Alejandro Colomar 9c9e0561d0 ioctl_fslabel.2: Make clear why exactly is each header needed
Only the include that provides the prototype doesn't need a comment.

Also sort the includes alphabetically.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:05:23 +02:00
Michael Kerrisk 0b1dc48225 ioctl_fat.2: Minor tweaks to Alex Colomar's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 13:05:23 +02:00
Alejandro Colomar a71d209b9b ioctl_fat.2: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:58:29 +02:00
Alejandro Colomar 3a0989120d ioctl_fat.2: Make clear why is each header exactly needed.
Only the one that provides the prototype doesn't need a comment.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:57:23 +02:00
Alejandro Colomar 1852998a68 dup.2: SYNOPSIS: Use consistent comments through pages
[mtk: Alex's change switches the comment to the more generally used
form "Definition of..."]

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:53:41 +02:00
Alejandro Colomar d2ac3dcfbe fanotify_init.2: Add comment: why more than one include is needed
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:50:00 +02:00
Alejandro Colomar 0cb59ab63f getpriority.2: Remove unused include
<sys/time.h> is not needed to get the function declaration nor any
constant used by the function.  It was only needed (before
POSIX.1) to get 'struct timeval', but that information would be
more suited for system_data_types(7), and not for this page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:49:18 +02:00
Alejandro Colomar 43be8898c2 delete_module.2: Add missing include
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:48:35 +02:00
Alejandro Colomar 1e145f150d getrlimit.2, getrusage.2: Remove unused include
<sys/time.h> is not required by any of the function declarations
or macro definitions used by these functions.  It may be (or maybe
not) needed by some type inside the rlimit structure, but that
info belongs in system_data_types(7), not here.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:47:01 +02:00
Alejandro Colomar 8c402eb013 add_key.2: Remove unused include
<sys/types.h> was only needed for size_t, AFAIK.  That is already
(and more precisely) documented in system_data_types(7).  Let's
remove it here, as it's not really needed for calling add_key().

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:45:48 +02:00
Alejandro Colomar af2ea7fdbb fcntl.2: Remove unused include
I couldn't find a reason for including <unistd.h>.  All the macros
used by fcntl() are defined in <fcntl.h>.  For comparison, FreeBSD
and OpenBSD don't specify <unistd.h> in their manual pages.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:43:49 +02:00
Alejandro Colomar f6ecadcba1 exit_group.2: Use 'noreturn' in prototypes
This function never returns to its caller.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:43:05 +02:00
Alejandro Colomar c0e1178b14 futimesat.2: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:41:53 +02:00
Alejandro Colomar ece1112b56 socklen_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:37:16 +02:00
Alejandro Colomar ffcccbf3a3 system_data_types.7: Add 'socklen_t'
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:37:04 +02:00
Alejandro Colomar 49084c3d5d sockaddr.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:36:39 +02:00
Alejandro Colomar f563bf642d system_data_types.7: Add 'struct sockaddr'
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-05 12:36:31 +02:00
Alejandro Colomar a60b5d45e7 errno.3: Fix ENODATA text
ENODATA is an XSI STREAMS extension (not base POSIX).

Linux reused the name for extended attributes.
The current manual pages don't use ENODATA with its POSIX
meaning, so use the xattr(7) specific text, and leave the POSIX
meaning for a secondary paragraph.

Reported-by: Mark Kettenis <kettenis@openbsd.org>
Reported-by: Florian Weimer <fw@deneb.enyo.de>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-04 22:16:48 +02:00
Josh Triplett 21bc0c8713 exec.3: Clarify that execvpe uses PATH from the caller, not envp
Checked via the latest glibc source. execvpe calls getenv("PATH") and
searches that; the PATH in envp does not affect the search.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-04 22:08:48 +02:00
Michael Kerrisk 8e2cab90e1 set_mempolicy.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-04 22:07:31 +02:00
Huang Ying 5858ad9ca8 set_mempolicy.2: Add mode flag MPOL_F_NUMA_BALANCING
In Linux kernel 5.12, a new mode flag, MPOL_F_NUMA_BALANCING, is
added to set_mempolicy() to optimize the page placement among the
NUMA nodes with the NUMA balancing mechanism even if the memory of
the applications is bound with MPOL_BIND.  This patch updates the
man page for the new mode flag.

Related kernel commits:
bda420b985054a3badafef23807c4b4fa38a3dff

[mtk: Minor fixes to commit message]

Signed-off-by: "Huang, Ying" <ying.huang@intel.com>
Cc: "Michael Kerrisk" <mtk.manpages@gmail.com>
[ alx: srcfix ]
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-04 22:04:49 +02:00
Josh Triplett a198453571 exec.3: Fix description of 'e' variants
The envp argument specifies the environment of the new process image,
not "the environment of the caller".

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-04 22:04:29 +02:00
Alejandro Colomar 01926df072 printf.3: Minor wording tweaks to Utkarsh's patch
The format string refers to the whole string passed in 'format'.
The syntax referred to is that of a conversion specification,
as called in the manual page.
Use specific language.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-04 22:04:29 +02:00
Utkarsh Singh 2fd8db84bf printf.3: Add overall structure of format string
Can we add a small syntax structure for format string in printf(3)
manual.  I personally find if easier to remember and scan.  This has
been taken from OpenBSD printf(3) manual.

Signed-off-by: Utkarsh Singh <utkarsh190601@gmail.com>
[ alx: ffix ]
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-04 22:04:29 +02:00
Josh Triplett 3333af873d environ.7: Remove obsolete admonishment of the GZIP environment variable
gzip deprecated the GZIP environment variable long ago.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
[ alx: srcfix ]
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-04 22:03:56 +02:00
Bruce Merry 285a7373e7 mmap.2: Clarify that MAP_POPULATE is best-effort
As discussed on linux-mm
(https://marc.info/?l=linux-mm&m=161528594100612&w=2), MAP_POPULATE can
fail silently if the hugetlb cgroup settings allow huge page reservation
but prevents huge pages being allocated.

Closes https://bugzilla.kernel.org/show_bug.cgi?id=212153.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-04 22:03:30 +02:00
Michael Kerrisk 1f72eb7511 write.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-04-02 12:28:00 +02:00
Michael Kerrisk 46b470231f listen.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-26 12:05:15 +01:00
Michael Kerrisk 737a840daa _exit.2: Add a little more detail on the raw _exit() system cal
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-25 09:32:30 +01:00
Michael Kerrisk b96ad91c7c dup.2: Further clarify the effect of dup2()
Add a sentence explaining what dup2() does in terms of file
descriptors and open file descriptions.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-23 11:33:40 +01:00
Michael Kerrisk 8b339e35fa dup.2: Clarify what silent closing means
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-23 11:27:39 +01:00
Michael Kerrisk 5c3611aa44 open.2: Make it clearer that an FD is an index into the process's FD table
Sometimes people are confused, thinking a file descriptor is just a
number.  To help avoid such confusions, add text highlighting that
a file descriptor is an index to an entry in the process's FD table.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-23 11:05:24 +01:00
Michael Kerrisk f5270fe6f8 dup.2: Rewrite the description of dup() somewhat
As can be seen by any number of StackOverflow questions, people
persistently misunderstand what dup() does, and the existing manual
page text, which talks of "copying" a file descriptor doesn't help.
Rewrite the text a little to try to prevent some of these
misunderstandings, in particular noting at the start that dup()
allocates a new file descriptor.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-23 10:38:28 +01:00
Michael Kerrisk 18e408ec5f Start of man-pages-5.12: updating Changes and Changes.old 2021-03-22 11:19:38 +01:00
Michael Kerrisk 35be575fd8 Start of man-pages-5.12: updating .Announce and .lsm files 2021-03-22 11:19:38 +01:00
Michael Kerrisk a7bd9adb11 Start of man-pages-5.12: renaming .Announce and .lsm files 2021-03-22 11:19:38 +01:00
Michael Kerrisk a291472957 Ready for 5.11 2021-03-22 07:38:11 +01:00
Michael Kerrisk ae151c5194 Changes: whitespace cleanups 2021-03-22 07:38:01 +01:00
Michael Kerrisk 1d767b552e getent.1, ldd.1, locale.1, localedef.1, memusage.1, memusagestat.1, mtrace.1, _exit.2, _syscall.2, accept.2, access.2, acct.2, add_key.2, adjtimex.2, alloc_hugepages.2, arch_prctl.2, bdflush.2, bind.2, bpf.2, brk.2, cacheflush.2, capget.2, chdir.2, chmod.2, chown.2, chroot.2, clock_getres.2, clock_nanosleep.2, clone.2, close.2, close_range.2, connect.2, copy_file_range.2, create_module.2, delete_module.2, dup.2, epoll_create.2, epoll_ctl.2, epoll_wait.2, eventfd.2, execve.2, execveat.2, fanotify_init.2, fanotify_mark.2, fcntl.2, flock.2, fork.2, fsync.2, futex.2, get_kernel_syms.2, get_mempolicy.2, get_robust_list.2, getcpu.2, getdents.2, getdomainname.2, getgid.2, getgroups.2, gethostname.2, getitimer.2, getpagesize.2, getpeername.2, getpid.2, getpriority.2, getrandom.2, getresuid.2, getrlimit.2, getrusage.2, getsid.2, getsockname.2, getsockopt.2, gettid.2, gettimeofday.2, getuid.2, getunwind.2, getxattr.2, idle.2, init_module.2, inotify_add_watch.2, inotify_rm_watch.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, ioctl.2, ioctl_console.2, ioctl_fat.2, ioctl_ficlonerange.2, ioctl_fideduperange.2, ioctl_fslabel.2, ioctl_getfsmap.2, ioctl_ns.2, ioctl_tty.2, ioctl_userfaultfd.2, ioperm.2, iopl.2, ipc.2, kcmp.2, kexec_load.2, keyctl.2, kill.2, link.2, listen.2, listxattr.2, llseek.2, lookup_dcookie.2, lseek.2, madvise.2, mbind.2, membarrier.2, memfd_create.2, migrate_pages.2, mincore.2, mkdir.2, mknod.2, mlock.2, mmap.2, mmap2.2, modify_ldt.2, mount.2, move_pages.2, mprotect.2, mq_getsetattr.2, mremap.2, msgctl.2, msgget.2, msgop.2, msync.2, nanosleep.2, nfsservctl.2, nice.2, open.2, open_by_handle_at.2, openat2.2, pause.2, pciconfig_read.2, perf_event_open.2, perfmonctl.2, personality.2, pidfd_getfd.2, pidfd_open.2, pidfd_send_signal.2, pipe.2, pivot_root.2, pkey_alloc.2, poll.2, posix_fadvise.2, prctl.2, pread.2, process_vm_readv.2, ptrace.2, query_module.2, quotactl.2, read.2, readahead.2, readdir.2, readlink.2, readv.2, reboot.2, recv.2, remap_file_pages.2, removexattr.2, rename.2, request_key.2, restart_syscall.2, rmdir.2, rt_sigqueueinfo.2, s390_guarded_storage.2, s390_pci_mmio_write.2, s390_runtime_instr.2, s390_sthyi.2, sched_get_priority_max.2, sched_rr_get_interval.2, sched_setaffinity.2, sched_setattr.2, sched_setparam.2, sched_setscheduler.2, sched_yield.2, seccomp.2, select.2, select_tut.2, semctl.2, semget.2, semop.2, send.2, sendfile.2, set_thread_area.2, seteuid.2, setfsgid.2, setfsuid.2, setgid.2, setpgid.2, setresuid.2, setreuid.2, setsid.2, setuid.2, setup.2, setxattr.2, sgetmask.2, shmctl.2, shmget.2, shmop.2, shutdown.2, sigaction.2, sigaltstack.2, signal.2, signalfd.2, sigpending.2, sigprocmask.2, sigreturn.2, sigsuspend.2, sigwaitinfo.2, socket.2, socketcall.2, socketpair.2, splice.2, spu_create.2, spu_run.2, stat.2, statfs.2, statx.2, stime.2, subpage_prot.2, swapon.2, symlink.2, sync.2, sync_file_range.2, syscall.2, syscalls.2, sysctl.2, sysfs.2, sysinfo.2, syslog.2, time.2, timer_create.2, timer_delete.2, timer_getoverrun.2, timer_settime.2, timerfd_create.2, times.2, tkill.2, truncate.2, umask.2, umount.2, uname.2, unimplemented.2, unlink.2, unshare.2, uselib.2, userfaultfd.2, ustat.2, utime.2, utimensat.2, vfork.2, vhangup.2, vm86.2, vmsplice.2, wait.2, wait4.2, write.2, CPU_SET.3, __ppc_get_timebase.3, __ppc_set_ppr_med.3, __ppc_yield.3, __setfpucw.3, a64l.3, abort.3, abs.3, acos.3, acosh.3, addseverity.3, adjtime.3, aio_cancel.3, aio_error.3, aio_fsync.3, aio_read.3, aio_return.3, aio_suspend.3, aio_write.3, alloca.3, argz_add.3, asin.3, asinh.3, asprintf.3, assert.3, assert_perror.3, atan.3, atan2.3, atanh.3, atexit.3, atof.3, atoi.3, backtrace.3, basename.3, bcmp.3, bcopy.3, bindresvport.3, bsd_signal.3, bsearch.3, bstring.3, btowc.3, byteorder.3, bzero.3, cabs.3, cacos.3, cacosh.3, canonicalize_file_name.3, carg.3, casin.3, casinh.3, catan.3, catanh.3, catgets.3, catopen.3, cbrt.3, ccos.3, ccosh.3, ceil.3, cexp.3, cexp2.3, cfree.3, cimag.3, circleq.3, clearenv.3, clock.3, clock_getcpuclockid.3, clog.3, clog10.3, clog2.3, closedir.3, cmsg.3, confstr.3, conj.3, copysign.3, cos.3, cosh.3, cpow.3, cproj.3, creal.3, crypt.3, csin.3, csinh.3, csqrt.3, ctan.3, ctanh.3, ctermid.3, ctime.3, daemon.3, des_crypt.3, difftime.3, dirfd.3, div.3, dl_iterate_phdr.3, dladdr.3, dlerror.3, dlinfo.3, dlopen.3, dlsym.3, drand48.3, drand48_r.3, duplocale.3, dysize.3, ecvt.3, ecvt_r.3, encrypt.3, endian.3, envz_add.3, erf.3, erfc.3, err.3, errno.3, error.3, ether_aton.3, euidaccess.3, exec.3, exit.3, exp.3, exp10.3, exp2.3, expm1.3, fabs.3, fclose.3, fcloseall.3, fdim.3, fenv.3, ferror.3, fexecve.3, fflush.3, ffs.3, fgetc.3, fgetgrent.3, fgetpwent.3, fgetwc.3, fgetws.3, fileno.3, finite.3, flockfile.3, floor.3, fma.3, fmax.3, fmemopen.3, fmin.3, fmod.3, fmtmsg.3, fnmatch.3, fopen.3, fopencookie.3, fpathconf.3, fpclassify.3, fpurge.3, fputwc.3, fputws.3, fread.3, frexp.3, fseek.3, fseeko.3, ftime.3, ftok.3, fts.3, ftw.3, futimes.3, fwide.3, gamma.3, gcvt.3, get_nprocs_conf.3, get_phys_pages.3, getaddrinfo.3, getaddrinfo_a.3, getauxval.3, getcontext.3, getcwd.3, getdate.3, getdirentries.3, getdtablesize.3, getentropy.3, getenv.3, getfsent.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, gethostid.3, getifaddrs.3, getipnodebyname.3, getline.3, getloadavg.3, getlogin.3, getmntent.3, getnameinfo.3, getnetent.3, getnetent_r.3, getopt.3, getpass.3, getprotoent.3, getprotoent_r.3, getpt.3, getpw.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent.3, getrpcent_r.3, getrpcport.3, gets.3, getservent.3, getservent_r.3, getspnam.3, getsubopt.3, getttyent.3, getumask.3, getusershell.3, getutent.3, getutmp.3, getw.3, getwchar.3, glob.3, gnu_get_libc_version.3, grantpt.3, group_member.3, gsignal.3, hsearch.3, hypot.3, iconv.3, iconv_close.3, iconv_open.3, if_nameindex.3, if_nametoindex.3, ilogb.3, index.3, inet.3, inet_net_pton.3, inet_ntop.3, inet_pton.3, initgroups.3, insque.3, isalpha.3, isatty.3, isfdtype.3, isgreater.3, iswalnum.3, iswalpha.3, iswblank.3, iswcntrl.3, iswctype.3, iswdigit.3, iswgraph.3, iswlower.3, iswprint.3, iswpunct.3, iswspace.3, iswupper.3, iswxdigit.3, j0.3, key_setsecret.3, killpg.3, ldexp.3, lgamma.3, lio_listio.3, list.3, localeconv.3, lockf.3, log.3, log10.3, log1p.3, log2.3, logb.3, login.3, lrint.3, lround.3, lsearch.3, lseek64.3, makecontext.3, makedev.3, mallinfo.3, malloc.3, malloc_get_state.3, malloc_hook.3, malloc_info.3, malloc_stats.3, malloc_trim.3, malloc_usable_size.3, mallopt.3, matherr.3, mblen.3, mbrlen.3, mbrtowc.3, mbsinit.3, mbsnrtowcs.3, mbsrtowcs.3, mbstowcs.3, mbtowc.3, mcheck.3, memccpy.3, memchr.3, memcmp.3, memcpy.3, memfrob.3, memmem.3, memmove.3, mempcpy.3, memset.3, mkdtemp.3, mkfifo.3, mkstemp.3, mktemp.3, modf.3, mpool.3, mq_close.3, mq_getattr.3, mq_notify.3, mq_open.3, mq_receive.3, mq_send.3, mq_unlink.3, mtrace.3, nan.3, newlocale.3, nextafter.3, nextup.3, nl_langinfo.3, ntp_gettime.3, on_exit.3, open_memstream.3, opendir.3, openpty.3, perror.3, popen.3, posix_fallocate.3, posix_madvise.3, posix_memalign.3, posix_openpt.3, posix_spawn.3, pow.3, pow10.3, printf.3, profil.3, psignal.3, pthread_attr_init.3, pthread_attr_setaffinity_np.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setscope.3, pthread_attr_setsigmask_np.3, pthread_attr_setstack.3, pthread_attr_setstackaddr.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_cleanup_push_defer_np.3, pthread_create.3, pthread_detach.3, pthread_equal.3, pthread_exit.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_join.3, pthread_kill.3, pthread_kill_other_threads_np.3, pthread_mutex_consistent.3, pthread_mutexattr_getpshared.3, pthread_mutexattr_setrobust.3, pthread_rwlockattr_setkind_np.3, pthread_self.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setconcurrency.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_setschedprio.3, pthread_sigmask.3, pthread_sigqueue.3, pthread_spin_init.3, pthread_spin_lock.3, pthread_testcancel.3, pthread_tryjoin_np.3, pthread_yield.3, ptsname.3, putenv.3, putgrent.3, putpwent.3, puts.3, putwchar.3, qecvt.3, qsort.3, raise.3, rand.3, random.3, random_r.3, rcmd.3, re_comp.3, readdir.3, readdir_r.3, realpath.3, regex.3, remainder.3, remove.3, remquo.3, resolver.3, rewinddir.3, rexec.3, rint.3, round.3, rpc.3, rpmatch.3, rtime.3, rtnetlink.3, scalb.3, scalbln.3, scandir.3, scanf.3, sched_getcpu.3, seekdir.3, sem_close.3, sem_destroy.3, sem_getvalue.3, sem_init.3, sem_open.3, sem_post.3, sem_unlink.3, sem_wait.3, setaliasent.3, setbuf.3, setenv.3, setjmp.3, setlocale.3, setlogmask.3, setnetgrent.3, shm_open.3, siginterrupt.3, signbit.3, significand.3, sigpause.3, sigqueue.3, sigset.3, sigsetops.3, sigvec.3, sigwait.3, sin.3, sincos.3, sinh.3, sleep.3, slist.3, sockatmark.3, sqrt.3, stailq.3, statvfs.3, stdarg.3, stdio.3, stdio_ext.3, stpcpy.3, stpncpy.3, strcasecmp.3, strcat.3, strchr.3, strcmp.3, strcoll.3, strcpy.3, strdup.3, strerror.3, strfmon.3, strfromd.3, strfry.3, strftime.3, string.3, strlen.3, strnlen.3, strpbrk.3, strptime.3, strsep.3, strsignal.3, strspn.3, strstr.3, strtod.3, strtoimax.3, strtok.3, strtol.3, strtoul.3, strverscmp.3, strxfrm.3, swab.3, sysconf.3, syslog.3, system.3, sysv_signal.3, tailq.3, tan.3, tanh.3, tcgetpgrp.3, tcgetsid.3, telldir.3, tempnam.3, termios.3, tgamma.3, timegm.3, timeradd.3, tmpfile.3, tmpnam.3, toascii.3, toupper.3, towctrans.3, towlower.3, towupper.3, trunc.3, tsearch.3, ttyname.3, ttyslot.3, tzset.3, ualarm.3, ulimit.3, undocumented.3, ungetwc.3, unlocked_stdio.3, unlockpt.3, updwtmp.3, uselocale.3, usleep.3, wcpcpy.3, wcpncpy.3, wcrtomb.3, wcscasecmp.3, wcscat.3, wcschr.3, wcscmp.3, wcscpy.3, wcscspn.3, wcsdup.3, wcslen.3, wcsncasecmp.3, wcsncat.3, wcsncmp.3, wcsncpy.3, wcsnlen.3, wcsnrtombs.3, wcspbrk.3, wcsrchr.3, wcsrtombs.3, wcsspn.3, wcsstr.3, wcstoimax.3, wcstok.3, wcstombs.3, wcswidth.3, wctob.3, wctomb.3, wctrans.3, wctype.3, wcwidth.3, wmemchr.3, wmemcmp.3, wmemcpy.3, wmemmove.3, wmemset.3, wordexp.3, wprintf.3, xcrypt.3, xdr.3, y0.3, cciss.4, console_codes.4, dsp56k.4, hpsa.4, initrd.4, loop.4, lp.4, msr.4, random.4, rtc.4, smartpqi.4, veth.4, wavelan.4, acct.5, core.5, elf.5, hosts.5, locale.5, proc.5, resolv.conf.5, rpc.5, slabinfo.5, sysfs.5, tmpfs.5, utmp.5, address_families.7, aio.7, attributes.7, bootparam.7, capabilities.7, cgroups.7, complex.7, ddp.7, environ.7, epoll.7, fanotify.7, feature_test_macros.7, hier.7, inode.7, inotify.7, ip.7, ipv6.7, keyrings.7, locale.7, man-pages.7, man.7, math_error.7, mount_namespaces.7, namespaces.7, netdevice.7, netlink.7, numa.7, packet.7, pkeys.7, pthreads.7, queue.7, raw.7, rtnetlink.7, sched.7, session-keyring.7, shm_overview.7, sigevent.7, signal-safety.7, signal.7, sock_diag.7, socket.7, spufs.7, symlink.7, system_data_types.7, tcp.7, time_namespaces.7, udp.7, udplite.7, unicode.7, unix.7, uri.7, user_namespaces.7, vdso.7, vsock.7, x25.7, iconvconfig.8, ld.so.8, ldconfig.8, sln.8, tzselect.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-22 00:15:34 +01:00
Michael Kerrisk abd7f4ed77 Changes: Ready for 5.11
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-21 23:50:36 +01:00
Michael Kerrisk c8e9c60bed user_namespaces.7: CAP_SYS_ADMIN now allows mounting of overlayfs fileseystems
Reported by: Szunti <szunti@gmail.com>
Reported by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-21 16:43:39 +01:00
Michael Kerrisk e3e22b2b2b close_range.2: Correct the explanation of the EMFILE error
close_range() CLOSE_RANGE_USHARE triggers a call to dup_fd()
which in turn calls alloc_fdtable(), which checks that
sysctl_nr_open has not been exceeded.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-21 16:37:17 +01:00
Michael Kerrisk 368ace8467 close_range.2: Minor wording fix
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-21 16:37:17 +01:00
Michael Kerrisk 336bd62ba2 close_range.2: Include a better example program
The current example program can't really be used to demonstrate the
effect of close_range(). Replace it by a program that does show the
effect of this system call.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-21 16:37:17 +01:00
Michael Kerrisk 3bb4fe47a5 close.2: SEE ALSO: add close_range(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-21 16:37:17 +01:00
Michael Kerrisk 8a7d961f0c close_range.2: Minor tweaks to Stephen Kitt's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-21 16:37:17 +01:00
Stephen Kitt bd704558d9 close_range.2: New page documenting close_range(2)
This documents close_range(2) based on information in
278a5fbaed89dacd04e9d052f4594ffd0e0585de,
60997c3d45d9a67daf01c56d805ae4fec37e0bd8, and
582f1fb6b721facf04848d2ca57f34468da1813e.

Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Stephen Kitt <steve@sk2.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-21 16:37:17 +01:00
Alejandro Colomar b0b19983d9 Various pages: Remove unused <sys/types.h>
The manual pages are already inconsistent in which headers need
to be included.  Right now, not all of the types used by a
function have their required header included in the SYNOPSIS.

If we were to add the headers required by all of the types used by
functions, the SYNOPSIS would grow too much.  Not only it would
grow too much, but the information there would be less precise.

Having system_data_types(7) document each type with all the
information about required includes is much more precise, and the
info is centralized so that it's much easier to maintain.

So let's document only the include required for the function
prototype, and also the ones required for the macros needed to
call the function.

<sys/types.h> only defines types, not functions or constants, so
it doesn't belong to man[23] (function) pages at all.

I ignore if some old systems had headers that required you to
include <sys/types.h> *before* them (incomplete headers), but if
so, those implementations would be broken, and those headers
should probably provide some kind of warning.  I hope this is not
the case.

[mtk: Already in 2001, POSIX.1 removed the requirement to
include <sys/types.h> for many APIs, so this patch seems
well past due.]

Acked-by: Zack Weinberg <zackw@panix.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-15 08:43:12 +01:00
Alejandro Colomar 71458d681b wprintf.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX uses 'restrict' in *wprintf() (see [v]fwprintf(3p)).
Let's use it here too.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 22:37:58 +01:00
Michael Kerrisk 2c051781be scandir.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 22:05:46 +01:00
Michael Kerrisk 3169822aaa rcmd.3: ffix
In SYNOPSIS, shift arguments right a little to make the function
names stand out a little more.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 22:03:46 +01:00
Alejandro Colomar e9de308449 wordexp.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wordexp().
Let's use it here too.

.../glibc$ grep_glibc_prototype wordexp
posix/wordexp.h:62:
extern int wordexp (const char *__restrict __words,
		    wordexp_t *__restrict __pwordexp, int __flags);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar ac6292052b wmemcpy.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wmemcpy().
Let's use it here too.

.../glibc$ grep_glibc_prototype wmemcpy
wcsmbs/wchar.h:262:
extern wchar_t *wmemcpy (wchar_t *__restrict __s1,
			 const wchar_t *__restrict __s2, size_t __n) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar 7ce7d2ad9b wcstombs.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcstombs().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcstombs
stdlib/stdlib.h:937:
extern size_t wcstombs (char *__restrict __s,
			const wchar_t *__restrict __pwcs, size_t __n)
     __THROW
  __attr_access ((__write_only__, 1, 3)) __attr_access ((__read_only__, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar 21a4b17edd wcstok.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcstok().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcstok
wcsmbs/wchar.h:217:
extern wchar_t *wcstok (wchar_t *__restrict __s,
			const wchar_t *__restrict __delim,
			wchar_t **__restrict __ptr) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar 55eb26ae3d wcstoimax.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcstoimax(), wcstoumax().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcstoimax
stdlib/inttypes.h:305:
extern intmax_t wcstoimax (const __gwchar_t *__restrict __nptr,
			   __gwchar_t **__restrict __endptr, int __base)
     __THROW;
.../glibc$ grep_glibc_prototype wcstoumax
stdlib/inttypes.h:310:
extern uintmax_t wcstoumax (const __gwchar_t *__restrict __nptr,
			    __gwchar_t ** __restrict __endptr, int __base)
     __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar 6b3c959f92 wcsrtombs.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcsrtombs().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcsrtombs
wcsmbs/wchar.h:343:
extern size_t wcsrtombs (char *__restrict __dst,
			 const wchar_t **__restrict __src, size_t __len,
			 mbstate_t *__restrict __ps) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar c37f316d8e wcsnrtombs.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcsnrtombs().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcsnrtombs
wcsmbs/wchar.h:357:
extern size_t wcsnrtombs (char *__restrict __dst,
			  const wchar_t **__restrict __src,
			  size_t __nwc, size_t __len,
			  mbstate_t *__restrict __ps) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar 815c456a48 wcsncpy.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcsncpy().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcsncpy
wcsmbs/wchar.h:92:
extern wchar_t *wcsncpy (wchar_t *__restrict __dest,
			 const wchar_t *__restrict __src, size_t __n)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar dac1e36026 wcsncat.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcsncat().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcsncat
wcsmbs/wchar.h:101:
extern wchar_t *wcsncat (wchar_t *__restrict __dest,
			 const wchar_t *__restrict __src, size_t __n)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar a6a3fd6675 wcscpy.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcscpy().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcscpy
wcsmbs/wchar.h:87:
extern wchar_t *wcscpy (wchar_t *__restrict __dest,
			const wchar_t *__restrict __src)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar 454eddea7a wcscat.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcscat().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcscat
wcsmbs/wchar.h:97:
extern wchar_t *wcscat (wchar_t *__restrict __dest,
			const wchar_t *__restrict __src)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar ce17c7a7e6 wcrtomb.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcrtomb().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcrtomb
wcsmbs/wchar.h:301:
extern size_t wcrtomb (char *__restrict __s, wchar_t __wc,
		       mbstate_t *__restrict __ps) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar a216fe2af0 wcpncpy.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcpncpy().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcpncpy
wcsmbs/wchar.h:556:
extern wchar_t *wcpncpy (wchar_t *__restrict __dest,
			 const wchar_t *__restrict __src, size_t __n)
     __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar 12ba9d41a2 wcpcpy.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in wcpcpy().
Let's use it here too.

.../glibc$ grep_glibc_prototype wcpcpy
wcsmbs/wchar.h:551:
extern wchar_t *wcpcpy (wchar_t *__restrict __dest,
			const wchar_t *__restrict __src) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar 586c5b22e8 unlocked_stdio.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in fread_unlocked(), fwrite_unlocked(), fgets_unlocked(), fputs_unlocked(), fgetws_unlocked(), fputws_unlocked().
Let's use it here too.

.../glibc$ grep_glibc_prototype fread_unlocked
libio/stdio.h:678:
extern size_t fread_unlocked (void *__restrict __ptr, size_t __size,
			      size_t __n, FILE *__restrict __stream) __wur;
.../glibc$ grep_glibc_prototype fwrite_unlocked
libio/stdio.h:680:
extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
			       size_t __n, FILE *__restrict __stream);
.../glibc$ grep_glibc_prototype fgets_unlocked
libio/stdio.h:591:
extern char *fgets_unlocked (char *__restrict __s, int __n,
			     FILE *__restrict __stream) __wur
    __attr_access ((__write_only__, 1, 2));
.../glibc$ grep_glibc_prototype fputs_unlocked
libio/stdio.h:667:
extern int fputs_unlocked (const char *__restrict __s,
			   FILE *__restrict __stream);
.../glibc$ grep_glibc_prototype fgetws_unlocked
wcsmbs/wchar.h:820:
extern wchar_t *fgetws_unlocked (wchar_t *__restrict __ws, int __n,
				 __FILE *__restrict __stream);
.../glibc$ grep_glibc_prototype fputws_unlocked
wcsmbs/wchar.h:829:
extern int fputws_unlocked (const wchar_t *__restrict __ws,
			    __FILE *__restrict __stream);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar c0828478b0 tsearch.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in tdelete().
Let's use it here too.

.../glibc$ grep_glibc_prototype tdelete
misc/search.h:138:
extern void *tdelete (const void *__restrict __key,
		      void **__restrict __rootp,
		      __compar_fn_t __compar);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar 4745230707 scanf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too.
Both POSIX and glibc use 'restrict' in scanf(), fscanf(), sscanf(), vscanf(), vfscanf(), vsscanf().
Let's use it here too.

.../glibc$ grep_glibc_prototype scanf
libio/stdio.h:397:
extern int scanf (const char *__restrict __format, ...) __wur;
.../glibc$ grep_glibc_prototype fscanf
libio/stdio.h:391:
extern int fscanf (FILE *__restrict __stream,
		   const char *__restrict __format, ...) __wur;
.../glibc$ grep_glibc_prototype sscanf
libio/stdio.h:399:
extern int sscanf (const char *__restrict __s,
		   const char *__restrict __format, ...) __THROW;
.../glibc$ grep_glibc_prototype vscanf
libio/stdio.h:443:
extern int vscanf (const char *__restrict __format, __gnuc_va_list __arg)
     __attribute__ ((__format__ (__scanf__, 1, 0))) __wur;
.../glibc$ grep_glibc_prototype vfscanf
libio/stdio.h:435:
extern int vfscanf (FILE *__restrict __s, const char *__restrict __format,
		    __gnuc_va_list __arg)
     __attribute__ ((__format__ (__scanf__, 2, 0))) __wur;
.../glibc$ grep_glibc_prototype vsscanf
libio/stdio.h:447:
extern int vsscanf (const char *__restrict __s,
		    const char *__restrict __format, __gnuc_va_list __arg)
     __THROW __attribute__ ((__format__ (__scanf__, 2, 0)));
.../glibc$

Also reorder v* functions to match the order of non-v functions.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:55:58 +01:00
Alejandro Colomar 0b3f94cb89 sigwait.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in sigwait().
Let's use it here too.

.../glibc$ grep_glibc_prototype sigwait
signal/signal.h:255:
extern int sigwait (const sigset_t *__restrict __set, int *__restrict __sig)
     __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:47:18 +01:00
Michael Kerrisk efebdba0af sigwait.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:47:02 +01:00
Alejandro Colomar cd2b76c7dc swab.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in swab().
Let's use it here too.

.../glibc$ grep_glibc_prototype swab
posix/unistd.h:1147:
extern void swab (const void *__restrict __from, void *__restrict __to,
		  ssize_t __n) __THROW __nonnull ((1, 2))
    __attr_access ((__read_only__, 1, 3))
    __attr_access ((__write_only__, 2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar 78f627d840 strxfrm.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in strxfrm().
Let's use it here too.

.../glibc$ grep_glibc_prototype strxfrm
string/string.h:150:
extern size_t strxfrm (char *__restrict __dest,
		       const char *__restrict __src, size_t __n)
    __THROW __nonnull ((2)) __attr_access ((__write_only__, 1, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar 891521ca8a strtol.3, strtoul.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in strtol(), strtoll(), strtoul(), strtoull().
Let's use it here too.

.../glibc$ grep_glibc_prototype strtol
stdlib/stdlib.h:176:
extern long int strtol (const char *__restrict __nptr,
			char **__restrict __endptr, int __base)
     __THROW __nonnull ((1));
.../glibc$ grep_glibc_prototype strtoll
stdlib/stdlib.h:199:
__extension__
extern long long int strtoll (const char *__restrict __nptr,
			      char **__restrict __endptr, int __base)
     __THROW __nonnull ((1));
.../glibc$ grep_glibc_prototype strtoul
stdlib/stdlib.h:180:
extern unsigned long int strtoul (const char *__restrict __nptr,
				  char **__restrict __endptr, int __base)
     __THROW __nonnull ((1));
.../glibc$ grep_glibc_prototype strtoull
stdlib/stdlib.h:204:
__extension__
extern unsigned long long int strtoull (const char *__restrict __nptr,
					char **__restrict __endptr, int __base)
     __THROW __nonnull ((1));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar da62878130 strtok.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in strtok(), strtok_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype strtok
string/string.h:340:
extern char *strtok (char *__restrict __s, const char *__restrict __delim)
     __THROW __nonnull ((2));
.../glibc$ grep_glibc_prototype strtok_r
string/string.h:350:
extern char *strtok_r (char *__restrict __s, const char *__restrict __delim,
		       char **__restrict __save_ptr)
     __THROW __nonnull ((2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar 8a0684ec41 strtoimax.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in strtoimax(), strtoumax().
Let's use it here too.

.../glibc$ grep_glibc_prototype strtoimax
stdlib/inttypes.h:297:
extern intmax_t strtoimax (const char *__restrict __nptr,
			   char **__restrict __endptr, int __base) __THROW;
.../glibc$ grep_glibc_prototype strtoumax
stdlib/inttypes.h:301:
extern uintmax_t strtoumax (const char *__restrict __nptr,
			    char ** __restrict __endptr, int __base) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar 4e2346405d strtod.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in strtod(), strtof(), strtold().
Let's use it here too.

.../glibc$ grep_glibc_prototype strtod
stdlib/stdlib.h:117:
extern double strtod (const char *__restrict __nptr,
		      char **__restrict __endptr)
     __THROW __nonnull ((1));
.../glibc$ grep_glibc_prototype strtof
stdlib/stdlib.h:123:
extern float strtof (const char *__restrict __nptr,
		     char **__restrict __endptr) __THROW __nonnull ((1));
.../glibc$ grep_glibc_prototype strtold
stdlib/stdlib.h:126:
extern long double strtold (const char *__restrict __nptr,
			    char **__restrict __endptr)
     __THROW __nonnull ((1));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar 2d91ea534d strsep.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in strsep().
Let's use it here too.

.../glibc$ grep_glibc_prototype strsep
string/string.h:455:
extern char *strsep (char **__restrict __stringp,
		     const char *__restrict __delim)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar 746d60af80 strptime.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in strptime().
However, glibc doesn't specify 'restrict' for the last parameter.
Let's use the most restrictive form here
(although I believe both to be equivalent).

.../glibc$ grep_glibc_prototype strptime
time/time.h:95:
extern char *strptime (const char *__restrict __s,
		       const char *__restrict __fmt, struct tm *__tp)
     __THROW;
.../glibc$

Cc: <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar b0ef498bd8 string.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in strsep().
Let's use it here too.

.../glibc$ grep_glibc_prototype strsep
string/string.h:455:
extern char *strsep (char **__restrict __stringp,
		     const char *__restrict __delim)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar 9180299e51 string.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in stpcpy(), strcat(), strcpy(), strncat(), strncpy(), strtok(), strxfrm().
Let's use it here too.

.../glibc$ grep_glibc_prototype stpcpy
string/string.h:475:
extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strcat
string/string.h:133:
extern char *strcat (char *__restrict __dest, const char *__restrict __src)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strcpy
string/string.h:125:
extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strncat
string/string.h:136:
extern char *strncat (char *__restrict __dest, const char *__restrict __src,
		      size_t __n) __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strncpy
string/string.h:128:
extern char *strncpy (char *__restrict __dest,
		      const char *__restrict __src, size_t __n)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strtok
string/string.h:340:
extern char *strtok (char *__restrict __s, const char *__restrict __delim)
     __THROW __nonnull ((2));
.../glibc$ grep_glibc_prototype strxfrm
string/string.h:150:
extern size_t strxfrm (char *__restrict __dest,
		       const char *__restrict __src, size_t __n)
    __THROW __nonnull ((2)) __attr_access ((__write_only__, 1, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar f8e178d48b strftime.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in strftime().
Let's use it here too.

.../glibc$ grep_glibc_prototype strftime
timezone/private.h:506:
size_t strftime(char *restrict, size_t, char const *restrict,
		struct tm const *restrict);
time/time.h:88:
extern size_t strftime (char *__restrict __s, size_t __maxsize,
			const char *__restrict __format,
			const struct tm *__restrict __tp) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar 4732985d0a strfmon.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in strfmon(), strfmon_l().
Let's use it here too.

.../glibc$ grep_glibc_prototype strfmon
stdlib/monetary.h:38:
extern ssize_t strfmon (char *__restrict __s, size_t __maxsize,
			const char *__restrict __format, ...)
     __THROW __attribute_format_strfmon__ (3, 4);
.../glibc$ grep_glibc_prototype strfmon_l
stdlib/monetary.h:47:
extern ssize_t strfmon_l (char *__restrict __s, size_t __maxsize,
			  locale_t __loc,
			  const char *__restrict __format, ...)
     __THROW __attribute_format_strfmon__ (4, 5);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar 168fd1184e strcpy.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in strcpy(), strncpy().
Let's use it here too.

.../glibc$ grep_glibc_prototype strcpy
string/string.h:125:
extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strncpy
string/string.h:128:
extern char *strncpy (char *__restrict __dest,
		      const char *__restrict __src, size_t __n)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar e4f4e683e5 strcat.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in strcat(), strncat().
Let's use it here too.

.../glibc$ grep_glibc_prototype strcat
string/string.h:133:
extern char *strcat (char *__restrict __dest, const char *__restrict __src)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype strncat
string/string.h:136:
extern char *strncat (char *__restrict __dest, const char *__restrict __src,
		      size_t __n) __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar 36addc2d59 stpncpy.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in stpncpy().
Let's use it here too.

.../glibc$ grep_glibc_prototype stpncpy
string/string.h:483:
extern char *stpncpy (char *__restrict __dest,
		      const char *__restrict __src, size_t __n)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar f23eb1ffb4 stpcpy.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in stpcpy().
Let's use it here too.

.../glibc$ grep_glibc_prototype stpcpy
string/string.h:475:
extern char *stpcpy (char *__restrict __dest, const char *__restrict __src)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar 0d93c9e70b statvfs.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in statvfs().
Let's use it here too.

.../glibc$ grep_glibc_prototype statvfs
io/sys/statvfs.h:51:
extern int statvfs (const char *__restrict __file,
		    struct statvfs *__restrict __buf)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:45 +01:00
Alejandro Colomar b20b8da6e3 setnetgrent.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getnetgrent(), getnetgrent_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getnetgrent
resolv/netdb.h:410:
extern int getnetgrent (char **__restrict __hostp,
			char **__restrict __userp,
			char **__restrict __domainp);
.../glibc$ grep_glibc_prototype getnetgrent_r
resolv/netdb.h:430:
extern int getnetgrent_r (char **__restrict __hostp,
			  char **__restrict __userp,
			  char **__restrict __domainp,
			  char *__restrict __buffer, size_t __buflen);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:12 +01:00
Alejandro Colomar 92bb261d6c setbuf.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in setvbuf(), setbuf().
Let's use it here too.

.../glibc$ grep_glibc_prototype setvbuf
libio/stdio.h:308:
extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
		    int __modes, size_t __n) __THROW;
.../glibc$ grep_glibc_prototype setbuf
libio/stdio.h:304:
extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:12 +01:00
Alejandro Colomar b4d9224a93 setbuf.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in setbuffer().
Let's use it here too.

.../glibc$ grep_glibc_prototype setbuffer
libio/stdio.h:314:
extern void setbuffer (FILE *__restrict __stream, char *__restrict __buf,
		       size_t __size) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:12 +01:00
Alejandro Colomar 4907425a46 setaliasent.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getaliasent_r(), getaliasbyname_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getaliasent_r
inet/aliases.h:48:
extern int getaliasent_r (struct aliasent *__restrict __result_buf,
			  char *__restrict __buffer, size_t __buflen,
			  struct aliasent **__restrict __result) __THROW;
.../glibc$ grep_glibc_prototype getaliasbyname_r
inet/aliases.h:56:
extern int getaliasbyname_r (const char *__restrict __name,
			     struct aliasent *__restrict __result_buf,
			     char *__restrict __buffer, size_t __buflen,
			     struct aliasent **__restrict __result) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:12 +01:00
Alejandro Colomar 3feebe29e7 sem_wait.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in sem_timedwait().
Let's use it here too.

.../glibc$ grep_glibc_prototype sem_timedwait
sysdeps/pthread/semaphore.h:62:
extern int sem_timedwait (sem_t *__restrict __sem,
			  const struct timespec *__restrict __abstime)
  __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:12 +01:00
Alejandro Colomar 439cb1d4ae sem_getvalue.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in sem_getvalue().
Let's use it here too.

.../glibc$ grep_glibc_prototype sem_getvalue
sysdeps/pthread/semaphore.h:81:
extern int sem_getvalue (sem_t *__restrict __sem, int *__restrict __sval)
  __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:40:12 +01:00
Michael Kerrisk 48ee34e75c pthread_mutexattr_getpshared.3, pthread_rwlockattr_setkind_np.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:34:16 +01:00
Alejandro Colomar fe817dd03c scandir.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in scandirat().
Let's use it here too.

.../glibc$ grep_glibc_prototype scandirat
dirent/dirent.h:293:
extern int scandirat (int __dfd, const char *__restrict __dir,
		      struct dirent ***__restrict __namelist,
		      int (*__selector) (const struct dirent *),
		      int (*__cmp) (const struct dirent **,
				    const struct dirent **))
     __nonnull ((2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 2866f31e8b scandir.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX does NOT specify scandir() to use 'restrict'.
However, glibc uses 'restrict'.
Users might be surprised by this!  Let's use it here too!

.../glibc$ grep_glibc_prototype scandir
dirent/dirent.h:255:
extern int scandir (const char *__restrict __dir,
		    struct dirent ***__restrict __namelist,
		    int (*__selector) (const struct dirent *),
		    int (*__cmp) (const struct dirent **,
				  const struct dirent **))
     __nonnull ((1, 2));
.../glibc$

Cc: glibc <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar e137171d80 rexec.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in rexec(), rexec_af().
Let's use it here too.

.../glibc$ grep_glibc_prototype rexec
resolv/netdb.h:477:
extern int rexec (char **__restrict __ahost, int __rport,
		  const char *__restrict __name,
		  const char *__restrict __pass,
		  const char *__restrict __cmd, int *__restrict __fd2p);
.../glibc$ grep_glibc_prototype rexec_af
resolv/netdb.h:489:
extern int rexec_af (char **__restrict __ahost, int __rport,
		     const char *__restrict __name,
		     const char *__restrict __pass,
		     const char *__restrict __cmd, int *__restrict __fd2p,
		     sa_family_t __af);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 716df87cf9 regex.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in regcomp(), regexec(),
regerror().
Let's use it here too.

.../glibc$ grep_glibc_prototype regcomp
posix/regex.h:644:
extern int regcomp (regex_t *_Restrict_ __preg,
		    const char *_Restrict_ __pattern,
		    int __cflags);
.../glibc$ grep_glibc_prototype regexec
posix/regex.h:648:
extern int regexec (const regex_t *_Restrict_ __preg,
		    const char *_Restrict_ __String, size_t __nmatch,
		    regmatch_t __pmatch[_Restrict_arr_],
		    int __eflags);
.../glibc$ grep_glibc_prototype regerror
posix/regex.h:653:
extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg,
			char *_Restrict_ __errbuf, size_t __errbuf_size);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 0f8d366c7e realpath.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in realpath().
Let's use it here too.

.../glibc$ grep_glibc_prototype realpath
stdlib/stdlib.h:800:
extern char *realpath (const char *__restrict __name,
		       char *__restrict __resolved) __THROW __wur;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 1c82c77213 readdir_r.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in readdir_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype readdir_r
dirent/dirent.h:183:
extern int readdir_r (DIR *__restrict __dirp,
		      struct dirent *__restrict __entry,
		      struct dirent **__restrict __result)
     __nonnull ((1, 2, 3)) __attribute_deprecated__;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar a353324694 rcmd.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in rcmd(), rcmd_af(), iruserok_af().
Let's use it here too.

.../glibc$ grep_glibc_prototype rcmd
resolv/netdb.h:449:
extern int rcmd (char **__restrict __ahost, unsigned short int __rport,
		 const char *__restrict __locuser,
		 const char *__restrict __remuser,
		 const char *__restrict __cmd, int *__restrict __fd2p);
.../glibc$ grep_glibc_prototype rcmd_af
resolv/netdb.h:461:
extern int rcmd_af (char **__restrict __ahost, unsigned short int __rport,
		    const char *__restrict __locuser,
		    const char *__restrict __remuser,
		    const char *__restrict __cmd, int *__restrict __fd2p,
		    sa_family_t __af);
.../glibc$ grep_glibc_prototype iruserok_af
resolv/netdb.h:537:
extern int iruserok_af (const void *__raddr, int __suser,
			const char *__remuser, const char *__locuser,
			sa_family_t __af);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar e5dc2f3405 random_r.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in random_r(), initstate_r(), setstate_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype random_r
stdlib/stdlib.h:434:
extern int random_r (struct random_data *__restrict __buf,
		     int32_t *__restrict __result) __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype initstate_r
stdlib/stdlib.h:440:
extern int initstate_r (unsigned int __seed, char *__restrict __statebuf,
			size_t __statelen,
			struct random_data *__restrict __buf)
     __THROW __nonnull ((2, 4));
.../glibc$ grep_glibc_prototype setstate_r
stdlib/stdlib.h:445:
extern int setstate_r (char *__restrict __statebuf,
		       struct random_data *__restrict __buf)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 7ecee41323 qecvt.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in qecvt(), qfcvt().
Let's use it here too.

.../glibc$ grep_glibc_prototype qecvt
stdlib/stdlib.h:890:
extern char *qecvt (long double __value, int __ndigit,
		    int *__restrict __decpt, int *__restrict __sign)
     __THROW __nonnull ((3, 4)) __wur;
.../glibc$ grep_glibc_prototype qfcvt
stdlib/stdlib.h:893:
extern char *qfcvt (long double __value, int __ndigit,
		    int *__restrict __decpt, int *__restrict __sign)
     __THROW __nonnull ((3, 4)) __wur;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 315a87ce92 puts.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in fputs().
Let's use it here too.

.../glibc$ grep_glibc_prototype fputs
libio/stdio.h:631:
extern int fputs (const char *__restrict __s, FILE *__restrict __stream);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar fbe8945399 putpwent.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in putpwent().
Let's use it here too.

.../glibc$ grep_glibc_prototype putpwent
pwd/pwd.h:102:
extern int putpwent (const struct passwd *__restrict __p,
		     FILE *__restrict __f);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 5952677947 putgrent.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in putgrent().
Let's use it here too.

.../glibc$ grep_glibc_prototype putgrent
grp/grp.h:93:
extern int putgrent (const struct group *__restrict __p,
		     FILE *__restrict __f);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 4beb303a63 pthread_setschedparam.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in pthread_getschedparam().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_getschedparam
sysdeps/htl/pthread.h:882:
extern int pthread_getschedparam (pthread_t __thr, int *__restrict __policy,
				  struct sched_param *__restrict __param)
	__THROW __nonnull ((2, 3));
sysdeps/nptl/pthread.h:426:
extern int pthread_getschedparam (pthread_t __target_thread,
				  int *__restrict __policy,
				  struct sched_param *__restrict __param)
     __THROW __nonnull ((2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 9ab24a89a3 pthread_rwlockattr_setkind_np.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in pthread_rwlockattr_getkind_np().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_rwlockattr_getkind_np
sysdeps/htl/pthread.h:633:
extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
					  __restrict __attr,
					  int *__restrict __pref)
     __THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:983:
extern int pthread_rwlockattr_getkind_np (const pthread_rwlockattr_t *
					  __restrict __attr,
					  int *__restrict __pref)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 26f78eec84 pthread_mutexattr_getpshared.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in
pthread_mutexattr_getpshared().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_mutexattr_getpshared
sysdeps/htl/pthread.h:368:
extern int pthread_mutexattr_getpshared(const pthread_mutexattr_t *__restrict __attr,
					int *__restrict __pshared)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:830:
extern int pthread_mutexattr_getpshared (const pthread_mutexattr_t *
					 __restrict __attr,
					 int *__restrict __pshared)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 71f5a50a03 pthread_create.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in pthread_create().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_create
sysdeps/htl/pthread.h:212:
extern int pthread_create (pthread_t *__restrict __threadp,
			   __const pthread_attr_t *__restrict __attr,
			   void *(*__start_routine)(void *),
			   void *__restrict __arg) __THROWNL __nonnull ((1, 3));
sysdeps/nptl/pthread.h:200:
extern int pthread_create (pthread_t *__restrict __newthread,
			   const pthread_attr_t *__restrict __attr,
			   void *(*__start_routine) (void *),
			   void *__restrict __arg) __THROWNL __nonnull ((1, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 5a00663af2 pthread_attr_setstack.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in pthread_attr_setstack().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_setstack
sysdeps/htl/pthread.h:158:
extern int pthread_attr_setstack (pthread_attr_t *__attr,
				  void *__stackaddr,
				  size_t __stacksize)
	__THROW __nonnull ((1));
sysdeps/nptl/pthread.h:367:
extern int pthread_attr_setstack (pthread_attr_t *__attr, void *__stackaddr,
				  size_t __stacksize) __THROW __nonnull ((1));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 07bd2112f2 pthread_attr_setstacksize.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in pthread_attr_getstacksize().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getstacksize
sysdeps/htl/pthread.h:192:
extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict __attr,
				      size_t *__restrict __stacksize)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:346:
extern int pthread_attr_getstacksize (const pthread_attr_t *__restrict
				      __attr, size_t *__restrict __stacksize)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar 4517c06e47 pthread_attr_setstackaddr.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in pthread_attr_getstackaddr().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getstackaddr
sysdeps/htl/pthread.h:138:
extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict __attr,
				      void **__restrict __stackaddr)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:333:
extern int pthread_attr_getstackaddr (const pthread_attr_t *__restrict
				      __attr, void **__restrict __stackaddr)
     __THROW __nonnull ((1, 2)) __attribute_deprecated__;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar c5144bd329 pthread_attr_setscope.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in pthread_attr_getscope().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getscope
sysdeps/htl/pthread.h:125:
extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
				  int *__restrict __contentionscope)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:324:
extern int pthread_attr_getscope (const pthread_attr_t *__restrict __attr,
				  int *__restrict __scope)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar f0171b8a51 pthread_attr_setschedpolicy.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in pthread_attr_getschedpolicy().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getschedpolicy
sysdeps/htl/pthread.h:113:
extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict __attr,
					int *__restrict __policy)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:304:
extern int pthread_attr_getschedpolicy (const pthread_attr_t *__restrict
					__attr, int *__restrict __policy)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-14 21:29:13 +01:00
Alejandro Colomar c355fea451 pthread_attr_setguardsize.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in pthread_attr_getguardsize().
Let's use it here too.

.../glibc$ grep_glibc_prototype pthread_attr_getguardsize
sysdeps/htl/pthread.h:180:
extern int pthread_attr_getguardsize (const pthread_attr_t *__restrict __attr,
				      size_t *__restrict __guardsize)
	__THROW __nonnull ((1, 2));
sysdeps/nptl/pthread.h:283:
extern int pthread_attr_getguardsize (const pthread_attr_t *__attr,
				      size_t *__guardsize)
     __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar b5ca16254f printf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too
Both POSIX and glibc use 'restrict' in printf(), fprintf(),
dprintf(), sprintf(), snprintf(), vprintf(), vfprintf(),
vdprintf(), vsprintf(), vsnprintf().
Let's use it here too.

.../glibc$ grep_glibc_prototype printf
libio/stdio.h:332:
extern int printf (const char *__restrict __format, ...);
.../glibc$ grep_glibc_prototype fprintf
libio/stdio.h:326:
extern int fprintf (FILE *__restrict __stream,
		    const char *__restrict __format, ...);
.../glibc$ grep_glibc_prototype dprintf
libio/stdio.h:382:
extern int dprintf (int __fd, const char *__restrict __fmt, ...)
     __attribute__ ((__format__ (__printf__, 2, 3)));
.../glibc$ grep_glibc_prototype sprintf
libio/stdio.h:334:
extern int sprintf (char *__restrict __s,
		    const char *__restrict __format, ...) __THROWNL;
.../glibc$ grep_glibc_prototype snprintf
libio/stdio.h:354:
extern int snprintf (char *__restrict __s, size_t __maxlen,
		     const char *__restrict __format, ...)
     __THROWNL __attribute__ ((__format__ (__printf__, 3, 4)));
.../glibc$ grep_glibc_prototype vprintf
libio/stdio.h:347:
extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg);
.../glibc$ grep_glibc_prototype vfprintf
libio/stdio.h:341:
extern int vfprintf (FILE *__restrict __s, const char *__restrict __format,
		     __gnuc_va_list __arg);
.../glibc$ grep_glibc_prototype vdprintf
libio/stdio.h:379:
extern int vdprintf (int __fd, const char *__restrict __fmt,
		     __gnuc_va_list __arg)
     __attribute__ ((__format__ (__printf__, 2, 0)));
.../glibc$ grep_glibc_prototype vsprintf
libio/stdio.h:349:
extern int vsprintf (char *__restrict __s, const char *__restrict __format,
		     __gnuc_va_list __arg) __THROWNL;
.../glibc$ grep_glibc_prototype vsnprintf
libio/stdio.h:358:
extern int vsnprintf (char *__restrict __s, size_t __maxlen,
		      const char *__restrict __format, __gnuc_va_list __arg)
     __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
.../glibc$

ffix: Align common parameters.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 0864c24079 posix_spawn.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX uses 'restrict' in posix_spawnp().
However, glibc doesn't.
Let's document here the more restrictive of them, which is POSIX.
I reported a bug to glibc about this.

$ man 3p posix_spawnp |sed -n '/^SYNOPSIS/,/;/p'
SYNOPSIS
       #include <spawn.h>

       int posix_spawnp(pid_t *restrict pid, const char *restrict file,
           const posix_spawn_file_actions_t *file_actions,
           const posix_spawnattr_t *restrict attrp,
           char *const argv[restrict], char *const envp[restrict]);
$

.../glibc$ grep_glibc_prototype posix_spawnp
posix/spawn.h:85:
extern int posix_spawnp (pid_t *__pid, const char *__file,
			 const posix_spawn_file_actions_t *__file_actions,
			 const posix_spawnattr_t *__attrp,
			 char *const __argv[], char *const __envp[])
    __nonnull ((2, 5));
.../glibc$

I conciously did an exception with respect to the right margin
of the rendered page.  Instead of having the right margin at 78
as usual (per Branden's recommendation), I let it use col 79
this time, to avoid breaking the prototype in an ugly way,
or shifting all of the parameters to the left, unaligned with
respect to the function parentheses.

Bug: glibc <https://sourceware.org/bugzilla/show_bug.cgi?id=27529>
Cc: G. Branden Robinson <g.branden.robinson@gmail.com>
Cc: glibc <libc-alpha@sourceware.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar a2471dc690 posix_spawn.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in posix_spawn().
Let's use it here too.

.../glibc$ grep_glibc_prototype posix_spawn
posix/spawn.h:72:
extern int posix_spawn (pid_t *__restrict __pid,
			const char *__restrict __path,
			const posix_spawn_file_actions_t *__restrict
			__file_actions,
			const posix_spawnattr_t *__restrict __attrp,
			char *const __argv[__restrict_arr],
			char *const __envp[__restrict_arr])
    __nonnull ((2, 5));
.../glibc$

I conciously did an exception with respect to the right margin
of the rendered page.  Instead of having the right margin at 78
as usual (per Branden's recommendation), I let it use col 79
this time, to avoid breaking the prototype in an ugly way,
or shifting all of the parameters to the left, unaligned with
respect to the function parentheses.

Cc: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 6d512409df mq_receive.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in mq_timedreceive().
Let's use it here too.

.../glibc$ grep_glibc_prototype mq_timedreceive
rt/mqueue.h:76:
extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr,
				size_t __msg_len,
				unsigned int *__restrict __msg_prio,
				const struct timespec *__restrict __abs_timeout)
  __nonnull ((2, 5));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 7369646c2b mq_getattr.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in mq_setattr().
Let's use it here too.

.../glibc$ grep_glibc_prototype mq_setattr
rt/mqueue.h:51:
extern int mq_setattr (mqd_t __mqdes,
		       const struct mq_attr *__restrict __mqstat,
		       struct mq_attr *__restrict __omqstat)
  __THROW __nonnull ((2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 34aec7f9e8 mempcpy.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in mempcpy(), wmempcpy().
Let's use it here too.

.../glibc$ grep_glibc_prototype mempcpy
string/string.h:384:
extern void *mempcpy (void *__restrict __dest,
		      const void *__restrict __src, size_t __n)
     __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype wmempcpy
wcsmbs/wchar.h:276:
extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
			  const wchar_t *__restrict __s2, size_t __n)
     __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 855b2aeb8c mbtowc.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in mbtowc().
Let's use it here too.

.../glibc$ grep_glibc_prototype mbtowc
stdlib/stdlib.h:925:
extern int mbtowc (wchar_t *__restrict __pwc,
		   const char *__restrict __s, size_t __n) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 0634d31b54 mbstowcs.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in mbstowcs().
Let's use it here too.

.../glibc$ grep_glibc_prototype mbstowcs
stdlib/stdlib.h:933:
extern size_t mbstowcs (wchar_t *__restrict  __pwcs,
			const char *__restrict __s, size_t __n) __THROW
    __attr_access ((__read_only__, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar b4a5b81892 mbsrtowcs.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in mbsrtowcs().
Let's use it here too.

.../glibc$ grep_glibc_prototype mbsrtowcs
wcsmbs/wchar.h:337:
extern size_t mbsrtowcs (wchar_t *__restrict __dst,
			 const char **__restrict __src, size_t __len,
			 mbstate_t *__restrict __ps) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 68802a1ec5 mbsnrtowcs.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in mbsnrtowcs().
Let's use it here too.

.../glibc$ grep_glibc_prototype mbsnrtowcs
wcsmbs/wchar.h:351:
extern size_t mbsnrtowcs (wchar_t *__restrict __dst,
			  const char **__restrict __src, size_t __nmc,
			  size_t __len, mbstate_t *__restrict __ps) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar b0d2d2e0e3 mbrtowc.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in mbrtowc().
Let's use it here too.

.../glibc$ grep_glibc_prototype mbrtowc
wcsmbs/wchar.h:296:
extern size_t mbrtowc (wchar_t *__restrict __pwc,
		       const char *__restrict __s, size_t __n,
		       mbstate_t *__restrict __p) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 95bc7a7667 mbrlen.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in mbrlen().
Let's use it here too.

.../glibc$ grep_glibc_prototype mbrlen
wcsmbs/wchar.h:307:
extern size_t mbrlen (const char *__restrict __s, size_t __n,
		      mbstate_t *__restrict __ps) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar ca2eb1e614 malloc_hook.3: SYNOPSIS: Use 'volatile' in prototypes
glibc uses 'volatile' in __malloc_hook, __realloc_hook,
__memalign_hook, __free_hook, and __after_morecore_hook.
Let's use it here too.

.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\b__malloc_hook\b.*?;';
malloc/malloc.h:168:
extern void *(*__MALLOC_HOOK_VOLATILE __malloc_hook)(size_t __size,
                                                     const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\b__realloc_hook\b.*?;';
malloc/malloc.h:171:
extern void *(*__MALLOC_HOOK_VOLATILE __realloc_hook)(void *__ptr,
                                                      size_t __size,
                                                      const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
 |grep '\.h$' \
 |xargs pcregrep -Mn '(?s)\b__memalign_hook\b.*?;';
malloc/malloc.h:175:
extern void *(*__MALLOC_HOOK_VOLATILE __memalign_hook)(size_t __alignment,
                                                       size_t __size,
                                                       const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\b__free_hook\b.*?;';
malloc/malloc.h:165:
extern void (*__MALLOC_HOOK_VOLATILE __free_hook) (void *__ptr,
                                                   const void *)
__MALLOC_DEPRECATED;
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\*\w*\s*\b__malloc_initialize_hook\b.*?;';
malloc/malloc-hooks.h:22:
void (*__malloc_initialize_hook) (void);
.../glibc$ find * -type f \
  |grep '\.h$' \
  |xargs pcregrep -Mn '(?s)\*\w*\s*\b__after_morecore_hook\b.*?;';
malloc/malloc.h:179:
extern void (*__MALLOC_HOOK_VOLATILE __after_morecore_hook) (void)
  __MALLOC_DEPRECATED;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar e64e5812b3 makecontext.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX.1-2001 and glibc use 'restrict' in swapcontext().
Let's use it here too.

.../glibc$ grep_glibc_prototype swapcontext
stdlib/ucontext.h:41:
extern int swapcontext (ucontext_t *__restrict __oucp,
			const ucontext_t *__restrict __ucp)
  __THROWNL __INDIRECT_RETURN;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar c445280cf3 lio_listio.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in lio_listio().
However, POSIX is a bit more restrictive than glibc
for the second parameter.
Let's document the more restrictive POSIX variant.

$ man 3p lio_listio |sed -n '/^SYNOPSIS/,/;/p'
SYNOPSIS
       #include <aio.h>

       int lio_listio(int mode, struct aiocb *restrict const list[restrict],
           int nent, struct sigevent *restrict sig);
$

.../glibc$ grep_glibc_prototype lio_listio
rt/aio.h:148:
extern int lio_listio (int __mode,
		       struct aiocb *const __list[__restrict_arr],
		       int __nent, struct sigevent *__restrict __sig)
  __THROW __nonnull ((2));
.../glibc$

Cc: Szabolcs Nagy <Szabolcs.Nagy@arm.com>
Cc: "Joseph S. Myers" <joseph@codesourcery.com>
Cc: Ulrich Drepper <drepper@redhat.com>
Cc: Florian Weimer <fweimer@redhat.com>
Cc: glibc <libc-alpha@sourceware.org>
Bug: glibc <https://sourceware.org/bugzilla/show_bug.cgi?id=16747>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 6d1cb47e4e inet_pton.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in inet_pton().
Let's use it here too.

.../glibc$ grep_glibc_prototype inet_pton
inet/arpa/inet.h:58:
extern int inet_pton (int __af, const char *__restrict __cp,
		      void *__restrict __buf) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar cd18d63b1a inet_ntop.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in inet_ntop().
Let's use it here too.

.../glibc$ grep_glibc_prototype inet_ntop
inet/arpa/inet.h:64:
extern const char *inet_ntop (int __af, const void *__restrict __cp,
			      char *__restrict __buf, socklen_t __len)
     __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar decc37b2f7 iconv.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in iconv().
Let's use it here too.

.../glibc$ grep_glibc_prototype iconv
iconv/iconv.h:42:
extern size_t iconv (iconv_t __cd, char **__restrict __inbuf,
		     size_t *__restrict __inbytesleft,
		     char **__restrict __outbuf,
		     size_t *__restrict __outbytesleft);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 86ce858344 glob.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in glob().
Let's use it here too.

.../glibc$ grep_glibc_prototype glob
posix/glob.h:146:
extern int glob (const char *__restrict __pattern, int __flags,
		 int (*__errfunc) (const char *, int),
		 glob_t *__restrict __pglob) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 48294a557d getsubopt.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX does NOT specify getsubopt() to use 'restrict'.
However, glibc uses 'restrict'.
Users might be surprised by this!  Let's use it here too!

.../glibc$ grep_glibc_prototype getsubopt
stdlib/stdlib.h:958:
extern int getsubopt (char **__restrict __optionp,
		      char *const *__restrict __tokens,
		      char **__restrict __valuep)
     __THROW __nonnull ((1, 2, 3)) __wur;
.../glibc$

Cc: glibc <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 956e8829b5 getservent_r.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getservent_r(), getservbyname_r(),
getservbyport_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getservent_r
resolv/netdb.h:306:
extern int getservent_r (struct servent *__restrict __result_buf,
			 char *__restrict __buf, size_t __buflen,
			 struct servent **__restrict __result);
.../glibc$ grep_glibc_prototype getservbyname_r
resolv/netdb.h:310:
extern int getservbyname_r (const char *__restrict __name,
			    const char *__restrict __proto,
			    struct servent *__restrict __result_buf,
			    char *__restrict __buf, size_t __buflen,
			    struct servent **__restrict __result);
.../glibc$ grep_glibc_prototype getservbyport_r
resolv/netdb.h:316:
extern int getservbyport_r (int __port, const char *__restrict __proto,
			    struct servent *__restrict __result_buf,
			    char *__restrict __buf, size_t __buflen,
			    struct servent **__restrict __result);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-07 11:16:21 +01:00
Alejandro Colomar 4dfd2b4f70 getpwnam.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX does NOT specify these functions to use 'restrict'.
However, glibc uses 'restrict' in getpwnam_r(), getpwuid_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getpwnam_r
pwd/pwd.h:151:
extern int getpwnam_r (const char *__restrict __name,
		       struct passwd *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct passwd **__restrict __result)
		       __nonnull ((1, 2, 3, 5));
.../glibc$ grep_glibc_prototype getpwuid_r
pwd/pwd.h:145:
extern int getpwuid_r (__uid_t __uid,
		       struct passwd *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct passwd **__restrict __result)
		       __nonnull ((2, 3, 5));
.../glibc$

Cc: glibc <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:44:40 +01:00
Alejandro Colomar 69b7afbe94 getpwent_r.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getpwent_r(), fgetpwent_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getpwent_r
pwd/pwd.h:139:
extern int getpwent_r (struct passwd *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct passwd **__restrict __result)
		       __nonnull ((1, 2, 4));
.../glibc$ grep_glibc_prototype fgetpwent_r
pwd/pwd.h:166:
extern int fgetpwent_r (FILE *__restrict __stream,
			struct passwd *__restrict __resultbuf,
			char *__restrict __buffer, size_t __buflen,
			struct passwd **__restrict __result)
			__nonnull ((1, 2, 3, 5));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:44:40 +01:00
Alejandro Colomar 698bf7902f getprotoent_r.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getprotoent_r(), getprotobyname_r(),
getprotobynumber_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getprotoent_r
resolv/netdb.h:372:
extern int getprotoent_r (struct protoent *__restrict __result_buf,
			  char *__restrict __buf, size_t __buflen,
			  struct protoent **__restrict __result);
.../glibc$ grep_glibc_prototype getprotobyname_r
resolv/netdb.h:376:
extern int getprotobyname_r (const char *__restrict __name,
			     struct protoent *__restrict __result_buf,
			     char *__restrict __buf, size_t __buflen,
			     struct protoent **__restrict __result);
.../glibc$ grep_glibc_prototype getprotobynumber_r
resolv/netdb.h:381:
extern int getprotobynumber_r (int __proto,
			       struct protoent *__restrict __result_buf,
			       char *__restrict __buf, size_t __buflen,
			       struct protoent **__restrict __result);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:44:40 +01:00
Alejandro Colomar 0bbc1dec0e getnetent_r.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getnetent_r(), getnetbyname_r(),
getnetbyaddr_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getnetent_r
resolv/netdb.h:235:
extern int getnetent_r (struct netent *__restrict __result_buf,
			char *__restrict __buf, size_t __buflen,
			struct netent **__restrict __result,
			int *__restrict __h_errnop);
.../glibc$ grep_glibc_prototype getnetbyname_r
resolv/netdb.h:246:
extern int getnetbyname_r (const char *__restrict __name,
			   struct netent *__restrict __result_buf,
			   char *__restrict __buf, size_t __buflen,
			   struct netent **__restrict __result,
			   int *__restrict __h_errnop);
.../glibc$ grep_glibc_prototype getnetbyaddr_r
resolv/netdb.h:240:
extern int getnetbyaddr_r (uint32_t __net, int __type,
			   struct netent *__restrict __result_buf,
			   char *__restrict __buf, size_t __buflen,
			   struct netent **__restrict __result,
			   int *__restrict __h_errnop);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:44:40 +01:00
Alejandro Colomar ce73ed19b0 getnameinfo.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in getnameinfo().
Let's use it here too.

I consciously did an exception with respect to the right margin
of the rendered page.  Instead of having the right margin at 78
as usual (per Branden's recommendation), I let it use col 79
this time, to avoid breaking the prototype in an ugly way.

.../glibc$ grep_glibc_prototype getnameinfo
resolv/netdb.h:675:
extern int getnameinfo (const struct sockaddr *__restrict __sa,
			socklen_t __salen, char *__restrict __host,
			socklen_t __hostlen, char *__restrict __serv,
			socklen_t __servlen, int __flags);
.../glibc$

Cc: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:44:16 +01:00
Alejandro Colomar 8fbe36d625 getmntent.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in addmntent(), getmntent_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype addmntent
misc/mntent.h:81:
extern int addmntent (FILE *__restrict __stream,
		      const struct mntent *__restrict __mnt) __THROW;
.../glibc$ grep_glibc_prototype getmntent_r
misc/mntent.h:73:
extern struct mntent *getmntent_r (FILE *__restrict __stream,
				   struct mntent *__restrict __result,
				   char *__restrict __buffer,
				   int __bufsize) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 22f4c26563 getline.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in getline(), getdelim().
Let's use it here too.

.../glibc$ grep_glibc_prototype getline
libio/stdio.h:621:
extern __ssize_t getline (char **__restrict __lineptr,
                          size_t *__restrict __n,
                          FILE *__restrict __stream) __wur;
.../glibc$ grep_glibc_prototype getdelim
libio/stdio.h:611:
extern __ssize_t getdelim (char **__restrict __lineptr,
                           size_t *__restrict __n, int __delimiter,
                           FILE *__restrict __stream) __wur;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 938c8215eb gethostbyname.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in gethostent_r(), gethostbyaddr_r(),
gethostbyname_r(), gethostbyname2_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype gethostent_r
resolv/netdb.h:165:
extern int gethostent_r (struct hostent *__restrict __result_buf,
			 char *__restrict __buf, size_t __buflen,
			 struct hostent **__restrict __result,
			 int *__restrict __h_errnop);
.../glibc$ grep_glibc_prototype gethostbyaddr_r
resolv/netdb.h:170:
extern int gethostbyaddr_r (const void *__restrict __addr, __socklen_t __len,
			    int __type,
			    struct hostent *__restrict __result_buf,
			    char *__restrict __buf, size_t __buflen,
			    struct hostent **__restrict __result,
			    int *__restrict __h_errnop);
.../glibc$ grep_glibc_prototype gethostbyname_r
resolv/netdb.h:177:
extern int gethostbyname_r (const char *__restrict __name,
			    struct hostent *__restrict __result_buf,
			    char *__restrict __buf, size_t __buflen,
			    struct hostent **__restrict __result,
			    int *__restrict __h_errnop);
.../glibc$ grep_glibc_prototype gethostbyname2_r
resolv/netdb.h:183:
extern int gethostbyname2_r (const char *__restrict __name, int __af,
			     struct hostent *__restrict __result_buf,
			     char *__restrict __buf, size_t __buflen,
			     struct hostent **__restrict __result,
			     int *__restrict __h_errnop);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 2bebee6f60 getgrnam.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX does NOT specify these functions to use 'restrict'.
However, glibc uses 'restrict' in getgrnam_r(), getgrgid_r().
Users might be surprised by this!  Let's use it here too!

.../glibc$ grep_glibc_prototype getgrnam_r
grp/grp.h:148:
extern int getgrnam_r (const char *__restrict __name,
		       struct group *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct group **__restrict __result);
.../glibc$ grep_glibc_prototype getgrgid_r
grp/grp.h:140:
extern int getgrgid_r (__gid_t __gid, struct group *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct group **__restrict __result);
.../glibc$

Cc: glibc <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 61f75e878a getgrent_r.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getgrent_r(), fgetgrent_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getgrent_r
grp/grp.h:131:
extern int getgrent_r (struct group *__restrict __resultbuf,
		       char *__restrict __buffer, size_t __buflen,
		       struct group **__restrict __result);
.../glibc$ grep_glibc_prototype fgetgrent_r
grp/grp.h:161:
extern int fgetgrent_r (FILE *__restrict __stream,
			struct group *__restrict __resultbuf,
			char *__restrict __buffer, size_t __buflen,
			struct group **__restrict __result);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 934e516236 getdirentries.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getdirentries().
Let's use it here too.

.../glibc$ grep_glibc_prototype getdirentries
dirent/dirent.h:353:
extern __ssize_t getdirentries (int __fd, char *__restrict __buf,
				size_t __nbytes,
				__off_t *__restrict __basep)
     __THROW __nonnull ((2, 4));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 5e0058dce8 getdate.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getdate_r().
Let's use it here too.

.../glibc$ grep_glibc_prototype getdate_r
time/time.h:297:
extern int getdate_r (const char *__restrict __string,
		      struct tm *__restrict __resbufp);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 79201b695e getaddrinfo_a.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' in getaddrinfo_a().
Let's use it here too.

.../glibc$ grep_glibc_prototype getaddrinfo_a
resolv/netdb.h:690:
extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr],
			  int __ent, struct sigevent *__restrict __sig);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 854214715b getaddrinfo.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in getaddrinfo().
Let's use it here too.

.../glibc$ grep_glibc_prototype getaddrinfo;
resolv/netdb.h:660:
extern int getaddrinfo (const char *__restrict __name,
			const char *__restrict __service,
			const struct addrinfo *__restrict __req,
			struct addrinfo **__restrict __pai);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:24:23 +01:00
Alejandro Colomar 2b19457ac5 fseek.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in fgetpos().
Let's use it here too.

glibc:
=============================  fgetpos
libio/stdio.h:736:
int fgetpos (FILE *restrict stream, fpos_t *restrict pos);

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 93a4d1d504 fread.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in these functions.
Let's use it here too.

glibc:
=============================  fread
libio/stdio.h:651:
size_t fread (void *restrict ptr, size_t size,
                     size_t n, FILE *restrict stream) wur;
=============================  fwrite
libio/stdio.h:657:
size_t fwrite (const void *restrict ptr, size_t size,
                      size_t n, FILE *restrict s);

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar a7bbdaf7b8 fputws.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in fputws().
Let's use it here too.

glibc:
=============================  fputws
wcsmbs/wchar.h:765:
int fputws (const wchar_t *restrict ws,
                   FILE *restrict stream);

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 1ac0a9ccbc fopen.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' for some of these functions.
Let's use it here too.

glibc:
=============================  fopen
libio/stdio.h:246:
FILE *fopen (const char *restrict filename,
                    const char *restrict modes) wur;
=============================  fdopen
libio/stdio.h:279:
FILE *fdopen (int fd, const char *modes) THROW wur;
=============================  freopen
libio/stdio.h:252:
FILE *freopen (const char *restrict filename,
                      const char *restrict modes,
                      FILE *restrict stream) wur;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar f61d0340cc fopencookie.3: SYNOPSIS: Use 'restrict' in prototypes
glibc uses 'restrict' for fopencookie().
Let's use it here too.

glibc:
libio/stdio.h:285:
FILE *fopencookie (void *restrict magic_cookie,
                          const char *restrict modes,
                          cookie_io_functions_t io_funcs) THROW wur;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar e7bb37ab1b fgetws.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' for fgetws().
Let's use it here too.

glibc:
wcsmbs/wchar.h:758:
wchar_t *fgetws (wchar_t *restrict ws, int n,
                        FILE *restrict stream);

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar ef5781cf66 fgetc.3: SYNOPSIS: Use 'restrict' in prototypes
Both POSIX and glibc use 'restrict' in fgets().
Let's use it here too.

glibc:
libio/stdio.h:568:
char *fgets (char *restrict s, int n, FILE *restrict stream)
     wur attr_access ((write_only__, 1, 2));

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar ebf67ad6ad envz_add.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for these functions
Let's use it here too.

=============================  envz_add
string/envz.h:49:
error_t envz_add (char **restrict envz,
                         size_t *restrict envz_len,
                         const char *restrict name,
                         const char *restrict value) THROW;
=============================  envz_entry
string/envz.h:33:
char *envz_entry (const char *restrict envz, size_t envz_len,
                         const char *restrict name)
     THROW attribute_pure__;
=============================  envz_get
string/envz.h:39:
char *envz_get (const char *restrict envz, size_t envz_len,
                       const char *restrict name)
     THROW attribute_pure__;
=============================  envz_merge
string/envz.h:57:
error_t envz_merge (char **restrict envz,
                           size_t *restrict envz_len,
                           const char *restrict envz2,
                           size_t envz2_len, int override) THROW;
=============================  envz_remove
string/envz.h:63:
void envz_remove (char **restrict envz,
                         size_t *restrict envz_len,
                         const char *restrict name) THROW;
=============================  envz_strip
string/envz.h:68:
void envz_strip (char **restrict envz,
                        size_t *restrict envz_len) THROW;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 017103fa19 ecvt.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX.1-2001 and glibc use 'restrict' for these functions.
Let's use it here too.

glibc:
=============================  ecvt
stdlib/stdlib.h:872:
char *ecvt (double value, int ndigit, int *restrict decpt,
                   int *restrict sign) THROW nonnull ((3, 4)) wur;
=============================  fcvt
stdlib/stdlib.h:878:
char *fcvt (double value, int ndigit, int *restrict decpt,
                   int *restrict sign) THROW nonnull ((3, 4)) wur;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar f0eb582b99 ecvt_r.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for these functions

=============================  ecvt_r
stdlib/stdlib.h:902:
int ecvt_r (double value, int ndigit, int *restrict decpt,
                   int *restrict sign, char *restrict buf,
                   size_t len) THROW nonnull ((3, 4, 5));
=============================  fcvt_r
stdlib/stdlib.h:905:
int fcvt_r (double value, int ndigit, int *restrict decpt,
                   int *restrict sign, char *restrict buf,
                   size_t len) THROW nonnull ((3, 4, 5));
=============================  qecvt_r
stdlib/stdlib.h:909:
int qecvt_r (long double value, int ndigit,
                    int *restrict decpt, int *restrict sign,
                    char *restrict buf, size_t len)
     THROW nonnull ((3, 4, 5));
=============================  qfcvt_r
stdlib/stdlib.h:913:
int qfcvt_r (long double value, int ndigit,
                    int *restrict decpt, int *restrict sign,
                    char *restrict buf, size_t len)
     THROW nonnull ((3, 4, 5));

Let's use it here too.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar f6ce9b1dbe drand48_r.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for some of the functions in this page:

=============================  drand48_r
stdlib/stdlib.h:501:
int drand48_r (struct drand48_data *restrict buffer,
                      double *restrict result) THROW nonnull ((1, 2));
=============================  erand48_r
stdlib/stdlib.h:503:
int erand48_r (unsigned short int xsubi[3],
                      struct drand48_data *restrict buffer,
                      double *restrict result) THROW nonnull ((1, 2));
=============================  lrand48_r
stdlib/stdlib.h:508:
int lrand48_r (struct drand48_data *restrict buffer,
                      long int *restrict result)
     THROW nonnull ((1, 2));
=============================  nrand48_r
stdlib/stdlib.h:511:
int nrand48_r (unsigned short int xsubi[3],
                      struct drand48_data *restrict buffer,
                      long int *restrict result)
     THROW nonnull ((1, 2));
=============================  mrand48_r
stdlib/stdlib.h:517:
int mrand48_r (struct drand48_data *restrict buffer,
                      long int *restrict result)
     THROW nonnull ((1, 2));
=============================  jrand48_r
stdlib/stdlib.h:520:
int jrand48_r (unsigned short int xsubi[3],
                      struct drand48_data *restrict buffer,
                      long int *restrict result)
     THROW nonnull ((1, 2));
=============================  srand48_r
stdlib/stdlib.h:526:
int srand48_r (long int seedval, struct drand48_data *buffer)
     THROW nonnull ((2));
=============================  seed48_r
stdlib/stdlib.h:529:
int seed48_r (unsigned short int seed16v[3],
                     struct drand48_data *buffer) THROW nonnull ((1, 2));
=============================  lcong48_r
stdlib/stdlib.h:532:
int lcong48_r (unsigned short int param[7],
                      struct drand48_data *buffer)
     THROW nonnull ((1, 2));

Let's use it here too.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar ad85578a68 dlsym.3: SYNOPSIS: Use 'restrict' in prototypes; add missing 'const' too
POSIX specifies that the parameters of dlsym()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

The glibc specific dlvsym() also uses 'restrict'.
Its 2nd and 3rd parameters are 'const' too.

Fix the prototypes to add these qualifiers.

......

.../glibc$ grep_glibc_prototype dlsym
dlfcn/dlfcn.h:64:
extern void *dlsym (void *__restrict __handle,
		    const char *__restrict __name) __THROW __nonnull ((2));
.../glibc$ grep_glibc_prototype dlvsym
dlfcn/dlfcn.h:73:
extern void *dlvsym (void *__restrict __handle,
		     const char *__restrict __name,
		     const char *__restrict __version)
     __THROW __nonnull ((2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar fbea610b4a dlinfo.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for dlinfo().
Let's use it here too.

......

.../glibc$ grep_glibc_prototype dlinfo
dlfcn/dlfcn.h:123:
extern int dlinfo (void *__restrict __handle,
		   int __request, void *__restrict __arg)
     __THROW __nonnull ((1, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 0300d62fc1 ctime.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX does NOT specify ctime_r() to use 'restrict'.
However, glibc uses 'restrict'.
Users might be surprised by this!  Let's use it here too!

......

.../glibc$ grep_glibc_prototype ctime_r
timezone/private.h:504:
char *ctime_r(time_t const *, char *);
timezone/private.h:712:
char *ctime_r(time_t const *, char *);
time/time.h:153:
extern char *ctime_r (const time_t *__restrict __timer,
		      char *__restrict __buf) __THROW;
.../glibc$

Cc: <libc-alpha@sourceware.org>
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar cd7ebdf9ae ctime.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of asctime_r(), gmtime_r(),
and localtime_r() shall be restrict.  Glibc uses 'restrict' too.
Let's use it here too.

ctime_r will be covered in a future commit,
as the glibc implementation differs from POSIX.

......

=============================  asctime
timezone/private.h:501:
char *asctime(struct tm const *);
time/time.h:139:
char *asctime (const struct tm *tp) THROW;
=============================  asctime_r
timezone/private.h:502:
char *asctime_r(struct tm const *restrict, char *restrict);
timezone/private.h:522:
char *asctime_r(struct tm const *restrict, char *restrict);
timezone/private.h:711:
char *asctime_r(struct tm const *, char *);
time/time.h:149:
char *asctime_r (const struct tm *restrict tp,
                        char *restrict buf) THROW;
=============================  ctime
timezone/private.h:503:
char *ctime(time_t const *);
time/time.h:142:
char *ctime (const time_t *timer) THROW;
=============================  ctime_r
timezone/private.h:504:
char *ctime_r(time_t const *, char *);
timezone/private.h:712:
char *ctime_r(time_t const *, char *);
time/time.h:153:
char *ctime_r (const time_t *restrict timer,
                      char *restrict buf) THROW;
=============================  gmtime
timezone/private.h:512:
struct tm *gmtime(time_t const *);
time/time.h:119:
struct tm *gmtime (const time_t *timer) THROW;
=============================  gmtime_r
timezone/private.h:513:
struct tm *gmtime_r(time_t const *restrict, struct tm *restrict);
time/time.h:128:
struct tm *gmtime_r (const time_t *restrict timer,
                            struct tm *restrict tp) THROW;
=============================  localtime
timezone/private.h:514:
struct tm *localtime(time_t const *);
time/time.h:123:
struct tm *localtime (const time_t *timer) THROW;
=============================  localtime_r
timezone/private.h:515:
struct tm *localtime_r(time_t const *restrict, struct tm *restrict);
time/time.h:133:
struct tm *localtime_r (const time_t *restrict timer,
                               struct tm *restrict tp) THROW;
=============================  mktime
timezone/private.h:516:
time_t mktime(struct tm *);
time/time.h:82:
time_t mktime (struct tm *tp) THROW;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar b5e85c2ef5 crypt.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for the 3rd parameter of crypt_r().
Let's use it here too.

......

.../glibc$ grep_glibc_prototype crypt_t
crypt/crypt.h:63:
extern char *crypt_r (const char *__phrase, const char *__salt,
		      struct crypt_data * __restrict __data)
     __THROW __nonnull ((1, 2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 9112c654ed memcpy.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of memcpy()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

It's especially important in memcpy(),
as it's been a historical source of bugs.

......

.../glibc$ grep_glibc_prototype memcpy
posix/regex_internal.h:746:
{
  memcpy (dest, src, sizeof (bitset_t));
string/string.h:43:
extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
		     size_t __n) __THROW __nonnull ((1, 2));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 98a1e7336e memccpy.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of memccpy()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype memccpy
string/string.h:54:
extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
		      int __c, size_t __n)
    __THROW __nonnull ((1, 2)) __attr_access ((__write_only__, 1, 4));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 23bdd87451 asprintf.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for [v]asprintf().
Let's use it here too.

......

.../glibc$ grep_glibc_prototype asprintf
libio/stdio.h:372:
extern int asprintf (char **__restrict __ptr,
		     const char *__restrict __fmt, ...)
     __THROWNL __attribute__ ((__format__ (__printf__, 2, 3))) __wur;
.../glibc$ grep_glibc_prototype vasprintf
libio/stdio.h:366:
extern int vasprintf (char **__restrict __ptr, const char *__restrict __f,
		      __gnuc_va_list __arg)
     __THROWNL __attribute__ ((__format__ (__printf__, 2, 0))) __wur;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 62b6077961 argz_add.3: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for some of the functions in this page:

=============================  argz_add
string/argz.h:76:
error_t argz_add (char **restrict argz,
                         size_t *restrict argz_len,
                         const char *restrict str) THROW;
=============================  argz_add_sep
string/argz.h:82:
error_t argz_add_sep (char **restrict argz,
                             size_t *restrict argz_len,
                             const char *restrict string, int delim)
     THROW;
=============================  argz_append
string/argz.h:70:
error_t argz_append (char **restrict argz,
                            size_t *restrict argz_len,
                            const char *restrict buf, size_t buf_len)
     THROW;
=============================  argz_count
string/argz.h:54:
size_t argz_count (const char *argz, size_t len)
     THROW attribute_pure__;
=============================  argz_create
string/argz.h:40:
error_t argz_create (char *const argv[], char **restrict argz,
                            size_t *restrict len) THROW;
=============================  argz_create_sep
string/argz.h:47:
error_t argz_create_sep (const char *restrict string,
                                int sep, char **restrict argz,
                                size_t *restrict len) THROW;
=============================  argz_delete
string/argz.h:88:
void argz_delete (char **restrict argz,
                         size_t *restrict argz_len,
                         char *restrict entry) THROW;
=============================  argz_extract
string/argz.h:61:
void argz_extract (const char *restrict argz, size_t len,
                          char **restrict argv) THROW;
=============================  argz_insert
string/argz.h:98:
error_t argz_insert (char **restrict argz,
                            size_t *restrict argz_len,
                            char *restrict before,
                            const char *restrict entry) THROW;
=============================  argz_next
string/argz.h:128:
char *argz_next (const char *restrict argz, size_t argz_len,
                        const char *restrict entry) THROW;
=============================  argz_replace
string/argz.h:106:
error_t argz_replace (char **restrict argz,
                             size_t *restrict argz_len,
                             const char *restrict str,
                             const char *restrict with,
                             unsigned int *restrict replace_count);
=============================  argz_stringify
string/argz.h:67:
void argz_stringify (char *argz, size_t len, int sep) THROW;

Let's use it here too.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:12:22 +01:00
Alejandro Colomar 252ec2330f inode.7: tfix
Epoch is 1970-01-01 00:00:00 +0000, UTC (see time(7)).

Reported-by: Walter Franzini <walter.franzini@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:32 +01:00
Michael Kerrisk d7461050ad pthread_create.3: Fix a signedness error in the example code
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:32 +01:00
Michael Kerrisk 9b4d747db7 pthread_create.3: Fix undeclared variable error in example program
Reported-by: Paran Lee <p4ranlee@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:32 +01:00
Alejandro Colomar e82f7bbb11 ftw.3: SYNOPSIS: Remove duplicate header
Both functions have the same header.
There's no reason to separate the prototypes repeating the header.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:32 +01:00
Jens Axboe c245512ad0 man2/openat2.2: Add RESOLVE_CACHED
RESOLVE_CACHED allows an application to attempt a cache-only open
of a file. If this isn't possible, the request will fail with
-1/EAGAIN and the caller should retry without RESOLVE_CACHED set.
This will generally happen from a different context, where a slower
open operation can be performed.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:32 +01:00
Alejandro Colomar 7f8d77c52b getopt.3: ffix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:32 +01:00
Jakub Wilk b88c066d29 scripts/bash_aliases: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:32 +01:00
Michael Kerrisk b007f233f5 kcmp.2: Since Linux 5.12, kcmp() availability is unconditional
kcmp() is no longer dependent on CONFIG_CHECKPOINT_RESTORE.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-03-03 23:06:16 +01:00
Philipp Schuster efbcc10934 netlink.7: Clarify details of netlink error responses
Make it clear that netlink error responses (i.e., messages with
type NLMSG_ERROR (0x2)), can be longer than sizeof(struct
nlmsgerr). In certain circumstances, the payload can be longer.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-21 09:57:04 +01:00
edef 04fd7f3121 futex.2: tfix
Signed-off-by: edef <edef@edef.eu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-20 22:46:59 +01:00
Alejandro Colomar 64b8654d8b scripts/bash_aliases: Add useful functions
That file should be sourced (.) from 'bashrc' (or 'bash_aliases').

It contains functions that are useful for the maintenance of this
project.

- grep_syscall()
- grep_syscall_def()
- man_section()
- man_lsfunc()
- pdfman()
- grep_glibc_prototype()

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-20 22:45:20 +01:00
Alejandro Colomar cad9592876 aio_suspend.3: SYNOPSIS: Use 'restrict' in prototypes
POSIX does NOT specify aio_suspend() to use 'restrict'.
However, glibc uses 'restrict'.
Users might be surprised by this!  Let's use it here too!

......

.../glibc$ grep_glibc_prototype aio_suspend
rt/aio.h:167:
extern int aio_suspend (const struct aiocb *const __list[], int __nent,
			const struct timespec *__restrict __timeout)
  __nonnull ((1));
.../glibc$

Cc: libc-alpha@sourceware.org
Cc: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-20 15:36:11 +01:00
edef d089fdeced ptrace.2: tfix
Signed-off-by: edef <edef@edef.eu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-20 15:27:19 +01:00
Michael Kerrisk 713c9be812 time_namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-20 15:21:58 +01:00
Jakub Wilk 0dd470d3ee pciconfig_read.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-20 15:15:46 +01:00
Michael Kerrisk d5c5da47bd prctl.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 14:29:32 +01:00
Alejandro Colomar aa4bbfd5ed setjmp.3: SYNOPSIS: Use 'noreturn' in prototypes
POSIX specifies that [sig]longjmp() shall not return,
transferring control back to the caller of [sig]setjmp().
Glibc uses __attribute__((__noreturn__)) for [sig]longjmp().
Let's use standard C11 'noreturn' in the manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:29:34 +01:00
Alejandro Colomar 6c49c14bdb pthread_exit.3: SYNOPSIS: Use 'noreturn' in prototypes
POSIX specifies that pthread_exit() shall not return.
Glibc uses __attribute__((__noreturn__)).
Let's use standard C11 'noreturn' in the manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:29:34 +01:00
Alejandro Colomar cec1239183 exit.3: SYNOPSIS: Use 'noreturn' in prototypes
POSIX specifies that exit() shall not return.
Glibc uses __attribute__((__noreturn__)).
Let's use standard C11 'noreturn' in the manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:29:34 +01:00
Alejandro Colomar 9ca4896771 err.3: SYNOPSIS: Use 'noreturn' in prototypes
Glibc uses __attribute__((__noreturn__)) for [v]err[x]().
These functions never return.
Let's use standard C11 'noreturn' in the manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:29:34 +01:00
Alejandro Colomar d8a9e2bbf5 _exit.2: SYNOPSIS: Use 'noreturn' in prototypes
POSIX specifies that _exit() and _Exit() shall not return.
Glibc uses __attribute__((__noreturn__)).
Let's use standard C11 'noreturn' in the manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:29:34 +01:00
Alejandro Colomar 0dfa5792bc abort.3: SYNOPSIS: Use 'noreturn' in prototypes
POSIX specifies that abort() shall not return.
Glibc uses __attribute__((__noreturn__)).
Let's use standard C11 'noreturn' in the manual page.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:29:34 +01:00
Michael Kerrisk 2b15f8c59e error.3: Clarify the meaning of 'status==0' for error(3)
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Reported-by: Walter Harms <wharms@bfs.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-19 13:21:50 +01:00
Alejandro Colomar fb0390dc5b strerror.3: VERSIONS: Document that strerrorname_np() and strerrordesc_np() functions first appeared on glibc 2.32
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-18 08:57:27 +01:00
Dmitry V. Levin 1e6910c947 epoll_wait.2: CONFORMING TO: note that epoll_pwait2() is Linux-specific
Mention epoll_pwait2 in "CONFORMING TO" section.

Complements: ba47eb5e3 "epoll_wait.2: Add documentation of epoll_pwait2()"
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-18 08:56:01 +01:00
Michael Kerrisk 7dc3250afc process_madvise.2: Add CONFORMING TO
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-18 08:54:06 +01:00
Michael Kerrisk 86e7d29168 Makefile: Fix html target bug
Switching into the man? subdirectories when running man2html(1)
caused a bug where ".so dir/page.n" links were misinterpreted
(because the directory prefix was interpreted with respect to
the current directory)i, and consequently, the link files
were not correctly rendered. There's no need to switch into the
subdirectories.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-16 11:07:36 +01:00
Michael Kerrisk 106843a6b7 elf.5: srcfix: Remove idiosyncratic mark-up
This page uses some idiosyncratic mark-up involving the use of
a groff register. The mark-up actually makes no difference to
the formatted result, but does cause man2html(1) to emit error
messages, since it does not understand the mark-up. So, remove
that mark-up.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-16 11:06:37 +01:00
Alejandro Colomar 9f80f9e34a simpleq.3, stailq.3, queue.7, SIMPLEQ_*.3: Document SIMPLEQ_*() as an alias to STAILQ_*() macros
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 21:31:33 +01:00
Alejandro Colomar de85f9235d pciconfig_read.2: SYNOPSIS: Fix prototype parameter types
Use the glibc prototypes instead of the kernel ones.
Exception: use 'int' instead of 'enum'.

......

.../glibc$ grep_glibc_prototype pciconfig_read
sysdeps/unix/sysv/linux/alpha/sys/io.h:72:
extern int pciconfig_read (unsigned long int __bus,
			   unsigned long int __dfn,
			   unsigned long int __off,
			   unsigned long int __len,
			   unsigned char *__buf) __THROW;
sysdeps/unix/sysv/linux/ia64/sys/io.h:57:
extern int pciconfig_read (unsigned long int __bus, unsigned long int __dfn,
			   unsigned long int __off, unsigned long int __len,
			   unsigned char *__buf);
.../glibc$ grep_glibc_prototype pciconfig_write
sysdeps/unix/sysv/linux/alpha/sys/io.h:78:
extern int pciconfig_write (unsigned long int __bus,
			    unsigned long int __dfn,
			    unsigned long int __off,
			    unsigned long int __len,
			    unsigned char *__buf) __THROW;
sysdeps/unix/sysv/linux/ia64/sys/io.h:61:
extern int pciconfig_write (unsigned long int __bus, unsigned long int __dfn,
			    unsigned long int __off, unsigned long int __len,
			    unsigned char *__buf);
.../glibc$ grep_glibc_prototype pciconfig_iobase
sysdeps/unix/sysv/linux/alpha/sys/io.h:66:
extern long pciconfig_iobase(enum __pciconfig_iobase_which __which,
			     unsigned long int __bus,
			     unsigned long int __dfn)
     __THROW __attribute__ ((const));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 21:11:29 +01:00
Alejandro Colomar 2b83f49313 vmsplice.2: SYNOPSIS: Fix prototype parameter type
The 3rd parameter of vmsplice() uses 'size_t' in glibc.  Fix it.

......

.../gnu/glibc$ grep_glibc_prototype vmsplice
sysdeps/unix/sysv/linux/bits/fcntl-linux.h:391:
extern __ssize_t vmsplice (int __fdout, const struct iovec *__iov,
			   size_t __count, unsigned int __flags);
.../gnu/glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 21:10:47 +01:00
Alejandro Colomar 0ce020a3f6 lookup_dcookie.2: Use standard types: u64 -> uint64_t
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:58:43 +01:00
Alejandro Colomar 5de448e93c tkill.2: SYNOPSIS: Fix prototype parameter types
All but the last parameters of t[g]kill() use 'pid_t',
both in the kernel and glibc.  Fix them.

......

.../linux/linux$ grep_syscall tkill
kernel/signal.c:3870:
SYSCALL_DEFINE2(tkill, pid_t, pid, int, sig)
include/linux/syscalls.h:685:
asmlinkage long sys_tkill(pid_t pid, int sig);
.../linux/linux$

.../gnu/glibc$ grep_glibc_prototype tgkill
sysdeps/unix/sysv/linux/bits/signal_ext.h:29:
extern int tgkill (__pid_t __tgid, __pid_t __tid, int __signal);
.../gnu/glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:58:20 +01:00
Alejandro Colomar beb7a3c10e spu_run.2: SYNOPSIS: Fix prototype parameter types
The 2nd and 3rd parameters of spu_run() use 'uint32_t *'.  Fix it.

......

.../linux$ grep_syscall spu_run
arch/powerpc/platforms/cell/spu_syscalls.c:80:
SYSCALL_DEFINE3(spu_run,int, fd, __u32 __user *, unpc, __u32 __user *, ustatus)
include/linux/syscalls.h:1034:
asmlinkage long sys_spu_run(int fd, __u32 __user *unpc,
				 __u32 __user *ustatus);
.../linux$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:57:56 +01:00
Alejandro Colomar 0a37ff53bc spu_create.2: SYNOPSIS: Fix prototype parameter type
The 'flags' parameter of spu_create() uses 'unsigned int'.  Fix it.

......

.../linux$ grep_syscall spu_create
arch/powerpc/platforms/cell/spu_syscalls.c:56:
SYSCALL_DEFINE4(spu_create, const char __user *, name, unsigned int, flags,
	umode_t, mode, int, neighbor_fd)
include/linux/syscalls.h:1036:
asmlinkage long sys_spu_create(const char __user *name,
		unsigned int flags, umode_t mode, int fd);
.../linux$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:57:36 +01:00
Alejandro Colomar 9bebb17e5b splice.2: Use 'off64_t' instead of 'loff_t'
The kernel syscall uses 'loff_t', but the glibc wrapper uses 'off64_t'.
Let's document the wrapper prototype, as in other pages.

......

.../glibc$ grep_glibc_prototype splice
sysdeps/unix/sysv/linux/bits/fcntl-linux.h:398:
extern __ssize_t splice (int __fdin, __off64_t *__offin, int __fdout,
			 __off64_t *__offout, size_t __len,
			 unsigned int __flags);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:57:19 +01:00
Alejandro Colomar 8494be5e85 setfsgid.2: tfix
The type of fsgid is git_t, and not uid_t.  Fix it.

......

.../glibc$ grep_glibc_prototype setfsgid
sysdeps/unix/sysv/linux/sys/fsuid.h:31:
extern int setfsgid (__gid_t __gid) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:53:35 +01:00
Michael Kerrisk 0181a85a16 socketcall.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:52:43 +01:00
Michael Kerrisk ccb8164053 socketcall.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:52:24 +01:00
Alejandro Colomar fa50e1599e socketcall.2: Add note about missing glibc wrapper
......

.../glibc$ grep_glibc_prototype socketcall
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:51:31 +01:00
Alejandro Colomar 2e5ae1b775 sched_setattr.2: Add note about missing glibc wrappers
......

.../glibc$ grep_glibc_prototype sched_setattr
.../glibc$ grep_glibc_prototype sched_getattr
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:50:19 +01:00
Alejandro Colomar 449e4dc9fc s390_pci_mmio_write.2: SYNOPSIS: Add 'const' qualifier
s390_pci_mmio_write() uses 'const void *' instead of 'void *'.
Fix it.

......

.../linux$ grep_syscall s390_pci_mmio_write
arch/s390/pci/pci_mmio.c:119:
SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr,
		const void __user *, user_buffer, size_t, length)
.../linux$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:49:50 +01:00
Jakub Wilk 86f733b4d8 execve.2: spfix
"Mibibytes" is a misspelling of "mebibytes",
but let's use more familiar "MiB" instead.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 20:47:37 +01:00
Michael Kerrisk 5232ea0fab rename.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-15 13:45:19 +01:00
Gabriel Krisman Bertazi 131ee1e1de prctl.2: Document Syscall User Dispatch
Signed-off-by: Gabriel Krisman Bertazi <krisman@collabora.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 13:09:08 +01:00
Dmitry V. Levin 8a6b6cb878 epoll_pwait2.2: New link to epoll_wait(2)
Complements: ba47eb5e3 "epoll_wait.2: Add documentation of epoll_pwait2()"
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 09:36:17 +01:00
Palmer Dabbelt 33f776b54c execve.2: Correct the versions of Linux that don't have ARG_MAX argv/envp size
I just happened upon this inconsistent text while reading `man 2
execve`.  The code in question landed in 2.6.23 as b6a2fea39318
("mm: variable length argument support").

Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 09:01:17 +01:00
Alejandro Colomar d14c4ba412 timer_settime.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of timer_settime()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype timer_settime
time/time.h:242:
extern int timer_settime (timer_t __timerid, int __flags,
			  const struct itimerspec *__restrict __value,
			  struct itimerspec *__restrict __ovalue) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar 3b184f9c85 timer_create.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of timer_create()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype timer_create
time/time.h:234:
extern int timer_create (clockid_t __clock_id,
			 struct sigevent *__restrict __evp,
			 timer_t *__restrict __timerid) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar caed1954a1 stat.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of stat(), lstat(), and fstatat()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype stat
io/sys/stat.h:205:
extern int stat (const char *__restrict __file,
		 struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype lstat
io/sys/stat.h:259:
extern int lstat (const char *__restrict __file,
		  struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
.../glibc$ grep_glibc_prototype fstatat
io/sys/stat.h:234:
extern int fstatat (int __fd, const char *__restrict __file,
		    struct stat *__restrict __buf, int __flag)
     __THROW __nonnull ((2, 3));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar 049d7f92e8 statx.2: SYNOPSIS: Use 'restrict' in prototypes
Glibc uses 'restrict' for the types of the parameters of statx().
Let's use it here too.

......

.../glibc$ grep_glibc_prototype statx
io/bits/statx-generic.h:60:
int statx (int __dirfd, const char *__restrict __path, int __flags,
           unsigned int __mask, struct statx *__restrict __buf)
  __THROW __nonnull ((2, 5));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar c59ca53abd sigwaitinfo.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of sigwaitinfo()
and sigtimedwait() shall be 'restrict'.
Glibc uses 'restrict' too.  Let's use it here too.

......

.../glibc$ grep_glibc_prototype sigwaitinfo
signal/signal.h:264:
extern int sigwaitinfo (const sigset_t *__restrict __set,
			siginfo_t *__restrict __info) __nonnull ((1));
.../glibc$ grep_glibc_prototype sigtimedwait
signal/signal.h:272:
extern int sigtimedwait (const sigset_t *__restrict __set,
			 siginfo_t *__restrict __info,
			 const struct timespec *__restrict __timeout)
     __nonnull ((1));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar 1c227750c0 sigprocmask.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of sigprocmask()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype sigprocmask
signal/signal.h:232:
extern int sigprocmask (int __how, const sigset_t *__restrict __set,
			sigset_t *__restrict __oset) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar c1603508a1 sigaltstack.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of sigaltstack()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype sigaltstack
signal/signal.h:320:
extern int sigaltstack (const stack_t *__restrict __ss,
			stack_t *__restrict __oss) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar 3d54c17a6d sigaction.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of sigaction()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype sigaction
signal/signal.h:243:
extern int sigaction (int __sig, const struct sigaction *__restrict __act,
		      struct sigaction *__restrict __oact) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar 6b032bf01e select.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of [p]select()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype select
misc/sys/select.h:101:
extern int select (int __nfds, fd_set *__restrict __readfds,
		   fd_set *__restrict __writefds,
		   fd_set *__restrict __exceptfds,
		   struct timeval *__restrict __timeout);
.../glibc$ grep_glibc_prototype pselect
misc/sys/select.h:113:
extern int pselect (int __nfds, fd_set *__restrict __readfds,
		    fd_set *__restrict __writefds,
		    fd_set *__restrict __exceptfds,
		    const struct timespec *__restrict __timeout,
		    const __sigset_t *__restrict __sigmask);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar 04dc013d9b recv.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of recvfrom()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype recvfrom
socket/sys/socket.h:163:
extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n,
			 int __flags, __SOCKADDR_ARG __addr,
			 socklen_t *__restrict __addr_len);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar 8f5b718ea1 readlink.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of readlink() and readlinkat()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype readlink
posix/unistd.h:820:
extern ssize_t readlink (const char *__restrict __path,
			 char *__restrict __buf, size_t __len)
     __THROW __nonnull ((1, 2)) __wur __attr_access ((__write_only__, 2, 3));
.../glibc$ grep_glibc_prototype readlinkat
posix/unistd.h:832:
extern ssize_t readlinkat (int __fd, const char *__restrict __path,
			   char *__restrict __buf, size_t __len)
     __THROW __nonnull ((2, 3)) __wur __attr_access ((__write_only__, 3, 4));
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar 78eb47fc8f getsockopt.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of getsockopt()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype getsockopt
socket/sys/socket.h:208:
extern int getsockopt (int __fd, int __level, int __optname,
		       void *__restrict __optval,
		       socklen_t *__restrict __optlen) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar 8de93cea54 getpeername.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies that the parameters of getpeername()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_glibc_prototype getpeername
socket/sys/socket.h:130:
extern int getpeername (int __fd, __SOCKADDR_ARG __addr,
			socklen_t *__restrict __len) __THROW;
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Alejandro Colomar e234eef0c6 accept.2: SYNOPSIS: Use 'restrict' in prototypes
POSIX specifies the parameters of accept() shall be 'restrict'.
Glibc uses 'restrict' too (also for accept4()).
Let's use it here too.

......

.../glibc$ grep_glibc_prototype accept
socket/sys/socket.h:232:
extern int accept (int __fd, __SOCKADDR_ARG __addr,
		   socklen_t *__restrict __addr_len);
.../glibc$ grep_glibc_prototype accept4
socket/sys/socket.h:240:
extern int accept4 (int __fd, __SOCKADDR_ARG __addr,
		    socklen_t *__restrict __addr_len, int __flags);
.../glibc$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-14 08:53:59 +01:00
Michael Kerrisk bb5d2db62e process_madvise.2: Consistently use the term 'advice'
The page used 'hint' and 'advice' synonymously. This leaves the
reader wondering if the terms mean the same thing, or different
things. They mean the same thing, so use just one term.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-13 23:03:06 +01:00
Michael Kerrisk c049935731 process_madvise.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-13 23:03:06 +01:00
Michael Kerrisk c7faf9452e process_madvise.2: Defer to madvise(2) for description of 'advice' flags
Rather than repeating the description of MADV_COLD and MADV_PAGEOUT
in two pages, centralize the discussion in madvise(2), and refer
from process_madvise(2) ro madvise(2).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-13 23:03:06 +01:00
Michael Kerrisk c9c9ab2e69 madvise.2: Add descriptions of MADV_COLD and MADV_PAGEOUT
Taken from process_madvise(2).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-13 23:03:03 +01:00
Michael Kerrisk 8d010a0673 process_madvise.2: Minor clarification regarding partial advice scenario
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-13 21:10:04 +01:00
Alejandro Colomar 147ad5cedc process_madvise.2: SYNOPSIS: Fix prototype parameter type
The type of vlen is 'size_t', and not 'unsigned int'.  Fix it.

......

$ grep_syscall process_madvise
mm/madvise.c:1161:
SYSCALL_DEFINE5(process_madvise, int, pidfd, const struct iovec __user *, vec,
		size_t, vlen, int, behavior, unsigned int, flags)
include/linux/syscalls.h:887:
asmlinkage long sys_process_madvise(int pidfd, const struct iovec __user *vec,
			size_t vlen, int behavior, unsigned int flags);

function grep_syscall()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.c$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';

	find * -type f \
	|grep '\.[ch]$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^asmlinkage\s+[\w\s]+\**sys_${1}\s*\(.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-13 16:44:46 +01:00
Alejandro Colomar 904291a421 process_madvise.2: Add note about missing glibc wrapper
Glibc bug: <https://sourceware.org/bugzilla/show_bug.cgi?id=27380>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-13 16:42:18 +01:00
Alejandro Colomar 4f1adaa493 move_pages.2: Add notes about missing glibc wrappers
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-13 16:38:19 +01:00
Michael Kerrisk 7a11af70b7 shm_overview.7: SEE ALSO: add memfd_create(2)
People interested POSIX shared memory may also be interested
in memfd and file sealing.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-12 20:33:16 +01:00
Alyssa Ross 7a0095a542 open.2, rename.2: Refer to tmpfs rather than shmem
Skimming open(2), I was surprised not to see tmpfs mentioned as a
filesystem supported by O_TMPFILE.

If I'm understanding correctly (I'm very possibly not!), tmpfs is
a filesystem built on shmem, so I think it's more correct (and
probably much more widely understandable) to refer to tmpfs here.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-10 22:07:30 +01:00
Michael Kerrisk 788c381c4b rename.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-10 22:05:34 +01:00
Michael Kerrisk 087a45933a netdevice.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 21:59:01 +01:00
Michael Kerrisk db17c2cbf0 netdevice.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 20:19:42 +01:00
Alejandro Colomar 8ccbd769d0 mmap2.2: Fix prototype parameter types
There are many slightly different prototypes for this syscall,
but none of them is like the documented one.
Of all the different prototypes,
let's document the asm-generic one.

This manual page was actually using a prototype similar to
mmap(2), but there's no glibc wrapper function called mmap2(2),
as the wrapper for this syscall is mmap(2).  Therefore, the
documented prototype should be the kernel one.

......

.../linux$ grep_syscall mmap2
arch/csky/kernel/syscall.c:17:
SYSCALL_DEFINE6(mmap2,
	unsigned long, addr,
	unsigned long, len,
	unsigned long, prot,
	unsigned long, flags,
	unsigned long, fd,
	off_t, offset)
arch/microblaze/kernel/sys_microblaze.c:46:
SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
		unsigned long, prot, unsigned long, flags, unsigned long, fd,
		unsigned long, pgoff)
arch/nds32/kernel/sys_nds32.c:12:
SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
	       unsigned long, prot, unsigned long, flags,
	       unsigned long, fd, unsigned long, pgoff)
arch/powerpc/kernel/syscalls.c:60:
SYSCALL_DEFINE6(mmap2, unsigned long, addr, size_t, len,
		unsigned long, prot, unsigned long, flags,
		unsigned long, fd, unsigned long, pgoff)
arch/riscv/kernel/sys_riscv.c:37:
SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
	unsigned long, prot, unsigned long, flags,
	unsigned long, fd, off_t, offset)
arch/s390/kernel/sys_s390.c:49:
SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
arch/sparc/kernel/sys_sparc_32.c:101:
SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
	unsigned long, prot, unsigned long, flags, unsigned long, fd,
	unsigned long, pgoff)
arch/ia64/include/asm/unistd.h:30:
asmlinkage unsigned long sys_mmap2(
				unsigned long addr, unsigned long len,
				int prot, int flags,
				int fd, long pgoff);
arch/ia64/kernel/sys_ia64.c:139:
asmlinkage unsigned long
sys_mmap2 (unsigned long addr, unsigned long len, int prot, int flags, int fd, long pgoff)
arch/m68k/kernel/sys_m68k.c:40:
asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
	unsigned long prot, unsigned long flags,
	unsigned long fd, unsigned long pgoff)
arch/parisc/kernel/sys_parisc.c:275:
asmlinkage unsigned long sys_mmap2(unsigned long addr, unsigned long len,
	unsigned long prot, unsigned long flags, unsigned long fd,
	unsigned long pgoff)
arch/powerpc/include/asm/syscalls.h:15:
asmlinkage long sys_mmap2(unsigned long addr, size_t len,
		unsigned long prot, unsigned long flags,
		unsigned long fd, unsigned long pgoff);
arch/sh/include/asm/syscalls.h:8:
asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
			  unsigned long prot, unsigned long flags,
			  unsigned long fd, unsigned long pgoff);
arch/sh/kernel/sys_sh.c:41:
asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
	unsigned long prot, unsigned long flags,
	unsigned long fd, unsigned long pgoff)
arch/sparc/kernel/systbls.h:23:
asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
			  unsigned long prot, unsigned long flags,
			  unsigned long fd, unsigned long pgoff);
include/asm-generic/syscalls.h:14:
asmlinkage long sys_mmap2(unsigned long addr, unsigned long len,
			unsigned long prot, unsigned long flags,
			unsigned long fd, unsigned long pgoff);
.../linux$

function grep_syscall()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.c$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';

	find * -type f \
	|grep '\.[ch]$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^asmlinkage\s+[\w\s]+\**sys_${1}\s*\(.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:39:47 +01:00
Alejandro Colomar 5ae403a2d4 mlock.2: mlock2(): Fix prototype parameter types
The documented prototype for mlock2() was a mix of the
glibc wrapper prototype and the kernel syscall prototype.
Let's document the glibc wrapper prototype, which is shown below.

......

.../glibc$ grep_glibc_prototype mlock2
sysdeps/unix/sysv/linux/bits/mman-shared.h:55:
int mlock2 (const void *__addr, size_t __length, unsigned int __flags) __THROW;
.../glibc$

function grep_glibc_prototype()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <func>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "(?s)^[^\s#][\w\s]+\s+\**${1}\s*\([\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:37:28 +01:00
Michael Kerrisk 4791875270 execveat.2: srcfix: add a link to glibc bug requesting wrapper
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:35:53 +01:00
Alejandro Colomar 71a25d4c79 execveat.2: Fix prototype
It's been 6 years since execveat(2) was added to the kernel,
and there's still no glibc wrapper.  Let's document the kernel
syscall prototype.

I reported a bug against glibc requesting a wrapper;
when glibc adds the wrapper, this commit should probably be
reverted.

......

.../linux$ grep_syscall execveat
fs/exec.c:2062:
SYSCALL_DEFINE5(execveat,
		int, fd, const char __user *, filename,
		const char __user *const __user *, argv,
		const char __user *const __user *, envp,
		int, flags)
fs/exec.c:2083:
COMPAT_SYSCALL_DEFINE5(execveat, int, fd,
		       const char __user *, filename,
		       const compat_uptr_t __user *, argv,
		       const compat_uptr_t __user *, envp,
		       int,  flags)
include/linux/compat.h:815:
asmlinkage long compat_sys_execveat(int dfd, const char __user *filename,
		     const compat_uptr_t __user *argv,
		     const compat_uptr_t __user *envp, int flags);
include/linux/syscalls.h:980:
asmlinkage long sys_execveat(int dfd, const char __user *filename,
			const char __user *const __user *argv,
			const char __user *const __user *envp, int flags);
.../linux$

function grep_syscall()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.c$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';

	find * -type f \
	|grep '\.[ch]$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^asmlinkage\s+[\w\s]+\**sys_${1}\s*\(.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Glibc bug: <https://sourceware.org/bugzilla/show_bug.cgi?id=27364>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:33:47 +01:00
Alejandro Colomar 56d1311b87 ipc.2: Fix prototype parameter types
The types for some of the parameters are incorrect
(different than the kernel).  Fix them.
Below are shown the types that the kernel uses.

......

.../linux$ grep_syscall ipc
ipc/syscall.c:110:
SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
		unsigned long, third, void __user *, ptr, long, fifth)
ipc/syscall.c:205:
COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
	u32, third, compat_uptr_t, ptr, u32, fifth)
include/linux/compat.h:874:
asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32);
include/linux/syscalls.h:1221:
asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
		unsigned long third, void __user *ptr, long fifth);
.../linux$

function grep_syscall()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.c$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';

	find * -type f \
	|grep '\.[ch]$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^asmlinkage\s+[\w\s]+\**sys_${1}\s*\(.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:26:49 +01:00
Michael Kerrisk d5ff9ffcdc rpc.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:16:43 +01:00
Jonathan Wakely 055811a99e stat.2: Remove <unistd.h> from synopsis
There seems to be no reason <unistd.h> is shown here, so remove it.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 13:27:59 +01:00
Michael Kerrisk ba50f49c69 getpriority.2, recv.2, fts.3: wfix
These pages have the odd wording 'the external variable errno',
which does not occur in other pages. Make these pages conform with
the norm.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 12:01:36 +01:00
Michael Kerrisk a23bf7259c ferror.3: POSIX.1-2008: these functions won't change 'errno' if 'stream' is valid
See https://www.austingroupbugs.net/view.php?id=401.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 12:01:36 +01:00
Michael Kerrisk 5b921fc469 ferror.3: Add a RETURN VALUE section
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 11:01:14 +01:00
Michael Kerrisk 15267cb8a1 ferror.3: Remove fileno(3) content that was migrated to new fileno(3) page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 11:01:14 +01:00
Michael Kerrisk acd8a0e37e fileno.3: Split fileno(3) content out of ferror(3) into new page
fileno(3) differs from the other functions in various ways.
For example, it is governed by different standards,
and can set 'errno'. Conversely, the other functions
are about examining the status of a stream, while
fileno(3) simply obtains the underlying file descriptor.
Furthermore, splitting this function out allows
for some cleaner upcoming changes in ferror(3).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 11:01:14 +01:00
Michael Kerrisk c9b9a599fc ipc.2: Minor tweak to Alex's patch regarding use of syscall()
Calling ipc() directly would be a rather unusual thing to do,
so add some text to emphasize that point.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:46:48 +01:00
Alejandro Colomar fa646e185f bdflush.2, capget.2, get_mempolicy.2, ipc.2, lookup_dcookie.2, mbind.2, migrate_pages.2: Add notes about missing glibc wrappers
.../glibc$ grep_syscall_wrapper bdflush
.../glibc$ grep_syscall_wrapper capget
.../glibc$ grep_syscall_wrapper capset
.../glibc$ grep_syscall_wrapper get_mempolicy
.../glibc$ grep_syscall_wrapper ipc
.../glibc$ grep_syscall_wrapper lookup_dcookie
.../glibc$ grep_syscall_wrapper mbind
.../glibc$ grep_syscall_wrapper migrate_pages
.../glibc$

function grep_syscall_wrapper()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "(?s)^[^\s#][\w\s]+\s+\**${1}\s*\([\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:45:41 +01:00
Alejandro Colomar 3d18bee298 getsockname.2: Use restrict in prototypes
POSIX specifies that the 2nd and 3rd parameters to getsockname()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_syscall_wrapper getsockname
socket/sys/socket.h:116:
extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
			socklen_t *__restrict __len) __THROW;
.../glibc$ grep -rn '# *define __SOCKADDR_ARG'
socket/sys/socket.h:58:
 # define __SOCKADDR_ARG		struct sockaddr *__restrict
.../glibc$

function grep_syscall_wrapper()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "(?s)^[^\s#][\w\s]+\s+\**${1}\s*\([\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:39:59 +01:00
Alejandro Colomar 1b213b4fa4 gettimeofday.2: Use restrict in prototypes
POSIX specifies that the parameters of gettimeofday() shall be
'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_syscall_wrapper gettimeofday
time/sys/time.h:66:
extern int gettimeofday (struct timeval *__restrict __tv,
			 void *__restrict __tz) __THROW __nonnull ((1));
.../glibc$

function grep_syscall_wrapper()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "(?s)^[^\s#][\w\s]+\s+\**${1}\s*\([\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:38:53 +01:00
Alejandro Colomar eaaa85c17c getitimer.2: Use restrict in prototypes
POSIX specifies that the 2nd and 3rd parameters to setitimer()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_syscall_wrapper setitimer
time/sys/time.h:129:
extern int setitimer (__itimer_which_t __which,
		      const struct itimerval *__restrict __new,
		      struct itimerval *__restrict __old) __THROW;
.../glibc$

function grep_syscall_wrapper()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "^[^\s][\w\s]+\s+\**${1}\s*\((?s)[\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:37:34 +01:00
Alejandro Colomar cb4baea939 epoll_wait.2: srcfix: glibc doesn't provide epoll_pwait2() yet
I filed a bug against glibc
requesting the wrapper for the new syscall.

Glibc bug: <https://sourceware.org/bugzilla/show_bug.cgi?id=27359>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:34:45 +01:00
Michael Kerrisk b926779b33 getgid.2, getuid.2: Note that these interfaces never modify 'errno'
See https://www.austingroupbugs.net/view.php?id=511
and the POSIX.1-2008 specifications of the interfaces.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 10:38:57 +01:00
Michael Kerrisk bdd65639ba setbuf.3: POSIX doesn't require to errno to be unchanged after successful setbuf()
See https://www.austingroupbugs.net/view.php?id=397#c799

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 10:26:43 +01:00
Michael Kerrisk c7c869e66d setbuf.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 10:19:25 +01:00
Alejandro Colomar 2a8c925ba8 s390_guarded_storage.2: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-04 22:36:46 +01:00
Michael Kerrisk 3aac0708a9 process_madvise.2: Restructure the text in DESCRIPTION a little
The 'advice' subsection fell in the middle of other text in the
DESCRIPTION, which is a little confusing. Instead, move that
subsection to the end of the DESCRIPTION, and make some other
minor text reorganization so that related details are placed in
the same paragraphs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-02 11:43:15 +01:00
Michael Kerrisk e3ce016472 process_madvise.2: Minor edits to Suren Baghdasaryan's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-02 11:43:15 +01:00
Michael Kerrisk 81ec67d804 madvise.2: SEE ALSO: add process_madvise(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-02 11:43:15 +01:00
Michael Kerrisk 790593b4ae pidfd_open.2: Note the process_madvise(2) use case for PID file descriptors
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-02 11:43:15 +01:00
Suren Baghdasaryan a144f458ba process_madvise.2: Document process_madvise(2)
Initial version of process_madvise(2) manual page. Initial text
was extracted from [1], amended after fix [2] and more details
added using man pages of madvise(2) and process_vm_readv(2) as
examples. It also includes the changes to required permission
proposed in [3].

[1] https://lore.kernel.org/patchwork/patch/1297933/
[2] https://lkml.org/lkml/2020/12/8/1282
[3] https://patchwork.kernel.org/project/selinux/patch/20210111170622.2613577-1-surenb@google.com/#23888311

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-02 11:43:00 +01:00
Dmitry Vorobev 04f20d64e0 malloc_trim.3: Remove mention of free() call
'malloc_trim' was and is never called from the 'free' function.
see related bug in glibc tracker:
https://sourceware.org/bugzilla/show_bug.cgi?id=2531. or
'__int_free' function. Only the top part of the heap is trimmed
after some calls to 'free', which is different from 'malloc_trim'
which also releases memory in between chunks from all the
arenas/heaps.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-01 13:05:30 +01:00
Michael Kerrisk fecb03bc50 environ.7: Minor tweaks to Bastien's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 14:34:54 +01:00
Bastien Roucariès 26dc4876ef environ.7: Reorder the text
Move the the text describing how to set environment variable before
the list(s) of variables in order to improve readability.

[mtk: rewrote commit message]

Signed-off-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 14:30:10 +01:00
Michael Kerrisk 7ec45f6276 environ.7: Note the default if PAGER is not defined
Reported-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 13:25:25 +01:00
Michael Kerrisk bd70fd2e6d environ.7: ffix + tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 13:21:49 +01:00
Michael Kerrisk 241b015a62 environ.7: Various edits to Bastien Roucariès's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:55:14 +01:00
Bastien Roucariès 37147e18b6 environ.7: Document that HOME, LOGNAME, SHELL, USER are set at login time
Clearly document that HOME, LOGNAME, SHELL and USER are set at
login time by a program like such as login(1).

Document also that using su could result in a mixed environment,
and point to the su(1) manual page.

[mtk: edited commit message]

Signed-off-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:55:07 +01:00
Michael Kerrisk b6cb76fb6a environ.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:44:13 +01:00
Michael Kerrisk 5cf53bcf1a environ.7: Improve the description of PATH
Add more details of how PATH is used, and mention the legacy
use of an empty prefix.

Changed after a suggested patch by Bastien Roucariès.

Reported-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:36:08 +01:00
Michael Kerrisk 95d690a249 environ.7: wfix in description of PATH
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:21:34 +01:00
Michael Kerrisk d0281fa3d0 time.1: wfix: remove crufty sentence
Remove a sentence that should have been removed in
commit f0e173d681.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:10:56 +01:00
Michael Kerrisk f2a4cb6592 tmpfile.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-29 13:34:09 +01:00
Michael Kerrisk db6bce7c06 netdevice.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 21:14:17 +01:00
Pali Rohár 1af219093e netdevice.7: Update documentation for SIOCGIFADDR SIOCSIFADDR SIOCDIFADDR
Unlike SIOCGIFADDR and SIOCSIFADDR which are supported by many
protocol families, SIOCDIFADDR is supported by AF_INET6 and
AF_APPLETALK only.

Unlike other protocols, AF_INET6 uses struct in6_ifreq.

Cc: Dmitry V. Levin <ldv@altlinux.org>
Cc: <netdev@vger.kernel.org>
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 21:12:42 +01:00
Alejandro Colomar ff822ed193 man-pages.7: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 21:11:00 +01:00
Michael Kerrisk c75cdeb4ce uri.7: tfix (logical quoting style)
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:59:34 +01:00
Michael Kerrisk 2775c77783 man.7: tfix (logical quoting style)
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:59:30 +01:00
Michael Kerrisk a9b03562b0 rcmd.3: tfix (logical quoting style)
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:56:01 +01:00
Michael Kerrisk 1543da430a shmget.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:10:42 +01:00
Michael Kerrisk 09c6d6ca72 access.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:10:10 +01:00
Michael Kerrisk 02576fcb1c mmap.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:08:52 +01:00
Jakub Wilk 384a1bb256 man-pages.7: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:50:30 +01:00
Michael Kerrisk d810c8199e environ.7: Minor tweaks to Bastien's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:11:06 +01:00
Bastien Roucariès 2768c48107 environ.7: Document convention of string in environ
Document the name=value system and that nul byte is forbidden.

Signed-off-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:11:06 +01:00
Michael Kerrisk 7939275a0a environ.7: Minor fixes to Bastien's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:11:06 +01:00
Bastien Roucariès 5b4da4c3fd environ.7: Add see also ld.so(8) for LD_ variables
Signed-off-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:11:06 +01:00
Michael Kerrisk a079bfc955 environ.7: Be a little more precise when discussing 'exec'
Say "execve(2)" instead of "exec(3)", and note that this step
starts a new program (not a new process!).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:11:06 +01:00
Michael Kerrisk fc0bcf3cfe environ.7: Relocate and reword the mention of _GNU_SOURCE
Using _GNU_SOURCE to obtain the declaration of 'environ' is
nonstandard. Therefore, move the mention of this detail to NOTES.
At the same time, add a few words proposed by Bastien.

Cowritten-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:10:52 +01:00
Michael Kerrisk 0efacbdd86 man-pages.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-25 16:37:30 +01:00
Michael Kerrisk fa28110cc9 man-pages.7: Add a FORMATTING AND WORDING CONVENTIONS section
In man-pages-5.11, a large number of pages were edited to achieve
greater consistency in the SYNOPIS, RETURN VALUE and ATTRIBUTES
sections. To avoid future inconsistencies, try to capture some of
the preferred conventions in text in man-pages(7).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-25 16:31:58 +01:00
Pali Rohár bc766f2c0c sock_diag.7: Fix recvmsg() usage in the example
The msg_name field for recvmsg() call points to a caller-allocated buffer
nladdr that is used to return the source address of the (netlink) socket.

As recvmsg() does not read this buffer and fills it for a caller, do not
initialize it and instead check its value in the example.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-25 08:01:56 +01:00
Jakub Wilk 29dee4ce10 semget.2, shm_open.3: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 23:33:35 +01:00
Alejandro Colomar 27fce38a2a random.3: srcfix: Don't break proper names into different lines
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 23:32:44 +01:00
Alejandro Colomar 48c3ffa776 kexec_load.2: srcfix: Don't break a line that doesn't get past the right margin
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 23:31:41 +01:00
Jakub Wilk 69a0ed3a21 MAINTAINER_NOTES: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 23:30:51 +01:00
Alejandro Colomar 8b55111d74 fopencookie.3: wsfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 15:51:58 +01:00
Michael Kerrisk fb0d03d11c uri.7: Note that 'logical' quoting is the norm in Europe
Drop the reference to the Hacker Writing Guide (and the broken URL)
and simply note that the logical quoting style is the norm in
European languages also.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-23 10:04:55 +01:00
Michael Kerrisk fe1ab0bcc9 man-pages.7: Note some rationale for the use of real minus signs
See:
https://lore.kernel.org/linux-man/20210121061158.5ul7226fgbrmodbt@localhost.localdomain/
    From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
    Cc: linux-man <linux-man@vger.kernel.org>, groff@gnu.org
    Subject: Re: Escaping hyphens ("real" minus signs in groff)
    Date: Thu, 21 Jan 2021 17:12:00 +1100

and also groff_char(7).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 12:10:36 +01:00
Michael Kerrisk cd415e7364 Various pages: use "\-" to generate real minus in circumstances where appropriate
Use \- for math formulas, pathnames, manual page cross references,
etc.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:53:59 +01:00
Michael Kerrisk 57c230fdfe inotify.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:46:28 +01:00
Michael Kerrisk 3fa9299861 mq_overview.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:29:14 +01:00
Michael Kerrisk b49c2acb42 Various pages: use real minus signs in pathnames
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:29:14 +01:00
Michael Kerrisk 694d07544e confstr.3: ffix: Use real minus sign inside a string
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:29:14 +01:00
Michael Kerrisk d064d41a4b Various pages: Inside code blocks (.EX/.EE) use \- to get real minus signs
A real minus can be cut and pasted...

THere are a few exceptions that gave been excluded in the this
change.  For example, where there' is a string such as "<p1-name>",
where p1-name is soome sort of pseudo-identifier.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:29:14 +01:00
Alessandro Bono d5de9d1dc5 fread.3: Swap size and nmemb params
It works both way, but this one feels more right. We are reading
four elements sizeof(*buffer) bytes each.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 21:30:43 +01:00
Michael Kerrisk c43f976fd8 mount.2: Note that the 'data' argument can be NULL
Verified from reading the kernel source and looking at the source
of mount(8). Surprisingly, this has not documented after so many
years.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 13:12:33 +01:00
Enke Chen 1942e41202 tcp.7: Documentation revision for TCP_USER_TIMEOUT
mtk: Enke later noted that this patch provides better documentation
of longstanding behavior (rather documenting a change in behavior).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 13:12:19 +01:00
Alejandro Colomar a3377dcec6 circleq.3: Fix CIRCLEQ_LOOP_*() return type
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 09:52:57 +01:00
Bastien Roucariès 67d876899e environ.7: Document valid values of pathnames for SHELL, PAGER and EDITOR/VISUAL
The environ(7) man page says:

       SHELL  The pathname of the user's login shell.

       PAGER  The user's preferred utility to display text files.

       EDITOR/VISUAL
              The user's preferred utility to edit text files.

but doesn't say whether the pathnames must be absolute or they can
be resolved using $PATH, or whether they can have options.

Note that at least for SHELL, this is not specified by POSIX.
This issue was raised in the Austin Group mailing-list, and the
answer is that "what constitutes a valid value for a platform
should be documented" [1].

Since OpenSSH assumes that $SHELL is an absolute pathname (when
set), it is supposed that the documentation should be:

       SHELL  The absolute pathname of the user's login shell.

For PAGER, POSIX says: "Any string acceptable as a command_string
operand to the sh -c command shall be valid."

For EDITOR, it does not need to be an absolute pathname since
POSIX gives the example:

  EDITOR=vi fc

and since it is specified as "the name of a utility", It assumes
that arguments (options) must not be provided. Page 3013 about
"more", it is said: "If the last pathname component in EDITOR is
either vi or ex, [...]", thus again, it is assumed to be a
pathname.

For VISUAL, POSIX says: "Determine a pathname of a utility to
invoke when the visual command [...]", thus it is also a pathname.
It is not clear whether the pathname must be absolute, but for
consistency with EDITOR, it will be resolved using $PATH.

[1] https://www.mail-archive.com/austin-group-l@opengroup.org/msg01399.html

Reported-by: Vincent Lefevre <vincent@vinc17.net>
Signed-off-by: Bastien Roucaries <rouca@debian.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 09:45:37 +01:00
Michael Kerrisk cb7cb64877 man-pages.7: Document "acknowledgement" as the preferred spelling
When I inherited man-pages in 2004, it was a hodge-podge mix of
American vs British spelling. My native spelling is the latter,
but I value consistency and felt that things needed to be
standardized on one or other, and in computing, American is the
norm so that is what I settled on.

Among the changes was the substitution of various instances
of "acknowledgement" for "acknowledgment". The latter spelling is
not one I care for, but I believed it to be the American norm.

Alex Colomar proposed a patch to change the spelling back
to "acknowledgement", and some discussion and investigation
ensued, whereby I learned the following:

* The situation is not clear cut.

* Historically, "acknowledgment" was the norm in British English,
  but was eclipsed by "acknowledgement" some decades ago.

* Even in American English, "acknowledgment" is not universal,
  and "acknowledgement" has become more common in recent decades
  (although it still remains minority usage) [2].

* The BSD license uses "acknowledgement" even though it was
  (presumably) written in California.

* The POSIX standard uses "acknowledgement".

* The Debian BTS uses "acknowledgement".

* Looking at a corpus of manual pages from various systems
  that I have assembled over the years, "acknowledgement" seems
  a little more common than "acknowledgment".

Summary: the situation is not clear cut, but let's follow BSD,
POSIX, and the personal preference of the man-pages maintainers.

[1] https://books.google.com/ngrams/graph?content=acknowledgment%2Cacknowledgement&year_start=1800&year_end=2019&corpus=29&smoothing=3#

[2] https://books.google.com/ngrams/graph?content=acknowledgment%2Cacknowledgement&year_start=1800&year_end=2000&corpus=5&smoothing=3&

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-19 10:24:06 +01:00
Alejandro Colomar daff5a6686 netlink.7, tcp.7: Spelling fix: s/acknowledgment/acknowledgement/
Signed-off-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-19 10:17:16 +01:00
Johannes Wellhöfer 2a1b1111ca clone.2: tfix
For the alternate signal stack to be cleared, CLONE_VM should and
CLONE_VFORK should not be specified.

[mtk: fixes my commit 52e5819c41]

Signed-off-by: Johannes Wellhöfer <johannes.wellhofer@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-19 08:54:41 +01:00
Jakub Wilk cf14bdbde1 cacheflush.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-18 16:58:48 +01:00
Jakub Wilk 22206f7dac pipe.7: tfix
Escape hyphens in pathnames, as per man-pages(7)

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-18 16:41:42 +01:00
Michael Kerrisk 91c6bf1ce9 system.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-18 16:34:52 +01:00
Alejandro Colomar 4797383171 system.3: Document bug and workaround when the command name starts with a hypen
man-pages bug: 211029
 https://bugzilla.kernel.org/show_bug.cgi?id=211029

Complete workaround example
(it was too long for the page, but it may be useful here):

......

$ sudo ln -s -T /usr/bin/echo /usr/bin/-echo;
$ cc -o system_hyphen -x c - ;
#include <stdlib.h>

int
main(void)
{
    system(" -echo Hello world!");
    exit(EXIT_SUCCESS);
}

$ ./system_hyphen;
Hello world!

Reported-by: Ciprian Dorin Craciun <ciprian.craciun@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-18 16:33:34 +01:00
Pali Rohár 169db9487b netlink.7: Fix minimal Linux version for NETLINK_CAP_ACK
NETLINK_CAP_ACK option was introduced in commit 0a6a3a23ea6e which first
appeared in Linux version 4.3 and not 4.2.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-17 21:55:12 +01:00
Pali Rohár 7c978d1801 rtnetlink.7: Remove IPv4 from description
rtnetlink is not only used for IPv4

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-17 21:55:12 +01:00
Alyssa Ross 0218166754 ulimit.3: tfix
The parentheses here make it look like a function rather than a
command.

This was a typo introduced by a script-assisted global edit.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-17 21:55:12 +01:00
Alejandro Colomar d51b60ac01 execveat.2: Normalize notes about missing wrappers
It's been a long time sine kernel 3.19.
There's still no glibc wrapper.

......

$ grep -rn 'execveat *(' glibc/
$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-17 21:55:12 +01:00
Alejandro Colomar d75c2ffe21 cacheflush.2: Update SYNOPSIS for glibc wrapper
Glibc uses 'void *' instead of 'char *'.
And the prototype is declared in <sys/cachectl.h>.

......

$ syscall='cacheflush';
$ ret='int';
$ find glibc/ -type f -name '*.h' \
  |xargs pcregrep -Mn "(?s)^[\w\s]*${ret}\s*${syscall}\s*\(.*?;";
glibc/sysdeps/unix/sysv/linux/nios2/sys/cachectl.h:27:
extern int cacheflush (void *__addr, const int __nbytes, const int __op) __THROW;
glibc/sysdeps/unix/sysv/linux/mips/sys/cachectl.h:35:
extern int cacheflush (void *__addr, const int __nbytes, const int __op) __THROW;
glibc/sysdeps/unix/sysv/linux/arc/sys/cachectl.h:30:
extern int cacheflush (void *__addr, int __nbytes, int __op) __THROW;
glibc/sysdeps/unix/sysv/linux/csky/sys/cachectl.h:30:
extern int cacheflush (void *__addr, const int __nbytes,
		       const int __op) __THROW;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-17 21:55:12 +01:00
Michael Kerrisk f199762139 crypt.3: Update crypt() FTM requirements to note glibc 2.28 changes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-15 23:38:14 +01:00
Michael Kerrisk d7200ac321 crypt.3: Reformat FTM info (in preparation for next patch)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-15 23:33:07 +01:00
Michael Kerrisk 5efa68d57d epoll_wait.2: Minor tweaks to Willem de Bruijn's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-12 08:19:51 +01:00
Willem de Bruijn ba47eb5e3c epoll_wait.2: Add documentation of epoll_pwait2()
Expand the epoll_wait() page with epoll_pwait2(), an epoll_wait()
variant that takes a struct timespec to enable nanosecond
resolution timeout.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-12 08:07:56 +01:00
Valentin Kettner e71d103b2c clone.2: Fix types in clone_args
A file descriptor is an int so it should be stored through an int
pointer while parent_tid should have the same type as child_tid
which is pid_t pointer.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-11 09:17:47 +01:00
Alejandro Colomar da116d481b malloc.3: Document that realloc(p, 0) is specific to glibc and nonportable
A more detailed notice is on realloc(3p).

......

$ man 3p realloc \
  |sed -n \
     -e '/APPLICATION USAGE/,/^$/p' \
     -e '/FUTURE DIRECTIONS/,/^$/p';
APPLICATION USAGE
       The description of realloc() has been modified from  pre‐
       vious  versions  of  this  standard  to  align  with  the
       ISO/IEC 9899:1999 standard. Previous versions  explicitly
       permitted  a  call  to  realloc(p,  0)  to free the space
       pointed to by p and return a null pointer. While this be‐
       havior  could be interpreted as permitted by this version
       of the standard, the C language committee have  indicated
       that   this  interpretation  is  incorrect.  Applications
       should assume that if realloc() returns a  null  pointer,
       the  space pointed to by p has not been freed. Since this
       could lead to double-frees, implementations  should  also
       set errno if a null pointer actually indicates a failure,
       and applications should only free the space if errno  was
       changed.

FUTURE DIRECTIONS
       This  standard  defers  to the ISO C standard. While that
       standard currently has language that might  permit  real‐
       loc(p, 0), where p is not a null pointer, to free p while
       still returning a null pointer, the committee responsible
       for  that standard is considering clarifying the language
       to explicitly prohibit that alternative.

Bug: 211039 <https://bugzilla.kernel.org/show_bug.cgi?id=211039>
Reported-by: Johannes Pfister <johannes.pfister@josttech.ch>
Cc: libc-alpha@sourceware.org
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 09:18:22 +01:00
Alejandro Colomar ccca30c230 Various pages: srcfix: Remove redundant .PP
.PP are redundant just after .SH or .SS.
Remove them.

$ find man? -type f \
  |xargs sed -i '/^\.S[HS]/{n;/\.PP/d}';

Plus a couple manual edits.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 09:15:48 +01:00
Michael Kerrisk dc9cadc1c2 Revert "stailq.3, utmp.5, time_namespaces.7: srcfix: remove redundant .PP"
Do this in order to apply a better patch from Alex Colomar.

This reverts commit f7fc28f97a.
2021-01-10 09:15:12 +01:00
Michael Kerrisk a60e8c598e xcrypt.3: srcfix: use .PP rather than .LP
.LP is equivalent .PP, but the latter is what is used
throughout man-pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 08:59:28 +01:00
Michael Kerrisk 7c2838715f shm_open.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 08:59:28 +01:00
Michael Kerrisk f7fc28f97a stailq.3, utmp.5, time_namespaces.7: srcfix: remove redundant .PP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 08:59:28 +01:00
Michael Kerrisk feaef5f266 getfsent.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 22:43:31 +01:00
Michael Kerrisk 0a23e9aac0 mprotect.2, readv.2, sigaltstack.2, sigreturn.2, ctime.3, scandir.3, random.4, pkeys.7: ffix: s/-1/\-1/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 22:08:50 +01:00
Michael Kerrisk 9fd0c2f252 mlock.2: CONFORMING TO: note more explicitly which APIs are in the standards
The current wording is a little unclear...

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 20:57:09 +01:00
Michael Kerrisk 45e399e7f8 alloc_hugepages.2: CONFORMING TO: reword to reflect that these system calls are long gone
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 20:52:49 +01:00
Michael Kerrisk e4c07f6482 epoll_create.2: CONFORMING TO: mention also that epoll_create1() is Linux-specific
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 20:49:43 +01:00
Michael Kerrisk f7f02d0f8d epoll_wait.2: CONFORMING TO: mention also that epoll_pwait() is Linux-specific
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 20:47:47 +01:00
Michael Kerrisk 3d81c05a79 time.1, ioctl_console.2, daemon.3, updwtmp.3, mouse.4, smartpqi.4: tfix (Oxford comma)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 12:53:15 +01:00
Michael Kerrisk 5473bd6687 smartpqi.4: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 12:46:55 +01:00
Michael Kerrisk 36dce68747 open.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 12:30:48 +01:00
Michael Kerrisk 031115a52c inode.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:55:03 +01:00
Michael Kerrisk 3ded684c1a Various pages: tfix (Oxford comma)
Found using:

    git grep -lE '^[^.].*,.*,.*[^,] (and|or)\>'

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:15:26 +01:00
Michael Kerrisk 12325c3856 suffixes.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:15:26 +01:00
Michael Kerrisk 6b67fcc064 tailq.3: srcfix: remove redundant .PP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:15:22 +01:00
Michael Kerrisk 735334d454 Various pages: tfix (Oxford comma)
Discovered using:

    git grep -lE '^[^.].*, [^ ]*[^,] (or|and)\>'

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:02:33 +01:00
Michael Kerrisk 61eaa18945 round.3: wsfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:45:38 +01:00
Michael Kerrisk 2ddebe1a77 circleq.3, list.3, slist.3, stailq.3, queue.7: tfix (Oxford comma)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:41:55 +01:00
Michael Kerrisk 31e9088393 encrypt.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:35:56 +01:00
Michael Kerrisk e8d28f7cc9 ioctl_fslabel.2, ioctl_fideduperange.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:34:46 +01:00
Michael Kerrisk f2fa055834 ioctl_console.2, msgctl.2, msgget.2, msgop.2, semctl.2, semget.2, semop.2, shm_open.3, shmget.2, shmop.2: ERRORS: remove redundant statement that 'errno' is set
This is implied in every other manual page. There is no need to
state it explicitly in these pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:21:57 +01:00
Michael Kerrisk d9b17b7371 semget.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:14:48 +01:00
Michael Kerrisk 73b81e53fe write.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 09:59:10 +01:00
Michael Kerrisk 2df7ea6cd8 getsid.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 09:57:41 +01:00
Michael Kerrisk 95887a0039 clone.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 09:51:59 +01:00
Michael Kerrisk 402f955e66 setlocale.3: Restructure a particularly difficult sentence
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 09:44:09 +01:00
Michael Kerrisk 2c916a1d3c Various pages: Remove redundant "\\ " to escape spaces
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 13:42:27 +01:00
Michael Kerrisk 51ebfb92a9 keyctl.2: wfix
Fix a glitch in commit ff91beca5b.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 10:06:35 +01:00
Alejandro Colomar b47ee0ab7b msr.4, veth.4, packet.7, sched.7, unicode.7: Remove redundant .PP
.PP and .IP are redundant just before .SH or .SS.
Remove them.

$ find man? -type f \
  |xargs sed -i '/^\.[IP]P$/{N;s/.*\n\(\.S[HS]\)/\1/}';

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 09:58:28 +01:00
Alejandro Colomar aa0da2b9b1 Various pages: tfix: Use Oxford comma
Found using:
$ pcregrep -rnM "^\.[B|I]R .*,\n\.[B|I].*[^,]\nor" man? \
  |grep ^man \
  |sort;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 09:57:24 +01:00
Alejandro Colomar 03659d7d46 close.2, getpriority.2, ioctl_userfaultfd.2, expm1.3, lio_listio.3, rcmd.3, lirc.4, mount_namespaces.7: tfix: Fix punctuation
Found using:
$ pcregrep -rnM '^..[^"].*[^.]\.\n[a-z]' man?

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 09:55:25 +01:00
Yang Xu 43ebbd1925 semctl.2: Correct SEM_STAT_ANY description
Since kernel commit a280d6dc77eb
("ipc/sem: introduce semctl(SEM_STAT_ANY)"),
it only skips read access check when using SEM_STAT_ANY command.
And it should use the semid_ds struct instead of seminfo struct.
Fix this.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Acked-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk 8c7307e8c6 rcmd.3: wfix (errno)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk e46baa4443 wait.2: Minor wording fixes in RETURN VALUE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk a8a93e8a5a sched_setaffinity.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk 2ae5c63aed epoll_wait.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk a084d8168c cacheflush.2: wfix (errno)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk 89fc988bd5 adjtimex.2: wfix (errno)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk 7a6227d368 Various pages: Various improvements in wording in RETURN VALUE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:00 +01:00
Michael Kerrisk 9862ec0c5c Various System V IPC pages: Improve wording describing RETURN VALUE and setting of 'errno'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:28:40 +01:00
Michael Kerrisk cb6a894ee7 Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, miscellaneous descriptions of the setting
of 'errno' are reworded to the norm of "is set to indicate
the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:51 +01:00
Michael Kerrisk c112329ffe Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, reword various cases saying that 'errno' is set
"appropriately" to "is set to indicate the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:51 +01:00
Michael Kerrisk f6a4078be5 Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, fix some instances stating that 'errno' is set
"appropriately" to instead say "to indicate the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:35 +01:00
Michael Kerrisk 855d489a7f Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, "to indicate the cause of the error"
is changed to "to indicate the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:27 +01:00
Michael Kerrisk 3cf2958737 wordexp.3: Minor wording fixes in RETURN VALUE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:02 +01:00
Michael Kerrisk 30b0d8d97e memusage.1: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:02 +01:00
Michael Kerrisk a077147b0a chroot.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:02 +01:00
Michael Kerrisk 2aec4ef8f5 ioctl_tty.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:02 +01:00
Michael Kerrisk 2858b5b5ef ioctl_tty.2: Reformat argument type information
The current mark-up renders poorly. To resolve this, move
the type information into a separate line.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 00:05:48 +01:00
Michael Kerrisk 6d1a711b69 netlink.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 00:05:48 +01:00
Michael Kerrisk 0b174fe008 clone.2, ioctl_tty.2, syslog.2, setlocale.3, stdio.3, console_codes.4, inode.7, namespaces.7, netlink.7, signal-safety.7, socket.7: Better table formatting
In particular, allow for rendering in widths different from
(especially less than) 80 columns.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 00:05:48 +01:00
Michael Kerrisk 30e3e116bb syscalls.2: ffix: Improve table formatting
Allow more text wrapping in the Notes column

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 15:28:02 +01:00
Michael Kerrisk 0ab815e900 man-pages.7: ffix: don't fill text in tables
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 15:06:06 +01:00
Michael Kerrisk 29b18c3946 slist.3: tfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:53:34 +01:00
Michael Kerrisk 9d281e06da Various pages: add missing .nf/.fi in FTM info
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk 422d5327a8 rcmd.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk 5c10d2c5e2 Various pages: Remove redundant escaping of space characters in FTM info
Since we are using .nf/.fi to bracket FTM info, escaping
space characters serves no space and clutters the source.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk 2bafc702d0 fsync.2: srcfix: add missing ./f/.fi in FTMs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk 5979710fc5 wait4.2: ffix (Make FTM text narrower)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Alejandro Colomar 554afbe862 circleq.3, list.3, slist.3, stailq.3, tailq.3: Improve readability, especially in SYNOPSIS
- Group macros by kinds.
- Align so that it's easiest to distinguish differences
  between related macros.
  (Align all continuations for consistency on PDF.)
- Fix minor typos.
- Remove redundant text:
    'The macro xxx() ...':
        The first paragraph already says that these are macros.
    'circular|tail|... queue':
        Don't need to repeat every time.
        Generic text makes it easier to spot the differences.
- Fit lines into 78 columns.
- Reorder descriptions to match SYNOPSIS,
  and add subsections to DESCRIPTION.
- srcfix: fix a few semantic newlines.

I noticed a bug which should be fixed next:
CIRCLEQ_LOOP_*() return a 'struct TYPE *'.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
John Morris 076fbe0613 resolv.conf.5: tfix
Change `RES_USE_EDNSO` to `RES_USE_EDNS0`, defined in
`resolv.h`.  (This is written correctly in `man3/resolver.3` in this
same repo.)  Helps with grepping and internet searches!

Signed-off-by: John Morris <john@zultron.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk b32feea59e Various pages: Formatting tweaks after "Improve formatting in ATTRIBUTES"
Various ATTRIBUTES table improvements following the previous
commit. In particular, make use of T{...T} to allow wrapping
in table cells that have a lot of text.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk c466875ecd Various pages: Improve formatting in ATTRIBUTES
Make the formatting more consistent inside the tables in the
ATTRIBUTES sections. Make the source code more uniform; in
particular, eliminate the use of custom tweaks using
'lbwNN'/'lwNN' and .br macros.  In addition, ensure that
hyphenation and text justification do not occur inside the tables.

This is a script-driven edit:

[[
PAGE_LIST=$(git grep -l 'SH ATTRIBUTES' man[23])

# Strip out any preexisting .sp/.br/.ad macros

sed -i '/SH ATTR/,/^\.SH/{/^\.sp/d; /^\.br/d; /\.ad/d}' $PAGE_LIST

# Eliminate any use of 'wNN' in tables; default first column
# to fill unused space

sed -i '/SH ATTR/,/^\.SH/s/lbw[0-9]*/lb/g' $PAGE_LIST
sed -i '/SH ATTR/,/^\.SH/s/lw[0-9]*/l/g' $PAGE_LIST
sed -i '/SH ATTR/,/^\.SH/s/^lb /lbx /' $PAGE_LIST

# Nest the tables inside ".ad l"+".nh" and ".hy"+".ad"+".sp 1"
# ".ad l" ==> no right justification of text in table cells
# ".nh" ==> No hyphenation in table cells
# ".sp 1" ==> ensure a blank line before the next section heading

sed -i '/SH ATTR/,/^\.SH/{/\.TS/i.ad l\n.nh
}'  $PAGE_LIST
sed -i '/SH ATTR/,/^\.SH/{/\.TE/a.hy\n.ad\n.sp 1
}'  $PAGE_LIST

# In a few of the tables, the third column has a lot of text, so
# make that column wide (rather than the first column)

sed -i '/^lbx/{s/lbx/lb/;s/lb$/lbx/}' \
        man3/bindresvport.3 \
        man3/fmtmsg.3 man3/gethostbyname.3 man3/getlogin.3 \
        man3/getnetent.3 man3/getprotoent.3 man3/getpwent.3 \
        man3/getservent.3 man3/getspnam.3 man3/getutent.3 man3/glob.3 \
        man3/login.3 \
        man3/setnetgrent.3 \
        man3/wordexp.3
]]

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:39 +01:00
Michael Kerrisk daaf6d327b getlogin.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 10:32:26 +01:00
Michael Kerrisk 365a3f2919 man-pages.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 10:20:50 +01:00
Michael Kerrisk f2667a7212 Various pages: Use internally consistent continuation indents in SYNOPSIS
In the SYNOPSIS, a long function prototype may need to be
continued over to the next line. The continuation line is
indented according to the following rules:

1. If there is a single such prototype that needs to be continued,
   then align the continuation line so that when the page is
   rendered on a fixed-width font device (e.g., on an xterm) the
   continuation line starts just below the start of the argument
   list in the line above.  (Exception: the indentation may be
   adjusted if necessary to prevent a very long continuation line
   or a further continuation line where the function prototype is
   very long.)

   Thus:

       int tcsetattr(int fd, int optional_actions,
                     const struct termios *termios_p);

2. But, where multiple functions in the SYNOPSIS require
   continuation lines, and the function names have different
   lengths, then align all continuation lines to start in the
   same column.  This provides a nicer rendering in PDF output
   (because the SYNOPSIS uses a variable width font where
   spaces render narrower than most characters).

   Thus:

       int getopt(int argc, char * const argv[],
                  const char *optstring);
       int getopt_long(int argc, char * const argv[],
                  const char *optstring,
                  const struct option *longopts, int *longindex);

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 20:27:11 +01:00
Michael Kerrisk 96b6532808 stat.2: Move the obsolete _BSD_SOURCE FTM to the end of the FTM info
Since _BSD_SOURCE is obsolete for quite some time now,
it should not be listed as the first FTM for lstat().

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 14:35:55 +01:00
Michael Kerrisk 1dd0d7b4e4 Various pages: ffix: More layout consistency fixes for FTMs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 13:22:01 +01:00
Alejandro Colomar ba2c475246 futex.2, syscalls.2, vmsplice.2, bpf-helpers.7: wfix: Write consistently 'user space' instead of 'userspace'
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 12:48:33 +01:00
Michael Kerrisk 72af9e8351 fseeko.3: Move info about obsolete FTM from SYNOPSIS to NOTES
This makes the SYNOPSIS more consistent with other pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk cc4423f732 j0.3, strerror.3, y0.3: wspfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk 58a6844d20 brk.2, chmod.2, gethostname.2, setpgid.2, wait4.2, atoi.3, fwide.3, getlogin.3, printf.3, strtoul.3, wprintf.3: Consistency fix-up in FTMs
Generally, place '||' at start of a line, rather than the end of
the previous line.

Rationale: this placement clearly indicates that that each piece
is an alternative.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk 16fe373c85 qecvt.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk b15b92a585 fsync.2, gethostname.2, stat.2, getutent.3: Minor consistency clean-ups in FTMs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk 9d2adbae20 Various pages: Simplify mark-up for Feature Test Macro requirements
Different source styles are used in different pages to achieve the
same formatted output, and in some cases the source mark-up is a
rather convoluted combination of .RS/.RE/.TP/.PD macros. Simplify
this greatly, and unify all of the pages to use more or less the
same source code style. This makes the source code rather easier
to read, and may simplify future scripted global changes.

The feature test macro info is currently bracketed by .nf/.fi
pairs. This is not strictly necessary (i.e., it makes no
difference to the rendered output), but for the moment we keep
these "brackets" in case they may be replaced with something else.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:01 +01:00
Michael Kerrisk 1a412fc5cb gethostid.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 16:27:45 +01:00
Michael Kerrisk e36f10f91d Various pages: replace '.ad b' macro with '.ad'
Verified no change in rendered output

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 16:25:50 +01:00
Michael Kerrisk 3d614fb849 clock_getres.2, atan2.3, ctime.3, getcwd.3, isgreater.3, iswblank.3, scalbln.3: ffix
Consistently use 4-space indents for FTMs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:55:20 +01:00
Michael Kerrisk 255d42333e chroot.2, rename.2, getgrent.3, nextafter.3, ttyslot.3, wprintf.3: ffix
Bring a bit more consistency to the layout of FTMs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:47:04 +01:00
Michael Kerrisk c418bc9d16 grantpt.3, ptsname.3, unlockpt.3: Remove mention of _XOPEN_SOURCE_EXTENDED FTM
This rather ancient FTM is not mentioned in other pages for
reasons discussed in feature_test_macros(7).  Remove this FTM
from the three pages where it does appear.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:47:04 +01:00
Michael Kerrisk db198f06a8 nice.2, putenv.3, strtok.3, toascii.3, tzset.3: ffix
Where FTM requirements span multiple lines, start the FTMs on
a new line.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:19:02 +01:00
Michael Kerrisk 3754620f0e getpagesize.2, getdtablesize.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:10:10 +01:00
Michael Kerrisk d187835fe7 fanotify_init.2, fanotify.7: Minor edits to Jan Kara's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:29:59 +01:00
Jan Kara f040d28675 fanotify_init.2, fanotify.7: Document FAN_AUDIT flag and FAN_ENABLE_AUDIT
Acked-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:29:59 +01:00
Michael Kerrisk 028350ffb8 exec.3: tfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:29:59 +01:00
Michael Kerrisk 10afe9f58d malloc_hook.3: tfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:29:56 +01:00
Michael Kerrisk 2bb103326f ecvt.3, gcvt.3: Update FTM requirements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:10:59 +01:00
Michael Kerrisk 9e8a25d700 getpagesize.2, getdtablesize.3: Update/correct FTM requirements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 12:13:37 +01:00
Michael Kerrisk 49b843f53a gethostid.3: Update FTM requirements for gethostid()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 11:55:58 +01:00
Michael Kerrisk 6e5cd0d9c1 gethostname.2: Update FTM requirements for gethostname()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 11:50:30 +01:00
Michael Kerrisk f1663f029c feature_test_macros.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 11:02:32 +01:00
Michael Kerrisk bd8e32e0b2 feature_test_macros.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 10:47:12 +01:00
Michael Kerrisk 51a6f93d71 wait.2, getaddrinfo.3, getnameinfo.3: ffix: Bring greater consistency to FTM layout
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 10:10:05 +01:00
Michael Kerrisk b1a4a24634 qecvt.3: Update feature test macro requirements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 09:34:08 +01:00
Michael Kerrisk 4653ec6ef2 Various pages: Use .nf/.fi in SYNOPSIS
Fix various pages missed in commit
c7db92b96a.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 09:34:08 +01:00
Michael Kerrisk e3528453c0 getutent.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 08:54:44 +01:00
Michael Kerrisk fe05d0458e bsd_signal.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 08:53:50 +01:00
Michael Kerrisk 464ba16d1e scandir.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 08:48:01 +01:00
Michael Kerrisk 5b72a11386 string.3: tfix
Reported-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 20:50:04 +01:00
Michael Kerrisk 05d13bfb42 string.3: SEE ALSO: add bstring(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:10:04 +01:00
Michael Kerrisk 28f288d395 bstring.3: SEE ALSO: add string(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:10:04 +01:00
Michael Kerrisk c7db92b96a Various pages: Use .nf/.fi in SYNOPSIS
The majority of pages use .nf/.fi in SYNOPSIS, but there are
still many that don't and use .br to achieve newlines. Fix many
of those. This brings greater consistency to the pages, which
eases editing and may ease future scripted edits to the pages.

Many of these changes were script-assisted, with some additional
manual edits.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:09:47 +01:00
Michael Kerrisk 511bb71b0c Various pages: Further clean-ups after "bring more whitespace consistency in SYNOPSIS"
Yet more clean-ups after commit
15d6565317.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:09:36 +01:00
Michael Kerrisk ff21c173ea wordexp.3: ffix
Reported-by: "Alejandro Colomar" <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-02 20:57:59 +01:00
Michael Kerrisk c9eec92c18 getcpu.2: Rewrite page to describe glibc wrapper function
Since glibc 2.29, there is a wrapper for getcpu(2).
The wrapper has only 2 arguments, omitting the unused
third system call argument. Rework the manual page
to reflect this.

Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-02 09:37:11 +01:00
Alejandro Colomar 771aecbeff Various pages: Consistently use 'unsigned int'
Most pages use 'unsigned int' (and the kernel too).
Make them all do so.

$ find man? -type f \
  | xargs sed -i \
	-e 's/unsigned \*/unsigned int */g'
	-e 's/unsigned "/unsigned int "/g';

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-02 08:31:43 +01:00
Michael Kerrisk e878a2de3e get_phys_pages.3: Minor relocation of text
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 23:38:00 +01:00
Alejandro Colomar 984126f454 off64_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 23:31:50 +01:00
Alejandro Colomar d6ab4c76a1 system_data_types.7: Add off64_t to system_data_types(7)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 23:30:49 +01:00
Michael Kerrisk 7b5d39f48f Various pages: clean-ups after "bring more whitespace consistency in SYNOPSIS"
Cleann-ups after commit 15d6565317.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 23:28:14 +01:00
Michael Kerrisk 15d6565317 Various pages: bring more whitespace consistency in SYNOPSIS
The use of vertical white space in the SYNOPSIS sections
is rather inconsistent. Make it more consistent, subject to the
following heuristics:

* Prefer no blank lines between function signatures by default.
* Where many functions are defined in the SYNOPSIS, add blank
  lines where needed to improve readability, possibly by using
  blank lines to separate logical groups of functions.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 12:40:22 +01:00
Michael Kerrisk 742694e926 gethostbyname.3: Move mention of <sys/socket.h> from SYNOPSIS to DESCRIPTION
The functions are all declared in <netdb.h>. <sys/socket.h> is only
needed for the AF_* constants.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 12:26:47 +01:00
Michael Kerrisk 460aeeb46d puts.3: Reorder functions more logically (group related fuinctions together)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 23:38:02 +01:00
Michael Kerrisk cbd813e73c getdirentries.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 22:50:57 +01:00
Michael Kerrisk d4f9c56ac5 drand48.3: tfix (Oxford comma)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 21:19:28 +01:00
Michael Kerrisk 1210ac324b dl_iterate_phdr.3: wsppfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 21:16:41 +01:00
Michael Kerrisk fb30841679 perfmonctl.2, pidfd_send_signal.2: ffix: Ensure statement about no wrapper function is a new paragraph
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 15:13:41 +01:00
Alejandro Colomar 76c5631fb4 copy_file_range.2: Document glibc wrapper instead of kernel syscall
Glibc uses 'off64_t' instead of 'loff_t'.

......

Glibc prototype:

$ syscall='copy_file_range';
$ ret='ssize_t';
$ find glibc/ -type f -name '*.h' \
  |xargs pcregrep -Mn "(?s)^[\w\s]*${ret}\s*${syscall}\s*\(.*?;";
glibc/posix/unistd.h:1121:
ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
			 int __outfd, __off64_t *__poutoff,
			 size_t __length, unsigned int __flags);

......

Testing example:

$ man ./man2/copy_file_range.2 \
  |sed -n '/^EXAMPLES/,/^SEE ALSO/p' \
  |head -n -1 \
  |tail -n +2 \
  >copy_file_range.c
$ gcc -Wall -Wextra -Werror -pedantic
copy_file_range.c -o copy_file_range
$ ./copy_file_range
Usage: ./copy_file_range <source> <destination>
$ tee a >/dev/null
asdf
$ tee b >/dev/null
qwerty
zxcvbn
$ ./copy_file_range a b
$ cat a
asdf
$ cat b
asdf

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 15:01:18 +01:00
Michael Kerrisk 9834f61da2 wait4.2, endian.3, isalpha.3, unlocked_stdio.3: Minor consistency fix for Feature Test Macro info
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 11:05:26 +01:00
Michael Kerrisk ea40ab1199 strsignal.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 11:05:26 +01:00
Michael Kerrisk 7d8d2f0941 Various pages: s/Glibc versions </Glibc </ in Feature Test Macro discussions
Use a more compact notation that will render less wide
on the terminal.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 11:05:22 +01:00
Michael Kerrisk 38c1dbe910 pread.2, rename.2, syscall.2, utimensat.2, gethostid.3, rcmd.3, seekdir.3, setnetgrent.3, strerror.3, strsignal.3: ffix: Various tweaks for greater consistency in Feature Test Macros
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 10:48:51 +01:00
Michael Kerrisk 0129eef26c chown.2, ffs.3, fpclassify.3, gamma.3, getgrent.3, ilogb.3, strdup.3: ffix
Bring a bit more consistency to Feature Test Macro information
(mainly .PP between differnt FTM lists).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 10:27:24 +01:00
Michael Kerrisk 58e93595b9 Changes.old: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 10:07:18 +01:00
Michael Kerrisk 98c9347c15 Various pages: Formatting fix
Use .PP (which gives a bit of vertical white space) rather than
.br to separate functions in Feature Test Macro requirement lists.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:55:48 +01:00
Michael Kerrisk 1faebd253c Various pages: srcfix: remove redundant .br
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:55:48 +01:00
Michael Kerrisk e111e485ed recv.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:24:56 +01:00
Alejandro Colomar a6f73f75e6 get_phys_pages.3: glibc gets the info from sysinfo(2) since 2.23
See glibc's commit: 0ce657c576bf1b24
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=0ce657c576bf1b24

Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:18:04 +01:00
Alejandro Colomar 00d3eabb53 keyctl.2: SYNOPSIS: Fix prototype parameter types
The Linux kernel uses 'unsigned long'.
There's no reason to use the typedef '__kernel_ulong_t'.

......

$ syscall='keyctl';
$ find linux/ -type f -name '*.c' \
  |xargs pcregrep -Mn "(?s)^[\w_]*SYSCALL_DEFINE.\(${syscall},.*?\)";
linux/security/keys/keyctl.c:1869:
SYSCALL_DEFINE5(keyctl, int, option, unsigned long, arg2, unsigned long, arg3,
		unsigned long, arg4, unsigned long, arg5)
linux/security/keys/compat.c:17:
COMPAT_SYSCALL_DEFINE5(keyctl, u32, option,
		       u32, arg2, u32, arg3, u32, arg4, u32, arg5)

Cc: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 23:37:05 +01:00
Alejandro Colomar 7eee650211 delete_module.2: SYNOPSIS: Fix prototype parameter types
The Linux kernel uses 'unsigned int' instead of 'int' for the
'flags' parameter.  As glibc provides no wrapper, use the same
type the kernel uses.

......

$ syscall='delete_module';
$ find linux/ -type f -name '*.c' \
  |xargs pcregrep -Mn "(?s)^[\w_]*SYSCALL_DEFINE.\(${syscall},.*?\)";
linux/kernel/module.c:977:
SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
		unsigned int, flags)

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 23:35:35 +01:00
Michael Kerrisk 40c502d623 kexec_load.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 17:02:42 +01:00
Ganimedes Colomar 16cc03ca92 Various pages: Normalize NOTES about nonexistent glibc wrappers
See previous commit.

This commit normalizes texts under sections other than SYNOPSIS
(most of them in NOTES).

Signed-off-by: Ganimedes Colomar <gacoan.linux@gmail.com>
Cowritten-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 16:56:38 +01:00
Ganimedes Colomar 632d115294 Various pages: Normalize SYNOPSIS notes about nonexistent glibc wrappers
To easily distinguish documentation about glibc wrappers from
documentation about kernel syscalls, let's have a normalized
'Note' in the SYNOPSIS, and a further explanation in the page body
(NOTES in most of them), as already happened in many (but not all)
of the manual pages for syscalls without a wrapper.  Furthermore,
let's normalize the messages, following membarrier.2 (because it's
already quite extended), so that it's easy to use grep to find
those pages.

To find these pages, we used:
$ grep -rn wrapper man? | sort -V
and
$ grep -rni support.*glibc | sort -V

delete_module.2, init_module.2:  glibc 2.23 is no longer
  maintained, so we changed the notes about wrappers, to say that
  there are no glibc wrappers for these system calls; see NOTES.

We didn't fix some obsolete pages such as create_module.2.

Signed-off-by: Ganimedes Colomar <gacoan.linux@gmail.com>
Cowritten-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 16:55:39 +01:00
Michael Kerrisk 3c8813156d syscalls.2: Add epoll_pwait2()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 15:18:54 +01:00
Michael Kerrisk ab4001e286 readlink.2: Emphasize that the returned buffer is not null-terminated
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 14:55:38 +01:00
Jakub Wilk 5bd94cbd31 filesystems.5: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 09:30:34 +01:00
Jakub Wilk 704b5ab54c ftime.3: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 09:30:17 +01:00
Jakub Wilk 6a0aa2ecb1 cgroups.7: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 09:30:10 +01:00
Jakub Wilk 0580884cc7 signal.7: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 09:29:46 +01:00
Michael Kerrisk c55f66855e pkeys.7: srcfix: remove redundant .PP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk c65f02bae3 user_namespaces.7: srcfix: remove redundant .PP after .SS
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk 312b0eb182 userfaultfd.2, posix_spawn.3: srcfix: remove redundant .PP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk 0421538981 pthread_mutexattr_setrobust.3: wfix: remove redundant comments
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk ae12e0e0f9 bind.2: wfix: remove redundant comment
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk d5d83905a1 spu_run.2: Minor fix-ups for comments
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk a8114045ab fanotify.7, inotify.7: wfix: Tweak location of tag comments
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:25 +01:00
Michael Kerrisk 46b20ca1bb ioctl_ns.2, keyctl.2, memfd_create.2, pidfd_send_signal.2, poll.2, seccomp.2, signalfd.2, timerfd_create.2, unshare.2, dlinfo.3, duplocale.3, fopencookie.3, getgrouplist.3, getifaddrs.3, getprotoent_r.3, getservent_r.3, insque.3, printf.3, pthread_attr_init.3, pthread_cancel.3, pthread_create.3, pthread_mutexattr_setrobust.3, pthread_setaffinity_np.3, qsort.3, sem_wait.3, core.5, elf.5, aio.7, epoll.7, pkeys.7, system_data_types.7, unix.7: Use periods more consistently inside code comments
In general, complete sentences in free-standing comments
should be terminated by periods.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:32:44 +01:00
Michael Kerrisk c6beb8a167 bind.2, clone.2, dup.2, futex.2, mprotect.2, open_by_handle_at.2, pivot_root.2, select_tut.2, shmop.2, timer_create.2, userfaultfd.2, getaddrinfo.3, getaddrinfo_a.3, inet_net_pton.3, malloc_info.3, mbstowcs.3, newlocale.3, posix_spawn.3, pthread_sigmask.3, shm_open.3, strtol.3, inotify.7, user_namespaces.7: Add periods at end of sentences in comments
Try to bring a little more consistency on the use of periods
in comments in example code.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:32:44 +01:00
Michael Kerrisk f18f9c4095 man-pages.7: Add some notes on comments in example code
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:32:44 +01:00
Michael Kerrisk 1297239d41 slist.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 14:24:43 +01:00
Michael Kerrisk c5127de6ff stailq.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 14:23:39 +01:00
Michael Kerrisk f52cb55283 list.3, slist.3, stailq.3, tailq.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 14:20:50 +01:00
Michael Kerrisk c2e81ff964 seccomp.2, circleq.3, list.3, malloc_hook.3, slist.3, stailq.3, tailq.3, ip.7, unix.7: tfix
Remove "." at the end of sentence fragments/short single sentences
in comments.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 14:17:30 +01:00
Michael Kerrisk d526b40d5b system_data_types.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 14:10:05 +01:00
Alejandro Colomar eaa18d3c44 Various pages: Remove explicit blank lines, replacing them with .PP when appropriate
Rationale:
$ man 7 man-pages 2>/dev/null | sed -n /Paragraphs/,/^$/p
       Paragraphs should be separated by suitable markers (usually
       either .PP or .IP).  Do not separate paragraphs using blank
       lines,  as  this  results  in poor rendering in some output
       formats (such as PostScript and PDF).

Fix:
$ sed -i -e '1,/^\.EX/s/^$/.PP/' -e '/^\.EE/,/^\.EX/s/^$/.PP/' man?/*

And then some manual adjustments.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 13:19:10 +01:00
Peter H. Froehlich 4fce5f5bc8 syscall.2: Update superh syscall convention
I noticed this while working on some silly "hello, world"
programs, see https://git.sr.ht/~phf/hello-again if you're
curious.  Disassembling sh4 code showed trap #31 all over the
place but the syscall(2) man page talked about trap #0x17 and
friends. Checking the kernel sources I got lucky in
arch/sh/kernel/entry-common.S where in commit 3623d138213ae Rich
Felker clarifies the situation.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 18:14:37 +01:00
Michael Kerrisk fbe926ebdf mallinfo2.3: New link to mallinfo(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk e9e534537d mallinfo.3: Update example program to use mallinfo2()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk 5bf7268349 mallinfo.3: Document mallinfo2() and note that mallinfo() is deprecated
Document the mallinfo2() function added in glibc 2.33.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk 766f0fd68a ld.so.8: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk 4fd41d7544 ld.so.8: Document the --argv0 option added in glibc 2.33
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk 37fac7c6b2 ftime.3: glibc 2.33 has removed ftime()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk c751bb1e0f getrusage.2: Starting in 2.33, glibc no longer provides vtimes()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:01:31 +01:00
Michael Kerrisk 5ebc9e0a0a pthread_attr_setsigmask_np.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk 0c9ab4fcb7 nl_langinfo.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk 15974546a2 isfdtype.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk 46ab01a33a aio_suspend.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk 88a3ec7921 setns.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk ee2379ef31 perf_event_open.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk ff9469c09c statfs.2: tfix (Section number)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk 3ff7c9e360 Changes.old: Minor fixes to 5.10 changelog
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 11:05:58 +01:00
Michael Kerrisk 5e207fcf11 Start of man-pages-5.11: updating Changes and Changes.old 2020-12-22 09:30:12 +01:00
Michael Kerrisk 9811bdcbdf Start of man-pages-5.11: updating .Announce and .lsm files 2020-12-22 09:30:12 +01:00
Michael Kerrisk 339818643f Start of man-pages-5.11: renaming .Announce and .lsm files 2020-12-22 09:30:12 +01:00
Michael Kerrisk 79cd79b631 Ready for 5.10 2020-12-21 16:20:35 +01:00
Michael Kerrisk 9f43659f85 getent.1, access.2, cacheflush.2, chroot.2, clock_getres.2, fcntl.2, getrusage.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, link.2, llseek.2, mmap.2, mount.2, readv.2, restart_syscall.2, semctl.2, set_mempolicy.2, set_tid_address.2, shmctl.2, sigaction.2, sigaltstack.2, spu_create.2, statfs.2, subpage_prot.2, syscalls.2, timer_getoverrun.2, uselib.2, INFINITY.3, __ppc_set_ppr_med.3, bstring.3, btree.3, ctime.3, fgetc.3, fopen.3, getcontext.3, gethostbyname.3, getnetent.3, getprotoent.3, getservent.3, inet.3, j0.3, list.3, makecontext.3, nextafter.3, posix_memalign.3, profil.3, pthread_tryjoin_np.3, puts.3, rcmd.3, resolver.3, rtime.3, sigsetops.3, strnlen.3, tailq.3, elf.5, filesystems.5, nscd.conf.5, proc.5, utmp.5, attributes.7, ipv6.7, packet.7, pthreads.7, signal-safety.7, signal.7, spufs.7, system_data_types.7, tcp.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-21 16:19:35 +01:00
Michael Kerrisk b52ce0e5b5 Changes: Ready for 5.10
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-21 16:13:16 +01:00
Michael Kerrisk fd39178d4a rcmd.3: SEE ALSO: remove intro(2)
There's no reason to link to intro(2)...

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-21 10:36:39 +01:00
Michael Kerrisk adce9485ce cacheflush.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 21:52:42 +01:00
Alejandro Colomar 08811c1418 cacheflush.2: Document Architecture-specific variants
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 21:49:49 +01:00
Alejandro Colomar d7e7ab0e34 cacheflush.2: Document __builtin___clear_cache() as a more portable alternative
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Martin Sebor <msebor@redhat.com>
Cc: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 21:47:43 +01:00
Baruch Siach ce0efb4382 packet.7: Update references to kernel documentation
Files moved from .txt to .rst.

Also, drop / prefix from kernel source tree references.

Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 15:49:17 +01:00
наб 1f8e172790 filesystems.5: wfix: ntfs: remove FAT comparison
The main point I was driving at with this patch was to fix
"Microsoft Window's FAT filesystems" (i.e., FAT filesystems which
belong to Microsoft Windows, which is decidedly wrong).

FAT32 first shipped with MS-DOS 7.1, as part of Windows 95 OSR2,
but it's a (relatively) simple logical extension of the previous
FATx filesystems (16 and 12 as we know and love them today, I
don't think the PC ever saw 8), hence the "VFAT" driver name ‒
calling FAT-anything a Windows filesystem would be a flat-out lie,
calling it a Microsoft filesystem would be, uh, facetious.

NTFS (as part of Windows NT), on the other hand, is wholly
different WRT the scope and feature-set (it does borrow some
layouting from FAT, but reading NTFS as FAT doesn't get you very
far, or much).

The replacing bit is also questionable, especially in a.d. 2020:
while it is true that you cannot install NT on FAT (after a
certain point? my memory ain't what it used to be), and must
therefore replace your existing FAT partitions with NTFS during
upgrades; Windows NT 4.0, the last product to be NT-branded came
out in 1996, i.e. you could not install Windows on FAT (and,
therefore, upgrade it to NTFS, replacing it) during my entire
lifetime.

Indeed, in $(date +%Y) we live in a post-NTFS world ‒ putting NTFS
in the same class as FAT beyond "is a filesystem" is a joke.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 15:42:25 +01:00
Ahelenia Ziemiańska f5bb7e8e4d filesystems.5: Note ncpfs removal from kernel
Relevant Linux commits:
 * moved to staging in 1bb8155080c652c4853e6228f8f0d262b3049699
   (describe: v4.15-rc1-129-g1bb8155080c6) in Nov 2017,
   described as "broken" and "obsolete"
 * purged in bd32895c750bcd2b511bf93917bf7ae723e3d0b6
   (describe: v4.17-rc3-1010-gbd32895c750b) in Jun 2018,
   "since no one has complained or even noticed it was gone"

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 15:41:41 +01:00
Ahelenia Ziemiańska 8c3293a170 filesystems.5: Fix link to user space tooling for ncpfs
Corresponds to Linux commit 1b83df308f69a5a3cc59be03bd7fb23e4bcebd8e

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 15:41:24 +01:00
Michael Kerrisk 5cd5aecdf9 pthreads.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 12:08:09 +01:00
Michael Kerrisk e979e5e4bd pthreads.7: Rephrase function list in terms of POSIX rather than SUS
The list was using an inconsistent mixture of "POSIX" and "SUS".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 12:05:42 +01:00
Michael Kerrisk 5b2ab95fed regex.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 12:01:36 +01:00
Michael Kerrisk 87e8e9e479 pthread_attr_setguardsize.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 12:00:42 +01:00
Michael Kerrisk 8c20c31ad1 pthread_attr_setstacksize.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 12:00:12 +01:00
Michael Kerrisk 6a5f3c599c pthread_mutexattr_setrobust.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 11:58:53 +01:00
Michael Kerrisk 7f3c0a5fcb pthread_attr_setstackaddr.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 11:56:47 +01:00
Michael Kerrisk 3bf920615d pthread_attr_setdetachstate.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 11:56:07 +01:00
Michael Kerrisk ab949f50af setns.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 11:54:31 +01:00
Michael Kerrisk 10cee42ae6 elf.5: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-18 21:16:53 +01:00
Michael Kerrisk 300ef55cf2 perf_event_open.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-16 15:51:34 +01:00
Michael Kerrisk 4cfdaa5365 mount_namespaces.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-16 14:36:22 +01:00
John A. Leuenhagen c93376e8ba strtol.3: tfix
Signed-off-by: John A. Leuenhagen <john@zlima12.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-15 10:23:33 +01:00
Michael Kerrisk 27482d700b elf.5: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-13 11:13:43 +01:00
Michael Kerrisk 89a3c07fb2 elf.5: SEE ALSO: add objcopy(1)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-13 11:13:36 +01:00
Alejandro Colomar 3af0cb4890 tcp.7: tcp_syncookies: It is now an integer [0, 2]
Since Linux kernel 3.12, tcp_syncookies can have the value 2,
which sends out cookies unconditionally.

Related kernel commits:
5ad37d5deee1ff7150a2d0602370101de158ad86
d8513df2598e5142f8a5c4724f28411936e1dfc7

Reported-by: Philip Rowlands <linux-kernel@dimebar.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-13 11:13:30 +01:00
Michael Kerrisk b5dae39596 modf.3: tfix
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=976312

Reported-by: Bill Allombert <ballombe@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-03 10:47:48 +01:00
Arusekk e2e73b468a keyctl.2: tfix
Fixes: fa76da808e

Signed-off-by: Arusekk <arek_koz@o2.pl>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-01 20:46:58 +01:00
Michael Kerrisk 45323bbef7 strnlen.3: Fix a small inconsistency in the text
Quoting Heinrich:

    The strnlen.3 manpage has the following sentence:

    "In doing this, strnlen() looks only at the first maxlen
    characters in the string pointed to by s and never beyond
    s+maxlen."

    This sentence is self-contradictory:

    The last visited character implied by "first maxlen
    characters" is s[maxlen-1].

    Given that "beyond a" does not include "a", the last visited
    character implied by "never beyond s+maxlen" is s[maxlen].

    A consistent sentence would be

    "In doing this, strnlen() looks only at the first maxlen
    characters in the string pointed to by s and never beyond
    s+maxlen-1."

    I would prefer

    "In doing this, strnlen() looks only at the first maxlen
    characters in the string pointed to by s and never beyond
    s[maxlen-1]"

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-28 10:00:23 +01:00
Alejandro Colomar e115d825c3 subpage_prot.2: SYNOPSIS: Fix return type: s/long/int/
The Linux kernel uses 'int' instead of 'long' for the return type.
As glibc provides no wrapper, use the same type the kernel uses.

......

$ grep -n wrapper man-pages/man2/subpage_prot.2
40:There is no glibc wrapper for this system call; see NOTES.
99:Glibc does not provide a wrapper for this system call; call it using

$ grep -rn SYSCALL_DEFINE.*subpage_prot linux/;
linux/arch/powerpc/mm/book3s64/subpage_prot.c:190:
SYSCALL_DEFINE3(subpage_prot, unsigned long, addr,

$ sed -n /SYSCALL.*subpage_prot/,/^}/p \
  linux/arch/powerpc/mm/book3s64/subpage_prot.c \
  |grep return;
		return -ENOENT;
		return -EINVAL;
		return -EINVAL;
		return 0;
		return -EFAULT;
			return -EFAULT;
	return err;

$ sed -n /SYSCALL.*subpage_prot/,/^}/p \
  linux/arch/powerpc/mm/book3s64/subpage_prot.c \
  |grep '\<err\>';
	int err;
			err = -ENOMEM;
		err = -ENOMEM;
	err = 0;
	return err;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-28 09:56:37 +01:00
Michael Kerrisk c8efc05e6a spu_create.2: Clarify that spu_create() now has 4 arguments but once had only 3
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 11:15:14 +01:00
Michael Kerrisk c15912550f spu_create.2: Relocate paragraph on 'mode' argument
This paragraph is a little bit hidden at the end of DESCRIPTION;
make it a little more prominent.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 11:05:44 +01:00
Michael Kerrisk 42c7a19c5f spu_create.2: Add kernel version numbers for SPU_CREATE_AFFINITY_SPU/_MEM
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 11:04:02 +01:00
Michael Kerrisk 7be45add14 spu_run.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 10:05:38 +01:00
Michael Kerrisk 61d6b66a58 getpriority.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 09:29:12 +01:00
Michael Kerrisk fe2764329d getpriority.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 09:28:11 +01:00
Michael Kerrisk 373a3de56d link.2: ffix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-26 13:52:15 +01:00
Mathias Rav 336be2e745 link.2: ERRORS: add ENOENT when target is deleted
Linux kernel commit aae8a97d3ec30788790d1720b71d76fd8eb44b73 (part
of kernel release v2.6.39) added a check to disallow creating a
hardlink to an unlinked file.

The manual page already describes the trick of using
AT_SYMLINK_FOLLOW as an alternative to AT_EMPTY_PATH, and for
AT_EMPTY_PATH the manual page already notes that it "will
generally not work if the file has a link count of zero". However,
the precise error (ENOENT) is not mentioned, and the error case
isn't mentioned in the ERRORS section at all.

This makes it easy to overlook the fact that the AT_SYMLINK_FOLLOW
trick on /proc/self/fd/NN won't work on deleted files, as
evidenced by the follow message (which turns up when googling
"linkat deleted ENOENT"):
https://groups.google.com/g/linux.kernel/c/zZO4lqqwp64

Signed-off-by: Mathias Rav <m@git.strova.dk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-26 10:58:54 +01:00
Amir Goldstein af5a2ff87e fanotify.7: fix outdated description
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-26 10:33:37 +01:00
Michael Kerrisk 32a72b3e1b pivot_root.2: tfix
Reported-by: Davide Giorgio <davide@giorgiodavide.it>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-26 10:30:35 +01:00
Michael Kerrisk 6e94330a07 getrusage.2: Note that the 'vtimes' symbol exists only up to glibc 2.32
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-25 23:42:44 +01:00
Alejandro Colomar 36ded6fe89 set_tid_address.2: SYNOPSIS: Fix set_tid_address() return type
The Linux kernel uses 'pid_t' instead of 'long' for the return type.
As glibc provides no wrapper, use the same types the kernel uses.

$ sed -n 34,36p man-pages/man2/set_tid_address.2
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.

$ grep -rn 'SYSCALL_DEFINE.*set_tid_address' linux/
linux/kernel/fork.c:1632:
SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)

$ sed -n 1632,1638p linux/kernel/fork.c
SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
{
	current->clear_child_tid = tidptr;

	return task_pid_vnr(current);
}

$ grep -rn 'task_pid_vnr(struct' linux/
linux/include/linux/sched.h:1374:
static inline pid_t task_pid_vnr(struct task_struct *tsk)

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-24 10:49:48 +01:00
Alejandro Colomar 701b2272cd restart_syscall.2: SYNOPSIS: Fix restart_syscall() return type
The Linux kernel uses 'long' instead of 'int' for the return type.
As glibc provides no wrapper, use the same types the kernel uses.

$ grep -rn 'SYSCALL_DEFINE.*(restart_syscall'
kernel/signal.c:2891:SYSCALL_DEFINE0(restart_syscall)

$ sed -n 2891,2895p kernel/signal.c
SYSCALL_DEFINE0(restart_syscall)
{
	struct restart_block *restart = &current->restart_block;
	return restart->fn(restart);
}

$ grep -rn 'struct restart_block {'
include/linux/restart_block.h:25:struct restart_block {

$ sed -n 25,56p include/linux/restart_block.h
struct restart_block {
	long (*fn)(struct restart_block *);
	union {
		/* For futex_wait and futex_wait_requeue_pi */
		struct {
			u32 __user *uaddr;
			u32 val;
			u32 flags;
			u32 bitset;
			u64 time;
			u32 __user *uaddr2;
		} futex;
		/* For nanosleep */
		struct {
			clockid_t clockid;
			enum timespec_type type;
			union {
				struct __kernel_timespec __user *rmtp;
				struct old_timespec32 __user *compat_rmtp;
			};
			u64 expires;
		} nanosleep;
		/* For poll */
		struct {
			struct pollfd __user *ufds;
			int nfds;
			int has_timeout;
			unsigned long tv_sec;
			unsigned long tv_nsec;
		} poll;
	};
};

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 22:52:30 +01:00
Michael Kerrisk d01ce2930f attributes.7: SEE ALSO: add signal-safety(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 13:35:04 +01:00
Michael Kerrisk 9bc4ab60e6 lseek64.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 13:28:12 +01:00
Michael Kerrisk 6c9fd46b05 pthread_tryjoin_np.3: Note that pthread_timedjoin_np() uses CLOCK_REALTIME, but there's a bug
Learned from an email converasation with Mike Crowe, and
verified by experiment.

Reported-by: Mike Crowe <mac@mcrowe.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 10:32:03 +01:00
Michael Kerrisk bdcc471b64 standards.7: Add LFS (Large File Summit)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 10:08:52 +01:00
Michael Kerrisk e0b19c5b50 lseek64.3: NOTES: describe the origin of lseek64() in LFS
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 10:01:25 +01:00
Michael Kerrisk 83f0bca3b1 lseek64.3: Remove sentence saying lseek64() is an alias for llseek()
As far as I can see, it is instead simply an alias for a
wrapper that calls _llseek(). Saying it's an alias for "llseek()"
seems confusing.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 09:42:00 +01:00
Michael Kerrisk 50f5ae5389 lseek64.3: Remove section numbers from interface list
We're talking of a mix of wrapper functions and system calls
in this page. lseek() is both a system and a wrapper function,
and this page is mostly describing the wrapper

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 09:32:38 +01:00
Michael Kerrisk 522c24f1cb lseek64.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 09:31:01 +01:00
Michael Kerrisk 8369c0f737 lseek64.3: Minor clarifications
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 09:24:56 +01:00
Michael Kerrisk 90f1c92fd3 lseek64.3: srcfix: add some comments to remind myself of some details
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 07:26:52 +01:00
Michael Kerrisk 7c1a416d65 llseek.2: Point the reader to lseek64(3) for info about llseek(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 07:18:43 +01:00
Michael Kerrisk 48a830d7c8 llseek.2: Note size of 'loff_t' type
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 07:11:13 +01:00
Michael Kerrisk eca874e183 lseek64.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 07:08:12 +01:00
Michael Kerrisk 62d506c7a2 getnameinfo.3: tfix
Reported-by: Sebastian Kirmayer <man-pages@kirmayer.eu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 06:54:02 +01:00
Michael Kerrisk 1876c40aed lseek64.3: srcfix: Add a lore link to some background on these APIs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 00:00:24 +01:00
Michael Kerrisk 5ef9b068ec getnameinfo.3: tfix
Reported-by: Sebastian Kirmayer <sebastian@kirmayer.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-22 23:56:03 +01:00
Michael Kerrisk 940a0979de llseek.2: Some mild rewriting to ease reading of the info in this page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-22 07:34:56 +01:00
Alejandro Colomar e7ff75357d capget.2, execve.2, readv.2, socketpair.2, utime.2, utimensat.2, getloadavg.3, proc.5, mount_namespaces.7, unix.7: ffix
{.IR var [x]} -> {.I var[x]}

There were around 15 entries of the former,
and around 360 of the latter.

Found using:
$ grep -rn '^\.I[ |R].* \[.*\]' |sort

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-21 23:33:07 +01:00
Alejandro Colomar 6ff0e05d77 utmp.5: Oxford comma
Found using:
$ grep -rn '\\f., [^ ]*\\f. and' man?

I also updated the markup in that paragraph: \f -> .

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-21 22:26:16 +01:00
Jing Peng e2c751049c futex.2: tfix
In the comment of the example program, the peer blocks on fwait()
rather than fpost().

Signed-off-by: Jing Peng <pj.hades@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-21 22:25:21 +01:00
Michael Kerrisk fd97f2fe65 standards.7: Relocate the discussion on POSIX manual pages
Rather than mention these pages under the discussion of one
version of the standard, move that text to the end of the page,
where it is probably a little more obvious.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-21 07:56:32 +01:00
Michael Kerrisk 978412f5c4 standards.7: Add URL for POSIX.1-2008/SUSv4
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-21 07:44:58 +01:00
Michael Kerrisk f89df02010 standards.7: Fix some URLs for locations of the standards
Reported-by: Rob Landley <rob@landley.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-21 07:44:36 +01:00
Michael Kerrisk 19b2538d4b clock_getres.2: Plae ERRORS in alphabetical order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-21 06:49:25 +01:00
Michael Kerrisk 0b3f52d008 socket.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-19 10:41:47 +01:00
Michael Kerrisk b5638e2e06 socket.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-19 10:29:25 +01:00
Michael Kerrisk 6b3561b8e4 arch_prctl.2: wfix: "current thread" ==> "calling thread"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-19 10:20:31 +01:00
Michael Kerrisk 7533c83d88 perf_event_open.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-18 23:39:00 +01:00
Michael Kerrisk 5ae2634dba perf_event_open.2: Minor tweaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-18 23:39:00 +01:00
Namhyung Kim 1e554f3e32 perf_event_open.2: Update man page with recent kernel changes
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
[alx: ffix + tfix]
Cowritten-by:  Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>

Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Stephane Eranian <eranian@google.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Song Liu <songliubraving@fb.com>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Vince Weaver <vincent.weaver@maine.edu>

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-18 22:58:20 +01:00
Michael Kerrisk bdeb6c887e signal.7: Add pidfd_send_signal() to list of APIs for sending signals
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-18 00:19:44 +01:00
Michael Kerrisk 1f11ae8aa7 signal.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-18 00:15:27 +01:00
Michael Kerrisk 42e6553d40 signal.7: Fixes and additions to text on execution of signal handlers
After comments from Dave Martin.

Reported-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-17 18:04:34 +01:00
Michael Kerrisk a3727934a0 sigaction.2: Add a cross-reference to signal(7) for further info on 'ucontext_t'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-17 13:18:09 +01:00
Michael Kerrisk 938dd97e35 signal.7: Mention 'ucontext_t' in the discussion of signal handler execution
Linking up the info presented on this page with the discussion
in getcontext(3) helps the reader.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-17 13:16:22 +01:00
Michael Kerrisk 6430ba7a90 makecontext.3: Minor rewording
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-17 13:12:18 +01:00
Michael Kerrisk e066dcb35a signal.7: Fixes to the text of "Execution of signals handlers"
See https://lore.kernel.org/linux-man/3fac10ea-7fed-739b-4974-09845f34867f@gmail.com/

Reported-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-17 11:43:37 +01:00
Michael Kerrisk e7a5700f23 getcontext.3, signal.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-17 09:55:02 +01:00
Michael Kerrisk 3a38254934 getcontext.3: SEE ALSO: add signal(7)
The signal(7) manual page has some useful info related
to ucontext_t.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-17 09:53:34 +01:00
Michael Kerrisk 2f29697700 getcontext.3: Mention SA_SIGINFO flag when talking about 3-argument signal handler
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 21:57:48 +01:00
Michael Kerrisk 1680bd6e73 getcontext.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 21:57:48 +01:00
Alejandro Colomar 1d8566691a Add script to get modified pages for commit messages
The script can be used this way:

git commit -sm "$(./scripts/modified_pages.sh): Short commit msg"

And then maybe --amend and add a longer message.

This is especially useful for changes to many pages at once,
usually when running a script to apply some global changes.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 21:26:15 +01:00
Michael Kerrisk ebf47ac9da uselib.2, posix_memalign.3, profil.3, rtime.3: Remove some text about libc/libc5
With this change, there remain almost no vestiges of information
about the long defunct Linux libc.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 12:29:42 +01:00
Michael Kerrisk d678063436 ioctl_tty.2, matherr.3, cciss.4, sk98lin.4: ffix: use proper table for formatting, not .nf/.fi
This gives better PDF rendering.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 11:26:23 +01:00
Michael Kerrisk 85c5699bc3 cciss.4: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 11:26:23 +01:00
Michael Kerrisk 30dd9882b0 pidfd_open.2, pidfd_send_signal.2, poll.2, semget.2: ffix: EXAMPLES: use .EX/.EE instead of .nf/.fi
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 11:26:23 +01:00
Michael Kerrisk 34de771d1f man-pages.7: ffix: use a table rather .nf/.fi
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 11:26:23 +01:00
Michael Kerrisk 13304561e8 MAINTAINER_NOTES: Add a file with some notes for maintainers
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 11:26:23 +01:00
Michael Kerrisk 67bc5d49be scandir.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 11:26:23 +01:00
Michael Kerrisk 5a659c0829 check_unbalanced_macros.sh: A script to look for unbalanced *roff/man macro pairs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 11:26:23 +01:00
Michael Kerrisk b2d7a6f8d8 queue.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 08:23:00 +01:00
Michael Kerrisk cfdcea61de kernel_lockdown.7: Remove unneeded quotes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 08:23:00 +01:00
Michael Kerrisk fdf5dbe784 nextafter.3: Remove duplicate "BUGS" section heading
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 08:23:00 +01:00
Michael Kerrisk ce7ba00b76 bpf.2: Place EXAMPLES section in correct location
As per section ordering rules given in man-pages(7).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 08:23:00 +01:00
Michael Kerrisk af8d2ec2c1 CIRCLEQ_EMPTY.3, CIRCLEQ_FIRST.3, CIRCLEQ_FOREACH.3, CIRCLEQ_FOREACH_REVERSE.3, CIRCLEQ_HEAD_INITIALIZER.3, CIRCLEQ_LAST.3, CIRCLEQ_LOOP_NEXT.3, CIRCLEQ_LOOP_PREV.3, CIRCLEQ_NEXT.3, CIRCLEQ_PREV.3: Add missing links to circleq.3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 08:23:00 +01:00
Michael Kerrisk 3112110398 list.3: NAME: remove LIST_PREV, which is not documented in this page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 08:23:00 +01:00
Michael Kerrisk 4f6d0749d0 pthread_attr_getsigmask_np.3: New link to pthread_attr_setsigmask_np.3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 08:23:00 +01:00
Michael Kerrisk 71103ce878 prctl.2, setns.2: tfix: remove section number from API documented in this page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-16 08:22:50 +01:00
Michael Kerrisk 7a92eea0de chroot.2, memfd_create.2, tailq.3: Fix unbalanced .nf/.fi
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 23:33:33 +01:00
Michael Kerrisk 678f71707e uname.2, feature_test_macros.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 22:30:17 +01:00
Michael Kerrisk 2ec12d3f32 getutent.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 22:30:02 +01:00
Alejandro Colomar d556548bf4 getent.1, fanotify_mark.2, fcntl.2, futex.2, membarrier.2, mmap.2, mount.2, msgctl.2, readv.2, semctl.2, set_mempolicy.2, shmctl.2, syscalls.2, abs.3, bstring.3, btree.3, ctime.3, drand48.3, fgetc.3, fopen.3, gethostbyname.3, getnetent.3, getprotoent.3, getservent.3, INFINITY.3, __ppc_set_ppr_med.3, inet.3, j0.3, makecontext.3, printf.3, puts.3, resolver.3, sigsetops.3, elf.5, nscd.conf.5, proc.5, inotify.7, ipv6.7, spufs.7, system_data_types.7: Use Oxford comma
Found using:
pcregrep -rnM "^\.[B|I]R .*,\n\.[B|I].*[^,]\nand" man? |grep ^man |sort

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 21:30:30 +01:00
Alejandro Colomar 14d43d3005 locale.5, ipv6.7: ffix
[.B XX_*] is the most extended form in the pages.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 21:29:21 +01:00
Michael Kerrisk 3fd7a10d90 faccessat2.2: New link to access.2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 12:46:29 +01:00
Michael Kerrisk 8729436021 access.2: Document faccessat2()
faccessat2() was added in Linux 5.8 and enables a fix to
longstanding bugs in the faccessat() wrapper function.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 12:44:34 +01:00
Michael Kerrisk 06ad6cdfac access.2: BUGS: note that faccessat() wrapper function emulation ignores ACLs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 12:21:55 +01:00
Colin Ian King 8faba2435b openat.2: Fix include path, should be linux/openat2.h
The include path is linux/openat2, so fix the manual to reference
this correct path.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 10:45:56 +01:00
Michael Kerrisk 3890042031 shmctl.2: wfix (for consistency with other *ctl.2 pages)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 10:27:38 +01:00
Michael Kerrisk 0a33c83e51 msgctl.2, semctl.2, shmctl.2: Minor fix
Break text into more paragraphs to ease readability

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 10:27:33 +01:00
Michael Kerrisk 10aa508cad msgctl.2: Make comments in 'msqid_ds' definition more compact
The comments do not need to be so verbose, since the main text
provides the full details.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 10:06:50 +01:00
Michael Kerrisk bd0ff36407 msgctl.2: Add description of 'msg_cbytes' field
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 10:00:12 +01:00
Michael Kerrisk a07ea11104 msgctl.2: Use field name "msg_cbytes" rather than "__msg_cbytes"
The shorter name is provided by default (i.e., if _DEFAULT_SOURCE
is defined).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 09:56:03 +01:00
Michael Kerrisk 72d2eba770 msgctl.2: Place list of field descriptions in same order as structure definition
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 09:49:49 +01:00
Michael Kerrisk 379c3ee9d0 shmctl.2: Place list of field descriptions in same order as structure definition
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 09:48:15 +01:00
Michael Kerrisk a79c3fc030 semctl.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-15 09:24:11 +01:00
Michael Kerrisk 24ce772b9c sigaction.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-14 10:12:54 +01:00
Michael Kerrisk 659e4f17cc signal-safety.7: Note async-signal-safety details for errno
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-14 08:04:34 +01:00
Michael Kerrisk 57ffe9ddc4 sigaction.2: Minor wording improvements
Restructure the sa_handler description as a list, for easier
reading.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-14 07:56:27 +01:00
Michael Kerrisk 06287aca29 sigaction.2: Clarify description of SA_NODEFER
Clarify description of SA_NODEFER, and note interaction with
act.sa_mask.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-14 07:50:20 +01:00
Michael Kerrisk 66b961cab6 sigaction.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-14 07:50:20 +01:00
Michael Kerrisk 4f71321abe sigaction.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-14 07:50:20 +01:00
Alejandro Colomar 2b9bf369d1 perf_event_open.2: srcfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-13 22:49:55 +01:00
Michael Kerrisk 17cf67cc72 signal.7: Minor tweaks to new "Execution of signal handlers" subsection
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-13 13:04:07 +01:00
Alejandro Colomar 33694c779a io_setup.2: SYNOPSIS: return long
The Linux kernel uses a long as the return type for this syscall.
As glibc provides no wrapper, use the same types the kernel uses.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-13 10:23:53 +01:00
Michael Kerrisk 4672536d89 signal.7: Relocate the new "Execution of signal handlers" subsection
It is probably more sensible to place this section after
the subsection "Signal mask and pending signals".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-12 22:14:52 +01:00
Alejandro Colomar 5020bc2822 perf_event_open.2: Assign calculated value explicitly to 'config'
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-12 21:52:06 +01:00
Michael Kerrisk b5277108b4 signal.7: Minor tweaks to the test on execution of signal handlers
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-12 21:48:33 +01:00
Michael Kerrisk f527d6fe30 signal.7: Add some details on the execution of signal handlers
Add a "big picture" of what happens when a signal handler
is invoked.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-12 21:48:33 +01:00
Michael Kerrisk 3b7d89960a sigaltstack.2: Clarify that the alternate signal stack is per-thread
Clarify that the alternate signal stack is per-thread (rather
than process-wide).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-12 14:32:26 +01:00
Michael Kerrisk 52e5819c41 clone.2, sigaltstack.2: clone(CLONE_VM) disdables the alternate signal stack
In the kernel sources (kernel/fork.c::copy_process()), we have:

        /*
         * sigaltstack should be cleared when sharing the same VM
         */
        if ((clone_flags & (CLONE_VM|CLONE_VFORK)) == CLONE_VM)
                sas_ss_reset(p);

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-12 14:07:17 +01:00
Michael Kerrisk 1374ba4278 signal.7: SEE ALSO: add swapcontext(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-12 12:56:57 +01:00
Michael Kerrisk c2a2cc269c sigaction.2: Further clarify the effect of the SA_NODEFER flag
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-12 12:16:45 +01:00
Michael Kerrisk 4be47a8214 getrlimit.2: State more precisely the range of kernel versions that had RLIMIT_LOCKS
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-11 13:00:19 +01:00
Michael Kerrisk 0807d1b387 timer_getoverrun.2: timer_getoverrun() now clamps the overrun count to DELAYTIMER_MAX
See https://bugzilla.kernel.org/show_bug.cgi?id=12665.
The fix by Thomas Gleixner was in kernel commit
78c9c4dfbf8c04883941445a195276bb4bb92c76.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-11 10:33:33 +01:00
Michael Kerrisk 9b71be4f0b signal.2: wfix: Make the warning against the use of signal() even more obvious
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-10 13:13:11 +01:00
Michael Kerrisk 886888470f localedef.1: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-08 13:13:35 +01:00
Michael Kerrisk f100465696 syscalls.2: Note that sysctl() was removed in Linux 5.5
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-06 12:35:47 +01:00
Michael Kerrisk c53d4fc16e bpf.2: Minor wording improvement
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-06 12:34:00 +01:00
Michael Kerrisk 13648a9cfa proc.5: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-06 12:30:20 +01:00
Michael Kerrisk baa72cc312 syscalls.2: Add process_madvise()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-06 07:41:02 +01:00
Michael Kerrisk 97ba2b53f5 mount.2, statfs.2: Minor tweaks to Ross Zwisler's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-06 07:40:06 +01:00
Ross Zwisler 527375b2c7 mount.2, statfs.2: Add NOSYMFOLLOW flags to mount(2) and statfs(2)
Signed-off-by: Ross Zwisler <zwisler@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-06 07:40:06 +01:00
Peter Oskolkov d98b1454fc membarrier.2: Update for Linux 5.10
Linux kernel commit 2a36ab717e8fe678d98f81c14a0b124712719840
(part of 5.10 release) changed sys_membarrier prototype/parameters
and added two new commands [MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ
and MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ]. This
man-pages patch reflects these changes, by mostly copying comments
from the kernel patch into the man-page ([Peter Oskolkov] was also
the author of the kernel change).

[mtk: commit message tweaked]

Signed-off-by: Peter Oskolkov <posk@google.com>
Cowritten-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-05 22:07:14 +01:00
Alejandro Colomar 73cf5b8390 strerror.3: tfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-05 10:50:54 +01:00
Michael Kerrisk 2b851e6ffd errno.3: Note another possible cause of the EMFILE error
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-02 13:15:37 +01:00
Michael Kerrisk 9807d9afdd mmap.2: Clarify SIGBUS text and treatment of partial page at end of a mapping
See https://unix.stackexchange.com/questions/616848/what-is-the-behaviour-of-a-file-backed-memory-map-when-reading-from-or-writing-t

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-02 10:57:14 +01:00
Alejandro Colomar 1d5974814d io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2: SYNOPSIS: s/io_context_t/aio_context_t/
Linux uses aio_context_t for these syscalls,
and it's the type provided by <linux/aio_abi.h>.
Use it in the SYNOPSIS.

libaio uses 'io_context_t', but that difference is already noted
in NOTES.

[mtk: patch slightly tweaked]

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-02 08:46:39 +01:00
John A. Leuenhagen 5115a7dede feature_test_macros.7: tfix
Signed-off-by: John A. Leuenhagen <john@zlima12.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-02 08:43:32 +01:00
Michael Kerrisk 07d6c242cf Start of man-pages-5.10: updating Changes and Changes.old 2020-11-02 07:58:09 +01:00
Michael Kerrisk db9c2b96ab Start of man-pages-5.10: updating .Announce and .lsm files 2020-11-02 07:58:09 +01:00
Michael Kerrisk 40e13069d9 Start of man-pages-5.10: renaming .Announce and .lsm files 2020-11-02 07:58:09 +01:00
Michael Kerrisk 2b71d80b72 Ready for 5.09 2020-11-01 21:56:08 +01:00
Michael Kerrisk 1184825216 Changes: whitespace cleanups 2020-11-01 21:56:08 +01:00
Michael Kerrisk 3fde8c2e45 memusage.1, pldd.1, sprof.1, add_key.2, bind.2, bpf.2, clone.2, dup.2, epoll_ctl.2, eventfd.2, fanotify_init.2, fanotify_mark.2, futex.2, getdents.2, getpid.2, getrlimit.2, intro.2, ioctl_fat.2, ioctl_ns.2, kcmp.2, keyctl.2, membarrier.2, memfd_create.2, mprotect.2, msgctl.2, msgop.2, nfsservctl.2, open.2, open_by_handle_at.2, openat2.2, outb.2, perf_event_open.2, pivot_root.2, recv.2, recvmmsg.2, request_key.2, sched_setaffinity.2, sched_setattr.2, seccomp.2, select.2, send.2, signalfd.2, spu_run.2, sysctl.2, timer_create.2, userfaultfd.2, wait.2, CPU_SET.3, abs.3, argz_add.3, backtrace.3, bsearch.3, bswap.3, clock_getcpuclockid.3, cmsg.3, dl_iterate_phdr.3, dlinfo.3, dlopen.3, drand48.3, drand48_r.3, duplocale.3, encrypt.3, endian.3, envz_add.3, errno.3, ffs.3, fopencookie.3, get_phys_pages.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getgrent_r.3, getgrouplist.3, getifaddrs.3, getline.3, getprotoent_r.3, getpwent_r.3, getpwnam.3, getservent_r.3, hsearch.3, insque.3, intro.3, lrint.3, lround.3, lseek64.3, mallinfo.3, malloc_hook.3, malloc_info.3, mbsinit.3, mbstowcs.3, mtrace.3, newlocale.3, ntp_gettime.3, offsetof.3, perror.3, posix_fallocate.3, posix_spawn.3, printf.3, psignal.3, pthread_attr_init.3, pthread_create.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_setaffinity_np.3, pthread_setname_np.3, pthread_sigmask.3, qsort.3, rand.3, random.3, rpc.3, rtnetlink.3, scalbln.3, shm_open.3, stdarg.3, strcat.3, strerror.3, strfmon.3, strptime.3, strsignal.3, strtod.3, strtok.3, strtol.3, strtoul.3, tsearch.3, wordexp.3, loop.4, vcs.4, veth.4, core.5, locale.5, slabinfo.5, cgroup_namespaces.7, cpuset.7, credentials.7, fanotify.7, feature_test_macros.7, inotify.7, ip.7, kernel_lockdown.7, man.7, mount_namespaces.7, namespaces.7, pid_namespaces.7, rtld-audit.7, sigevent.7, sock_diag.7, standards.7, unix.7, user_namespaces.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 21:56:08 +01:00
Michael Kerrisk da11ac24e1 Changes: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 21:56:08 +01:00
Michael Kerrisk 9a81a9fd8d Changes: Ready for 5.09
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 21:16:29 +01:00
Michael Kerrisk 7722ae4804 bpf-helpers.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 21:16:29 +01:00
Michael Kerrisk 152ce70f53 pthread_attr_init.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 21:06:53 +01:00
Alejandro Colomar 23a74bd771 openat.2: SYNOPSIS: return long
The Linux kernel uses long as the return type for this syscall.
As glibc provides no wrapper, use the same type the kernel uses.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 19:04:11 +01:00
Alejandro Colomar a024704790 mq_getsetattr.2: Use 'const' when appropriate
The Linux kernel uses the following:

ipc/mqueue.c:1480:
SYSCALL_DEFINE3(mq_getsetattr, mqd_t, mqdes,
		const struct mq_attr __user *, u_mqstat,
		struct mq_attr __user *, u_omqstat)

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 18:23:38 +01:00
Michael Kerrisk 706d4f73ae pthread_attr_init.3: SEE ALSO: add pthread_attr_init(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 18:18:13 +01:00
Michael Kerrisk 96841f0e25 pthread_sigmask.3: SEE ALSO: add pthread_attr_setsigmask_np(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 18:18:13 +01:00
Michael Kerrisk 340f4f9e7c pthread_attr_setsigmask_np.3: New page for pthread_attr_setsigmask_np() + pthread_attr_getsigmask_np()
Add a page documenting the pthread_attr_setsigmask_np(3) and
pthread_attr_getsigmask_np() functions added in glibc 2.32.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 18:18:13 +01:00
Michael Kerrisk 2e33563284 statx.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-01 07:17:20 +01:00
Michael Kerrisk e9c09849cc dlopen.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-31 10:17:00 +01:00
Alejandro Colomar 68219aba7f futex.2: ffix
That comment wrapped on an 80-column terminal.
Divide it into two lines.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-30 21:05:10 +01:00
Alejandro Colomar 2253ecf016 futex.2: Use appropriate types
The Linux kernel uses the following:

kernel/futex.c:3778:
SYSCALL_DEFINE6(futex, u32 __user *, uaddr, int, op, u32, val,
		struct __kernel_timespec __user *, utime, u32 __user *, uaddr2,
		u32, val3)

Since there is no glibc wrapper, use the same types the kernel uses.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-30 20:16:08 +01:00
Alejandro Colomar 8a60718ef0 futex.2: srcfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-30 20:15:59 +01:00
Alejandro Colomar 13e88b7070 getdents.2: Use appropriate types
[mtk: Applied patch manually]

getdents():
This function has no glibc wrapper.
As such, we should use the same types the Linux kernel uses:
Use 'long' as the return type.

getdents64():
The glibc wrapper uses:
ssize_t getdents64(int, void *, size_t);

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-29 20:10:56 +01:00
Michael Kerrisk 833ba57027 getdents.2: Minor tweak to Alex's patch
The text in NOTES doesn't really relate specifically to
the #include, so remove the comment on the #include.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 22:17:53 +01:00
Alejandro Colomar 2adfdd7795 getdents.2: SYNOPSIS: Add missing header and feature test macro
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 22:16:41 +01:00
Alejandro Colomar d70361dab7 getdents.2: wfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 22:14:02 +01:00
Alejandro Colomar 276dc9a3cc clock_getres.2: EXAMPLES: Use 'const' when appropriate
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 22:13:50 +01:00
Alejandro Colomar 93f369892a strtol.3: EXAMPLES: Simplify errno checking
(No expected change in behavior,)

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 11:12:22 +01:00
Alejandro Colomar b924e6b65a strtol.3: EXAMPLES: As the default base, use special value 0
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 11:11:25 +01:00
Alejandro Colomar d01c330357 strtol.3: EXAMPLES: Delimit output string using ""
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 11:11:12 +01:00
Michael Kerrisk 10414db19b man_show_fixme.sh: Don't hyphenate or justify the manual page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 09:42:41 +01:00
Michael Kerrisk 820e13fbd4 socket.7: srcfix: rewrap source lines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 07:20:31 +01:00
Sridhar Samudrala e8500ecc78 socket.7: Document SO_INCOMING_NAPI_ID
Signed-off-by: Sridhar Samudrala <sridhar.samudrala@intel.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 07:15:43 +01:00
Michael Kerrisk f36f4f855b strtol.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-28 07:01:01 +01:00
Michael Kerrisk b6a968bca7 strtol.3: srcfix: Add myself to copyright
I added the xample program in 2006, but omitted to add myself to the
copyright.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 20:00:23 +01:00
Michael Kerrisk 30d41ce662 FIXME_list.sh: Fix broken regexp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 19:42:47 +01:00
Michael Kerrisk 4111ac7675 perf_event_open.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 17:59:36 +01:00
Michael Kerrisk 0f66701491 perf_event_open.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 17:55:07 +01:00
Alexey Budankov d19b29a5bc perf_event_open.2: Update the man page with CAP_PERFMON related information
Extend this page with the information about CAP_PERFMON capability
designed to secure performance monitoring and observability
operation in a system according to the principle of least
privilege [1] (POSIX IEEE 1003.1e, 2.2.2.39).

[1] https://sites.google.com/site/fullycapable/, posix_1003.1e-990310.pdf

Signed-off-by: Alexey Budankov <alexey.budankov@linux.intel.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 17:53:10 +01:00
Alejandro Colomar 900d564055 system_data_types.7: off_t: Add note about _FILE_OFFSET_BITS
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 17:34:55 +01:00
Michael Kerrisk 8573214f58 lseek64.3: Since glibc 2.28. the 'llseek' symbol is no longer available
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 17:08:18 +01:00
Jann Horn 20e43cd694 proc.5: Document inaccurate RSS due to SPLIT_RSS_COUNTING
[mtk: Manually applied patch, because of conflicts with other
merged changes; also added an edit suggested by Jann; see the
thread at
https://lore.kernel.org/linux-man/20201012114940.1317510-1-jannh@google.com/]

Since 34e55232e59f7b19050267a05ff1226e5cd122a5 (introduced back in
v2.6.34), Linux uses per-thread RSS counters to reduce cache
contention on the per-mm counters. With a 4K page size, that means
that you can end up with the counters off by up to 252KiB per
thread.

Example:

$ cat rsstest.c
#include <stdlib.h>
#include <err.h>
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/eventfd.h>
#include <sys/prctl.h>
void dump(int pid) {
  char cmd[1000];
  sprintf(cmd,
    "grep '^VmRSS' /proc/%d/status;"
    "grep '^Rss:' /proc/%d/smaps_rollup;"
    "echo",
    pid, pid
  );
  system(cmd);
}
int main(void) {
  eventfd_t dummy;
  int child_wait = eventfd(0, EFD_SEMAPHORE|EFD_CLOEXEC);
  int child_resume = eventfd(0, EFD_SEMAPHORE|EFD_CLOEXEC);
  if (child_wait == -1 || child_resume == -1) err(1, "eventfd");
  pid_t child = fork();
  if (child == -1) err(1, "fork");
  if (child == 0) {
    if (prctl(PR_SET_PDEATHSIG, SIGKILL)) err(1, "PDEATHSIG");
    if (getppid() == 1) exit(0);
    char *mapping = mmap(NULL, 80 * 0x1000, PROT_READ|PROT_WRITE,
                         MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
    eventfd_write(child_wait, 1);
    eventfd_read(child_resume, &dummy);
    for (int i=0; i<40; i++) mapping[0x1000 * i] = 1;
    eventfd_write(child_wait, 1);
    eventfd_read(child_resume, &dummy);
    for (int i=40; i<80; i++) mapping[0x1000 * i] = 1;
    eventfd_write(child_wait, 1);
    eventfd_read(child_resume, &dummy);
    exit(0);
  }

  eventfd_read(child_wait, &dummy);
  dump(child);
  eventfd_write(child_resume, 1);

  eventfd_read(child_wait, &dummy);
  dump(child);
  eventfd_write(child_resume, 1);

  eventfd_read(child_wait, &dummy);
  dump(child);
  eventfd_write(child_resume, 1);

  exit(0);
}
$ gcc -o rsstest rsstest.c && ./rsstest
VmRSS:	      68 kB
Rss:                 616 kB

VmRSS:	      68 kB
Rss:                 776 kB

VmRSS:	     812 kB
Rss:                 936 kB

$

Let's document that those counters aren't entirely accurate.

Reported-by: Mark Mossberg <mark.mossberg@gmail.com>
Signed-off-by: Jann Horn <jannh@google.com>

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:52:08 +01:00
Michael Kerrisk 14948ad6ec proc.5: Minor fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk bd13ace0c5 proc.5: ffix: use a hanging list as is done elsewhere in the page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Alejandro Colomar 4492c4bf2c system_data_types.7: ffix
Format section names inside each type.
Follow the same pattern as in stat.2 (see line 158: ".IR Note :")

Before this ffix, it was visually harder to find sections inside a type.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Alejandro Colomar 476e632b65 system_data_types.7: ffix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 2fbfb575b8 capabilities.7: Under CAP_SYS_ADMIN, group "sub-capabilities" together
CAP_BPF, CAP_PERFMON, and CAP_CHECKPOINT_RESTORE have all been
added to split out the power of CAP_SYS_ADMIN into weaker pieces.
Group all of these capabilities together in the list under
CAP_SYS_ADMIN, to make it clear that there is a pattern to these
capabilities.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 045c5bde77 capabilities.7: CAP_SYS_ADMIN implies CAP_CHECKPOINT_RESTORE
But the latter, weaker capability is preferred.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk a526aa4040 capabilities.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 71f6247f3c capabilities.7: Document the CAP_CHECKPOINT_RESTORE capability added in Linux 5.9
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 167f94b707 proc.5: Update capability requirements for accessing /proc/[pid]/map_files
The requirements changed with kernel commit 12886f8ab10ce6.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 1e516a820b pid_namespaces.7: Update capability requirements for /proc/sys/kernel/ns_last_pid
Since Linux 5.9, CONFIG_CHECKPOINT_RESTORE also allows writing to
/proc/sys/kernel/ns_last_pid.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 1e4d6750e0 clone.2: CAP_CHECKPOINT_RESTORE can now be used to employ 'set_tid'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 874355e30b capabilities.7: Add kernel doc reference for CAP_PERFMON
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk f7cf9c0bf0 capabilities.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 3af4e9733e posix_fallocate.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Érico Rolim d5ee3a149e posix_fallocate.3: add EOPNOTSUPP error code.
As can be seen in

https://git.musl-libc.org/cgit/musl/tree/src/fcntl/posix_fallocate.c?id=73cc775bee53300c7cf759f37580220b18ac13d3

musl libc returns the syscall's errors directly, which means it
doesn't perform the same emulation as glibc, and can return
EOPNOTSUPP to an application, which isn't listed in ERRORS.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 14:51:44 +01:00
Michael Kerrisk 631337cee3 system_data_types.7: Promote makedev(3) in discussion of 'dev_t'
makedev(3) provides much more detail on this type, so mention it
in the description rather than in 'See also'.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 07:06:15 +01:00
Michael Kerrisk c198bc6d41 system_data_types.7: Under 'dev_t' mention stat(2) rather than ustat(2) in "See also"
stat(2) is the most interesting API here; ustat(2) is obscure.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 06:59:57 +01:00
Alejandro Colomar c5af3bfc1a dev_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 06:58:59 +01:00
Alejandro Colomar 63aa8b9a46 system_data_types.7: Add 'dev_t'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-27 06:58:35 +01:00
Michael Kerrisk 43891c16ed argz_add.3, envz_add.3: Point out that 'error_t' is an integer type
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-26 17:13:33 +01:00
Michael Kerrisk 588b77dc9d argz_add.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-26 16:51:15 +01:00
Michael Kerrisk dd427377e2 argz_add.3, envz_add.3: Remove sentence that conveys no useful info
The sentence "Handle with care" in CONFORMING TO conveys no useful
information. Remove it.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-26 16:25:51 +01:00
Michael Kerrisk fd6f7ef2f7 argz_add.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-26 16:24:49 +01:00
Alejandro Colomar c89a843c28 stailq.3: SEE ALSO: Add insque(3), queue(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-26 06:49:31 +01:00
Alejandro Colomar 94964749a5 clockid_t: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 22:17:47 +01:00
Alejandro Colomar 8df562c03f system_Data_types.7: Add 'clockid_t'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 22:17:39 +01:00
Alejandro Colomar 083d4e6a47 circleq.3, insque.3, list.3, slist.3, tailq.3: SEE ALSO: queue(3) -> queue(7)
queue.3 has been moved to queue.7.

Fix SEE ALSO accordingly.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 22:17:28 +01:00
Alejandro Colomar 68fab1113e queue.3: Link to queue(7)
queue has been for so many years in Section 3,
and still is in Section 3 in most manuals.

For legacy reasons,
especially because hyperlinks to the online manual pages
would break otherwise,
a link queue.3 -> queue(7) is necessary.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 22:17:13 +01:00
Alejandro Colomar d9a0505f71 queue.3, queue.7: Move queue.3 to queue.7
After forking slist.3, list.3, tailq.3, stailq.3 & circleq.3
in the previous commits,
this page no longer belongs in Section 3 of the manual pages.

According to its contents, the most suitable section is Section 7.

Because of legacy reasons, a link queue.3 -> queue(7)
would be appropriate.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 22:17:05 +01:00
Michael Kerrisk 11fd5e7c2a membarrier.2, openat2.2, insque.3, proc.5, tzfile.5, hier.7: Minor grammar fix
Don't hyphenate after adjective ending in "ly". See, for example:
https://www.dragoman.ist/compound-modifiers-with-words-ending-in-ly/
https://www.merriam-webster.com/words-at-play/6-common-hypercorrections-and-how-to-avoid-them/between-you-and-i

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 13:12:57 +01:00
Dmitry V. Levin ba273524e7 tailq.3: tfix
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 13:07:43 +01:00
Michael Kerrisk 9484d926ff stailq.3, tailq.3: Minor fix: replace ".Ss" lines with ".PP"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 12:31:25 +01:00
Michael Kerrisk df10ec359a circleq.3, list.3, queue.3, slist.3, stailq.3, tailq.3: Minor grammar fix
Don't hyphenate after adjective ending in "ly". See, for example:
https://www.dragoman.ist/compound-modifiers-with-words-ending-in-ly/
https://www.merriam-webster.com/words-at-play/6-common-hypercorrections-and-how-to-avoid-them/between-you-and-i

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 12:23:43 +01:00
Michael Kerrisk df1a46a560 circleq.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 12:19:44 +01:00
Alejandro Colomar 13e59b9684 circleq.3, list.3, slist.3, stailq.3, tailq.3: Use the 'struct' keyword when appropriate
This helps differentiate 'TYPE' in some arguments from
'struct TYPE *var' in others, and is technically more correct.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 12:15:47 +01:00
Michael Kerrisk d03e886304 queue.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 12:11:25 +01:00
Alejandro Colomar d43abf2771 queue.3: Fix & update after forking circleq.3, list.3, slist.3, stailq.3 & tailq.3
- ffix: Use man markup
- Remove specific notes about code size increase
  and execution time increase,
  as they were (at least) inaccurate.
  Instead, a generic note has been added.
- Structure the text into subsections.
- Remove sections that were empty after the forks.
- Clearly relate macro names (SLIST, TAILQ, ...)
  to a human readable name of which data structure
  they implement.

Reported-by: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 12:09:38 +01:00
Alejandro Colomar 90a60096ba queue.3: Add self to copyright notice
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 12:09:27 +01:00
Michael Kerrisk 3fe1b81c69 strerrorname_np.3: New link to strerror(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:58:01 +01:00
Michael Kerrisk a8556aef87 strerrordesc_np.3: New link to strerror(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:58:01 +01:00
Michael Kerrisk d2c55aa77d strerror.3: Document strerrorname_np() and strerrordesc_np()
strerrorname_np() and strerrordesc_np() were added in glibc 2.32.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:58:01 +01:00
Michael Kerrisk fddad21b8f sigdescr_np.3: New link to strsignal.3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:48:31 +01:00
Michael Kerrisk 818c17af67 sigabbrev_np.3: New link to strsignal.3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:48:31 +01:00
Michael Kerrisk 5dc64eddfd strsignal.3: Document sigabbrev_np() and sigdescr_np().
sigabbrev_np() and sigdescr_np() were added in glibc 2.32.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:48:31 +01:00
Alejandro Colomar bfc09cdd9a queue.3: SEE ALSO: Add tailq(3)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:42:56 +01:00
Alejandro Colomar ec1ce1f00e TAILQ_CONCAT.3, TAILQ_EMPTY.3, TAILQ_ENTRY.3, TAILQ_FIRST.3, TAILQ_FOREACH.3, TAILQ_FOREACH_REVERSE.3, TAILQ_HEAD.3, TAILQ_HEAD_INITIALIZER.3, TAILQ_INIT.3, TAILQ_INSERT_AFTER.3, TAILQ_INSERT_BEFORE.3, TAILQ_INSERT_HEAD.3, TAILQ_INSERT_TAIL.3, TAILQ_LAST.3, TAILQ_NEXT.3, TAILQ_PREV.3, TAILQ_REMOVE.3, TAILQ_SWAP.3: Link to the new tailq(3) page instead of queue(3)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:42:50 +01:00
Alejandro Colomar ec99c74df3 tailq.3: Add remaining details to complete the page
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:42:45 +01:00
Alejandro Colomar ace2899780 tailq.3: ffix: Use man markup
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:42:40 +01:00
Alejandro Colomar cf5b6a7745 tailq.3: Copy and adapt code from queue.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:42:35 +01:00
Alejandro Colomar 7b8d4bbf32 queue.3, tailq.3: EXAMPLES: Move code from queue.3 to tailq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:42:31 +01:00
Alejandro Colomar 32d12807a8 queue.3, tailq.3: DESCRIPTION: Move code from queue.3 to tailq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:42:26 +01:00
Alejandro Colomar af64b7276f queue.3, tailq.3: SYNOPSIS: Move code from queue.3 to tailq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:42:21 +01:00
Alejandro Colomar f8f346bc7f queue.3, tailq.3: NAME: Move code from queue.3 to tailq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:42:16 +01:00
Alejandro Colomar 1a5756108b tailq.3: New page that will hold the (tailq) contents of queue.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:42:08 +01:00
Alejandro Colomar b1db934051 circleq.3, list.3, slist.3, stailq.3: Fix return type of macros
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 10:34:07 +01:00
Alejandro Colomar 9fed47b65d queue.3: SEE ALSO: Add stailq(3)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:49:52 +01:00
Alejandro Colomar 852fd77395 STAILQ_CONCAT.3, STAILQ_EMPTY.3, STAILQ_ENTRY.3, STAILQ_FIRST.3, STAILQ_FOREACH.3, STAILQ_HEAD.3, STAILQ_HEAD_INITIALIZER.3, STAILQ_INIT.3, STAILQ_INSERT_AFTER.3, STAILQ_INSERT_HEAD.3, STAILQ_INSERT_TAIL.3, STAILQ_NEXT.3, STAILQ_REMOVE.3, STAILQ_REMOVE_HEAD.3: Link to the new stailq(3) page instead of queue(3)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:49:45 +01:00
Alejandro Colomar 906766f590 stailq.3: Add remaining details to complete the page
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:49:38 +01:00
Alejandro Colomar 00ba3a085e stailq.3: ffix: Use man markup
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:49:33 +01:00
Alejandro Colomar fc89a378d6 stailq.3: Copy and adapt code from queue.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:49:28 +01:00
Alejandro Colomar d47b080534 queue.3, stailq.3: EXAMPLES: Move stailq example from queue.3 to stailq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:49:22 +01:00
Alejandro Colomar cdba777fd5 queue.3, stailq.3: DESCRIPTION: Move stailq specific code from queue.3 to stailq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:49:18 +01:00
Alejandro Colomar 17ef240dbf queue.3, stailq.3: SYNOPSIS: Move code from queue.3 to stailq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:49:13 +01:00
Alejandro Colomar e029607481 queue.3, stailq.3: NAME: Move code from queue.3 to stailq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:49:08 +01:00
Alejandro Colomar 27f9e01adf stailq.3: New page that will hold the (stailq) contents of queue.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:49:03 +01:00
Jing Peng 9ae9894c8e proc.5: wfix
In the section for /proc/[pid]/smaps, the description of field
ProtectionKey occurs twice: both before and after the description of
VmFlags.

Changes made by this patch:
1) Only the first occurrence is kept because its order matches the
output of /proc/[pid]/smaps.
2) The kernel version that CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS was
introduced is only mentioned in the second occurrence. Now it's moved
to the first one.

Signed-off-by: Jing Peng <pj.hades@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:47:47 +01:00
Alejandro Colomar 8fe75257c6 circleq.3: ffix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-25 09:43:56 +01:00
Michael Kerrisk 90845028d2 signal.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-24 12:58:04 +02:00
Alejandro Colomar 14992403c8 queue.3: SEE ALSO: Add circleq(3)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:13:47 +02:00
Alejandro Colomar eadc4573fb CIRCLEQ_ENTRY.3, CIRCLEQ_HEAD.3, CIRCLEQ_INIT.3, CIRCLEQ_INSERT_AFTER.3, CIRCLEQ_INSERT_BEFORE.3, CIRCLEQ_INSERT_HEAD.3, CIRCLEQ_INSERT_TAIL.3, CIRCLEQ_REMOVE.3: Link to the new circleq(3) page instead of queue(3)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:13:35 +02:00
Alejandro Colomar ccb0db7f35 circleq.3: Add remaining details to complete the page
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:13:27 +02:00
Alejandro Colomar 086acf39f1 circleq.3: ffix: Use man markup
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:13:21 +02:00
Alejandro Colomar 0d1891f3b6 circleq.3: Copy and adapt code from queue.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:13:16 +02:00
Alejandro Colomar 68ed526e29 queue.3: ffix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:13:11 +02:00
Alejandro Colomar 8306d5cb87 circleq.3, queue.3: EXAMPLES: Move circleq example program from queue.3 to circleq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:13:06 +02:00
Alejandro Colomar 66bb7b4db4 circleq.3, queue.3: DESCRIPTION: Move circleq specific code from queue.3 to circleq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:13:00 +02:00
Alejandro Colomar 8ad9d90ccf circleq.3, queue.3: SYNOPSIS: Move code from queue.3 to circleq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:12:56 +02:00
Alejandro Colomar 90502e3efa circleq.3, queue.3: NAME: Move code from queue-3 to circleq.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:12:50 +02:00
Alejandro Colomar 151c1cffc5 circleq.3: New page that will hold the (circleq) content of queue.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:12:44 +02:00
Alejandro Colomar 31e6e673b1 queue.3: Sort alphabetically
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:11:49 +02:00
Alejandro Colomar 20131a9b3b slist.3: tfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-23 18:10:57 +02:00
Alejandro Colomar 6280809fb8 openat2.2, loop.4: tfix: s/non-zero/nonzero/
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 23:06:02 +02:00
Alejandro Colomar fbe553e912 list.3: Sort alphabetically
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:46:42 +02:00
Michael Kerrisk a45701ef72 list.3, slist.3, strcmp.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:33:04 +02:00
Alejandro Colomar c49f19edef queue.3: SEE ALSO: Add slist(3)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:31:37 +02:00
Alejandro Colomar e988825f2c SLIST_EMPTY.3, SLIST_ENTRY.3, SLIST_FIRST.3, SLIST_FOREACH.3, SLIST_HEAD.3, SLIST_HEAD_INITIALIZER.3, SLIST_INIT.3, SLIST_INSERT_AFTER.3, SLIST_INSERT_HEAD.3, SLIST_NEXT.3, SLIST_REMOVE.3, SLIST_REMOVE_HEAD.3: Link to the new slist(3) page instead of queue(3)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:31:30 +02:00
Alejandro Colomar 22f12126de slist.3: Add details
Add remaining details to complete the page.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:31:24 +02:00
Alejandro Colomar bb8164dec0 slist.3: ffix: Use man markup
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:31:19 +02:00
Alejandro Colomar 6a1c4d6fc4 slist.3: Copy and adapt code from queue.3
A few fixes to note:

- Sorted alphabetically some macros
- ffix: remove alignment spaces in example (as in list.3)

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:31:13 +02:00
Alejandro Colomar 21b0363fd0 queue.3, slist.3: EXAMPLES: Move example program from queue.3 to slist.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:31:07 +02:00
Alejandro Colomar 8d526f6322 queue.3, slist.3: DESCRIPTION: Move slist specific code from queue.3 to slist.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:30:54 +02:00
Alejandro Colomar 36eac952da queue.3, slist.3: SYNOPSIS: Move code from queue.3 to list.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:30:49 +02:00
Alejandro Colomar 96234e9ef8 queue.3, slist.3: NAME: Move code from queue.3 to slist.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:30:42 +02:00
Alejandro Colomar 9f2d647444 slist.3: New page that will hold the (slist) contents of queue.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-22 19:30:35 +02:00
Michael Kerrisk d3f0057ec7 list.3: Minor fix to grammar
Fix a preexisting grammar issue in text taken from queue.3.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:49:54 +02:00
Michael Kerrisk 7e5e369998 list.3: Minor tweak's to Alex's text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:48:03 +02:00
Michael Kerrisk c460d23963 list.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:42:08 +02:00
Michael Kerrisk ef4138a9f3 list.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:41:39 +02:00
Alejandro Colomar 4c95e2afae queue.3: SEE ALSO: Add list(3)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:35:58 +02:00
Alejandro Colomar b44784d752 LIST_EMPTY.3, LIST_ENTRY.3, LIST_FIRST.3, LIST_FOREACH.3, LIST_HEAD.3, LIST_HEAD_INITIALIZER.3, LIST_INIT.3, LIST_INSERT_AFTER.3, LIST_INSERT_BEFORE.3, LIST_INSERT_HEAD.3, LIST_NEXT.3, LIST_REMOVE.3: Link to the new list.3 page instead of queue.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:35:52 +02:00
Alejandro Colomar ce6606e121 list.3: Add details
list.3: NAME: Add description
list.3: DESCRIPTION: Add short description
list.3: SEE ALSO: Add insque(3) and queue(3)
list.3: BUGS: Note LIST_FOREACH() limitations
list.3: RETURN VALUE: Add details about the return value of those macros that "return" a value

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:35:45 +02:00
Alejandro Colomar 87241f17f6 list.3: ffix: Use man markup
list.3: NAME: ffix: Use man markup
list.3: SYNOPSIS: ffix: Use man markup
list.3: DESCRIPTION: ffix: Use man markup
list.3: DESCRIPTION: ffix: Use man markup
list.3: CONFORMING TO: ffix: Use man markup
list.3: EXAMPLES: ffix: Use man markup

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:35:37 +02:00
Alejandro Colomar 481854f548 list.3: Copy and adapt code from queue.3
list.3: SYNOPSIS: Copy include from queue.3
list.3: DESCRIPTION: Copy description about naming of macros from queue.3
list.3: DESCRIPTION: Remove unrelated code to adapt to this page
list.3: DESCRIPTION: Remove lines pointing to the EXAMPLES
list.3: CONFORMING TO: Copy from queue.3
list.3: CONFORMING TO: Adapt to this page

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:35:27 +02:00
Alejandro Colomar be7973e6b1 list.3, queue.3: EXAMPLES: Move example program from queue.3 to list.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:35:20 +02:00
Alejandro Colomar 13514abe53 list.3, queue.3: DESCRIPTION: Move list specific code from queue.3 to list.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:35:12 +02:00
Alejandro Colomar 6ac2278707 list.3, queue.3: SYNOPSIS: Move code from queue.3 to list.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:35:04 +02:00
Alejandro Colomar 71b0fc4a75 list.3, queue.3: NAME: Move code from queue.3 to list.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:34:57 +02:00
Alejandro Colomar 815041a539 list.3: New page that will hold the (list) contents of queue.3
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-21 06:34:47 +02:00
Michael Kerrisk 2009b72758 setns.2: Correct the version for time namespace support
Time namespaces were added in kernel 5.6, but setns() support
for time namespaces was added only starting with kernel 5.8:

    commit 76c12881a38aaa83e1eb4ce2fada36c3a732bad4
    Author: Christian Brauner <christian.brauner@ubuntu.com>
    Date:   Mon Jul 6 17:49:11 2020 +0200

        nsproxy: support CLONE_NEWTIME with setns()

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-20 12:54:32 +02:00
Michael Kerrisk e013bdeb8f namespaces.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-20 12:32:16 +02:00
Michael Kerrisk a1a8c63fd0 namespaces.7: A 'time_for_children' symlink can also pin a namespace
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-20 12:31:34 +02:00
Alejandro Colomar 2b557a7dc7 clock_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-18 18:51:37 +02:00
Alejandro Colomar 92237a424f system_data_types.7: Add 'clock_t'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-18 15:09:39 +02:00
Michael Kerrisk 843574ae2a system_data_types.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-18 15:04:49 +02:00
Michael Kerrisk 853a4cff4e system_data_types.7: srcfix: add comment noting time_t difference in POSIX.1-2001
Paul Eggert commented on a patch that proposed to note the
POSIX.2001 details:

    No actual POSIXish implementation ever made it a
    real-floating type, though, and that point should be made
    lest some conscientious programmer worry about a nonexistent
    porting issue.

We opted to drop the patch, but in case someone else points out
this POSIX.1-2001 difference in the future, let's leave a comment
in the page source.

Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-18 15:00:14 +02:00
Michael Kerrisk 7f306fae15 ld.so.8: Add self to copyright
By now, I'm responsible for quite a lot of the content in
this page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-17 23:16:47 +02:00
Michael Kerrisk 185f4da527 mallinfo.3: srcfix: add comments noting errors in glibc info page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-17 18:49:48 +02:00
Michael Kerrisk 70fd3c08d3 mallinfo.3: The 'usmblks' is nowadays always 0
Verified from the course code.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-17 18:49:48 +02:00
Alejandro Colomar 7e35a02866 regex.3: Add example program
$ gcc -Wall -Wextra -Werror -pedantic regex.c -o regex
$ ./regex.3
String = "1) John Driverhacker;
2) John Doe;
3) John Foo;
"
Matches:
#0:
offset = 25; length = 7
substring = "John Do"
#1:
offset = 38; length = 8
substring = "John Foo"

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-17 16:35:36 +02:00
Alejandro Colomar 740656b855 queue.3: stailq: Complete example
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-17 12:26:00 +02:00
Heinrich Schuchardt 7a737de2e1 kernel_lockdown.7: Describe LSM activation
Describe the activation of the Kernel Lockdown feature via Kconfig
and the command line.

Cf. Documentation/admin-guide/kernel-parameters.rst.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-17 12:23:44 +02:00
Michael Kerrisk d2bbc4b7eb kernel_lockdown.7: Add a VERSIONS section
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-16 18:08:34 +02:00
Michael Kerrisk ae53794d61 kernel_lockdown.7: Various minor edits to bring this page closer to man-pages stype
No content changes...

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-16 18:04:41 +02:00
Heinrich Schuchardt bb509e6fcb kernel_lockdown.7: New page documenting the Kernel Lockdown feature
Provide a man-page for kernel_lockdown. The content is taken
from a patch for the Fedora 34 man-pages available at

https://kojipkgs.fedoraproject.org//packages/man-pages/5.08/1.fc34/src/man-pages-5.08-1.fc34.src.rpm

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-16 17:54:35 +02:00
Michael Kerrisk 02667b1ee5 link.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-16 08:47:15 +02:00
Alejandro Colomar 7ef4fb8fcf queue.3: list: Complete example
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-15 20:49:50 +02:00
Michael Kerrisk 4b6e3782e1 seccomp.2: Warn reader that SECCOMP_RET_TRACE can be overridden
Highlight to the reader that if another filter returns a
higher-precedence action value, then the ptracer will not
be notified.

Reported-by: Jann Horn <jannh@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-15 13:06:36 +02:00
Michael Kerrisk 025584732f regex.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-14 18:39:09 +02:00
Alejandro Colomar 4f2f24ff13 regex.3: wfix
The wording was incorrect:

It stated that 'eflags' may be the OR of one or two of those two flags,
but then a third flag was documented
(which according to the previous wording could not be used?!).
Moreover, the wording also disallowed using 0 (i.e., no flags at all),
which POSIX specifically allows;
I tested the function with no flags and it worked fine for me,
so I guess it was a problem with the documentation,
and not with the implementation itself.

POSIX ref: https://pubs.opengroup.org/onlinepubs/9699919799/

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-14 18:37:33 +02:00
Michael Kerrisk 5d771a4a9d futex.2, quotactl.2: wfix: use "bitwise" rather than "bit-wise"
Most manual pages already use "bitwise".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-14 18:34:45 +02:00
Alejandro Colomar 46b0a9d69c queue.3: circleq: Complete example
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-13 17:36:17 +02:00
Michael Kerrisk 861b602b53 resolv.conf.5: Minor edits to Florian Weimer's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-12 23:11:08 +02:00
Michael Kerrisk cd79eb0ded resolv.conf.5: srcfix: rewrap source lines
No content changes

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-12 23:11:08 +02:00
Florian Weimer a3f91ca97b resolv.5: Document the trust-ad option
Signed-off-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-12 20:48:39 +02:00
Michael Kerrisk 92e4056a29 strsignal.3: Further addition on version range for sys_siglist
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-11 18:04:29 +02:00
Michael Kerrisk d5e7276516 perror.3: sys_errlist and sys_nerr are no longer exposed by <stdio.h>
The change came with the release of glibc 2.32.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-11 18:04:17 +02:00
Alejandro Colomar 5158e8ee72 queue.3: slist: Complete example
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-11 18:04:17 +02:00
Alejandro Colomar b3617b75f9 queue.3: Replace incomplete example by a complete example
I added the EXAMPLES section.
The examples in this page are incomplete
(you can't copy&paste&compile&run).
I fixed the one about TAILQ first,
and the rest should follow.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-11 14:22:20 +02:00
Alejandro Colomar 8e3a414354 regex_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-11 14:21:58 +02:00
Alejandro Colomar adbc303656 system_data_types.7: Add 'regex_t'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-11 14:21:33 +02:00
Alejandro Colomar 71030dbdd2 regex.3: Remove unnecessary include
POSIX requires that the <regex.h> header shall define
the structures and symbolic constants used by the
regcomp(),  regexec(), regerror(), and regfree() functions.

Therefore, there should be no need to include <sys/types.h>
at all.

The POSIX docs don't use that include:
https://pubs.opengroup.org/onlinepubs/9699919799/functions/regcomp.html

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-11 07:38:41 +02:00
Florian Weimer 870d48813c locale.5: Decimal points, thousands separators must be one character
This is implied by POSIX because it requires that these strings in
the locale definition file contain one symbol.  Currently,
locale.5 does not document the concept of symbols, this change
glosses over that and just uses the term "single-character
string".

Signed-off-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-10 11:07:24 +02:00
Alejandro Colomar abb53fc49c system_data_types.7: Add 'fd_set'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-10 11:02:06 +02:00
Michael Kerrisk 2c1b51b14b epoll_ctl.2: epoll instances can be nested to a maximum depth of 5
This limit appears to be an off-by-one count against
EP_MAX_NESTS (4).

Verified by experiment.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-09 23:49:54 +02:00
Michael Kerrisk be1586b2f6 epoll_ctl.2: Move some version info from CONFORMING TO to VERSIONS
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-09 23:06:43 +02:00
Michael Kerrisk 2650e82753 recv.2, send.2: Add cross references to pages with further info about ancillary data
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-08 07:42:24 +02:00
Michael Kerrisk ac31fab940 man.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-08 07:09:00 +02:00
Michael Kerrisk 2f9b9e5a5d man.7: Clarify that alternating typeface macros print arguments without spaces
Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-08 07:07:11 +02:00
Michael Kerrisk 71a382811f socket.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-08 07:03:41 +02:00
Michael Kerrisk 999f8568bd socket.7: SEE ALSO: add ipv6(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-08 07:02:52 +02:00
Michael Kerrisk 0f849717a9 send.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-08 07:00:11 +02:00
Samanta Navarro 9d4976ce7d mmap.2, proc.5, bpf-helpers.7, cpuset.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-07 19:24:59 +02:00
Michael Kerrisk f2e7c3b645 system_data_types.7: Trim "See also" list of 'off_t'
Trim the list to just be a representative sample of
the APIs that use 'off_t'.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-07 08:48:03 +02:00
Alejandro Colomar 0de1c1dda3 off_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-07 08:45:22 +02:00
Alejandro Colomar a0321d70b7 system_data_types.7: Add 'off_t'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-07 08:45:18 +02:00
Michael Kerrisk f5506505da system_data_types.7: tfix: Oxford comma
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-03 22:11:23 +02:00
Michael Kerrisk 8f75c5029c system_data_types.7: tfix: remove mention of __uint128_t and __int128_t types
Those types won't appear in this page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-03 22:05:07 +02:00
Alejandro Colomar 875d83cb57 Revert [u]int_*astN_t commits
Revert "uint_least8_t.3, uint_least16_t.3, uint_least32_t.3, uint_least64_t.3, uint_leastN_t.3: New links to system_data_types(7)"
This reverts commit a5d13a32b7.

Revert "system_data_types.7: Add uint_leastN_t family of types"
This reverts commit 3450a5621e.

Revert "int_least8_t.3, int_least16_t.3, int_least32_t.3, int_least64_t.3, int_leastN_t.3: New links to system_data_types(7)"
This reverts commit 876838354d.

Revert "system_data_types.7: Add int_leastN_t family of types"
This reverts commit f9b54d3a2e.

Revert "uint_fast8_t.3, uint_fast16_t.3, uint_fast32_t.3, uint_fast64_t.3, uint_fastN_t.3: New links to system_data_types(7)"
This reverts commit 496b1aad79.

Revert "system_data_types.7: Add uint_fastN_t family of types"
This reverts commit 3c9ae6e5a2.

Revert "int_fast8_t.3, int_fast16_t.3, int_fast32_t.3, int_fast64_t.3, int_fastN_t.3: New links to system_data_types(7)"
This reverts commit 9df81a23e5.

Revert "system_data_types.7: Add int_fastN_t family of types"
This reverts commit 8f12d3f683.

Reported-by: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-03 13:44:58 +02:00
Alejandro Colomar e1d90896ba system_data_types.7: Move notes about versions to "Versions"
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-03 13:39:28 +02:00
Alejandro Colomar 941e891435 void.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-03 10:00:14 +02:00
Alejandro Colomar baab22e295 system_data_types.7: Add 'void *'
Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Reported-by: David Laight <David.Laight@ACULAB.COM>
Reported-by: Jonathan Wakely <jwakely.gcc@gmail.com>
Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-03 09:59:07 +02:00
Alejandro Colomar c2ccd81779 system_data_types.7: Remove duplicate reference
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-02 13:39:49 +02:00
Michael Kerrisk 970c890a17 strsignal.3: Note that 'sys_siglist' is nonstandard
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-02 13:07:30 +02:00
Michael Kerrisk 2d71151934 strsignal.3: Note that starting with v2.32, glibc no longer exports 'sys_siglist'
Reported-by: Hauke Fath <hf@spg.tu-darmstadt.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-02 13:05:23 +02:00
Michael Kerrisk fdecdf810f sys_siglist.3: New link to strsignal(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-02 12:57:45 +02:00
Michael Kerrisk 317203472e psignal.3, strsignal.3: Consolidate information on 'sys_siglist' in one page (strsignal(3))
Through some accident, 'sys_siglist' has been documented in
two different pages. Consolidate the information to one page
(strsignal(3)) and add 'sys_siglist" to the NAME line of that
page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-02 12:57:45 +02:00
Alejandro Colomar a5d13a32b7 uint_least8_t.3, uint_least16_t.3, uint_least32_t.3, uint_least64_t.3, uint_leastN_t.3: New links to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 17:30:29 +02:00
Alejandro Colomar 3450a5621e system_data_types.7: Add uint_leastN_t family of types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 17:30:22 +02:00
Alejandro Colomar 876838354d int_least8_t.3, int_least16_t.3, int_least32_t.3, int_least64_t.3, int_leastN_t.3: New links to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 17:21:17 +02:00
Alejandro Colomar f9b54d3a2e system_data_types.7: Add int_leastN_t family of types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 17:21:09 +02:00
Alejandro Colomar 496b1aad79 uint_fast8_t.3, uint_fast16_t.3, uint_fast32_t.3, uint_fast64_t.3, uint_fastN_t.3: New links to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 17:20:40 +02:00
Alejandro Colomar 3c9ae6e5a2 system_data_types.7: Add uint_fastN_t family of types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 17:20:31 +02:00
Alejandro Colomar 9df81a23e5 int_fast8_t.3, int_fast16_t.3, int_fast32_t.3, int_fast64_t.3, int_fastN_t.3: New links to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 17:20:19 +02:00
Alejandro Colomar 8f12d3f683 system_data_types.7: Add int_fastN_t family of types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 17:20:02 +02:00
Alejandro Colomar c1900cfe9f system_data_types.7: Move "Bugs" after "Notes", as man-pages(7) specifies
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 17:17:32 +02:00
Alejandro Colomar b2769f6f7d uintptr_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 13:29:07 +02:00
Alejandro Colomar 8df2c50a79 system_data_types.7: Add 'uintptr_t'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 13:28:59 +02:00
Alejandro Colomar d6ecaa2252 intptr_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 13:28:52 +02:00
Alejandro Colomar e32a655712 system_data_types.7: Add 'intptr_t'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 13:28:43 +02:00
Alejandro Colomar fa7442884c system_data_types.7: srcfix
We used .br to force a simple line break (with no extra blank line)
after the tag.

Recently, we added .RS/.RS, and .RS comes just after the tag,
and I realized by accident that .RS already forces a simple line break.

Therefore, .br is completely redundant here, and can be removed.

This way we get rid of "raw" *roff requests in this page.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 13:27:59 +02:00
Alejandro Colomar 410b22b2f2 system_data_types.7: srcfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 13:27:41 +02:00
Alejandro Colomar 6539f11e12 system_data_types.7: srcfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 13:27:17 +02:00
Alejandro Colomar 8d924ccfd5 malloc_get_state.3: ffix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 13:16:03 +02:00
Jakub Wilk 27e7a9a48b feature_test_macros.7: Update list of macros that inhibit default definitions
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 13:10:34 +02:00
Alejandro Colomar bd85f9c632 system_data_types.7: Improve "Include" wording and format, and explain it in NOTES
The previous format/wording for the includes wasn't very clear.
Improve it a bit following Branden's proposal.
It also helps reduce lines of code.

Add a subsection in NOTES explaining the conventions used.

Remove the comment for helping maintain the page,
as the NOTES section is now clear enough.

Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Reported-by: Dave Martin <Dave.Martin@arm.com>
Reported-by: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-10-01 11:34:49 +02:00
Aleksa Sarai bbed82c069 openat2.2: tfix: fix minor reference typo
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-30 21:45:57 +02:00
Aleksa Sarai 1953608d8a sched_getattr.2: Update to include changed size semantics
Due to a userspace breakage, commit 1251201c0d34 ("sched/core: Fix
uclamp ABI bug, clean up and robustify sched_read_attr() ABI logic
and code") changed the semantics of sched_getattr(2) when the
userspace struct is smaller than the kernel struct. Now, any
trailing non-zero data in the kernel structure is ignored when
copying to userspace. We also document the original error code
correctly (it was EFBIG not E2BIG) in the BUGS section.

Ref: 1251201c0d34 ("sched/core: Fix uclamp ABI bug, clean up and
                 robustify sched_read_attr() ABI logic and code")

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-30 21:45:23 +02:00
Michael Kerrisk d8f63a9860 man_show_fixme.sh: Fix misquoted double quotes in regexps
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-30 09:39:05 +02:00
Michael Kerrisk b7a12afe3f xdr.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 22:01:46 +02:00
Michael Kerrisk 4a42acaf3e rpc.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 22:00:44 +02:00
Michael Kerrisk 9ac786461f feature_test_macros.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 22:00:44 +02:00
Michael Kerrisk 71c5827828 getutent.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 22:00:44 +02:00
Michael Kerrisk c089afee8b perf_event_open.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 16:41:26 +02:00
Michael Kerrisk e3fb1b6bfc proc.5: ffix + srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 16:34:50 +02:00
Michael Kerrisk 3cf6149060 adjtimex.2, futex.2, semop.2, slabinfo.5, feature_test_macros.7, keyrings.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 16:34:29 +02:00
Michael Kerrisk 2dab618c67 strftime.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 15:42:42 +02:00
Alejandro Colomar 13fb746008 FILE.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 15:33:55 +02:00
Tycho Andersen edc18bbf61 system_data_types.7: Add 'FILE'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 15:33:03 +02:00
Michael Kerrisk d39ad78f73 _exit.2, access.2, acct.2, brk.2, chdir.2, chmod.2, chown.2, chroot.2, clock_getres.2, clock_nanosleep.2, fsync.2, futimesat.2, getdomainname.2, getgroups.2, gethostname.2, getpagesize.2, getrlimit.2, getsid.2, gettimeofday.2, kill.2, link.2, madvise.2, mincore.2, mkdir.2, mknod.2, nanosleep.2, nice.2, open.2, posix_fadvise.2, pread.2, process_vm_readv.2, readlink.2, readv.2, rename.2, select.2, semop.2, seteuid.2, setpgid.2, setreuid.2, sigaction.2, sigaltstack.2, sigpending.2, sigprocmask.2, sigsuspend.2, sigwaitinfo.2, stat.2, stime.2, symlink.2, sync.2, syscall.2, timer_create.2, timer_delete.2, timer_getoverrun.2, timer_settime.2, truncate.2, unlink.2, utimensat.2, vfork.2, vhangup.2, wait.2, wait4.2, a64l.3, abs.3, acos.3, acosh.3, addseverity.3, adjtime.3, asin.3, asinh.3, atan.3, atan2.3, atanh.3, atoi.3, bsd_signal.3, cbrt.3, ceil.3, cfree.3, clearenv.3, clock_getcpuclockid.3, confstr.3, copysign.3, cos.3, cosh.3, ctermid.3, ctime.3, daemon.3, dirfd.3, div.3, drand48.3, drand48_r.3, duplocale.3, dysize.3, ecvt.3, ecvt_r.3, endian.3, erf.3, erfc.3, exec.3, exp.3, exp2.3, expm1.3, fabs.3, fdim.3, ferror.3, fexecve.3, ffs.3, fgetgrent.3, fgetpwent.3, finite.3, flockfile.3, floor.3, fma.3, fmax.3, fmemopen.3, fmin.3, fmod.3, fopen.3, fpclassify.3, frexp.3, fseeko.3, ftw.3, futimes.3, fwide.3, gamma.3, gcvt.3, getaddrinfo.3, getcwd.3, getdate.3, getdirentries.3, getdtablesize.3, getentropy.3, getenv.3, getgrent.3, getgrent_r.3, getgrnam.3, getgrouplist.3, gethostbyname.3, gethostid.3, getline.3, getloadavg.3, getlogin.3, getmntent.3, getnameinfo.3, getnetent_r.3, getopt.3, getpass.3, getprotoent_r.3, getpwent.3, getpwent_r.3, getpwnam.3, getrpcent_r.3, getservent_r.3, getspnam.3, getsubopt.3, getusershell.3, getw.3, grantpt.3, group_member.3, gsignal.3, hypot.3, ilogb.3, inet.3, inet_net_pton.3, initgroups.3, insque.3, isalpha.3, isfdtype.3, isgreater.3, iswblank.3, j0.3, killpg.3, ldexp.3, lgamma.3, lockf.3, log.3, log10.3, log1p.3, log2.3, logb.3, lrint.3, lround.3, malloc.3, mbsnrtowcs.3, memchr.3, mkdtemp.3, mkfifo.3, mkstemp.3, mktemp.3, modf.3, mq_receive.3, mq_send.3, nan.3, newlocale.3, nextafter.3, nl_langinfo.3, on_exit.3, open_memstream.3, opendir.3, perror.3, popen.3, posix_fallocate.3, posix_madvise.3, posix_memalign.3, posix_openpt.3, pow.3, printf.3, profil.3, psignal.3, pthread_attr_setstack.3, pthread_cleanup_push_defer_np.3, pthread_kill.3, pthread_mutex_consistent.3, pthread_mutexattr_setrobust.3, pthread_rwlockattr_setkind_np.3, pthread_sigmask.3, pthread_sigqueue.3, pthread_spin_init.3, pthread_spin_lock.3, ptsname.3, putenv.3, putpwent.3, qecvt.3, qsort.3, rand.3, random.3, random_r.3, rcmd.3, readdir_r.3, realpath.3, remainder.3, remquo.3, rint.3, round.3, rpmatch.3, scalb.3, scalbln.3, scandir.3, scanf.3, sched_getcpu.3, seekdir.3, sem_wait.3, setbuf.3, setenv.3, setjmp.3, setnetgrent.3, siginterrupt.3, signbit.3, significand.3, sigqueue.3, sigset.3, sigsetops.3, sigvec.3, sigwait.3, sin.3, sinh.3, sockatmark.3, sqrt.3, stpcpy.3, stpncpy.3, strdup.3, strerror.3, strfromd.3, strnlen.3, strsep.3, strsignal.3, strtod.3, strtok.3, strtol.3, strtoul.3, syslog.3, tan.3, tanh.3, telldir.3, tempnam.3, termios.3, tgamma.3, timegm.3, timeradd.3, tmpnam.3, toascii.3, toupper.3, towlower.3, towupper.3, trunc.3, ttyslot.3, tzset.3, ualarm.3, unlocked_stdio.3, unlockpt.3, uselocale.3, usleep.3, wcpcpy.3, wcpncpy.3, wcscasecmp.3, wcsdup.3, wcsncasecmp.3, wcsnlen.3, wcsnrtombs.3, wordexp.3, wprintf.3, y0.3: srcfix: use better macros in SYNOPSIS
Around the text:
"Feature Test Macro Requirements for glibc..."
replace ".in -4n/.in" with ".RS -4/.RE".
The latter form is more idiomatic use of man macros.
The nroff output is unchanged.

Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 15:12:12 +02:00
Michael Kerrisk 281dca499e chmod.2, connect.2, recv.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 14:46:56 +02:00
Michael Kerrisk 161b8eda4d clone.2, io_submit.2, select.2, shmget.2, getcontext.3, malloc_info.3, mtrace.3, posix_spawn.3, strfromd.3, proc.5: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 14:24:12 +02:00
Michael Kerrisk c37e8cfb04 system_data_types.7: Minor edits to Alejandro Colomar's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 13:48:52 +02:00
Alejandro Colomar b93cf1e1da uint8_t.3, uint16_t.3, uint32_t.3, uint64_t.3, uintN_t.3: New links to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 13:43:32 +02:00
Alejandro Colomar 1231520ca9 system_data_types.7: Add uintN_t family of types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 13:43:27 +02:00
Alejandro Colomar f30ba1fbcb int8_t.3, int16_t.3, int32_t.3, int64_t.3, intN_t.3: New links to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 13:43:21 +02:00
Alejandro Colomar 76ea908ca8 system_data_types.7: Add intN_t family of types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 13:43:15 +02:00
Alejandro Colomar c3ed59072e uintmax_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 13:43:09 +02:00
Alejandro Colomar 1d0046bf67 system_data_types.7: Add 'uintmax_t'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 13:43:03 +02:00
Alejandro Colomar 333e127b94 intmax_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 13:42:57 +02:00
Alejandro Colomar df7da8f544 system_data_types.7: Add 'intmax_t'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 13:42:48 +02:00
Michael Kerrisk c9e6c5abc9 statx.2: Minor edits to Ira Weiny's
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 10:27:10 +02:00
Ira Weiny 38ad6a8808 statx.2: Add STATX_ATTR_DAX
Linux 5.8 adds STATX_ATTR_DAX support.

https://lore.kernel.org/lkml/20200428002142.404144-4-ira.weiny@intel.com/
https://lore.kernel.org/lkml/20200504161352.GA13783@magnolia/

Add the text to the statx man page.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-29 10:21:21 +02:00
Michael Kerrisk e9a0682b18 ioctl_fslabel.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-28 12:40:13 +02:00
Alejandro Colomar 9cdd2e0512 system_data_types.7: ffix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-28 07:52:54 +02:00
Alejandro Colomar f8e0d67e80 va_list.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-26 22:12:26 +02:00
Alejandro Colomar 5f85c6469f system_data_types.7: Add va_list
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-26 22:12:16 +02:00
Michael Kerrisk 9076359f0e seccomp.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-26 15:49:32 +02:00
Michael Kerrisk cfedbfb96c rtld-audit.7: srcfix: semantic newlines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 20:41:01 +02:00
Florian Weimer 3d49f95b4d rtld-audit.7: Clarify la_version handshake
Returning its argument without further checks is almost always
wrong for la_version.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 20:41:01 +02:00
Michael Kerrisk 7955742d0d system_data_types.7: Minor tweaks to Alejandro Colomar's float_t/double_t patches
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 13:58:47 +02:00
Alejandro Colomar 156e30baa6 system_data_types.7: srcfix
The contents of each type are a logical block that is indented as
a block.  They are not separate paragraphs that happen to be
indented separately, but a set of continuous paragraphs, all at
the same level, indented as a block from the list entry--the name
of the type--.  Therefore, it makes more sense to use block
indentation, represented by .RS/.RE, rather than indenting each
paragraph separately.  That way it's also easier to further indent
a separate paragraph inside a block, which happens for example in
the case of float_t & double_t.  It's simply much easier now to
use .IP specifically in those cases where you want to indent just
a single paragraph.

Also added an ending separator comment line just after the last
type.

[mtk: minor edits to commit message]

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 13:51:32 +02:00
Alejandro Colomar 0c3e8eb330 double_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 13:50:29 +02:00
Alejandro Colomar 55e24f06a0 system_data_types.7: Add double_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 13:50:20 +02:00
Alejandro Colomar fa712444b4 float_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 13:49:03 +02:00
Alejandro Colomar 77b5b456de system_data_types.7: Add float_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 13:48:49 +02:00
Alejandro Colomar 963e636c35 system_data_types.7: srcfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 12:38:20 +02:00
Alejandro Colomar 59a1988b25 seccomp.2: Use ARRAY_SIZE() macro instead of raw sizeof division
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 11:25:12 +02:00
Alejandro Colomar c9cedb53b2 seccomp.2: Remove unneeded cast
From the email discussion:

> Hi Alex,
>
> On 9/25/20 9:31 AM, Alejandro Colomar wrote:
>> Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
>> ---
>>   man2/seccomp.2 | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/man2/seccomp.2 b/man2/seccomp.2
>> index 58033da1c..d6b856c32 100644
>> --- a/man2/seccomp.2
>> +++ b/man2/seccomp.2
>> @@ -1101,7 +1101,7 @@ install_filter(int syscall_nr, int t_arch, int f_errno)
>>       };
>>
>>       struct sock_fprog prog = {
>> -        .len = (unsigned short) (sizeof(filter) / sizeof(filter[0])),
>> +        .len = sizeof(filter) / sizeof(filter[0]),
>>           .filter = filter,
>>       };
>
> I have a small doubt about this change. With the change,
> there are no compilation warnings.
>
> But, if we change the code to something slightly different:
>
> [[
>      size_t x = (sizeof(filter) / sizeof(filter[0]));
>      struct sock_fprog prog = {
>          .len = x,
>          .filter = filter,
>      };
> ]]
>
> The "cc -Wconversion" gives us the following warning:
>
>      warning: conversion from ‘size_t’ {aka ‘long unsigned int’}
>      to ‘short unsigned int’ may change value
>
> Presumably we don't get a warning for an assignment of the form
>
>      .len = (sizeof(filter) / sizeof(filter[0]))
>
> because the compiler is smart enough to work out that the
> value of the constant expression is within the range of
> "unsigned short".
>
> Your thoughts?

Hi Michael,

I'd say that the cast doesn't fix any problems at all.  It silences a
valid warning, and I'd use a pragma for that (to be more explicit about
the intention of silencing a warning) if I do want -Wconversion enabled
(which usually I don't want, because it's too noisy) and I'm sure that
this won't overflow.  I'd limit the use casts to only when I *really*
need to.

I guess that if you enable -O3, the warning will vanish again because
the compiler will optimize away 'x' (but I didn't test).

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 11:17:01 +02:00
Alejandro Colomar ffd4b5b90f lconv.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 09:58:57 +02:00
Alejandro Colomar ecc4a0453b system_data_types.7: Add lconv
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 09:58:26 +02:00
Alejandro Colomar 203a500f25 getgrent_r.3: Declare variables with different types in different lines
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 09:57:26 +02:00
Alejandro Colomar 548c692848 system_data_types.7: ffix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-25 09:56:51 +02:00
Alejandro Colomar 8f53215faa lldiv_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 13:04:40 +02:00
Alejandro Colomar 7ffe6428d0 system_data_types.7: Add lldiv_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 13:04:31 +02:00
Alejandro Colomar 79cb0be81a ldiv_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 13:03:41 +02:00
Alejandro Colomar 6680e1944e system_data_types.7: Add ldiv_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 13:03:35 +02:00
Alejandro Colomar b3b22e7f4d div_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 13:03:09 +02:00
Alejandro Colomar 55cc29ab80 system_data_types.7: Add div_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 13:03:03 +02:00
Alejandro Colomar 72eee6454f imaxdiv_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 12:07:21 +02:00
Alejandro Colomar 9037ba92eb system_data_types.7: Add imaxdiv_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 12:07:11 +02:00
Michael Kerrisk 2e7e669c2e strfromd.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 10:02:00 +02:00
Michael Kerrisk db0411bd20 core.5: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 10:00:16 +02:00
Michael Kerrisk 1ef38c0eb1 core.5: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 09:59:57 +02:00
Michael Kerrisk 3c8acfd73c ldd.1: Minor tweak to 'ldd' output example
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 09:57:27 +02:00
Michael Kerrisk 9f5f1b5b8f ptrace.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 09:47:55 +02:00
Michael Kerrisk 861d36ba31 pldd.1, bpf.2, clone.2, dup.2, ioctl_fat.2, nfsservctl.2, open_by_handle_at.2, perf_event_open.2, pivot_root.2, request_key.2, sched_setaffinity.2, seccomp.2, select.2, statx.2, dl_iterate_phdr.3, dlinfo.3, dlopen.3, insque.3, newlocale.3, printf.3, pthread_setname_np.3, rpc.3, stdarg.3, strfmon.3, veth.4, proc.5, slabinfo.5, cgroup_namespaces.7, cgroups.7, cpuset.7, fanotify.7, inotify.7, mount_namespaces.7, sock_diag.7, user_namespaces.7, ld.so.8: Use \(aq instead of ' inside monospace fonts
Use \(aq to get an unslanted single quote inside monospace code
blocks. Using a simple ' results in a slanted quote inside PDFs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 09:32:31 +02:00
Michael Kerrisk 89de1a399e open.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 09:02:29 +02:00
Alejandro Colomar a39e673a89 ioctl_ns.2, stat.2: Fix signedness of printf specifiers
These variables are either of an unsigned integer type per POSIX;
or of an integer type per POSIX, that Linux defines as an unsigned integer type.

Print them with 'uintmax_t' instead of 'intmax_t' to avoid
big positive numbers being printed as negative numbers.

Bug report:
From: Konstantin Bukin @ 2020-09-13 15:04 UTC
  To: mtk.manpages; +Cc: Konstantin Bukin, linux-man

inode numbers are expected to be positive. Casting them to a signed type
may result in printing negative values. E.g. running example program on
the following file:

$ ls -li test.txt
9280843260537405888 -r--r--r-- 1 kbukin hardware 300 Jul 21 06:36 test.txt

results in the following output:

$ ./example test.txt
ID of containing device:  [0,480]
File type:                regular file
I-node number:            -9165900813172145728
Mode:                     100444 (octal)
Link count:               1
Ownership:                UID=2743   GID=30
Preferred I/O block size: 32768 bytes
File size:                300 bytes
Blocks allocated:         8
Last status change:       Tue Jul 21 06:36:50 2020
Last file access:         Sat Sep 12 14:13:38 2020
Last file modification:   Tue Jul 21 06:36:50 2020

Such erroneous reporting happens for inode values greater than maximum
value which can be stored in signed long. Casting does not seem to be
necessary here. Printing inode as unsigned long fixes the issue.

Reported-by: Konstantin Bukin <kbukin@gmail.com>
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-24 00:02:13 +02:00
Alejandro Colomar ab7a387479 fexcept_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-23 15:30:45 +02:00
Alejandro Colomar 1f4e2d27b4 system_data_types.7: Add 'fexcept_t'
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-23 15:30:31 +02:00
Michael Kerrisk 6eaf991472 system_data_types.7: Reword description of fenv_t to avoid simply quoting POSIX text
The existing text comes straight from POSIX. In copyright terms,
this is at least a gray area, and in any case, simply reproducing
the text of the standard has limited value, since people can
consult the standard directly.  So, rewrite the text, to simply
quote the description from fenv(3).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-23 10:41:28 +02:00
Alejandro Colomar 2f98c2d488 system_data_types.7: ffix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 11:09:35 +02:00
Michael Kerrisk 54b35f3a8d id_t.3: New link to system_data_types(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 10:39:33 +02:00
Michael Kerrisk a9e48bd40f system_data_types.7: Add 'id_t'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 10:38:42 +02:00
Michael Kerrisk cde5ffdeb4 system_data_types.7: Add self to copyright notice
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 10:30:08 +02:00
Michael Kerrisk 1e02faf49b gid_t.3: New link to system_data_types(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 10:30:08 +02:00
Michael Kerrisk 7c6b4444ce system_data_types.7: Add 'gid_t'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 10:28:08 +02:00
Michael Kerrisk ac93017ede uid_t.3: New link to system_data_types(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 10:23:14 +02:00
Michael Kerrisk de74a9bba2 system_data_types.7: Add 'uid_t'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 10:22:35 +02:00
Michael Kerrisk 95c3d0a025 kcmp.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 10:08:14 +02:00
Michael Kerrisk 6415668a2a credentials.7: SEE ALSO: add system_data_types(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 10:03:07 +02:00
Michael Kerrisk 2d96af707a system_data_types.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 09:59:57 +02:00
Michael Kerrisk b383f33581 system_data_types.7: Add further POSIX details for size_t, ssize_t, and suseconds_t
The implementation shall support one or more programming
environments where these types are no wider than 'long'.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 09:56:03 +02:00
Michael Kerrisk 8e331675f3 pid_t.3: New link to system_data_types(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 09:52:08 +02:00
Michael Kerrisk 68fe0bc92e system_data_types.7: Document pid_t
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 09:51:41 +02:00
Michael Kerrisk 50270e97ed sigset_t.3: New link to system_data_types.7
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 09:31:14 +02:00
Michael Kerrisk 786a98e286 system_data_types.7: Add description of sigset_t
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 09:30:31 +02:00
Michael Kerrisk a6c2dc0da0 system_data_types.7: Add brief description of regmatch_t
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-22 09:18:41 +02:00
Alejandro Colomar 100e4aaaea fenv_t.3: New link to new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-21 20:43:56 +02:00
Alejandro Colomar 8eb2d11770 system_data_types.7: Document fenv_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-21 20:43:44 +02:00
Alejandro Colomar 097a4463dd system_data_types.7: wfix
A limit can be defined by other than POSIX

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-21 20:41:41 +02:00
Michael Kerrisk 89c6c2bdd2 system_data_types.7: Minor tweaks to Alejandro Colomar's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-21 16:08:18 +02:00
Alejandro Colomar f5d2c2efb2 system_data_types.7: Describe use of printf()/scanf() modifiers for integer data types
Add note about length modifiers and conversions to [u]intmax_t,
and add a corresponding example.

Reported-by: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-21 16:00:48 +02:00
Michael Kerrisk 104fcc3c16 system_data_types.7: Minor tweaks to Alejandro Colomar's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-20 22:14:51 +02:00
Alejandro Colomar 1a6e6d4012 system_data_types.7: Specify the length modifiers for the variables that have them
Reported-by: Florian Weimer <fweimer@redhat.com>
Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Reviewed-by: Paul Eggert <eggert@cs.ucla.edu>
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-20 22:10:42 +02:00
Alejandro Colomar fce28f1448 siginfo_t.3: New link to new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-20 22:10:42 +02:00
Michael Kerrisk 50ba3793f9 system_data_types.7: Defer to sigaction(2) for further information on siginfo_t
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-20 22:10:42 +02:00
Michael Kerrisk 6b20a947be system_data_types.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-20 22:10:42 +02:00
Alejandro Colomar 60ce58d963 system_data_types.7: Document siginfo_t
Note: There are a few members of this structure that are
not required by POSIX (XSI extensions, and such).

I simply chose to not document them at all.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-20 21:50:42 +02:00
Michael Kerrisk 14dd128c7c syscalls.2: Move system calls from discontinued ports out of main syscall list
Various ports that had their own indigenous system calls have
been discontinued. Remove those system calls (none of which had
manual pages!) to a separate part of the page, to avoid
cluttering the main list of system calls.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-20 14:20:39 +02:00
Michael Kerrisk d022c7fdf0 getcwd.2, mq_notify.2, mq_open.2, mq_timedreceive.2, mq_timedsend.2, mq_unlink.2: Reinstate links to section 3 pages that document system calls
Some of the links removed in commit 247c654385 should
have been kept, because in some cases there are real system
calls whose wrapper functions are documented in Section 3.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-20 13:41:38 +02:00
Michael Kerrisk 0a3bfcf774 syscalls.2: Remove duplicate entry for swapcontext(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-20 13:21:46 +02:00
Michael Kerrisk a35315178d ip.7: Minor wording fixes
Mainly cleaning up usages of "only".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:26:21 +02:00
Michael Kerrisk b5d7102ea4 ip.7: Minor edits to Stephen Smalley's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:22:55 +02:00
Stephen Smalley 755b3ecb73 ip.7: Document IP_PASSSEC for UDP sockets
Document the IP_PASSSEC socket option and SCM_SECURITY
ancillary/control message type for UDP sockets.

IP_PASSSEC for UDP sockets was introduced in Linux 2.6.17 [1].

Example NetLabel and IPSEC configurations and usage of this
option can be found in the SELinux Notebook [2] and SELinux
testsuite [3].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2c7946a7bf45ae86736ab3b43d0085e43947945c

[2] https://github.com/SELinuxProject/selinux-notebook

[3] https://github.com/SELinuxProject/selinux-testsuite

Reviewed-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:52 +02:00
Michael Kerrisk 29494dfeb8 ip.7, unix.7: Minor edits to Stephen Smalley's patches
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:46 +02:00
Michael Kerrisk 14c11c826a unix.7: srcfix: rewrap source lines in Stephen Smalley's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:46 +02:00
Michael Kerrisk 7e915f4c58 ip.7: srcfix: rewrap source lines in Stephen Smalley's patch
(No content changes.)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:46 +02:00
Stephen Smalley 3c63603499 socket.7,ip.7: Document SO_PEERSEC for AF_INET sockets
Augment the description of SO_PEERSEC to cover AF_INET sockets in
addition to the prior description for AF_UNIX.

SO_PEERSEC for TCP sockets was introduced in Linux 2.6.17 [1], and
SO_PEERSEC for SCTP sockets was introduced in Linux 4.17 [2].

This does not cover usage of SCM_SECURITY for UDP sockets, which
was also introduced in the same commit for 2.6.17.

Examples of the necessary labeled IPSEC and NetLabel
configurations to enable use of SO_PEERSEC for TCP and SCTP
sockets can be found in the SELinux Notebook [3] and the
selinux-testsuite [4].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2c7946a7bf45ae86736ab3b43d0085e43947945c

[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d452930fd3b9031e59abfeddb2fa383f1403d61a

[3] https://github.com/SELinuxProject/selinux-notebook

[4] https://github.com/SELinuxProject/selinux-testsuite

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:46 +02:00
Stephen Smalley e6f90c3fb2 socket.7, unix.7: Add initial description for SO_PEERSEC
SO_PEERSEC was introduced for AF_UNIX stream sockets connected via
connect(2) in Linux 2.6.2 [1] and later augmented to support
AF_UNIX stream and datagram sockets created via socketpair(2) in
Linux 4.18 [2].  Document SO_PEERSEC in the socket.7 and unix.7
man pages following the example of the existing SO_PEERCRED
descriptions.  SO_PEERSEC is also supported on AF_INET sockets
when using labeled IPSEC or NetLabel but defer adding a
description of that support to a separate patch.

The module-independent description of the security context
returned by SO_PEERSEC is from Simon McVittie.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/tglx/history.git/commit/?id=da6e57a2e6bd7939f610d957afacaf6a131e75ed

[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0b811db2cb2aabc910e53d34ebb95a15997c33e7

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Cowritten-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:18:46 +02:00
Michael Kerrisk 65c0f42710 sigevent.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:07:26 +02:00
Michael Kerrisk 0b62a2e3bd sigevent.7: Note that 'sigev_notify_thread_id' is Linux-specific
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 10:02:51 +02:00
Michael Kerrisk efbe7900b9 system_data_types.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 09:59:36 +02:00
Michael Kerrisk 6b7bf192b9 system_data_types.7: Minor tweaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-19 00:16:50 +02:00
Alejandro Colomar 96c63a40af aiocb.3: New link to new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:27:22 +02:00
Michael Kerrisk 126e68fb73 system_data_types.7: Defer to aio(7) for further information about 'struct aiocb'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:26:29 +02:00
Alejandro Colomar def0975720 system_data_types.7: Document aiocb
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:25:19 +02:00
Alejandro Colomar b4a5c62b3b system_data_types.7: srcfix: cosmetic: Visually separate types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:13:36 +02:00
Michael Kerrisk 66c2f0b251 system_data_types.7: Add reference to sigevent(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:08:28 +02:00
Alejandro Colomar bcae58d752 system_data_types.7: Document sigevent
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 23:05:49 +02:00
Alejandro Colomar 8d1c20e01e system_data_types.7: ffix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:49:47 +02:00
Alejandro Colomar 62f4b73a5e regmatch_t.3: New link for new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:45:02 +02:00
Alejandro Colomar 6fdfb077b8 system_data_types.7: Document regmatch_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:42:50 +02:00
Alejandro Colomar f33cc31420 system_data_types.7: ffix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:41:38 +02:00
Alejandro Colomar 924dea4c9c system_data_types.7: srcfix: Add FIXME notes
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:31:46 +02:00
Alejandro Colomar 1c0569eac3 regoff_t.3: New link to new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:31:15 +02:00
Alejandro Colomar 1415a39e39 system_data_types.7: Document regoff_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:29:27 +02:00
Alejandro Colomar f723e17664 ptrdiff_t.3: New link to new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:19:56 +02:00
Alejandro Colomar 515348d543 system_data_types.7: Document ptrdiff_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:19:07 +02:00
Alejandro Colomar dd06f85245 system_data_types.7: wfix: sort referenced types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:16:09 +02:00
Alejandro Colomar b6d3f94f29 system_data_types.7: srcfix: Remove TODO comment
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:15:38 +02:00
Michael Kerrisk c72ab20dc8 system_data_types.7: Add read(2) and write(2) to "See also" for size_t
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:08:02 +02:00
Alejandro Colomar 231b22152a size_t.3: New link to new documented type in system_data_types(7)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:06:55 +02:00
Alejandro Colomar eb3f724506 system_data_types.7: Document size_t
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-18 22:06:50 +02:00
Michael Kerrisk 3006c18803 feature_test_macros.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 22:54:01 +02:00
Michael Kerrisk 9f2a6007d1 intro.2, intro.3, feature_test_macros.7, standards.7: SEE ALSO: add system_data_types(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 22:54:01 +02:00
Michael Kerrisk 866c73c89f system_data_types.7: Add SEE ALSO references to feature_test_macros(7) and standards(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 22:54:01 +02:00
Alejandro Colomar 9334a43e41 sigval.3, ssize_t.3, suseconds_t.3, time_t.3, timer_t.3, timespec.3, timeval.3: New links to new system_data_types(7) page
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 22:54:01 +02:00
Alejandro Colomar cb7fd5031a system_data_types.7: Add a new page to document system data types
The initial version documents sigval, ssize_t, suseconds_t,
time_t, timer_t, timespec, and timeval.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 22:37:57 +02:00
Marko Hrastovec a23b00988a freeaddrinfo.3: Fix memory leaks in freeaddrinfo() examples
[mtk: the coding style used in the example could lead people to
inject memory leaks in their code if they cut/paste/modify the
code to replace "exit" paths with "return" paths from a library
function.]

[Marko, from the mail thread discussing this patch:]
You are right about terminating the process. However, people copy
that example and put the code in a function changing "exit" to
"return". There are a bunch of examples like that here
https://beej.us/guide/bgnet/html/#poll, for instance. That error
bothered me when reading the network programming guide
https://beej.us/guide/bgnet/html/. Than I looked for information
elsewhere:

https://stackoverflow.com/questions/6712740/valgrind-reporting-that-getaddrinfo-is-leaking-memory

https://stackoverflow.com/questions/15690303/server-client-sockets-freeaddrinfo3-placement

And finally, I checked manual pages and saw where these errors
come from.

When you change that to a function and return without doing
freeaddrinfo, that is a memory leak. I believe an example should
show good programming practices. Relying on exiting and clearing
the memory in that case is not such a case. In my opinion, these
examples lead people to make mistakes in their programs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-17 09:12:24 +02:00
Michael Kerrisk 966d17b1c5 sigaction.2: Use correct POSIX type for siginfo_t.si_value
Reported-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-16 16:26:12 +02:00
Michael Kerrisk 15e2ed1500 man-pages.7: Add some more requests re code examples
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-15 10:44:00 +02:00
Michael Kerrisk 6e68441741 man-pages.7: Soften the statement that ideal programs should be short
Sometimes, a longer program is needed. See
https://twitter.com/shuveb/status/1305689727715086337.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-15 10:43:20 +02:00
Michael Kerrisk 1aaa7bcd6a fanotify.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-15 07:39:27 +02:00
Alejandro Colomar 8eb90116f1 add_key.2, clock_getres.2, clone.2, futex.2, getdents.2, getpid.2, getrlimit.2, ioctl_ns.2, kcmp.2, keyctl.2, memfd_create.2, request_key.2, stat.2, timer_create.2, wait.2, clock_getcpuclockid.3, dl_iterate_phdr.3, getgrent_r.3, getpwent_r.3, getpwnam.3, posix_spawn.3, pthread_getcpuclockid.3, strcat.3, feature_test_macros.7, user_namespaces.7: Switch printf() casts to use [u]intmax_t + %ju / %jd
Let's move to the 21st century. Instead of casting system data
types to long/long long/etc. in printf() calls, instead cast to
intmax_t or uintmax_t, the largest available signed/unsigned
integer types.

[mtk: rewrote commit message]

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-15 07:39:19 +02:00
Alejandro Colomar 6fd153d540 clock_getres.2: Cast 'time_t' to 'int' for printf() and fix the length modifiers
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Reviewed-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-13 08:07:05 +02:00
Alejandro Colomar f6fbffeae5 userfaultfd.2: Use 'PRIx64' rather than "%llx" when printing 64-bit fixed-width types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-13 08:07:05 +02:00
Alejandro Colomar adb2084109 rtld-audit.7: Use "%u" rather than "%d" when printing 'unsigned int' values
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-13 08:07:05 +02:00
Alejandro Colomar 1bdfc7fc42 open_by_handle_at.2: Use "%u" rather than "%d" when printing 'unsigned int' values
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-13 08:07:05 +02:00
Alejandro Colomar 982dfed192 mprotect.2: Use "%p" rather than casting to 'long' when printing pointer values
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-13 08:06:46 +02:00
Alejandro Colomar 627a256ed6 malloc_hook.3: Remove unneeded cast, and print 'size_t' with "%zu"
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-13 07:44:06 +02:00
Alejandro Colomar dc97703b4a eventfd.2, mprotect.2, pidfd_open.2, spu_run.2, timer_create.2, bswap.3, dl_iterate_phdr.3, endian.3, pthread_attr_init.3, pthread_getattr_np.3, vcs.4, rtld-audit.7: In printf(): s/0x%/%#/ except when followed by X instead of x
Use printf()'s '#' flag character to prepend the string "0x".

However, when the number is printed in uppercase, and the prefix
is in lowercase, the string "0x" needs to be manually written.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-12 08:38:20 +02:00
Alejandro Colomar ec8b00033c getaddrinfo_a.3: Use C99 style to declare loop counter variables
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-12 08:38:20 +02:00
Alejandro Colomar ae85f653e4 msgctl.2, outb.2, abs.3, dl_iterate_phdr.3, drand48.3, drand48_r.3, encrypt.3, ffs.3, lrint.3, lround.3, ntp_gettime.3, printf.3, random.3, scalbln.3, scanf.3, strtol.3, strtoul.3, utmp.5, feature_test_macros.7, rtld-audit.7: Omit 'int' keyword for 'short', 'long' and 'long long' types, both signed and 'unsigned'
For consistency.

The types are written both with and without the redundant 'int' keyword
all over the man-pages.  However, the most used form, by far, is the one
without 'int'.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-12 08:37:41 +02:00
Michael Kerrisk 7d9746136e pthread_attr_init.3, pthread_create.3, pthread_getattr_np.3: Use correct type (size_t) for some variables
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 14:24:56 +02:00
Michael Kerrisk 404990aeb9 pthread_getattr_np.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 14:22:59 +02:00
Michael Kerrisk 68041421a1 userfaultfd.2: Use a better type (uint64_t) for 'len' in EXAMPLES
See the previous commit to bswap.3...

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 14:19:24 +02:00
Jakub Wilk 581c3ea730 bswap.3: Use strtoull() for parsing 64-bit numbers
Before, on 32-bit systems:

    $ ./a.out 0x0123456789abcdef
    0xffffffff ==> 0xffffffff00000000

After:

    $ ./a.out 0x0123456789abcdef
    0x123456789abcdef ==> 0xefcdab8967452301

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 14:11:10 +02:00
Alejandro Colomar 0ef3e1b730 clock_getcpuclockid.3: Remove unneeded cast
Member 'tv_nsec' of 'struct timespec' is of type 'long' (see time.h.0p),
and therefore, the cast is completely redundant.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 13:04:21 +02:00
Alejandro Colomar ea7dc0bdcf stat.2: wsfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 11:36:05 +02:00
Michael Kerrisk fbd150d909 timerfd_create.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 11:33:28 +02:00
Alejandro Colomar 76db89d368 stat.2: Cast to 'unsigned long' rather than 'long' when printing with "%lx"
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 11:33:28 +02:00
Alejandro Colomar e080a90f48 ioctl_ns.2: Cast to 'unsigned long' rather than 'long' when printing with "%lx"
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 11:33:28 +02:00
Michael Kerrisk 49f06c0010 pthread_setname_np.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 11:33:28 +02:00
Alejandro Colomar 77de385db6 eventfd.2: Use 'PRIxN' macros when printing C99 fixed-width integer types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 11:33:28 +02:00
Alejandro Colomar 86d90299ae timerfd_create.2: Use 'PRIxN' macros when printing C99 fixed-width integer types
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 11:33:28 +02:00
Alejandro Colomar 95cc0897f7 core.5: Use adequate type
'nread' is of type 'ssize_t'
'tot' adds up different values contained in 'nread',
so it should also be 'ssize_t', and not 'int' (which possibly overflows).

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 11:33:28 +02:00
Alejandro Colomar b9bf902972 unix.7: Use sizeof() to get buffer size (instead of hardcoding macro name)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 11:33:28 +02:00
Alejandro Colomar cbb22338cf fread.3: Move ARRAY_SIZE logic into macro
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 11:33:28 +02:00
Alejandro Colomar 3996bc9c26 timer_create.2: Cast to 'unsigned long' rather than 'long' when printing with "%lx"
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 11:33:20 +02:00
Alejandro Colomar c9e2544b17 request_key.2: Cast to 'unsigned long' rather than 'long' when printing with "%lx"
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 09:51:12 +02:00
Alejandro Colomar 53de137678 add_key.2: Cast to 'unsigned long' rather than 'long' when printing with "%lx"
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 09:50:32 +02:00
Alejandro Colomar 1656c1702d getpwent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 09:17:50 +02:00
Alejandro Colomar cf254328fe getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 09:17:45 +02:00
Alejandro Colomar 6da4ee9147 membarrier.2: Note that glibc does not provide a wrapper
Notes: I copied .nf and .fi from futex.2, but they made no visual difference.
What do they actually do?

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 08:44:48 +02:00
Alejandro Colomar 9a84e3383f get_phys_pages.3: Write 'long' instead of 'long int'
For consistency.

Most man pages use 'long' instead of 'long int'.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 08:43:37 +02:00
Alejandro Colomar 4e4e6e5e14 getpwent_r.3: Declare variables with different types in different lines
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 08:43:14 +02:00
Alejandro Colomar b8c40f8946 aio.7: Use perror() directly
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 08:42:46 +02:00
Alejandro Colomar e85fd9034f loop.4: ffix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 08:42:26 +02:00
Alejandro Colomar 2bbfed1b16 offsetof.3: Use "%zu" rather than "%zd" when printing 'size_t' values
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 08:41:18 +02:00
Michael Kerrisk 288d42bc37 rtnetlink.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 07:42:55 +02:00
Michael Kerrisk 10c2b377e5 readlink.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 07:33:34 +02:00
Michael Kerrisk 50dc2db4eb rtnetlink.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 07:32:56 +02:00
Michael Kerrisk 1bad27850d rtnetlink.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 07:31:50 +02:00
Michael Kerrisk a6c679521b locale.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 07:24:36 +02:00
Michael Kerrisk 6feb8aa967 fuse.4: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 07:23:41 +02:00
Michael Kerrisk cb540eb3fc fuse.4: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 07:22:16 +02:00
Michael Kerrisk c97d0132a0 spu_create.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 07:20:48 +02:00
Michael Kerrisk 712d2fa586 copy_file_range.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 07:19:38 +02:00
Michael Kerrisk 4190ca0ab3 ioctl_userfaultfd.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-11 07:19:04 +02:00
Jakub Wilk a99abf87e2 dlopen.3, gnu_get_libc_version.3: tfix
Escape hyphens.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-10 12:40:34 +02:00
Jakub Wilk 98939695b6 loop.4: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-10 12:40:18 +02:00
Michael Kerrisk ea4cec5f87 dlopen.3: Clarify DT_RUNPATH/DT_RPATH details
It is the DT_RUNPATH/DT_RPATH of the calling object (not the
executable) that is relevant for the library search. Verified
by experiment.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-10 11:48:08 +02:00
Michael Kerrisk 4f247e780f getopt.3: Minor wording fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-10 09:35:27 +02:00
Michael Kerrisk 75f2a1b866 loop.4: Minor edits to Yang Xu's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-10 08:11:48 +02:00
Yang Xu b4557e3bcf loop.4: Add some details about lo_flags
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-10 08:11:10 +02:00
Michael Kerrisk 61958467fb loop.4: Minor tweaks to Yang Xu's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-09 15:09:47 +02:00
Yang Xu 06df754f52 loop.4: Document LOOP_CONFIGURE ioctl
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-09 15:05:26 +02:00
Michael Kerrisk e38283d738 msgop.2: Minor tweak's to Yang Xu's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-09 14:23:57 +02:00
Yang Xu ab365f43e7 msgop.2: Add restriction on ENOSYS error
When calling msgrcv() with the MSG_COPY flag, it will report
EINVAL error even we if have disabled CONFIG_CHECKPOINT_RESTORE.
ENOSYS will be reported only if we also specify the IPC_NOWAIT
flag.

[mtk: edited commit message]

Notes from mtk:

The relevant kernel code is this:

[[
#ifdef CONFIG_CHECKPOINT_RESTORE
...
#else
static inline struct msg_msg *prepare_copy(void __user *buf, size_t bufsz)
{
        return ERR_PTR(-ENOSYS);
}

...
static long do_msgrcv(int msqid, void __user *buf, size_t bufsz, long
msgtyp, int msgflg,
               long (*msg_handler)(void __user *, struct msg_msg *, size_t))
{
...
        if (msgflg & MSG_COPY) {
                if ((msgflg & MSG_EXCEPT) || !(msgflg & IPC_NOWAIT))
                        return -EINVAL;
                copy = prepare_copy(buf, min_t(size_t, bufsz, ns->msg_ctlmax));
...
}
]]

We'll only hit the ENOSYS error if:
(1) MSG_COPY was specified;
(2) IPC_NOWAIT was not specified; and
(3) CONFIG_CHECKPOINT_RESTORE was not enabled.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-09 14:19:44 +02:00
Michael Kerrisk c3e8ceb883 proc.5: Note "open file description" as (better) synonym for "file handle"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-09 12:09:56 +02:00
Michael Kerrisk f1e030a9c9 loop.4: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-09 11:08:41 +02:00
Michael Kerrisk e30e023de2 loop.4: Minor tweaks to Yang Xu's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-09 11:06:01 +02:00
Yang Xu 2c45b62ea4 loop.4: Document LO_FLAGS_DIRECT_IO flag
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-09 11:05:39 +02:00
Mike Frysinger 4e0df17fce posix_spawn.3: tfix
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-08 07:29:33 +02:00
Alejandro Colomar b33535f535 bsearch.3: Declare variables with different types in different lines
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-08 07:26:00 +02:00
Alejandro Colomar 037c6fd4ee pthread_getattr_np.3: Use "%zu" and "%zx" when printing 'size_t' values
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-07 22:21:52 +02:00
Alejandro Colomar a3eeca342d fopencookie.3: Fix bugs in example
fread(3), unlike read(2) which returns a ssize_t, returns a
size_t.  It doesn't distinguish between error and enf-of-file.
Instead, either ferror(3) or feof(3) need to be checked if fread()
returned 0.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-07 12:32:03 +02:00
Alejandro Colomar a1eb1a6a33 fopencookie.3: printf()'s .* expects an int; cast accordingly
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-07 12:31:10 +02:00
Michael Kerrisk 7497e9d8c8 errno.3: Note that the pthreads APIs do not set errno
Reported-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-07 11:21:06 +02:00
Michael Kerrisk f9a5e57925 pthreads.7: Explicitly note that pthreads APIs return an errno-style value on error
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-07 11:11:30 +02:00
Alejandro Colomar 0ca5f06155 getline.3: Use %zd rather than %zu when printing 'ssize_t' values
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-07 11:00:05 +02:00
Alejandro Colomar 29a95ad159 hcreate.3: Declare variables with different types in different lines
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-07 10:59:47 +02:00
Michael Kerrisk 836a5bbf02 open.2: ERRORS: EBUSY
An EBUSY error case is mentioned in DESCRIPTIOn; add it to ERRORS
also.

See also https://bugzilla.kernel.org/show_bug.cgi?id=209109

Reported-by: henrik@optoscale.no
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-07 09:26:02 +02:00
Michael Kerrisk 51c1b1031b dlopen.3: Revert accidentally applied "dlopen.3: Remove unneeded cast"
This reverts commit ffa50fbf01.
2020-09-06 16:58:45 +02:00
Alejandro Colomar 9ba82f225c qsort.3: Fix casts
`p1` (and `p2` too) is `const void *` and it comes from a
`const char **` (for legacy reasons, argv is not `const` but should be
treated as if it were).  That means, the ultimate `char` is `const`:
"a pointer to a pointer to a const char".

Let's see what is going on before the fix first, and then the fix.

Before the fix:

`(char *const *)` (I removed the space on purpose) casts `p1` to be
"a pointer to a const pointer to a non-const char".  That's clearly
not what it originally was.

Then we dereference, ending with a `char *const`, which is
"a const pointer to a non-const char".  But given that the pointer value
is passed to a function, `const` doesn't make sense there, because the
function will already take a copy of it, so it is impossible to modify
the pointer itself.

The fix:

`(const char **)` The only thing that is const is the ultimate `char`,
which is the only thing that matters, because it is the only thing
strcmp(3) has access to (everything else, i.e. the pointers, are
copies).

Then, after the dereference we end up with `const char *`, the type of
argv (more or less, as previously noted), which is also the type of the
arguments to strcmp(3).

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-06 14:58:37 +02:00
Alejandro Colomar 684130db5c bsearch.3: Fix intermediate type and remove unneeded casts
Casting `const void *` to `struct mi *` should result in a warning if
done implicitly.  The explicit cast was probably silencing that warning.
`const` can and should be kept.
Now, casting `const void *` to `const struct mi *` is done implicitly.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-06 14:58:29 +02:00
Alejandro Colomar dc0bba35e7 user_namespaces.7: Remove unneeded cast
Casting `void *` to `struct child_args *` is already done implicitly.
Explicitly casting can silence warnings when mistakes are made, so it's
better to remove those casts when possible.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-06 14:58:13 +02:00
Alejandro Colomar 180698be28 msgop.2: Remove unneeded casts
The type `struct msgbuf *` is implicitly casted to `const void *`.
Not only that, but the explicit cast to `void *` was slightly
misleading.
Explicitly casting can silence warnings when mistakes are made, so it's
better to remove those casts when possible.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-06 14:57:59 +02:00
Alejandro Colomar a0303c05c4 pthread_sigmask.3: Remove unneeded casts
The type `sigset_t *` is implicitly casted to `void *`.
Explicitly casting can silence warnings when mistakes are made, so it's
better to remove those casts when possible.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-06 14:57:50 +02:00
Alejandro Colomar 44ab56cd6e sock_diag.7: Remove unneeded casts
The type `struct sockaddr_nl *` is implicitly casted to `void *`.
Explicitly casting can silence warnings when mistakes are made, so it's
better to remove those casts when possible.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-06 14:57:29 +02:00
Alejandro Colomar ffa50fbf01 dlopen.3: Remove unneeded cast
Casting `void *` to `double (*cosine)(double)` is already done
implicitly.
I had doubts about this one, but `gcc -Wall -Wextra` didn't complain
about it.
Explicitly casting can silence warnings when mistakes are made, so it's
better to remove those casts when possible.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-06 14:56:18 +02:00
Alejandro Colomar 7ac7f6510b stdarg.3: Declare variables with different types in different lines
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-06 14:52:22 +02:00
Alejandro Colomar 0e00826840 tsearch.3: Simplify type usage and remove unneeded casts
The type of `val` is `int **`, and it will work with tsearch()
anyway because of implicit cast from `void *`, so declaring it as an
`int **` simplifies the code.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 21:42:00 +02:00
Alejandro Colomar 209e118e30 fanotify.7: Pass array to read(2) directly instead of a pointer to it
It doesn't make any sense to pass a pointer to the array to
read(2).

It might make sense to pass a pointer to the first element of the
array, but that is already implicitly done when passing the array,
which decays to that pointer, so it's simpler to pass the array.

And anyway, the cast was unneeded, as any pointer is implicitly
cast to `void *`.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 17:43:55 +02:00
Alejandro Colomar c7e5aa83d2 tsearch.3: Remove unneeded cast
Casting `int *` to `const void *` is already done implicitly.
Not only that, but the explicit cast to `void *` was slightly
misleading.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 17:40:44 +02:00
Alejandro Colomar 69003a5891 tsearch.3: Use size_t for malloc() argument
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 17:27:46 +02:00
Michael Kerrisk 88893a773c sprof.1, eventfd.2, execve.2, futex.2, getdents.2, mprotect.2, open_by_handle_at.2, recvmmsg.2, sched_setaffinity.2, CPU_SET.3, backtrace.3, bsearch.3, dl_iterate_phdr.3, dlinfo.3, duplocale.3, encrypt.3, envz_add.3, fopencookie.3, getaddrinfo.3, getaddrinfo_a.3, getdate.3, getgrent_r.3, getgrouplist.3, getifaddrs.3, getprotoent_r.3, getservent_r.3, hsearch.3, mallinfo.3, malloc_info.3, mbstowcs.3, mtrace.3, pthread_create.3, pthread_getcpuclockid.3, pthread_setaffinity_np.3, qsort.3, rand.3, strcat.3, strtok.3, tsearch.3, wordexp.3, core.5, aio.7, inotify.7, sock_diag.7, unix.7, user_namespaces.7: Use C99 style to declare loop counter variables
Rather than:

    sometype x;

    for (x = ....; ...)

use

    for (sometype x = ...; ...)

This brings the declaration and use closer together (thus aiding
readability) and also clearly indicates the scope of the loop
counter variable.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 17:20:12 +02:00
Michael Kerrisk 3b27ce1573 getdents.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 16:54:19 +02:00
Michael Kerrisk 48d0510307 getgrouplist.3, insque.3, malloc_info.3, pthread_create.3, tsearch.3, aio.7: Use C99-style declarations for readability
Rather than writing things such as:

    struct sometype *x;
    ...
    x = malloc(sizeof(*x));

let's use C99 style so that the type info is in the same line as
the allocation:

    struct sometype *x = malloc(sizeof(*x));

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 16:34:34 +02:00
Alejandro Colomar 3b7e518d44 tsearch.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 16:22:21 +02:00
Alejandro Colomar 0091da30d5 pthread_create.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 16:21:33 +02:00
Alejandro Colomar a7751aafaa mbstowcs.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 16:19:44 +02:00
Alejandro Colomar 5780a2e798 shm_open.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar a899cafef4 aio.7: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 23766e41b5 rtnetlink.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar baa51272f5 rtnetlink.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 9ddabae6e7 pthread_setaffinity_np.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 012b86a0b6 unix.7: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 0ff1c5e28a fanotify.7: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 06c4d5d588 strptime.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 7c813ea528 mbsinit.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 9e81cf89e5 malloc_info.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 6a38293919 insque.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar c6683e64ba getgrouplist.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar facc3c56fe getaddrinfo.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 8e4dfb59d7 getaddrinfo.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar d5307ece21 cmsg.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 3aa268080f cmsg.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 8ec19d1240 bsearch.3: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar b300d5cf92 signalfd.2: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar bbedcb755a sysctl.2: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 284a36798f perf_event_open.2: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar 3376a63838 perf_event_open.2: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar aff660d379 open_by_handle_at.2: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar d60a7a9a4b futex.2: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Alejandro Colomar b40e812a64 bind.2: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Michael Kerrisk 78da9b6b29 bind.2, ioctl_ns.2, open_by_handle_at.2, duplocale.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Michael Kerrisk bf49fb9387 cpuset.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-05 14:49:42 +02:00
Michael Kerrisk d6c07484e9 memusage.1: Use %zu rather than %zd when printing 'size_t' values
'size_t' is an unsigned type...

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-04 09:52:59 +02:00
Michael Kerrisk d9f42b52cb memusage.1: wspfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-04 09:52:59 +02:00
Michael Kerrisk 15fc4aab1f memusage.1: EXAMPLES: remove doubled calculations
The same calculations are repeated in malloc() and printf() calls.
For better readability, do the calculations once.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-04 09:52:59 +02:00
Alejandro Colomar 8d635e0a7e memusage.1: Use sizeof consistently
Hi Michael,

Continuing with the series, this is the first of the last set of
patches: (2).1 as numbered in previous emails.

Regards,
Alex.

------------------------------------------------------------------------
>From ad5f958ed68079791d6e35f9d70ca5ec2a72c43b Mon Sep 17 00:00:00 2001
From: Alejandro Colomar <colomar.6.4.3@gmail.com>
Date: Thu, 3 Sep 2020 12:11:18 +0200
Subject: [PATCH] memusage.1: Use sizeof consistently

Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

	Rationale:
	https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-04 09:43:36 +02:00
Jakub Wilk 166c03a6b5 Changes.old: tfix
Remove duplicated words.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-04 09:41:46 +02:00
Alejandro Colomar 7551caeaed unix.7: wsfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-04 09:37:24 +02:00
Alejandro Colomar 64913f9cf7 mbsinit.3: wsfix
Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-09-04 09:37:21 +02:00
Michael Kerrisk 2d3122a1ea fanotify.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-28 14:26:57 +02:00
Michael Kerrisk 0bda7dedcf fanotify_init.2, fanotify.7: Minor edits to Amir Goldstein's patches
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-28 14:26:12 +02:00
Michael Kerrisk 1a1e4638a5 fanotify_init.2, fanotify.7: srcfix: Semantic newlines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-28 14:18:05 +02:00
Amir Goldstein ea4f577808 fanotify.7, fanotify_init.2: Document FAN_REPORT_NAME
Document fanotify_init(2) flag FAN_REPORT_NAME and the format of
the event info type FAN_EVENT_INFO_TYPE_DFID_NAME.

The fanotify_fid.c example is extended to also report the name of
the created file or subdirectory.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-28 14:16:30 +02:00
Amir Goldstein e9f14fa0bb fanotify.7, fanotify_init.2: Document FAN_REPORT_DIR_FID
Document fanotify_init(2) flag FAN_REPORT_DIR_FID and event info
type FAN_EVENT_INFO_TYPE_DFID.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-28 14:16:03 +02:00
Amir Goldstein b216da617f fanotify.7, fanotify_mark.2: Generalize documentation of FAN_REPORT_FID
With fanotify_init(2) flag FAN_REPORT_FID, the group identifies
filesystem objects by file handles in a single event info record
of type FAN_EVENT_INFO_TYPE_FID.

We intend to add support for new fanotify_init(2) flags for which
the group identifies filesystem objects by file handles and add
more event info record types.

To that end, start by changing the language of the man page to
refer to a "group that identifies filesystem objects by file
handles" instead of referring to the FAN_REPORT_FID flag and
document the extended event format structure in a more generic
manner that allows more than a single event info record and not
only a record of type FAN_EVENT_INFO_TYPE_FID.

Clarify that the object identified by the file handle refers to
the directory in directory entry modification events.

Remove a note about directory entry modification events and
monitoring a mount point that I found to be too confusing and out
of context.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-28 14:15:31 +02:00
Michael Kerrisk e7497fba60 mount.2: Minor wording improvement
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-28 13:51:17 +02:00
Michael Kerrisk 6a955f035e syscalls.2: Bump kernel version number
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-28 11:35:12 +02:00
Michael Kerrisk 373bd6e2bb syscalls.2: Add close_range (Linux 5.9)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-27 17:19:43 +02:00
Michael Kerrisk 5c14a73b2c bpf-helpers.7: Really resync against latest kernel source
Jakub points out that my last resync may accidentally have been
against an old version of the kernel source, since the resync
resulted in many deleted lines. I suspect he may be right.
Let's resync against today's current kernel.

Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-26 20:55:47 +02:00
Alejandro Colomar 26499b040c cmsg.3, getaddrinfo_a.3 getgrouplist.3: Use sizeof, consistently
Use ``sizeof`` consistently through all the examples in the
following way:

- When the result of ``sizeof`` is multiplied (or otherwise
  modified), write ``sizeof`` in the first place.

Rationale:

``(sizeof(x) * INT_MAX * 2)`` doesn't overflow.

``(INT_MAX * 2 * sizeof(x))`` overflows, giving incorrect
results.

As a side effect, the parentheses of ``sizeof`` are not next to
the parentheses of the whole expression, and it is visually
easier to read.

Detailed rationale:

In C, successive multiplications are evaluated left to right (*),
and therefore here is what happens (assuming x86_64):

``(sizeof(x) * INT_MAX * 2)``:

1) sizeof(x) * INT_MAX  (the type is the largest of both, which
                         is size_t (unsigned long; uint64_t)).
2) ANS * 2        	(the type is again the largest: size_t)

``(INT_MAX * 2 * sizeof(x))``:

1) INT_MAX * 2        	(the type is the largest of both, which is
        		 int as both are int (int; int32_t), so the
        		 result is already truncated as it doesn't fit
        		 an int; at this point, the intermediate result
        		 will be 2^32 - 2 (``INT_MAX - 1``) (if I did
        		 the math right)).
2) ANS * 2        	(the type is again the largest of both: size_t;
        		 however, ANS was already incorrect, so the
        		 result will be an incorrect size_t value)

(*):        https://en.cppreference.com/w/c/language/operator_precedence

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-26 08:18:07 +02:00
Michael Kerrisk fb84ed2aae clock_getres.2: Fix type and variable name in dynamic clock code example
Use 'struct timespec', not 'struct timeval', and adjust
the variable name accordingly.

Reported-by: Tony May <tony.may@mediakind.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-26 08:10:56 +02:00
Alejandro Colomar b5cd247069 getgrouplist.3, inotify.7: Use sizeof consistently
Use ``sizeof`` consistently through all the examples in the
following way:

- Never use a space after ``sizeof``, and always use parentheses
  around the argument.

  Rationale:
  https://www.kernel.org/doc/html/v5.8/process/coding-style.html#spaces

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-25 14:33:03 +02:00
Michael Kerrisk b32a693559 Makefile: Fix lintian.debian.org URL in comment
From the email conversation:

    From: Jakub Wilk <jwilk@jwilk.net>
    Subject: Re: [bug] Makefile: Broken link

    * Alejandro Colomar <colomar.6.4.3@gmail.com>, 2020-08-25, 12:51:
    >Line 32 on the Makefile has a broken link in a comment:
    >
    >https://lintian.debian.org/tags/manpage-has-errors-from-man.html

    This Lintian tag was renamed recently:
    https://salsa.debian.org/lintian/lintian/commit/844278682aafa1da

    The current URL is:
    https://lintian.debian.org/tags/groff-message.html

Reported-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-25 13:55:07 +02:00
Michael Kerrisk b49ea62e96 queue.3: ffix
Reported-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-24 17:06:59 +02:00
Michael Kerrisk c3a4e4fe36 queue.3: Minor formatting fixes for Alejandro Colomar's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-24 09:02:54 +02:00
Alejandro Colomar cbade5057d queue.3: Document CIRCLEQ_* macros
I run ``sudo make`` and then visualized the man page with
``man 3 queue``, and the contents looked good.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-24 08:50:23 +02:00
Jonathan Wakely c4c038c9dd strtod.3: Fix return value for underflow
In C89 strtod returns zero on underflow, but since C99 it can return
non-zero. This means the strtod.3 page contradicts all recent C and
POSIX standards. Both C and POSIX say "smallest normalized positive
number", but for consistency with HUGE_VAL, HUGE_VALF and HUGE_VALL
this patch uses the constants for those numbers.

Also slightly improve the presentation of return values for overflow.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-23 20:03:04 +02:00
Jonathan Wakely 400c2265a2 printf.3: Fix description of %a hexfloat output
The description of hexadecimal floating-point output is missing a
character describing the exponent. The guarantee of at least one digit
in the exponent is present in both C99 and POSIX.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-23 20:02:51 +02:00
Michael Kerrisk f15ff6fa4e seccomp.2: EXAMPLES: use SECCOMP_RET_KILL_PROCESS rather than SECCOMP_RET_KILL
See previous commit.

Reported-by: Rich Felker <dalias@libc.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-23 19:23:46 +02:00
Michael Kerrisk 6b0c25f101 seccomp.2: Warn against the use of SECCOMP_RET_KILL_THREAD
Killing a thread with SECCOMP_RET_KILL_THREAD is very likely
to leave the rest of the process in a broken state.

Wording pretty much taken from Rick Felker's suggestion.

Reported-by: Rich Felker <dalias@libc.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-23 19:23:46 +02:00
Steve Hilder cbcd119573 capabilities.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-22 22:24:02 +02:00
Michael Kerrisk 7b203a3d6d bpf-helpers.7: Resync with current kernel source
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-22 13:28:09 +02:00
Thomas Piekarski e00e18a247 cgroups.7: wfix
Removing repeated word "the"

Signed-off-by: Thomas Piekarski <t.piekarski@deloquencia.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-22 10:16:39 +02:00
Thomas Piekarski b754b41430 time_namespaces.7: wfix
Removing repeated word "the"

Signed-off-by: Thomas Piekarski <t.piekarski@deloquencia.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-22 10:16:23 +02:00
Michael Kerrisk 750fda980b Start of man-pages-5.09: updating Changes and Changes.old 2020-08-13 13:49:52 +02:00
Michael Kerrisk f9d68d8a7e Start of man-pages-5.09: updating .Announce and .lsm files 2020-08-13 13:49:52 +02:00
Michael Kerrisk 88b8586b2d Start of man-pages-5.09: renaming .Announce and .lsm files 2020-08-13 13:49:52 +02:00
Michael Kerrisk 6762f6fb56 Ready for 5.08 2020-08-13 10:03:54 +02:00
Michael Kerrisk ed6c69cab9 intro.1, clock_getres.2, execve.2, fcntl.2, iopl.2, lseek.2, mknod.2, mmap.2, mount.2, mq_getsetattr.2, pidfd_open.2, prctl.2, setns.2, sgetmask.2, sigaction.2, stat.2, statx.2, sync.2, syscalls.2, syslog.2, timerfd_create.2, umask.2, a64l.3, aio_init.3, atoi.3, dladdr.3, fread.3, getpt.3, isfdtype.3, malloc_stats.3, malloc_trim.3, mkfifo.3, mq_close.3, mq_open.3, mq_receive.3, mq_send.3, mq_unlink.3, posix_memalign.3, posix_openpt.3, pthread_atfork.3, pthread_rwlockattr_setkind_np.3, regex.3, scanf.3, sem_close.3, sem_destroy.3, sem_init.3, sem_open.3, sem_post.3, sem_unlink.3, sigset.3, sigvec.3, strftime.3, termios.3, console_codes.4, dsp56k.4, fd.4, lp.4, mouse.4, pts.4, sk98lin.4, dir_colors.5, proc.5, resolv.conf.5, termcap.5, utmp.5, aio.7, armscii-8.7, arp.7, capabilities.7, cgroups.7, charsets.7, cp1251.7, cp1252.7, environ.7, glob.7, inode.7, iso_8859-1.7, iso_8859-10.7, iso_8859-11.7, iso_8859-13.7, iso_8859-14.7, iso_8859-15.7, iso_8859-16.7, iso_8859-2.7, iso_8859-3.7, iso_8859-4.7, iso_8859-5.7, iso_8859-6.7, iso_8859-7.7, iso_8859-8.7, iso_8859-9.7, keyrings.7, koi8-r.7, koi8-u.7, mailaddr.7, man-pages.7, netdevice.7, operator.7, persistent-keyring.7, process-keyring.7, pthreads.7, pty.7, raw.7, regex.7, session-keyring.7, shm_overview.7, signal.7, socket.7, suffixes.7, thread-keyring.7, unicode.7, units.7, uri.7, user-keyring.7, user-session-keyring.7, iconvconfig.8, ld.so.8, zic.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-13 10:01:14 +02:00
Michael Kerrisk 6743dc4434 Changes: Ready for 5.08
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-13 09:55:59 +02:00
Mike Frysinger b4c38a723f drop "coding: UTF-8" header
This header is used inconsistently -- man pages are UTF-8 encoded
but not setting this marker.  It's only respected by the man-db
package, and seems a bit anachronistic at this point when UTF-8
is the standard default nowadays.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-13 09:36:46 +02:00
Alejandro Colomar 1d2e2ecda7 queue.3: Remove wrong code from example
There was code containing ``CIRCLEQ_*`` in the examples for ``TAILQ_*``.  It was introduced by accident in commit ``041abbe``.

From 0c9dfbe9b1ce1130e9a92d1a16fbecd4a08bbe29 Mon Sep 17 00:00:00 2001
From: Alejandro Colomar <colomar.6.4.3@gmail.com>
Date: Wed, 12 Aug 2020 09:11:27 +0200
Subject: [PATCH] queue.3: Remove wrong code from example

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-13 09:27:07 +02:00
Michael Kerrisk cc863b39dd man-pages.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-09 12:35:22 +02:00
Michael Kerrisk 17b015b53e man-pages.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-09 12:34:42 +02:00
Michael Kerrisk 4fba3f2aa8 man-pages.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-09 12:33:20 +02:00
Michael Kerrisk 1884339410 man-pages.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-09 10:27:38 +02:00
Michael Kerrisk 5daacbdbcc man-pages.7: Add some notes on generating optimal glyphs
Getting nice renderings of ^ ` and ~ requires special
steps in the page source.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-09 10:27:38 +02:00
Michael Kerrisk 9ca13180d5 pldd.1, bpf.2, execve.2, futex.2, ioctl_fat.2, ioctl_tty.2, keyctl.2, signalfd.2, timerfd_create.2, __ppc_get_timebase.3, a64l.3, frexp.3, pthread_setname_np.3, regex.3, rpmatch.3, scanf.3, strfmon.3, strftime.3, termios.3, console_codes.4, vcs.4, veth.4, core.5, dir_colors.5, termcap.5, ascii.7, charsets.7, glob.7, man-pages.7, operator.7, regex.7, user_namespaces.7, zic.8: Use "\(ha" rather than "^" in code
This renders better in PDF.

Reported-by: Geoff Clare <gwc@opengroup.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-09 10:22:22 +02:00
Michael Kerrisk 7b97eb9ff0 glob.7, zic.8: Use \` rather than `
\` produces better rendering in PDF.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-09 10:22:19 +02:00
Michael Kerrisk b7ee1a369d strftime.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-06 22:25:17 +02:00
Michael Kerrisk be266c07cb assert.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-06 22:25:17 +02:00
Michael Kerrisk af2d18b2c2 intro.1, clock_getres.2, clone.2, futex.2, ioctl_fat.2, mkdir.2, mknod.2, mmap.2, open.2, statx.2, umask.2, userfaultfd.2, glob.3, mkfifo.3, termios.3, wordexp.3, console_codes.4, sk98lin.4, vcs.4, dir_colors.5, hosts.equiv.5, proc.5, termcap.5, utmp.5, ascii.7, bpf-helpers.7, charsets.7, environ.7, glob.7, mailaddr.7, netlink.7, operator.7, suffixes.7, tcp.7, unicode.7, uri.7, zic.8: Use "\(ti" instead of "~"
A naked tilde ("~") renders poorly in PDF. Instead use "\(ti",
which renders better in a PDF, and produces the same glyph
when rendering on a terminal.

Reported-by: Geoff Clare <gwc@opengroup.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-06 22:25:11 +02:00
Michael Kerrisk 18f49d7563 math_error.7: tfix
Reported-by: John Scott <jscott@posteo.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-04 21:08:06 +02:00
Alejandro Colomar 6253e7d6ec queue.3: Comment out text for functions not in glibc (related: 6559169cac)
===========
DESCRIPTION
===========

I'm documenting ``CIRCLEQ_*`` macros in queue.3.  While writing
this, I noticed that the documentation for some types of
queues/lists talked about swapping contents of two lists, but only
for some of them.  I then found that those macros (``*_SWAP``)
don't exist in my system (Debian), but exist in BSD, and I also
found that a previous commit (6559169cac) commented out a lot of
the *_SWAP macros documentation, but not all, and the reason was
that they were not present on glibc.

I checked that I didn't have any of the *_SWAP macros on my glibc,
so I think this is probably that the commit simply forgot to
comment some of
them.

=======
TESTING
=======

I did ``sudo make`` and then visualized the man page with
``man 3 queue``, and the changes looked good.

I also noticed that the subsection ``Tail queue example`` contents
were wrong, as they contained calls to CIRCLEQ_* macros.  I will
address that in a future patch, before I submit the patch
documenting CIRCLEQ_*.

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-08-04 14:48:03 +02:00
Michael Kerrisk 0629df8b96 open.2, proc.5: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-31 22:32:59 +02:00
Michael Kerrisk 8842f53458 ioctl_tty.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-30 12:11:21 +02:00
Michael Kerrisk 322522ea3b ioctl_tty.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-30 12:06:11 +02:00
Michael Kerrisk 490f9b6c2b socket.2, address_families.7: wfix: multiplexor ==> multiplexer
Both are used, but "multiplexer" seems to be majority usage in
English.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-30 08:03:02 +02:00
Michael Kerrisk b384813479 pts.4: Remove NOTES on BSD pseuodterminals
This information is already covered better in pty(7). No need to
mention it again here.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:11 +02:00
Michael Kerrisk a3d59075f4 pts.4: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:11 +02:00
Michael Kerrisk 980a26282d openpty.3: Minor wording fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:11 +02:00
Michael Kerrisk 9e232754c1 pty.7: Explicitly mention CONFIG_LEGACY_PTYS
Explicitly mention CONFIG_LEGACY_PTYS, and note that it is disabled
by default since Linux 2.6.30.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:11 +02:00
Michael Kerrisk 8931e190a9 pty.7: Relocate a paragraph to NOTES
The paragraph noting applications that use pseudoterminals is better
placed in NOTES than in the DESCRTIPTION.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:11 +02:00
Michael Kerrisk 7f9cf51802 unlockpt.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:11 +02:00
Michael Kerrisk e87eb066cc ttyname.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:11 +02:00
Michael Kerrisk 965cd80037 ptsname.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:11 +02:00
Michael Kerrisk 1f5529f250 grantpt.3: Minor wording fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:11 +02:00
Michael Kerrisk fac73de408 getpt.3, posix_openpt.3, pts.4: Use the term "pseudoterminal multiplexor device" for /dev/ptmx
Let's use some consistent terminology for this device.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:11 +02:00
Michael Kerrisk 9ea5c15a95 getpt.3: Minor wording fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:11 +02:00
Michael Kerrisk 86e5910635 getpt.3, pts.4: Minor wording fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:08 +02:00
Michael Kerrisk cc1a0b7e16 ioctl_tty.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:08 +02:00
Michael Kerrisk c4316bb5f6 ioctl_tty.2: Minor wording and formatting fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 11:17:08 +02:00
Michael Kerrisk 7b67208034 ioctl_tty.2: Fix a confusing wording error in description of TIOCSPTLCK
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-29 08:56:21 +02:00
Mike Frysinger 795cf36094 Various pages: Drop t comment header
Historically, a comment of the following form at the top of a
manual page was used to indicate too man(1) that the use of tbl(1)
was required in order to process tables:

    '\" t

However, at least as far back as 2001 (according to Branden),
man-db's man(1) automatically uses tbl(1) as needed, rendering
this comment unnecessary. And indeed many existing pages in
man-pages that have tables don't have this comment at the top of
the file.  So, drop the comment from those files where it is
present.

[mtk: completely rewrote commit message]

Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-24 14:18:27 +02:00
Michael Kerrisk de527cb9b7 seccomp.2: Minor tweaks to Andy Lutomirski's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-24 14:15:00 +02:00
Andy Lutomirski 9729408da5 seccomp.2: Improve x32 and nr truncation notes
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-24 13:53:22 +02:00
Michael Kerrisk 901c8ecf7c open.2: Say a bit more about what happens when 'mode' is wrongly omitted
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-24 13:26:38 +02:00
Michael Kerrisk 88f463a9be open.2: Minor wording fixes
Add some paragraph breaks to the discussion of 'mode' to make
the details a bit easier to read.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-24 13:16:16 +02:00
Michael Kerrisk 7f4e971631 open.2: srcfix: use saner macros to achieve same formatting effect
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-24 13:14:41 +02:00
Mike Frysinger 01ae31d315 Various pages: Trim leading blank comment line
Very few pages do this, so trim them.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-24 12:56:59 +02:00
Mike Frysinger 243d656fdb Various pages: Use standard .\" comment style
The \" comment produces blank lines.  Use the .\" that the vast
majority of the codebase uses instead.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-24 12:55:55 +02:00
Bruno Haible 62e2943e17 posix_memalign.3: Clarify how to free the result of posix_memalign
The man page did not tell how a memory block obtained through
posix_memalign() can be freed. POSIX:2018 says it.
https://pubs.opengroup.org/onlinepubs/9699919799/functions/posix_memalign.html
I verified using a test program that this is true for glibc.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-21 12:45:20 +02:00
Bruno Haible 8c464d172c wctob.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-21 12:44:40 +02:00
Michael Kerrisk 3c650501b3 ioctl_fat.2, dladdr.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-20 13:47:59 +02:00
Michael Kerrisk 5bee07eb51 ld.so.8: Clean up page internal cross references after Florian Weimer's patch
The subsection named "Rpath token expansion" was renamed to
"Dynamic string tokens". Update the cross-references inside
the page accordingly.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-20 13:44:37 +02:00
Michael Kerrisk 2f8e66b0e7 ld.so.8: Minor tweaks to Florian Weimer's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-20 13:43:12 +02:00
Florian Weimer 8aea307b4f ld.so.8: List more places in which dynamic string tokens are expanded
This happens for more than just DT_RPATH/DT_RUNPATH.

Signed-off-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-20 13:36:19 +02:00
Jakub Wilk 9eff2f495f proc.5: Use "pwd -P" for printing cwd
"/bin/pwd" happens to work with the GNU coreutils implementation,
which has -P as the default, contrary to POSIX requirements.

Use "pwd -P" instead, which is shorter, easier to type, and should
work everywhere.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-20 11:35:07 +02:00
Jakub Wilk 9363af082e proc.5: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-20 11:27:26 +02:00
Jakub Wilk cc6d2edb9b prctl.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-20 11:26:40 +02:00
Andrew Price a5b25af5c5 lseek.2: List gfs2 support for SEEK_HOLE/SEEK_DATA
Signed-off-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-17 13:31:12 +02:00
Michael Kerrisk aade901bee capabilities.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-17 13:31:12 +02:00
Saikiran Madugula 69a0c93e3c capabilities.7: CAP_SYS_RESOURCE: add two more items for POSIX message queues
CAP_SYS_RESOURCE also allows overriding /proc/sys/fs/mqueue/msg_max
and /proc/sys/fs/mqueue/msgsize_max.

Signed-off-by: Saikiran Madugula <hummerbliss@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-17 13:31:06 +02:00
Carlos O'Donell c47c61c330 pthread_rwlockattr_setkind_np.3: Clarify a PTHREAD_RWLOCK_PREFER_WRITER_NP detail
Clarify that it is recursive read locks on the read-write lock
that make it difficult to implement
PTHREAD_RWLOCK_PREFER_WRITER_NP.

Update the libc-alpha URL and provide the URL to the POSIX wording
that is quoted in the comment.

Reported-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Signed-off-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-17 10:02:28 +02:00
Benjamin Peterson 80c5b48d9c cgroup_namespaces.7: wfix
Signed-off-by: Benjamin Peterson <benjamin@python.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-17 09:59:19 +02:00
Michael Kerrisk 298743a573 setns.2: EXAMPLE: use O_CLOEXEC when opening namespace file descriptor
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-17 09:22:52 +02:00
Michael Kerrisk 7cb61821b9 pidfd_open.2: Close the pidfd in EXAMPLE
Close the PID file descriptor in the example program, to hint to
the reader that like every other kind of file descriptor, a PID FD
should be closed.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-17 09:13:31 +02:00
Michael Kerrisk f4fb9919e1 truncate.2: tfix
Reported-by: Diogo Miguel Ferreira Rodrigues <dmfrodrigues2000@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-13 09:17:58 +02:00
Michael Kerrisk 402f2e7b67 prctl.2: The parent death signal is cleared on some credential changes
See kernel/cred.c::commit_creds() in the Linux 5.6 source code.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-11 11:40:24 +02:00
Michael Kerrisk 28a4c58cc2 intro.1, localedef.1, memusage.1, memusagestat.1, bpf.2, execve.2, fork.2, keyctl.2, request_key.2, sigaction.2, signal.2, socket.2, dlopen.3, getauxval.3, gnu_get_libc_version.3, pthread_atfork.3, sem_post.3, setjmp.3, strftime.3, veth.4, locale.5, nscd.conf.5, resolv.conf.5, address_families.7, armscii-8.7, ascii.7, capabilities.7, cgroups.7, charsets.7, cp1251.7, cp1252.7, iso_8859-1.7, iso_8859-10.7, iso_8859-11.7, iso_8859-13.7, iso_8859-14.7, iso_8859-15.7, iso_8859-16.7, iso_8859-2.7, iso_8859-3.7, iso_8859-4.7, iso_8859-5.7, iso_8859-6.7, iso_8859-7.7, iso_8859-8.7, iso_8859-9.7, keyrings.7, koi8-r.7, koi8-u.7, libc.7, locale.7, man.7, network_namespaces.7, persistent-keyring.7, session-keyring.7, signal.7, unicode.7, uri.7, user-keyring.7, user-session-keyring.7: ffix: replace - with real\-
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 14:28:51 +02:00
Michael Kerrisk 168aac07bd move_pages.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 13:57:58 +02:00
Michael Kerrisk 8352be12ff strfmon.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 13:51:38 +02:00
Michael Kerrisk 5d48943394 strfmon.3: ffix
Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 13:48:36 +02:00
Bjarni Ingi Gislason 6b469e24eb man[13]/*: ffix: change '--' to '\-\-' (options) or '\(em' (em-dash)
Change '--' to '\-\-' for options and '--' between words to '\(em'
(em-dash).

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 13:42:21 +02:00
Jakub Wilk 79b12902b9 Changes.old: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 13:39:43 +02:00
Jakub Wilk cf35dd37b2 termios.3: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 13:39:30 +02:00
Jakub Wilk 6a17c54c3a prctl.2: tfix
Remove duplicated word.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 13:39:15 +02:00
Michael Kerrisk f08ee8bca4 math_error.7: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 13:36:01 +02:00
Michael Kerrisk 23f3fcad22 resolv.conf.5: Clarify that ip6-bytestring was removed in 2.25
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 13:03:22 +02:00
Michael Kerrisk 54d43f67ae strcmp.3: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:57:02 +02:00
Michael Kerrisk 616617ddf7 strcmp.3: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:54:47 +02:00
Michael Kerrisk 019390e04d shmop.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:53:39 +02:00
Michael Kerrisk 48f43dae39 resolver.3: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:50:41 +02:00
Michael Kerrisk 747f5636fd proc.5: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:44:40 +02:00
Michael Kerrisk a00214da73 proc.5: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:43:49 +02:00
Michael Kerrisk 313fb52719 open.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:42:33 +02:00
Michael Kerrisk 234d7f094d mremap.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:41:25 +02:00
Michael Kerrisk 0664253bf8 mmap.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:39:09 +02:00
Michael Kerrisk 8c1bd6e500 getusershell.3: ffix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:38:04 +02:00
Michael Kerrisk 9e9a5b61b5 execve.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:35:57 +02:00
Michael Kerrisk 34fa760449 dsp56k.4: ffix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-06 12:04:38 +02:00
Alyssa Ross 71d8892776 send.2, recv.2: Add msg_iovlen POSIX note
msg_iovlen is incorrectly typed (according to POSIX) in addition
to msg_controllen, but unlike msg_controllen, this wasn't
mentioned for msg_iovlen.

msg_iovlen being incorrectly typed hasn't been reported as a GCC
bug, but there's no point since it is caused by the same
underlying issue.

Sources: POSIX.1-2017 (<sys/socket.h>), Linux
(include/linux/socket.h)

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-03 13:42:22 +02:00
Michael Kerrisk 16170fbc5c mount.2: ERRORS: add EINVAL for bind mount of mount namespace inode
See kernel commit 8823c079ba7136dc1948d6f6dcb5f8022bde438e
and the in fs/namespace.c::do_loopback():

        err = -EINVAL;
        if (mnt_ns_loop(old_path.dentry))
                goto out;

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-03 12:38:18 +02:00
Michael Kerrisk b3bb3f58be strfromd.3: ffix: use \- for minus sign
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-02 12:24:45 +02:00
Bjarni Ingi Gislason 86d93b3eeb man3/*: ffix: change '-' to '\-' for options
Change '-' to '\-' for the prefix of names to indicate an option.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-02 12:23:21 +02:00
Bjarni Ingi Gislason f764b4557d man8/*: ffix: change '-' to '\-' for options
Change '-' to '\-' for the prefix of names to indicate an option.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-02 12:21:22 +02:00
Bjarni Ingi Gislason fb6d2c09ae man7/*: ffix: change '-' to '\-' for options and to '\(en' for a range
Change '-' to '\-' for the prefix of names to indicate an option.

  Change '-' to '\(en' for a range.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-02 12:21:02 +02:00
Bjarni Ingi Gislason 1c8ae9fefb man5/*: ffix: change '-' to '\-' for options
Change '-' to '\-' for the prefix of names to indicate an option.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-02 12:20:31 +02:00
Bjarni Ingi Gislason 47cf5cbc98 man4/*: ffix: change '-' to '\-' for options
Change '-' to '\-' for the prefix of names to indicate an option.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-02 12:20:25 +02:00
Bjarni Ingi Gislason 2c1acf16da man2/*: ffix: change '-' to '\-' for options
Change '-' to '\-' for the prefix of names to indicate an option.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-02 12:20:04 +02:00
Bjarni Ingi Gislason 8ef1d3d11d man1/*: ffix: change '-' to '\-' for options
Change '-' to '\-' for the prefix of names to indicate an option.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-02 12:18:03 +02:00
Michael Kerrisk 99192e5fbf ftw.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-07-02 10:36:55 +02:00
Sven Hoexter 069cbb6044 cgroups.7, cpuset.7: Update kernel cgroup documentation references
cgroups-v1/v2 documentation got moved to the "admin-guide" subfolder
and converted from .txt files to .rst

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-30 09:37:38 +02:00
Thomas Bartelsmeier 215c784ff4 hosts.5: Clarify capability for IPv6 outside of examples
Resolves https://bugzilla.kernel.org/show_bug.cgi?id=208279

Signed-off-by: Thomas Bartelsmeier <t.bartelsmeier@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-30 09:33:46 +02:00
Michael Kerrisk c5c0846dbe strfromd.3: wfix (null character --> null byte)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-29 22:30:07 +02:00
Michael Kerrisk feb9ef3848 iopl.2: Minor tweaks to Thomas Piekarski's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-29 13:50:23 +02:00
Thomas Piekarski 6caf6c4380 iopl.2: Updating description of permissions and disabling interrupts
Update description of permissions for port-mapped I/O set
per-thread and not per-process. Mention that iopl() can not
disable interrupts since Linux 5.5 anymore and is in general
deprecated and only provided for legacy X servers.

See https://bugzilla.kernel.org/show_bug.cgi?id=205317

Reported-by: victorm007@yahoo.com
Signed-off-by: Thomas Piekarski <t.piekarski@deloquencia.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-29 13:50:23 +02:00
Michael Kerrisk ada17e7d82 prctl.2: srcfix: add various people to copyright
Based on git history.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-29 13:50:16 +02:00
Michael Kerrisk 236a9f706a prctl.2: Minor fixes to Dave Martin's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 13:34:48 +02:00
Dave Martin 9b276f9ea8 prctl.2: Add tagged address ABI control prctls (arm64)
Add documentation for the the PR_SET_TAGGED_ADDR_CTRL and
PR_GET_TAGGED_ADDR_CTRL prctls added in Linux 5.4 for arm64.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Cc: Vincenzo Frascino <vincenzo.frascino@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 13:22:26 +02:00
Michael Kerrisk 7fe3c5a9cf prctl.2: Minor tweaks to Dave Martin's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 13:13:19 +02:00
Dave Martin 034f403aa7 prctl.2: Add SVE prctls (arm64)
Add documentation for the the PR_SVE_SET_VL and PR_SVE_GET_VL
prctls added in Linux 4.15 for arm64.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 13:06:38 +02:00
Michael Kerrisk 27e0d164d9 locale.5: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 11:34:20 +02:00
Michael Kerrisk 927a5da23a locale.5: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 11:33:41 +02:00
Michael Kerrisk d44890b7a3 cciss.4: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 11:29:02 +02:00
Michael Kerrisk 0b06563436 clone.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 11:17:44 +02:00
Michael Kerrisk f3061d3662 semctl.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 11:15:53 +02:00
Michael Kerrisk f902db6b7d sync.2: Minor fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 11:11:20 +02:00
Michael Kerrisk 4e375ad273 sync.2: Minor tweaks to Jeff Layton's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 11:11:01 +02:00
Jeff Layton 7b9af2eb80 sync.2: syncfs() now returns errors if writeback fails
A patch has been merged for v5.8 that changes how syncfs() reports
errors. Change the sync() manpage accordingly.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 11:01:54 +02:00
Philip Adams aeaf667ec3 tcp.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-26 10:49:16 +02:00
Michael Kerrisk fb033b1e18 gethostid.3: wfix: s/is intended/was intended/
The host ID might once have been intended to be globally unique,
but that turned out not to feasible.

Reported-by: Rich Felker <dalias@libc.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-25 21:35:44 +02:00
Arkadiusz Drabczyk af04113d0c ld.so.8: Explain than empty entry in LD_LIBRARY_PATH means cwd
If this was ever going to change the test case is very simple:

$ cd /tmp
$ touch libc.so.6
$ LD_LIBRARY_PATH=: sh
sh: error while loading shared libraries: libc.so.6: file too short

Signed-off-by: Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-25 09:13:46 +02:00
Michael Kerrisk 09caeefd5c ip.7: Remove mention of ipfw(4) which was in long obsolete ipchains project
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-25 09:00:59 +02:00
Michael Kerrisk ba6431be3a mmap.2: tfix
Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-25 08:10:21 +02:00
Dan Kenigsberg 0c576731a8 capabilities.7: Clarify that CAP_SYS_NICE relates to *lowering* the nice value
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-24 13:43:06 +02:00
Michael Kerrisk 7122afd6bf standards.7: Add an entry for POSIX.1-1988
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-24 13:22:12 +02:00
Michael Kerrisk f5f55ae2d3 standards.7: Correct various details in the explanation of XPG/POSIX/SUS
As reported by mail from Geoff Clare, there are some details that
need correcting:

Subject: standards(7) (was: man-pages-5.07 released)
Date: Wed, 10 Jun 2020 10:53:14 +0100
From: Geoff Clare <gwc@opengroup.org>

...

The first isn't really a problem, just an oddity. You list
POSIX.1b as "formerly known as POSIX.4", but you don't do the
equivalent for POSIX.1c ("formerly known as POSIX.4a").

There are several problems with the XPG3 entry:

    "first significant release" - although I suppose XPG3 could
    be considered more significant than XPG2 because it was the
    first one to incorporate POSIX.1, I don't think it's fair to
    imply that XPG2 was not significant.  (E.g. XPG2 was
    significant in that it was the first release to include
    I18N, and the first that had a conformance test suite.)

    "produced by the X/Open Company, a multivendor consortium" -
    this conflates two different things called X/Open. X/Open
    Company Limited is the UK company that did the editing work,
    organised meetings, etc. X/Open Group is the consortium
    whose members developed the technical content.

    "This multivolume guide was based on the POSIX standards" -
    at the time there was only one POSIX standard, namely
    POSIX.1-1988.  The first release to incorporate POSIX.2 was
    XPG4 (which you may consider worth noting in the XPG4
    entry).

To fix these problems I would suggest changing the entry to:

XPG3  Released in 1989, this was the first release of the X/Open
      Portability Guide to be based on a POSIX standard
      (POSIX.1-1988).  This multivolume guide was developed by the
      X/Open Group, a multivendor consortium.

Under SUSv2 I would suggest changing:

    Sometimes also referred to as XPG5.

to:

    Sometimes also referred to (incorrectly) as XPG5.

Under POSIX.1-2001, SUSv3: "XSI conformance constitutes the Single
UNIX Specification version 3 (SUSv3)" is problematic.  I think I
touched on this in the previous discussion. I would suggest
deleting that sentence and instead inserting, before "Two
Technical Corrigenda ...", the following:

    The Single UNIX Specification version 3 (SUSv3) comprises the
    Base Specifications containing XBD, XSH, XCU and XRAT as
    above, plus X/Open Curses Issue 4 version 2 as an extra volume
    that is not in POSIX.1-2001.

Something similar is needed in the POSIX.1-2008, SUSv4 entry where
it talks about "the same four parts". The extra volume this time
is X/Open Curses Issue 7.
]]

Cowritten-by: Geoff Clare <gwc@opengroup.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-24 13:22:12 +02:00
Michael Kerrisk baa9880610 capabilities.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-24 12:02:18 +02:00
Michael Kerrisk 9f6f7345e4 capabilities.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-24 12:01:06 +02:00
Michael Kerrisk a3cb5856c8 capabilities.7: Clarify wording around increasing process nice value
The fact that a more negative nice value means higher
priority is a continuing source of confusion.

Reported-by: Dan Kenigsberg <danken@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-24 11:59:49 +02:00
Michael Kerrisk c8863be925 zic.8: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-23 23:21:05 +02:00
Michael Kerrisk 24e14ed0b3 zic.8: Sync to 2020a tzdb release
From https://www.iana.org/time-zones, version 2020a.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-23 23:21:05 +02:00
Michael Kerrisk f4077c2c2c sysctl.2: glibc removed support for sysctl() starting in version 2.32
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-23 21:26:51 +02:00
Michael Kerrisk 575bac0fdd connect.2, pidfd_send_signal.2, ptrace.2, socket.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-21 09:26:30 +02:00
Bjarni Ingi Gislason 7f740303b2 man3/*: srcfix: fix warnings from "mandoc -Tlint"
Remove superfluous paragraph macros.

Remove request ".br" if it precedes a line, that begins with a
space, as such lines automatically cause a break.

There is no change in the output from "nroff" and "groff".

###

Examples of warnings from "mandoc -Tlint":

mandoc: bindresvport.3:41:2: WARNING: skipping paragraph macro: PP after SH

mandoc: crypt.3:228:2: WARNING: skipping paragraph macro: PP empty

mandoc: dlinfo.3:151:2: WARNING: skipping paragraph macro: IP empty

mandoc: exec.3:86:2: WARNING: skipping paragraph macro: PP after SS

mandoc: getsubopt.3:45:2: WARNING: skipping paragraph macro: br before text line with leading blank

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-21 09:22:01 +02:00
Bjarni Ingi Gislason fec6cf90e9 man2/*: srcfix: fix warnings from "mandoc -Tlint"
Remove superfluous paragraph macros.

  Remove ".br" if it is before a line that starts with a space
character, as such lines automatically cause a break.

###

  The output is unchanged, except two empty lines are added at the
bottom (before the footer line) in the output of "nroff" for the files
"alloc_hugepages.2" and "userfaultfd.2".

###

  Examples of warnings from "mandoc -Tlint":

mandoc: access.2:283:2: WARNING: skipping paragraph macro: PP after SH

mandoc: adjtimex.2:185:2: WARNING: skipping paragraph macro: PP empty

mandoc: futex.2:728:2: WARNING: skipping paragraph macro: IP empty

mandoc: getsid.2:48:2: WARNING: skipping paragraph macro: br before text line with leading blank

mandoc: init_module.2:290:2: WARNING: skipping paragraph macro: PP after SS

mandoc: ioctl_fideduperange.2:27:2: WARNING: skipping paragraph macro: br after SH

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-21 09:08:00 +02:00
Bjarni Ingi Gislason c3f602233d man7/*: srcfix: trim trailing space
Trim tailing space in "strings".

  There is no change in the output from "nroff" and "groff".

###

Output is from: test-groff -b -mandoc -T utf8 -rF0 -t -w w -z

  [ "test-groff" is a developmental version of "groff" ]

troff: <attributes.7>:510: warning: trailing space
troff: <attributes.7>:512: warning: trailing space
troff: <attributes.7>:513: warning: trailing space
troff: <attributes.7>:516: warning: trailing space
troff: <attributes.7>:649: warning: trailing space
troff: <attributes.7>:681: warning: trailing space
troff: <attributes.7>:720: warning: trailing space
####

troff: <environ.7>:181: warning: trailing space
troff: <environ.7>:182: warning: trailing space
####

troff: <ip.7>:820: warning: trailing space
####

troff: <signal.7>:316: warning: trailing space
Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>

####

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-21 09:03:31 +02:00
Bjarni Ingi Gislason 81533e83e2 proc.5: srcfix: trim trailing space
Output is from: test-groff -b -mandoc -T utf8 -rF0 -t -w w -z

  [ "test-groff" is a developmental version of "groff" ]

Input file is ./proc.5

troff: <proc.5>:4410: warning: trailing space
troff: <proc.5>:5206: warning: trailing space
troff: <proc.5>:5488: warning: trailing space

###

  There is no change in the output from "nroff" and "groff".

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-21 09:02:41 +02:00
Bjarni Ingi Gislason ee6a7196a6 man4/*: srcfix: remove trailing space in "strings"
Trim trailing space.

There is no change in the output from "nroff" and "groff".

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-21 08:48:42 +02:00
Michael Kerrisk 247c654385 fstatvfs.2, getcontext.2, getcwd.2, gethostid.2, killpg.2, mq_notify.2, mq_open.2, mq_timedreceive.2, mq_timedsend.2, mq_unlink.2, setcontext.2, sethostid.2, statvfs.2: Remove historical .so links
These links were mostly created when pages were moved between
sections, in almost every case several years ago. The idea
was to allow people time to get used to the new section numbers
while still having commands of the form "man <sec> <page>"
work as before. Let's assume that people have now had time to
get used to the new section numbers, and remove these links.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-20 09:24:32 +02:00
Michael Kerrisk 12e3a797b3 getdtablesize.2, sigqueue.2, clock_getres.3, clock_gettime.3, clock_settime.3, attr.5, numa_maps.5: Remove old links
These are all links that were created several years ago, mainly
when pages were migrated to different sections, in order to
allow the 'man' commands using the old section numbers to work.
However, the plan was always to eventually remove them, after
allowing people who cared to get used to the new section numbers.
Now, after 5+ years in each case, it's time to remove
these links.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 20:50:47 +02:00
Michael Kerrisk 04ce17bdba symlink.7: Minor fixes to Aleksa Sarai's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 14:59:45 +02:00
Aleksa Sarai 41e240557f symlink.7: Document magic links more completely
Traditionally, magic links have not been a well-understood topic
in Linux. This helps clarify some of the terminology used in
openat2.2.

Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 14:59:45 +02:00
Oleksandr Kravchuk 32b46e5005 keyctl.2: Declare auth_key
The variable is used in the code example, but not declared,
leading to a compilation error.

Signed-off-by: Oleksandr Kravchuk <open.source@oleksandr-kravchuk.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 14:58:54 +02:00
Michael Kerrisk 718bc4a9c1 fread.3: srcfix: remove crufty line
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 14:42:26 +02:00
Arkadiusz Drabczyk 8ef8ccaa7d fread.3: Add example
Signed-off-by: Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 14:42:26 +02:00
Arkadiusz Drabczyk ef5cd40e3f fread.3: Explain that file position is moved after calling fread()/fwrite()
Corresponding manpage on FreeBSD already contains that
information.

Signed-off-by: Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 14:27:54 +02:00
Michael Kerrisk d7f741cf33 atoi.3: Minor tweaks to Arkadiusz Drabczyk's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 14:23:38 +02:00
Michael Kerrisk c3e66a0608 atoi.3: Relocate BUGS section
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 14:22:18 +02:00
Michael Kerrisk f00c7b5b41 atoi.3: Add NOTES section explaining 0 return value on error
And note that this is not specified by POSIX.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 14:21:42 +02:00
Arkadiusz Drabczyk 5e297c356e atoi.3: Explain disadvantages of atoi()
I believe new users should be discouraged from using atoi() and
that its disadvantages should be explained.

I added the information that 0 is returned on error - although C
standard and POSIX say that "If the value of the result cannot be
represented, the behavior is undefined." there are some
interpretations that 0 has to be returned
https://stackoverflow.com/questions/38393162/what-can-i-assume-about-the-behaviour-of-atoi-on-error
and this is also what happens in practice with glibc, musl and
uClibc.

Signed-off-by: Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 14:13:57 +02:00
Arkadiusz Drabczyk b260aaeca9 proc.5: Inform that comm in /proc/pid/{stat,status} might also be truncated
pgrep for example searches for a process name in /proc/pid/status
and therefore cannot find processes whose names are longer than 15
characters unless -f is specified.

Signed-off-by: Arkadiusz Drabczyk <arkadiusz@drabczyk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 13:55:51 +02:00
Jakub Wilk 1297d74439 man-pages.7: wfix
Reorder full wordings to match the order of abbreviations.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-19 12:47:44 +02:00
Michael Kerrisk 9d3c4d88c3 setns.2: ERRORS: add ESRCH for PID FD that refers to a terminated process
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-15 22:41:49 +02:00
Michael Kerrisk 8bb318edc8 setns.2: Minor wording fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-15 22:16:32 +02:00
Michael Kerrisk f072850099 setns.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-15 22:12:42 +02:00
Michael Kerrisk 6c2a93c3ca setns.2: Minor tweak
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-15 16:32:52 +02:00
Michael Kerrisk ea31fdec71 setns.2: Document the use of PID file descriptors with setns()
Starting with Linux 5.8, setns() can take a PID file descriptor as
an argument, and move the caller into or more of the namespaces of
the thread referred to by that descriptor.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-15 16:23:49 +02:00
Michael Kerrisk eca31e6970 pidfd_open.2: Add the setns(2) use case for PID file descriptors
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-15 16:00:42 +02:00
Michael Kerrisk b93ed8895e pidfd_open.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-15 16:00:42 +02:00
Michael Kerrisk 7f52c11c37 setns.2: It is possible to setns() to the caller's current PID namespace
The page currently incorrectly says that 'fd' must refer to
a descendant PID namespace. However, 'fd' can also refer to
the caller's current PID namespace. Verified by experiment,
and also comments in kernel/pid_namespace.c (Linux 5.8-rc1).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-15 15:57:48 +02:00
Bjarni Ingi Gislason be1db87e41 Various pages: srcfix: trim a trailing space
Output is from: test-groff -b -e -mandoc -T utf8 -rF0 -t -w w -z

  [ "test-groff" is a developmental version of "groff" ]

  There is no change in the output of "nroff" and "groff".

####

troff: <fts.3>:50: warning: trailing space
####

troff: <getgrnam.3>:175: warning: trailing space
####

troff: <getpwnam.3>:181: warning: trailing space
####

troff: <rcmd.3>:52: warning: trailing space
troff: <rcmd.3>:57: warning: trailing space
troff: <rcmd.3>:60: warning: trailing space
troff: <rcmd.3>:63: warning: trailing space
troff: <rcmd.3>:69: warning: trailing space
troff: <rcmd.3>:73: warning: trailing space
####

troff: <rexec.3>:48: warning: trailing space
troff: <rexec.3>:51: warning: trailing space
####

troff: <sem_open.3>:36: warning: trailing space

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-15 15:57:30 +02:00
Michael Kerrisk 0e0984fc38 openat2.2: ffix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-12 21:54:55 +02:00
Michael Kerrisk 7d79c71ef1 pidfd_getfd.2: srcfix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-12 21:47:21 +02:00
Michael Kerrisk 20b9102ac7 madvise.2: tfix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-12 21:46:21 +02:00
Michael Kerrisk 98f89c711b timer_create.2, timerfd_create.2: tfix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-12 21:44:55 +02:00
Michael Kerrisk ac6dcc4865 timerfd_create.2: tfix
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-12 21:44:23 +02:00
Bjarni Ingi Gislason 77ca5b1d08 man2/*: srcfix: trim trailing space
Remove superfluous space at the end of a processed input line.

  There is no change in the output from "nroff" and "groff".

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-12 21:38:24 +02:00
Bjarni Ingi Gislason 7ba3e56fe6 time.1: ffix: correct a three-fonts line in SYNOPSIS
The current version shows the square brackets, '[' and ']', in
boldface.

  Use the '\c' escape sequence (function) to join the output of two
macros.

Signed-off-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-12 21:29:34 +02:00
Michael Kerrisk 81701c0437 capabilities.7: Document CAP_BPF
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-12 13:52:22 +02:00
Michael Kerrisk 3502d8682f capabilities.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-12 13:52:22 +02:00
Michael Kerrisk e39e42409d capabilities.7: Add CAP_PERFMON
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-12 13:52:22 +02:00
Michael Kerrisk 0071462373 syscalls.2: Add faccessat2(), added in Linux 5.8
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-12 13:52:17 +02:00
Michael Kerrisk c0cf0480da address_families.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-11 07:53:17 +02:00
Michael Kerrisk 22f79f9580 chroot.2, utimensat.2, vfork.2, getcwd.3, getdtablesize.3, ualarm.3, usleep.3, rtnetlink.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-11 07:52:18 +02:00
Michael Kerrisk 72970931d7 getpagesize.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-11 07:47:23 +02:00
Michael Kerrisk 9bfc9cb197 dup.2, fallocate.2, futex.2, ioctl_fat.2, ioctl_ficlonerange.2, ioctl_fideduperange.2, madvise.2, membarrier.2, mprotect.2, open.2, openat2.2, perf_event_open.2, perfmonctl.2, pipe.2, process_vm_readv.2, s390_pci_mmio_write.2, s390_runtime_instr.2, s390_sthyi.2, set_thread_area.2, sigprocmask.2, subpage_prot.2, unshare.2, cmsg.3, newlocale.3, pthread_setname_np.3, strfmon.3, strfromd.3, tsearch.3, tcp.7, ld.so.8: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-11 07:45:09 +02:00
Michael Kerrisk 6585950663 pthread_setconcurrency.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-11 07:42:26 +02:00
Michael Kerrisk 041035df23 if_nameindex.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-11 07:41:35 +02:00
Michael Kerrisk 0dbe186a35 proc.5: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-11 07:24:49 +02:00
Michael Kerrisk 4f23702902 cgroups.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-10 12:06:41 +02:00
Michael Kerrisk 146842f921 cgroup_namespaces.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-10 12:04:48 +02:00
Michael Kerrisk c919e22f82 proc.5: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-10 12:03:06 +02:00
Michael Kerrisk 00c5e01702 printf.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-10 11:57:30 +02:00
Michael Kerrisk 0d0da0de86 signal.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-10 11:55:59 +02:00
Michael Kerrisk da16ac098d open.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-10 11:53:47 +02:00
Michael Kerrisk c6ba384bf4 bpf.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-10 11:52:31 +02:00
Michael Kerrisk 3701115420 getdents.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-10 11:49:18 +02:00
Michael Kerrisk 9562b9aee5 dup.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-10 11:48:44 +02:00
Michael Kerrisk 73942082f2 proc.5: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-10 11:45:21 +02:00
Michael Kerrisk a8fcac48f5 capabilities.7: SEE ALSO: add getpcaps(8)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-10 08:00:46 +02:00
Michael Kerrisk 138b60c7b4 prctl.2: wfix
Reported-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 20:09:48 +02:00
Michael Kerrisk e04dc91a01 Changes.old: Fixes to 5.07 change log
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 19:51:40 +02:00
Michael Kerrisk 7d7c7f550d Start of man-pages-5.08: updating Changes and Changes.old 2020-06-09 14:48:40 +02:00
Michael Kerrisk 9009edbc12 Start of man-pages-5.08: updating .Announce and .lsm files 2020-06-09 14:48:40 +02:00
Michael Kerrisk a5f05118dc Start of man-pages-5.08: renaming .Announce and .lsm files 2020-06-09 14:48:40 +02:00
Michael Kerrisk c1ccfe364b Ready for 5.07 2020-06-09 14:48:40 +02:00
Michael Kerrisk edffc87e82 Changes: whitespace cleanups 2020-06-09 14:48:40 +02:00
Michael Kerrisk bffbb22fda iconv.1, locale.1, memusage.1, memusagestat.1, pldd.1, sprof.1, _syscall.2, add_key.2, adjtimex.2, bind.2, bpf.2, chown.2, clone.2, close.2, copy_file_range.2, eventfd.2, fanotify_init.2, fanotify_mark.2, fork.2, fsync.2, futex.2, getdents.2, getrlimit.2, getxattr.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, ioctl_fat.2, ioctl_getfsmap.2, ioctl_ns.2, ioctl_tty.2, ioctl_userfaultfd.2, kcmp.2, keyctl.2, listen.2, listxattr.2, mbind.2, membarrier.2, memfd_create.2, mkdir.2, move_pages.2, mremap.2, msync.2, nfsservctl.2, open.2, perf_event_open.2, pidfd_send_signal.2, pipe.2, pivot_root.2, pkey_alloc.2, process_vm_readv.2, ptrace.2, readlink.2, readv.2, recv.2, recvmmsg.2, rename.2, request_key.2, s390_runtime_instr.2, sched_setaffinity.2, seccomp.2, send.2, sendmmsg.2, sigaltstack.2, signalfd.2, socket.2, socketpair.2, splice.2, spu_create.2, spu_run.2, statfs.2, syscall.2, sysctl.2, sysfs.2, tee.2, timer_getoverrun.2, timer_settime.2, umount.2, userfaultfd.2, utimensat.2, wait4.2, INFINITY.3, __ppc_get_timebase.3, __setfpucw.3, abort.3, aio_cancel.3, aio_error.3, aio_read.3, aio_return.3, atexit.3, backtrace.3, basename.3, bsearch.3, bswap.3, cacos.3, cacosh.3, catan.3, catanh.3, cexp2.3, clock_getcpuclockid.3, clog2.3, cmsg.3, confstr.3, div.3, dl_iterate_phdr.3, dlerror.3, dlinfo.3, dlopen.3, dlsym.3, duplocale.3, encrypt.3, end.3, endian.3, envz_add.3, err.3, expm1.3, fdim.3, flockfile.3, fmtmsg.3, frexp.3, ftw.3, get_nprocs_conf.3, get_phys_pages.3, getaddrinfo_a.3, getauxval.3, getdate.3, getdtablesize.3, getgrent_r.3, getgrouplist.3, gethostbyname.3, getline.3, getnameinfo.3, getopt.3, getprotoent_r.3, getpwent_r.3, getpwnam.3, getservent_r.3, getsubopt.3, getutent.3, glob.3, gnu_get_libc_version.3, hsearch.3, if_nameindex.3, inet.3, inet_net_pton.3, inet_ntop.3, inet_pton.3, insque.3, killpg.3, makecontext.3, mallinfo.3, malloc.3, malloc_hook.3, malloc_info.3, mallopt.3, matherr.3, mbsnrtowcs.3, mbstowcs.3, mcheck.3, mempcpy.3, mq_getattr.3, mq_notify.3, mtrace.3, newlocale.3, nextafter.3, ntp_gettime.3, offsetof.3, open_memstream.3, pow.3, printf.3, pthread_attr_init.3, pthread_attr_setdetachstate.3, pthread_attr_setguardsize.3, pthread_attr_setinheritsched.3, pthread_attr_setschedparam.3, pthread_attr_setschedpolicy.3, pthread_attr_setstack.3, pthread_attr_setstacksize.3, pthread_cancel.3, pthread_cleanup_push.3, pthread_create.3, pthread_detach.3, pthread_getattr_default_np.3, pthread_getattr_np.3, pthread_getcpuclockid.3, pthread_join.3, pthread_mutex_consistent.3, pthread_mutexattr_setrobust.3, pthread_setaffinity_np.3, pthread_setcancelstate.3, pthread_setname_np.3, pthread_setschedparam.3, pthread_sigmask.3, pthread_spin_init.3, pthread_testcancel.3, pthread_tryjoin_np.3, ptsname.3, qsort.3, rand.3, random.3, remainder.3, rpmatch.3, rtime.3, rtnetlink.3, scalb.3, scalbln.3, scandir.3, sem_getvalue.3, sem_wait.3, setaliasent.3, setlogmask.3, sigwait.3, sincos.3, sockatmark.3, stdarg.3, stpcpy.3, strcat.3, strfmon.3, strptime.3, strtod.3, strtok.3, strtol.3, strtoul.3, strverscmp.3, tsearch.3, uselocale.3, wcstok.3, wcstombs.3, wordexp.3, y0.3, loop.4, vcs.4, veth.4, charmap.5, core.5, filesystems.5, gai.conf.5, hosts.5, hosts.equiv.5, locale.5, nss.5, repertoiremap.5, securetty.5, shells.5, ttytype.5, ascii.7, complex.7, cpuset.7, credentials.7, fanotify.7, hier.7, inotify.7, ip.7, mount_namespaces.7, mq_overview.7, netlink.7, network_namespaces.7, pid_namespaces.7, pkeys.7, rtld-audit.7, rtnetlink.7, sem_overview.7, signal-safety.7, sock_diag.7, spufs.7, standards.7, symlink.7, tcp.7, time_namespaces.7, unix.7, user_namespaces.7, xattr.7, ldconfig.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 14:48:40 +02:00
Michael Kerrisk fd85c2387b openat2.2, proc.5, bpf-helpers.7: srcfix: strip trailing whitespace
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 14:48:40 +02:00
Michael Kerrisk 8e454c19e2 Changes: Ready for 5.07
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 14:42:10 +02:00
Michael Kerrisk 7289930f20 prctl.2: Fixes to Dave Martin's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 13:33:23 +02:00
Dave Martin 8165500d4c prctl.2: Add PR_PAC_RESET_KEYS (arm64)
Add documentation for the PR_PAC_RESET_KEYS ioctl added in Linux
5.0 for arm64.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Amit Daniel Kachhap <amit.kachhap@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 13:30:57 +02:00
Michael Kerrisk c3a523e07d prctl.2: Add reference to proc(5) for /proc/self/task/[tid]/comm
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 12:39:17 +02:00
Michael Kerrisk b65e24c34a proc.5: Add a detail to /proc/[pid]/comm
Note the connection to the "%e" specifier in
/proc/sys/kernel/core_pattern.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 12:39:17 +02:00
Michael Kerrisk b463b03fd5 proc.5: TASK_COMM_LEN limit includes the terminating '\0'
Clarify this detail in the discussion of /proc/[pid]/comm.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 12:39:17 +02:00
Michael Kerrisk 6a7093c3f3 core.5: minor tweaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 12:39:17 +02:00
Michael Kerrisk 8d85a961ac core.5: Explain that core_pattern %e is process/thread 'comm' value
The 'comm' value is typically the same as the (possibly
truncated) executable name, but may be something different.

Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 12:08:39 +02:00
Michael Kerrisk 492a8b724f connect.2: Minor tweaks to Stefan Puiu's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 10:17:34 +02:00
Stefan Puiu 375c65a9c2 connect.2: Can return EACCES because of SELinux
Recently I had to troubleshoot a problem where a connect() call
was returning EACCES:

17648 socket(AF_INET, SOCK_STREAM, IPPROTO_IP) = 37
17648 connect(37, {sa_family=AF_INET, sin_port=htons(8081),
sin_addr=inet_addr("10.12.1.201")}, 16) = -1 EACCES (Permission
denied)

I've traced this to SELinux policy denying the connection. This is
on a Fedora 23 VM:

$ cat /etc/redhat-release
Fedora release 23 (Twenty Three)
$ uname -a
Linux mako-fedora-01 4.8.13-100.fc23.x86_64 #1 SMP Fri Dec 9 14:51:40
UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

The manpage says this can happen when connecting to a broadcast
address, or when a local firewall rule blocks the connection.
However, the address above is unicast, and using 'wget' from
another account to access the URL works fine.

The context is that we're building an OS image, and this involves
downloading RPMs through a proxy. The proxy (polipo) is labelled
by SELinux, and I guess there is some sort of policy that says
"proxy can only connect to HTTP ports". When trying to connect to
a server listening on a port that is not labeled as an HTTP server
port, I guess SELinux steps in. With 'setenforce 0', the build
works fine. In the kernel sources I see connect() calls
security_socket_connect() (see
https://elixir.bootlin.com/linux/latest/source/net/socket.c#L1855),
which calls whatever security hooks are registered. I see the
SELinux hook getting registered at
https://elixir.bootlin.com/linux/latest/source/security/selinux/hooks.c#L7047,
and setting a perf probe on the call proves that the
selinux_socket_connect function gets called (while
tcp_v4_connect() is not).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 10:09:55 +02:00
Michael Kerrisk 94e316bfea user_namespaces.7: Clarify "system time"
From an email conversation with Léo Stefanesco:

> In the man7.org version of the man page for user_namespaces(7), it reads:
>
>    there are many privileged operations that affect
>    resources that are not associated with any namespace type,
>    for example, changing the system time
>    (governed by CAP_SYS_TIME)
>
> which is not consistent with time_namespaces(7).

In fact, strictly peaking the text still is correct, even after
the arrival of time namespaces.

Time namespaces virtualize only the boot-time and monotonic
clocks, not the "real time" (i.e., calendar time), which is the
time referred in the passage you quote.

That said, the text is perhaps now a little misleading, and
a little clarification would help. I changed the text to:

    there are many privileged operations that affect
    resources are not associated with any namespace type,
    for example, changing the system **(i.e., calendar)** time
    (governed by CAP_SYS_TIME)

Reported-by: Léo Stefanesco <leo.lveb@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 10:03:04 +02:00
Michael Kerrisk 7dc03d8607 bpf-helpers.7: Resync against kernel 5.7
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 09:47:48 +02:00
Michael Kerrisk 599e0cef94 ioctl.2: Remove mentions of ioctl_list(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 09:40:08 +02:00
Michael Kerrisk 3de87d4684 ioctl_list.2: Remove this page
This page was first added more than 20 years ago. Since
that time it has seen hardly any update, and is by now
very much out of date, as reported by Heinrich Schuchardt
and confirmed by Eugene Syromyatnikov.

As Heinrich says:

    Man-pages like netdevices.7 or ioctl_fat.2 are what is
    needed to help a user who does not want to read through the
    kernel code.

    If ioctl_list.2 has not been reasonably maintained since
    Linux 1.3.27 and hence is not a reliable source of
    information, shouldn't it be dropped?

My answer is, yes (but let's move a little info into ioctl(2)).

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 09:40:08 +02:00
Michael Kerrisk 91b00e53b3 ioctl.2: Move subsection on "ioctl structure" from ioctl_list(2) to ioctl(2)
In preparation for removing ioctl_list(2), let's preserve
some useful text that was added to ioctl_list(2)
by Andries Brouwer.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-09 09:40:08 +02:00
Michael Kerrisk 02e701cde3 syscall.2: Minor wording tweaks
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-08 23:09:36 +02:00
Michael Kerrisk c5f7febc4f random.3: wfix: no need to mention INT32_MAX
Reported-by: walter harms <wharms@bfs.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-08 23:09:36 +02:00
John Marshall 2de361c8e9 random.3: Change "RAND_MAX" tp "2^31-1"
RAND_MAX is for rand(3).  POSIX fixes random()'s range at 2^31-1;
RAND_MAX may be smaller on some platforms (even though with glibc
or musl on Linux they are the same).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-08 23:09:36 +02:00
Amir Goldstein e9898cc8ba fanotify.7, fanotify_mark.2: Clarify FAN_ONDIR in output mask
FAN_ONDIR was an input only flag before introducing
FAN_REPORT_FID.  Since the introduction of FAN_REPORT_FID, it can
also be in output mask.

Move the text describing its role in the output mask to fanotify.7
where the other output mask bits are documented.

[mtk: commit message tidy-up]

Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-08 23:07:59 +02:00
Amir Goldstein e5a800c135 fanotify_init.2: Move out of place entry FAN_REPORT_FID
It was inserted in the middle of the FAN_CLASS_ multi flags bit
and broke the multi flag documentation.

Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-08 22:16:40 +02:00
Amir Goldstein c3a3f611f6 fanotify.7, fanotify_mark.2: Revert "fanotify.7, fanotify_mark.2: Document FAN_DIR_MODIFY"
This reverts commit a93e5c9593.

FAN_DIR_MODIFY was disabled for v5.7 release by kernel commit
f17936993af0 ("fanotify: turn off support for FAN_DIR_MODIFY").

Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-08 22:16:34 +02:00
Michael Kerrisk 2f0e61aec2 core.5: Note that not dumping core of an unreadable binary is a security measure
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-08 18:16:53 +02:00
Michael Kerrisk b665474b29 core.5: wfix
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-08 18:06:10 +02:00
Jakub Wilk 4ad5b7a575 proc.5: ffix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-08 17:41:12 +02:00
Michael Kerrisk 7ced1a6529 err.3: EXAMPLES: use EXIT_FAILURE rather than 1 as exit status
By way of good example, use the an EXIT_* symbolic constant,
rather than a hard-coded number.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-06-03 22:52:36 +02:00
Michael Kerrisk bd1686486f clock_getres.2, fsync.2, mlock.2, mmap.2, msync.2, INFINITY.3, cexp2.3, clog2.3, flockfile.3: Remove AVAILABILITY section heading
In the few pages where this heading (which is "nonstandard" within
man-pages) is used, it always immediately follows CONFORMING TO
and generally contains information related to standards. Remove
the section heading, thus incorporating AVAILABILITY into
CONFORMING TO.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-31 10:45:27 +02:00
Michael Kerrisk 005383e69e man-pages.7: Rename EXAMPLE to EXAMPLES
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-31 10:45:27 +02:00
Michael Kerrisk a14af333d6 Various pages: retitle EXAMPLE section heading to EXAMPLES
EXAMPLES appears to be the wider majority usage across various
projects' manual pages, and is also what is used in the POSIX
manual pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-31 10:45:27 +02:00
Michael Kerrisk c91a4f144c man-pages.7: Add REPORTING BUGS section
man-pages doesn't have a REPORTING BUGS section in manual pages,
but many other projects do. Make some recommendations about
placement of that section.
2020-05-31 10:45:27 +02:00
Michael Kerrisk fa1e323100 man-pages.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-31 10:45:27 +02:00
Michael Kerrisk 88c9c16a68 man-pages.7: Describe COPYRIGHT section
man-pages doesn't use COPYRIGHT sections in manual pages, but
various projects do. Make some recommendations about placement
of the section.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-31 10:45:27 +02:00
Michael Kerrisk cd2621174c man-pages.7: Mention AUTHORS in summary section list
Although man-pages doesn't use AUTHORS sections, many projects do
use an AUTHORS section in their manual pages, so mention it in
man-pages to suggest some guidance on the position at which
to place that section.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-31 10:45:27 +02:00
Michael Kerrisk 24581849d9 core.5: tfix
Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-28 11:37:38 +02:00
Michael Kerrisk 8626fdd2de core.5: Mention 'sysctl -w' as a way of changing core_pattern setting
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-28 11:37:32 +02:00
Michael Kerrisk 94c50673e6 core.5: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-28 09:52:09 +02:00
Dave Martin 4f65a89721 prctl.2: ffix: use literal hyphens when referencing kernel docs
There is one case of a cross-reference to a kernel documentation
filename that uses unescaped hyphens.

To avoid misrendering, escape these as \- similarly to other
instances.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-28 08:17:50 +02:00
Michael Kerrisk db4d540044 prctl.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-28 08:17:50 +02:00
Dave Martin 734439ca9e prctl.2: Add PR_SPEC_DISABLE_NOEXEC for SPECULATION_CTRL prctls
Add the PR_SPEC_DISABLE_NOEXEC mode added in Linux 5.1
for the PR_SPEC_STORE_BYPASS "misfeature" of
PR_SET_SPECULATION_CTRL and PR_GET_SPECULATION_CTRL.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Waiman Long <longman@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-28 08:17:50 +02:00
Michael Kerrisk 68b4922bf5 prctl.2: Minor tweaks to "prctl.2: Add PR_SPEC_INDIRECT_BRANCH for SPECULATION_CTRL prctls" patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-28 08:17:50 +02:00
Dave Martin 277d7d6d04 prctl.2: Add PR_SPEC_INDIRECT_BRANCH for SPECULATION_CTRL prctls
Add the PR_SPEC_INDIRECT_BRANCH "misfeature" added in Linux 4.20
for PR_SET_SPECULATION_CTRL and PR_GET_SPECULATION_CTRL.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Tim Chen <tim.c.chen@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-28 08:17:50 +02:00
Michael Kerrisk 7ef5957484 core.5: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-27 15:26:45 +02:00
Michael Kerrisk 259ce44eeb ctime.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 13:25:54 +02:00
Michael Kerrisk 5dbd04b5f9 pipe.2, socketpair.2, dlopen.3, posix_memalign.3, signal-safety.7: Correct bogus POSIX.1 standards names
POSIX.1-2003 ==> POSIX.1-2001 TC1
POSIX.1-2004 ==> POSIX.1-2001 TC2
POSIX.1-2013 ==> POSIX.1-2008 TC1
POSIX.1-2016 ==> POSIX.1-2008 TC2

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 13:25:54 +02:00
Michael Kerrisk b710e16161 close.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 13:25:54 +02:00
Michael Kerrisk e50b1125e1 tzset.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 13:25:54 +02:00
Michael Kerrisk fcf486714c getnameinfo.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 13:25:54 +02:00
Michael Kerrisk 3e4c47dde2 dlopen.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 13:25:54 +02:00
Michael Kerrisk d645b01b31 posix_fadvise.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 13:25:54 +02:00
Michael Kerrisk e1403777e7 y0.3: errno is now correctly set to ERANGE on underflow
The fix was in glibc 2.17. See
https://www.sourceware.org/bugzilla/show_bug.cgi?id=6808

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 13:25:54 +02:00
Michael Kerrisk 14b81bcfdf y0.3: srcfix: remove an ancient FIXME that no longer matters much
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 13:25:54 +02:00
Michael Kerrisk 696b65a571 y0.3: These functions now correctly diagnose a pole error
The fix was in glibc 2.19. See
https://sourceware.org/bugzilla/show_bug.cgi?id=6807

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 13:25:54 +02:00
Michael Kerrisk c2e0ff42a4 y0.3: srcfix: Note on "Range error: result underflow" and FE_UNDERFLOW
The fact that an FE_UNDERFLOW exception is not raised for
"Range error: result underflow" is intended behavior.
See https://www.sourceware.org/bugzilla/show_bug.cgi?id=6806.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 12:10:55 +02:00
Michael Kerrisk 84828d04a6 j0.3: srcfix: add notes that failing to raise FE_UNDERFLOW is intended behavior
See https://www.sourceware.org/bugzilla/show_bug.cgi?id=6805

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 11:26:00 +02:00
Michael Kerrisk 5b08d967e8 scalbln.3: These functions now correctly set errno for the ERANGE case
Modify DESCRIPTION appropriately and add BUGS section.
The fix was in glibc 2.20.

See https://www.sourceware.org/bugzilla/show_bug.cgi?id=6803

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 11:19:03 +02:00
Michael Kerrisk 121c4dfd41 hypot.3: srcfix: add some notes about the underflow case
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 10:56:28 +02:00
Michael Kerrisk 053d061aef sincos.3: The glibc implementation does now give EDOM for a domain error
The fix was in glibc 2.22
(commit d435569cd626bccb9c27361202a279d0fd7fce88).

See https://www.sourceware.org/bugzilla/show_bug.cgi?id=15467

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 10:44:57 +02:00
Michael Kerrisk 442456d931 rename.2: SEE ALSO: add rename(1)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 10:29:11 +02:00
Michael Kerrisk e9832dc0da mount_namespaces.7: SEE ALSO: add mount(8), umount(8)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 10:29:11 +02:00
Michael Kerrisk b2401bcbd3 proc.5: Remove "mp" under VmFlags in /proc/[pid]/smaps
Reported-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-26 10:29:06 +02:00
Tobias Stoeckmann 7577e4074b printf.3: Prevent signed integer overflow in example
The function make_message illustrates how to use vsnprintf to
determine the required amount of memory for a specific format and
its arguments.

If make_message is called with a format which will use exactly
INT_MAX characters (excluding '\0'), then the size++ calculation
will overflow the signed integer "size", which is an undefined
behaviour in C.

Since malloc and vsnprintf rightfully take a size_t argument, I
decided to use a size_t variable for size calculation. Therefore,
this patched code uses variables of the same data types as
expected by function arguments.

Proof of concept (tested on Linux/glibc amd64):

int main() { make_message("%647s%2147483000s", "", ""); }

If the code is compiled with address sanitizer (gcc
-fsanitize=address) you can see the following line, assuming that
a signed integer overflow simply leads to INT_MIN:

==3094==WARNING: AddressSanitizer failed to allocate 0xffffffff80000000 bytes

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:59:42 +02:00
Michael Kerrisk 9a76645224 proc.5: Add "sf" to VmFlags in /proc/[pid]/smaps
Added in kernel commit b6fb293f2497a9841d94f6b57bd2bb2cd222da43
Text from comment in include/uapi/asm-generic/mman.h.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk bc60704e1a proc.5: Add "um" and "uw" to VmFlags in /proc/[pid]/smaps
Added in kernel commit 16ba6f811dfe44bc14f7946a4b257b85476fc16e.
Text taken from comments in include/linux/mm.h.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk d85aebeaa1 proc.5: Add "mp" to VmFlags in /proc/[pid]/smaps
Added in kernel commit 4aae7e436fa51faf4bf5d11b175aea82cfe8224a.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 8485aade48 proc.5: Note kernel version for /proc/PID/smaps VmFlags "dd" flag
Kernel commit ec8e41aec13005fed0dbee002fb8c99b4e001d50

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk efd54c4adf proc.5: Note kernel version that removed /proc/PID/smaps VmFlags "nl" flag
Kernel commit 1da4b35b001481df99a6dcab12d5d39a876f7056

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 016dedb300 proc.5: Note kernel version for /proc/PID/smaps VmFlags "wf" flag
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Ian Rogers 74603f4ecd proc.5: Add "wf" to VmFlags in /proc/[pid]/smaps
This patch documents a flag added in the following kernel commit:

commit d2cd9ede6e193dd7d88b6d27399e96229a551b19
Author: Rik van Riel <riel@redhat.com>
Date:   Wed Sep 6 16:25:15 2017 -0700

    mm,fork: introduce MADV_WIPEONFORK

This was already documented in man2/madvise.2 in the commit:

commit c0c4f6c29c
Author: Rik van Riel <riel@redhat.com>
Date:   Tue Sep 19 20:32:00 2017 +0200

    madvise.2: Document MADV_WIPEONFORK and MADV_KEEPONFORK

Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Jakub Wilk 6a67ed89fc prctl.2: tfix
Remove duplicated word.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 7996b4e48c gettid.2: Document header file and feature test macro requirements for gettid()
The gettid() wrapper was added glibc 2.30, and is declared by
<unistd.h> if _GNU_SOURCE is defined.

Reported-by: Joseph C. Sible <josephcsible@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk a1d64896ae scanf.3: Clarify that 'x' specifier allows a 0x/0X prefix in input string
Reported-by: Jürgen Sauermann <mail@juergen-sauermann.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 09ba59d40c pow.3: Minor tweak to BUGS
Remove the text ("rare)" after a note from Vincent Lefèvre:

Subject: [Bug math/13932] dbl-64 pow unexpectedly slow for some inputs
Date: Sat, 23 May 2020 21:31:52 +0000
From: vincent-srcware at vinc17 dot net <sourceware-bugzilla@sourceware.org>
To: mtk.manpages@gmail.com

https://sourceware.org/bugzilla/show_bug.cgi?id=13932

--- Comment #26 from Vincent Lefèvre <vincent-srcware at vinc17 dot net> ---
(In reply to Michael Kerrisk from comment #25)
> Fix documented for man-pages-5.07.
[...]
> -On 64-bits,
> +Before glibc 2.28,
>  .\"
>  .\" https://sourceware.org/bugzilla/show_bug.cgi?id=13932
> +on some architectures (e.g., x86-64)
>  .BR pow ()
>  may be more than 10,000 times slower for some (rare) inputs
>  than for other nearby inputs.
[...]

The problematic values are uncommon, but not so rare, in the sense
that they are close to simple values, i.e. are likely to occur in
practice. An example given above: pow(0.999999999999999889, 1.5)

1 and 1.5 are very simple values, which are more likely to occur
in practice than some fixed random value. Then it suffices to have
a small rounding error on 1...

For instance, this is very different from hard-to-round cases of
exp, which are also very slow IMHO, but unless one writes a
specific program for them, no-one should notice the slowness
because such a case would typically occur only once among billions
(I don't remember the accuracy before the slowest path in this
library).

Reported-by: Vincent Lefèvre <vincent-srcware@vinc17.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 247a2afa55 pow.3: srcfix: remove an ancient FIXME that is pretty irrelevant these days
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk e088313b3d pow.3: Add a subheading to mark off historical bugs that are now fixed
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 831db5db46 pow.3: Several bugs in glibc's pow() implementation were fixed in glibc 2.16
See https://www.sourceware.org/bugzilla/show_bug.cgi?id=3866.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 427e4505b0 pow.3: BUGS: pow() performance problem for some (rare) inputs has been fixed
See https://sourceware.org/bugzilla/show_bug.cgi?id=13932
Fixed in glibc 2.28.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk e9e9f2424c hypot.3: srcfix: Clear an obsolete FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk e25000b9aa erf.3, erfc.3: srcfix: Clear an obsolete FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 2aadb86241 scalb.3: These functions now correctly set errno for the EDOM and ERANGE cases
Modify DESCRIPTION appropriately and add BUGS section.
The fix was in glibc 2.20.

See https://www.sourceware.org/bugzilla/show_bug.cgi?id=6803
and https://www.sourceware.org/bugzilla/show_bug.cgi?id=6804

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 839c0fe92a nextafter.3: Since glibc 2.23, these functions do set errno
Modify DESCRIPTION appropriately and add BUGS section.

See https://www.sourceware.org/bugzilla/show_bug.cgi?id=6799.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 4cc51f5e5a fdim.3: BUGS: these functions did not set errno on some architectures
The bug was fixed in glibc 2.24.
https://www.sourceware.org/bugzilla/show_bug.cgi?id=6796

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 62d6b18353 expm1.3: The bogus invalid floating-point exception bug has been fixed
Sometime around 2009 (approximately 2.11) according to
https://www.sourceware.org/bugzilla/show_bug.cgi?id=6814.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk 3887f72666 expm1.3: The expm1() bogus underflow floating-point exception has been fixed
Fixed in glibc 2.17.

See https://www.sourceware.org/bugzilla/show_bug.cgi?id=6778

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-25 15:46:44 +02:00
Michael Kerrisk c82d80af7b mount_namespaces.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 21:56:19 +02:00
Florian Weimer 4e977eff3e ldconfig.8: Mention new default for --format in glibc 2.32
This reflects glibc commit cad64f778aced84efdaa04ae64f8737b86f063ab
("ldconfig: Default to the new format for ld.so.cache").

Signed-off-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 15:20:27 +02:00
Michael Kerrisk a83addc775 stdarg.3: SEE ALSO: add vprintf(3), vscanf(3), vsyslog(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 15:20:27 +02:00
Michael Kerrisk b0d3e315cc sysfs.2: SEE ALSO: add proc(5) and sysfs(5)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 15:20:27 +02:00
Michael Kerrisk 817d604ac5 nfsservctl.2: SEE ALSO: add nfsd(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 15:20:27 +02:00
Michael Kerrisk d6df7eae48 cexp2.3: Still not present in glibc 2.31
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 15:20:27 +02:00
Michael Kerrisk 07161ed5f2 sysfs.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 15:20:27 +02:00
Michael Kerrisk f2637a5625 standards.7: Remove mention of bogus "POSIX" names
The terms POSIX.1-{2003,2004,2013,2016} were inventions of
my imagination, as confirmed by consulting Geoff Clare of
The Open Group. Remove these names.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 11:09:17 +02:00
Michael Kerrisk f69f82d84c standards.7: Add some more standards
Add: SUSv4 2016 edition, POSIX.1-2017, and SUSv4 2018 edition

Reported-by: Geoff Clare <gwc@opengroup.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-21 11:09:17 +02:00
Alexander Monakov 88da10c16c dlsym.3: Extend discussion of NULL symbol values
Avoid implying that use of IFUNC is the only way to produce a
symbol with NULL value. Give more scenarios how a symbol may get
NULL value, but explain that in those scenarios dlsym() will fail
with Glibc's ld.so due to an implementation inconsistency.

Signed-off-by: Alexander Monakov <amonakov@ispras.ru>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 22:19:39 +02:00
Devin J. Pohly 1b0b13fe97 veth.4: Add a more direct example
iproute2 allows you to specify the netns for either side of a veth
interface at creation time.  Add an example of this to veth(4) so
it doesn't sound like you have to move the interfaces in a
separate step.

Verified with commands:
    # ip netns add alpha
    # ip netns add bravo
    # ip link add foo netns alpha type veth peer bar netns bravo
    # ip -n alpha link show
    # ip -n bravo link show

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 21:53:28 +02:00
Thomas Piekarski 3514b9beba hier.7: Updating from FHS 2.3 to 3.0
Adding description of new directories (/run, /usr/libexec,
/usr/share/color,/usr/share/ppd, /var/lib/color), stating
/usr/X11R6 as removed and updating URL to and version of FHS.

See https://bugzilla.kernel.org/show_bug.cgi?id=206693

Reported-by: Gary Perkins <glperkins@lit.edu>
Signed-off-by: Thomas Piekarski <t.piekarski@deloquencia.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 21:48:04 +02:00
Michael Kerrisk 4fe3acd9e1 clone.2: Note a performance benefit of CLONE_INTO_CGROUP
As noted in email by Christian Brauner:

    I forgot to mention that spawning directly into a target
    cgroup is also more efficient than moving it after creation.
    The specific reason is mentioned in the commit message
    [ef2c41cf38a], the write lock of the semaphore need not be
    taken in contrast to when it is moved afterwards. That
    implementation details is not that interesting but it might
    be interesting to know that it provides performance benefits
    in general.

Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 21:41:08 +02:00
Michael Kerrisk c0e4ab6356 cgroups.7: Note the existence of the clone3() CLONE_INTO_CGROUP flag
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 21:32:10 +02:00
Michael Kerrisk b3041511b8 clone.2: Restructure text on CLONE_INTO_CGROUP use cases
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 21:24:55 +02:00
Michael Kerrisk 17d860301a clone.2: wfix
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 21:16:53 +02:00
Michael Kerrisk 673d16daad clone.2: Combine separate NOTES sections
Somewhere along the way, this page ended up with two NOTES
sections. Combine them.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 15:45:11 +02:00
Michael Kerrisk edc1b9fcd2 clone.2: Place CLONE_INTO_CGROUP text in correct alphabetical position
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 15:45:11 +02:00
Michael Kerrisk 6ba79da96e clone.2: ERRORS: add error cases for CLONE_INTO_CGROUP
These errors verified by experiment.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 15:45:11 +02:00
Michael Kerrisk ed7c137731 clone.2: Substantial reworking of Christian Brauner's CLONE_INTO_CGROUP text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 15:45:11 +02:00
Michael Kerrisk f7d5e0822a clone.2: Add kernel version numbers for clone_args fields
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 15:45:11 +02:00
Michael Kerrisk 5c216c0f7f clone.2: Some rewording of Christian Brauner's CLONE_INTO_CGROUP patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 15:45:11 +02:00
Michael Kerrisk b19679f754 clone.2: srcfix: semantic newlines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 15:45:11 +02:00
Christian Brauner aed3cc90e0 clone.2: Document the clone3() CLONE_INTO_CGROUP flag
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 15:45:09 +02:00
Michael Kerrisk 81b8997f5f pipe.2, sigaltstack.2, abort.3, signal.7: Place SH sections in standard order
Fix various pages that deviated from the norm described in
man-pages(7).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 15:45:01 +02:00
Michael Kerrisk 03cdc3e79b des_crypt.3: Minor wording fix in VERSIONS
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 09:39:01 +02:00
Michael Kerrisk 33e0202939 malloc.3: Add VERSIONS section noting when reallocarray() was added to glibc
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 08:05:52 +02:00
Michael Kerrisk 1cff573d31 malloc.3: Add 'reallocarray' in NAME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 08:05:52 +02:00
Michael Kerrisk e3a78ee965 adjtimex.2, prctl.2, semget.2, signalfd.2, umount.2, syscall.2, dlopen.3, getgrent_r.3, killpg.3: Add section number in page cross-reference (adjtime(3))
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 08:04:55 +02:00
Michael Kerrisk 9bfa575a6b sched_setattr.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 08:04:55 +02:00
Michael Kerrisk 3bf4529ec7 adjtimex.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 07:40:56 +02:00
Michael Kerrisk 74132c7775 adjtimex.2: Add 'clock_adjtime' to NAME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 07:37:13 +02:00
Michael Kerrisk a36d5a3593 close.2, poll.2, pthread_spin_init.3: Remove section number in page self-references
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 07:34:38 +02:00
Michael Kerrisk 0345fbd451 utimensat.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 07:27:03 +02:00
Michael Kerrisk c8fb1c6d4a gettid.2, open.2, seccomp.2, pthread_mutex_consistent.3, signal.7, xattr.7: Put SEE ALSO entries in alphabetical order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-19 07:23:34 +02:00
Kir Kolyshkin bba4bbbd9a Various pages: Add missing commas in SEE ALSO part II
This is a sequel to commit baf17bc4f2, addressing the
issues with missing commas in the middle of SEE ALSO lists that
emerged since.

The awk script from the original commit was not working and had to
be slightly modified (s/["]SEE ALSO["]/"?SEE ALSO/), otherwise it
works like a charm. Here's the fixed script and its output just
before this commit:

for f in man*/*; do
awk '
    /^.SH "?SEE ALSO/ {
	sa=1; print "== " FILENAME " =="; print; next
    }
    /^\.(PP|SH)/ {
	sa=0; no=0; next
    }
    /^\.BR/ {
	if (sa==1) {
	    print;
	    if (no == 1)
		print "Missing comma in " FILENAME " +" FNR-1; no=0
	}
    }
    /^\.BR .*)$/ {
	if (sa==1)
	    no=1;
	next
    }
    /\.\\"/ {next}
    /.*/ {
	if (sa==1) {
	    print; next
	}
    }
' $f; done | grep Missing
Missing comma in man1/memusage.1 +272
Missing comma in man2/adjtimex.2 +597
Missing comma in man2/adjtimex.2 +598
Missing comma in man2/mkdir.2 +252
Missing comma in man2/sigaction.2 +1045
Missing comma in man2/sigaction.2 +1047
Missing comma in man3/mbsnrtowcs.3 +198
Missing comma in man3/ntp_gettime.3 +142
Missing comma in man3/strcmp.3 +219
Missing comma in man3/strtol.3 +302
Missing comma in man3/wcstombs.3 +120
Missing comma in man7/user_namespaces.7 +1378
Missing comma in man7/xattr.7 +198

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-18 21:37:48 +02:00
Michael Kerrisk aa02339ca4 filesystems.5: SEE ALSO: add sysfs(5) and xfs(5)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-15 11:50:47 +02:00
Ondrej Slamecka 448d14e716 ip.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-15 11:49:54 +02:00
Michael Kerrisk 11b0b31a14 prctl.2: ffix
Reported-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 13:44:06 +02:00
Michael Kerrisk cd41e08cbf prctl.2: Soften Dave Martin's warning about the use of prctl()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 13:37:45 +02:00
Dave Martin f7abc99cf9 prctl.2: Clarify the unsupported hardware case of EINVAL
prctls that are architecture-specific won't work on other
architectures, and arch-specific prctls that manipulate optional
hardware features likewise won't work if that hardware feature is
not present.

The established pattern seems to be to treat such prctls as if they
are unimplemented, when attempted on the wrong hardware.

Cover these cases with some generic weasel words in the closet
existing EINVAL clause.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:49:36 +02:00
Michael Kerrisk 49a88f5dec prctl.2: ffix to "Work around bogus constant "maxsig" in PR_SET_PDEATHSIG" patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:44:23 +02:00
Michael Kerrisk 230dd8d060 prctl.2: wfix to "prctl.2: Document removal of Intel MPX prctls" patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:41:31 +02:00
Michael Kerrisk 0841915dee prctl.2: tfix to "prctl.2: Add health warning" patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:37:58 +02:00
Dave Martin e6935958b7 prctl.2: tfix: minor punctuation in SPECULATION_CTRL prctls
Fix a few very minor bits of punctuation in
PR_SET_SPECULATION_CTRL and PR_GET_SPECULATION_CTRL.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:34:28 +02:00
Dave Martin bfc592db67 prctl.2: Work around bogus constant "maxsig" in PR_SET_PDEATHSIG
The description of PR_SET_PDEATHSIG refers to "maxsig", which
is apparently intended to stand for the maximum defined signal
number.

maxsig seems not to be a thing, even in the kernel.

Reword to use the standard constant NSIG.  (Discussion of SIGRTMIN
and SIGRTMAX seems out of scope here, and anyway is not relevant
to the kernel.)

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:34:13 +02:00
Dave Martin 2ab5fe267f prctl.2: Document removal of Intel MPX prctls
The Intel MPX API was removed from Linux 5.4.  See Linux
commit f240652b6032 ("x86/mpx: Remove MPX APIs")

Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:34:02 +02:00
Dave Martin 194ccff9cc prctl.2: Sort prctls into alphabetical order
The prctl list has historically been sorted by prctl name (ignoring
any SET_ or GET_ prefix) to make individual prctls easier to find.
Some noise seems to have crept in since.

Sort the list back into order.  Similarly, reorder the list of
prctls specified to return non-zero values on success.

Content movement only.  No semantic change.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:33:53 +02:00
Dave Martin 667eb3ac39 prctl.2: srcfix: add comments for navigation
The prctl.2 source is unnecessarily hard to navigate, not least
because prctl option flags are traditionally named PR_* and so look
just like prctl names.

For each actual prctl, add a comment of the form

	.\" prctl PR_FOO

to make it move obvious where each top-level prctl starts.

Of course, we could add some clever macros, but let's not confuse
dumb parsers.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:33:45 +02:00
Dave Martin ec5cb536b1 prctl.2: Add health warning
In reality, almost every prctl interferes with assumptions that the
compiler and C library / runtime rely on.  prctl() can therefore
make userspace explode in a variety ways that are likely to be hard
to debug.

This is not obvious to the uninitiated, so add a warning.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:32:50 +02:00
Dave Martin 5aaf1385fb prctl.2: Fix mis-description of thread ID values in procfs
Under PR_SET_NAME, the [tid] value seen in procfs as
/proc/self/task/[tid] is mistakenly described as the name of the
thread, whereas really the name is on /proc/self/task/[tid]/comm.

Fix it.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:32:40 +02:00
Dave Martin 1e0d99b899 prctl.2: Clarify that prctl can apply to threads
The current synopsis for prctl(2) misleadingly claims that prctl
operates on a process.  Rather, some (in fact, most) prctls operate
on a thread.

The wording probably dates back to the old days when Linux didn't
really have threads at all.

Reword as appropriate.

Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-13 12:32:32 +02:00
Michael Kerrisk 3f1dc8e16a stat.2: Minor reworking of text describing AT_NO_AUTOMOUNT
No content changes. Just put things in a slightly more logical
order and add a few paragraph breaks for readability.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-12 11:35:35 +02:00
Michael Kerrisk 7200e79646 symlink.7: Describe differences in the treatment of symlinks in the dirname
Describe differences in the treatment of symlinks in the dirname
part of pathname.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-12 09:47:18 +02:00
Michael Kerrisk 4146f81b7d open.2: Some '*at' APIs have functionality that isn't in conventional APIs
Note that another reason to use the *at() APIs is to access
'flags' functionality that is not available in the corresponding
conventional APIs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-12 09:43:01 +02:00
Michael Kerrisk 9660f3baaf symlink.7: wfix
The close proximity of an em-dash and a hyphen is a little
visually jarring.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-12 09:43:01 +02:00
Michael Kerrisk 4d989e3563 stat.2: wfix ("it" used with two different referents in same sentence)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-12 09:42:56 +02:00
Michael Kerrisk 96c44b8f50 open.2: Explain ways in which a 'directory file descriptor' can be obtained
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-12 08:45:06 +02:00
Michael Kerrisk aec13430b1 open.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-12 08:03:52 +02:00
Michael Kerrisk 5c30e7cd9d open.2: Add a few more APIs to list in "Rationale for openat()..."
There have been a few more dirfd APIs added in recent times.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-12 07:43:41 +02:00
Michael Kerrisk 7022462f1d dirfd.3: SEE ALSO: add openat(2)
By way of a hint that the file descriptor returned by dirfd()
could usefully be fed to the *at() APIs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-12 07:07:30 +02:00
Kir Kolyshkin 483368b3b1 setenv.3: wfix
Both functions behave the same wrt return value, no need to describe
them separately.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-11 20:17:05 +02:00
Michael Kerrisk 3f298932bd pid_namespaces.7: Note that /proc/sys/kernel/ns_last_pid is virtualized per PID NS
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-11 14:07:36 +02:00
Michael Kerrisk 439526d153 pid_namespaces.7: Correct capability requirements for write to /proc/sys/kernel/ns_last_pid
CAP_SYS_ADMIN is needed in the user NS that owns the PID NS.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-11 14:06:09 +02:00
Michael Kerrisk c2f15a1349 close.2: Note behavior when close() happens in a parallel thread
If one thread is blocked in an I/O system call on a file descriptor
that is closed in another thread, then the blocking system call
does not return immediately, but rather when the I/O operation
completes. This surprises some people, but is longstanding
behavior.

See https://bugzilla.kernel.org/show_bug.cgi?id=53781

and

https://lore.kernel.org/lkml/3B1E3D86.C7A7874@canal-plus.fr/
To: linux-kernel@vger.kernel.org
Subject: PROBLEM: I/O system call never returns if file desc is closed in the  meantime
Date: Wed, 06 Jun 2001 16:26:14 +0200

Examples where people are surprised by this behavior:
https://www.linuxquestions.org/questions/linux-networking-3/recv-is-not-coming-out-of-blocking-after-closing-the-socket-459461/
https://stackoverflow.com/questions/3589723/can-a-socket-be-closed-from-another-thread-when-a-send-recv-on-the-same-socket

Reported-by: Thierry Lelegard <thierry.lelegard@canal-plus.fr>
Reported-by: Lukas Czerner <lczerner@redhat.com>
Reported-by: Peter Schiffer <pschiffe@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-09 13:24:39 +02:00
Dave Martin 3862672084 syscall.2: arm64: Fix syscall number register size
arm64 is currently documented as receiving the syscall number in
x8.

While this is the correct register, the syscall number is a 32-bit
integer.  Bits [63:32] are ignored by the kernel.

So it is more correct to say "w8".

Acked-by: Will Deacon <will@kernel.org>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-06 12:14:18 +02:00
Dave Martin f13396bc2d syscall.2: arm: Use real register names for arm/OABI
The arm OABI syscall interface is currently documented in terms of
register name aliases defined by the ARM Procedure Call Standard
(APCS).  However, these don't make sense in the context of a
binary interface that doesn't comply (or need to comply) with
APCS.

Use the real architectural register names instead.

The names a1-a4, v1... are just aliases for r0-r3, r4... anyway,
so the interface is just the same regardless of which set of names
is used.

Acked-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-06 12:03:22 +02:00
Michael Kerrisk 2b38639ab9 loop.4: 'lo_flags' is nowadays "r/w"
Since kernel commit 96c5865559cee0f9cbc5173f3c949f6ce3525581,
the 'lo_flags' field is modifiable via the LOOP_SET_STATUS and
LOOP_SET_STATUS64 ioctl() operations.

See https://bugzilla.kernel.org/show_bug.cgi?id=203417

Reported-by: Vlad <cvazir@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-06 11:36:20 +02:00
Michael Kerrisk ff1cac76a3 loop.4: ffix
In preparation for next patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-06 11:36:20 +02:00
Michael Kerrisk 3bd3ade0aa copy_file_range.2: tfix
There are 2 typos:
file_in is used instead of fd_in in the ERRORS and NOTES sections.
file_out is used instead of fd_out in the ERRORS section.

Reported-by: Ricardo Castano <ricardo.castano.salinas@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-04 10:29:01 +02:00
Michael Kerrisk 25da04997e tcp.7: Update info on tcp_syn_retries default value
See https://bugzilla.kernel.org/show_bug.cgi?id=202885.

Reported-by: vrafaeli@msn.com
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-04 10:21:57 +02:00
Michael Kerrisk 0dd34252fd namespaces.7: srcfix: Quote Eric Biederman on significance of st_dev in ns comparisons
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-02 21:29:04 +02:00
Michael Kerrisk 113a073baf inotify.7: Add missing #include in example program
Reported-by: Jason Etherton <jason@ethertonltd.co.uk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-05-02 21:28:59 +02:00
Nikola Forró bdc01e533e execve.2: Clarify signal sent to the process on late failure
Signed-off-by: Nikola Forró <nforro@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-29 21:50:22 +02:00
Michael Kerrisk 9e91819909 statfs.2: Add SMB2 constant to filesystem types list
Reported-by: David Adam <zanchey@ucc.gu.uwa.edu.au>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-29 21:50:09 +02:00
Michael Kerrisk d8e46424aa wait4.2: Update wait3() feature test macro requirements for changes in glibc 2.26
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-29 21:31:30 +02:00
Michael Kerrisk e9378590c4 setlogmask.3: Note that LOG_UPTO() is included in the next POSIX release
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-29 13:54:13 +02:00
Michael Kerrisk 20b82882f3 poll.2: srcfix: add pointer to Austin bug where ppoll() is proposed for POSIX
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-29 13:54:13 +02:00
Michael Kerrisk 34b0e020fd cmsg.3: CONFORMING TO: note which CMSG_* APIs are in current and upcoming POSIX
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-29 13:54:13 +02:00
Michael Kerrisk 0f5538870d dlopen.3: srcfix: add URL relevant for BUGS
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-29 09:28:48 +02:00
Michael Kerrisk 518271052d ftw.3: glibc eventually fixed a regression in FTW_SLN behavior
For details, see:
https://bugzilla.redhat.com/show_bug.cgi?id=1422736
http://austingroupbugs.net/view.php?id=1121
https://bugzilla.redhat.com/show_bug.cgi?id=1422736

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-28 13:18:18 +02:00
Michael Kerrisk 2ece4ef7c6 netlink.7: Update path for NETLINK_CONNECTOR docs in kernel source tree
Reported-by: Idan Katz <idanski1@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-28 11:10:20 +02:00
Jakub Wilk dcf91cdc7e user_namespaces.7: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-27 21:29:42 +02:00
Michael Kerrisk 63fd767f64 tzfile.5: Sync to 2020a tzdb release
From https://www.iana.org/time-zones, version 2020a.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-27 07:29:37 +02:00
Michael Kerrisk 7ab4eb9aae zdump.8: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-27 07:17:24 +02:00
Michael Kerrisk 0a9e18a42d zdump.8: Update to latest upstream tz release
This update addresses an issue described in
https://bugzilla.kernel.org/show_bug.cgi?id=207345

In answer to my question, Paul Eggert noted:

    > Where do I find it?

    https://www.iana.org/time-zones

    Look under "Latest version", which is 2020a.

Reported-by: Paul Eggert <eggert@cs.ucla.edu>
Reported-by: Marco Curreli <marcocurreli@tiscali.it>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-27 07:13:22 +02:00
Bruno Haible 8d4d268f0e ptsname.3: Fix description of failure behaviour of ptsname_r()
The Linux man page for ptsname_r, when describing the behaviour
in the error case, is
  - not consistent with the future POSIX standard (POSIX Issue 8).
  - not consistent with musl libc.

Find attached a patch to
  - keep it consistent with what glibc does,
  - make it consistent with musl libc,
  - make it consistent with the future POSIX standard (POSIX
    Issue 8).

Details:

glibc's implementation of ptsname_r, when it fails, returns the
error code as return value AND sets errno. See
https://sourceware.org/git/?p=glibc.git;a=blob;f=login/ptsname.c
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/mach/hurd/ptsname.c
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/ptsname.c

musl's implementation of ptsname_r, when it fails, returns the error code
but does NOT set errno. See
https://git.musl-libc.org/cgit/musl/tree/src/misc/pty.c

The proposal to add ptsname_r to POSIX, with text

  "If successful, the ptsname_r( ) function shall return zero.
   Otherwise, an error number shall be returned to indicate the
   error."

has been accepted for inclusion in POSIX Issue 8.
http://austingroupbugs.net/view.php?id=508

Therefore a portable program should look at the return value from
ptsname_r, NOT the errno value. The current text in the man page
suggests to look at the errno value, which is wrong (because of
musl libc) and not future-proof (because of future POSIX).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-25 21:44:06 +02:00
Michael Kerrisk c6364a1b33 io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2: Change uses of aio_context_t to io_context_t
Reported-by: Andi Kleen <andi@firstfloor.org>
Reported-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-25 09:02:18 +02:00
Michael Kerrisk ab08f6698e rtnetlink.7: Minor consistency fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-24 22:11:13 +02:00
Michael Kerrisk 97caa19c41 prctl.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-24 21:53:10 +02:00
Achilles Gaikwad ba3d7b1cd8 xattr.7: Add attr(1) as relevant page to SEE ALSO
The page of attr(1) is relevant to xattrs, therefore add it to the
SEE ALSO section.

attr(1) command works for other filesystems as well.

Signed-off-by: Achilles Gaikwad <agaikwad@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-24 21:43:23 +02:00
Michael Kerrisk 00b6e1dd67 rtnetlink.7: Various tweaks to Jan Moskyto Matejka's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-23 21:48:09 +02:00
Jan Moskyto Matejka a4c92224ac rtnetlink.7: Add missing RTA_* attributes
Used Bird's source code, kernel source code, iproute2 source code
and iproute2 manpages to find meanings of these new attributes.

Signed-off-by: Jan Moskyto Matejka <mq@ucw.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-23 21:28:05 +02:00
Michael Kerrisk 0345d654d3 newlocale.3: Fix a valgrind issue in example program
See https://bugzilla.kernel.org/show_bug.cgi?id=202977.

Reported-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-23 14:49:29 +02:00
Michael Kerrisk 3daa240eae fanotify_mark.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-23 14:46:41 +02:00
Michael Kerrisk 01ab9e6753 fanotify_mark.2: Remove mention of FAN_Q_OVERFLOW as an input value in 'mask'
See https://bugzilla.kernel.org/show_bug.cgi?id=198569.

Reported-by: Alexander Morozov <alexandermv@gmail.com>
Reported-by: Amir Goldstein <amir73il@gmail.com>
Reported-by: Jan Kara <jack@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-23 14:31:27 +02:00
Michael Kerrisk b789b1e430 netdevice.7: Minor rewording
See https://bugzilla.kernel.org/show_bug.cgi?id=201475.

Reported-by: alexopo.ceid@gmail.com
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-23 13:55:16 +02:00
Michael Kerrisk 792d42144b ip.7: SEE ALSO: add netdevice(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-23 13:48:37 +02:00
Michael Kerrisk 777ab17ea7 sem_getvalue.3: Note that glibc's sem_getvalue() doesn't return EINVAL errors
See https://bugzilla.kernel.org/show_bug.cgi?id=204273

Reported-by: Andrea Galbusera <gizero@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-23 11:26:05 +02:00
Michael Kerrisk d8833593c7 ip.7: Note a few more valid 'protocol' values
See https://bugzilla.kernel.org/show_bug.cgi?id=204981

Reported-by: Martin Doucha <mdoucha@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-23 11:13:26 +02:00
Michael Kerrisk c5885e4fff lp.4: tfix + ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-22 22:12:40 +02:00
Michael Kerrisk af52fb487f getdtablesize.3: Remove redundant statment that getdtablesize() is a library function
Redundant because this is a Section 3 page, and the
text also describes the implementation in glibc.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-22 21:55:39 +02:00
Michael Kerrisk a47ce0632c mremap.2: Describe some use cases for MREMAP_DONTUNMAP
Reported-by: Brian Geffon <bgeffon@google.com>
Reported-by: Lokesh Gidra <lokeshgidra@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-22 14:04:58 +02:00
Michael Kerrisk 0367239919 mremap.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-22 13:49:21 +02:00
Jakub Wilk 3076b3d996 prctl.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-22 13:12:46 +02:00
Michael Kerrisk 41f974b9fc user_namespaces.7: wfix: Improve wording in discussion of resetting of 'securebits' flags
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-22 13:07:07 +02:00
Michael Kerrisk 4d7a0dbc8b user_namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-22 13:03:44 +02:00
Michael Kerrisk 34aeffa286 open.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 20:51:58 +02:00
Michael Kerrisk 510adbed8e open.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 16:31:23 +02:00
Michael Kerrisk e64c566c57 open.2: Add openat2() to list of APIs that take a 'dirfd' argument
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 16:26:51 +02:00
Michael Kerrisk 0368720957 proc.5: Alert the reader that UID/GID changes can reset the "dumpable" attribute
Reported-by: Eric Hopper <hopper@omnifarious.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 14:27:34 +02:00
Michael Kerrisk 314f7c114e credentials.7: Alert reader that UID/GID changes can affect process capabilities
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 14:12:47 +02:00
Michael Kerrisk 485b33bf8c credentials.7: Relocate a paragraph (no content changes)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 14:09:30 +02:00
Michael Kerrisk cbae8f094e credentials.7: Changes to process UIDs/GIDs can effect the "dumpable" attribute
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 14:04:49 +02:00
Michael Kerrisk d4492caac0 prctl.2: Minor wording fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 14:01:01 +02:00
Michael Kerrisk f09f6a0628 credentials.7: Add a list of the APIs that change a process's credentials
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 13:55:22 +02:00
Michael Kerrisk 95818f493c execve.2: Minor rewording
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 13:37:39 +02:00
Michael Kerrisk bf85b5e63a execve.2: Changes to the "dumpable" flag may change ownership of /proc/PID files
Reported-by: Eric Hopper <hopper@omnifarious.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 13:10:06 +02:00
Michael Kerrisk 279aae0369 execve.2: SEE ALSO: add capabilities(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 13:05:40 +02:00
Michael Kerrisk 3a30f19ce8 execve.2: Improve/correct discussion of changes to dumpable flag during execve(2)
The details were not quite accurate. Defer to prctl(2)
for the more complete picture.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 13:05:40 +02:00
Michael Kerrisk afdfa65ba6 setpgid.2: srcfix
Reported-by: Jakub Wilk <jwilk@jwilk.net>
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 11:18:58 +02:00
Michael Kerrisk bad1c6c80c tzfile.5: Explain UT abbreviation
From a conversation with Paul Eggert:

From: Paul Eggert <eggert@cs.ucla.edu>
Subject: Re: Errors in man pages, here: tzfile(5): Typo?

On 4/20/20 12:27 AM, Michael Kerrisk (man-pages) wrote:
> I think "UT" here is intended to mean "Universal Time", and as such
> should not be "UTC". Perhaps Paul can comment.

Yes, that's right. The tzfile format covers timestamps that predate the
introduction of UTC in 1960, so the documentation uses the sloppier and
more-general term "UT" instead of the more-precise term "UTC".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-21 07:50:12 +02:00
Michael Kerrisk 4c258dbcb9 fanotify.7: Wrap some long lines in example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 21:33:46 +02:00
Michael Kerrisk 81daa1727d fanotify_mark.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 21:28:37 +02:00
Michael Kerrisk 3af8449062 fanotify_mark.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 21:23:22 +02:00
Amir Goldstein a93e5c9593 fanotify.7, fanotify_mark.2: Document FAN_DIR_MODIFY
Document the details of the new FAN_DIR_MODIFY event, which
introduces entry name information to the fanotify event
reporting format.

Enhance the fanotify_fid.c example to also report this event.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 21:22:09 +02:00
Amir Goldstein 4e53518552 fanotify.7: Fix fanotify_fid.c example
- The condition for printing "subdirectory created" was always
  true.
- The arguments and error check of open_by_handle_at() were
  incorrect.
- Fix example description inconsistencies.
- Nicer indentation of example output.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 21:22:02 +02:00
Amir Goldstein 1f20a88032 fanotify_mark.2: Clarification about FAN_EVENT_ON_CHILD and new events
Some of the new event types that were added in v5.1 along with
init flag FAN_REPORT_FID are not eligible for reporting to a
directory watching with FAN_EVENT_ON_CHILD.

Document the events that cannot be generated on children of a
watching parent.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 21:21:49 +02:00
Amir Goldstein d71c9b4a5c fanotify_mark.2: Clarification about FAN_MARK_MOUNT and FAN_REPORT_FID
It is not true that FAN_MARK_MOUNT cannot be used with a group
that was initialized with flag FAN_REPORT_FID.

The correct assertion is that events that require a group with
flag FAN_REPORT_FID cannot be requested on a mark mount.

For exaple, a FAN_OPEN event can be requested on a mark mount and
will generate an event with file handle information if the group
was initialized with flag FAN_REPORT_FID.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 21:21:20 +02:00
Jakub Wilk 488d9e3101 adjtimex.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 20:32:53 +02:00
Jakub Wilk 90d83c61f1 posix_spawn.3: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 20:31:17 +02:00
Michael Kerrisk ee01213e5b st.4: wfix
Reported-by: Kai Mäkisara <kai.makisara@kolumbus.fi>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 20:27:51 +02:00
Michael Kerrisk 980bec5dca st.4: wfix
Reported-by: Kai Mäkisara <kai.makisara@kolumbus.fi>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 20:21:13 +02:00
Michael Kerrisk c11e258bc8 ioctl_fslabel.2: Minor tweaks to Eric Sandeen's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 14:43:29 +02:00
Michael Kerrisk 407dd5e4cd ioctl.2: SEE ALSO: add ioctl_fslabel(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 14:40:09 +02:00
Eric Sandeen bcdf6f9c2a ioctl_fslabel.2: New page documenting filesystem get/set label ioctl(2) operations
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 14:38:53 +02:00
Michael Kerrisk 3a77fea522 adjtimex.2: Minor tweaks to patch by Arnd Bergmann / Richard Cochran
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 13:06:16 +02:00
Michael Kerrisk 4952e654c4 adjtimex.2: srcfix: semantic newlines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 13:01:43 +02:00
Arnd Bergmann 7c880414c4 clock_adjtime.2: New link to adjtimex(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 13:00:23 +02:00
Arnd Bergmann 1ebc1dbaa1 adjtimex.2: Document clock_adjtime(2)
I was experimenting with some possible changes to adjtimex(2) and
clock_adjtime(2) and tried to look up the man page to see what the
documented behavior is when I noticed that clock_adjtime() appears
to be the only system call that is currently undocumented.

Before I do any changes to it, this tries to document what I
understand it currently does.

[ RC: Add better explanations of the usage and error codes
  and correct some typographical mistakes. ]

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 13:00:23 +02:00
Michael Kerrisk bd72f280c9 clock_getres.2: Tweaks to Richard Cochran's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 12:57:02 +02:00
Michael Kerrisk aab942127b clock_getres.2: srcfix: semantic newlines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 12:47:42 +02:00
Richard Cochran f377393edd clock_getres.2: Explain dynamic clocks
Linux has allowed passing open file descriptors to clock_gettime()
and friends since v2.6.39.  This patch documents these "dynamic"
clocks and adds a brief example of how to use them.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 12:45:58 +02:00
Michael Kerrisk 70523ea5d4 mount_namespaces.7: Minor wording fix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 12:13:33 +02:00
Michael Kerrisk a93436f081 mount_namespaces.7: srcfix: remove a crufty FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 12:12:44 +02:00
Michael Kerrisk fb51288cb2 locale.5: Improve description of 'first_weekday'
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 11:59:34 +02:00
Michael Kerrisk 136b7eaf3d random.4: Minor wording improvement (split long sentence into two)
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 11:51:12 +02:00
Michael Kerrisk 6f283aed59 suffixes.7: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 11:41:25 +02:00
Michael Kerrisk c7169ee565 proc.5: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 11:24:27 +02:00
Michael Kerrisk c2e0c81ab3 psignal.3: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 11:09:37 +02:00
Michael Kerrisk f68d810435 proc.5: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 11:06:07 +02:00
Michael Kerrisk dd8e0737a6 networks.5: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 11:04:47 +02:00
Michael Kerrisk 3921205dd2 man-pages.7: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 11:00:11 +02:00
Michael Kerrisk 9226b36185 localedef.1: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 10:58:34 +02:00
Michael Kerrisk 6de69ccdf7 dsp56k.4: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 10:47:08 +02:00
Michael Kerrisk d288254972 initrd.4: ffix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 10:17:05 +02:00
Michael Kerrisk 4f8b740da8 securetty.5: Improve wording of .SH one-line description
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 10:06:44 +02:00
Michael Kerrisk 47bb592129 statfs.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 10:04:58 +02:00
Michael Kerrisk 3c320453d1 gethostbyname.3:
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 09:52:31 +02:00
Michael Kerrisk 45c2b89b54 getopt.3: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 09:47:54 +02:00
Michael Kerrisk f54a0d6a18 dsp56k.4: wfix
The structure in the kernel appears to be named 'dsp56k_upload'
not 'dsp56k_binary'. And this appears always to have been so.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 09:42:51 +02:00
Michael Kerrisk 31572c7125 proc.5: Minor tweaks to /proc/[pid]/mountstats example line
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 09:34:09 +02:00
Michael Kerrisk a6a5e521ab proc.5: Better explanation of some /proc/ide fields
Taken from Documentation/filesystems/proc.txt.

Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 09:32:20 +02:00
Michael Kerrisk 584916a03a wavelan.4: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 09:24:00 +02:00
Michael Kerrisk fdc344df74 wavelan.4: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 09:20:14 +02:00
Michael Kerrisk 7529f3ff72 wavelan.4: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 09:20:14 +02:00
Michael Kerrisk 2513b407d1 wavelan.4: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 09:16:20 +02:00
Michael Kerrisk d6b8e88b91 wavelan.4: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 09:14:26 +02:00
Michael Kerrisk b6df94519a console_codes.4: wfix
("abort" is used elsewhere in the page.)

Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 08:57:17 +02:00
Michael Kerrisk 0c2ae39853 exec.3: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 08:50:14 +02:00
Michael Kerrisk 6c525d1cde errno.3: ffix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 08:37:56 +02:00
Michael Kerrisk 078ade669b dsp56k.4: ffix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 08:35:33 +02:00
Michael Kerrisk 20e973f526 ascii.7: SEE ALSO: fix sort order in entries
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 08:29:30 +02:00
Michael Kerrisk 8668f5a176 mremap.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 00:10:27 +02:00
Michael Kerrisk ea89336966 proc.5: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 00:07:19 +02:00
Michael Kerrisk 67df396fe6 proc.5: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 00:02:52 +02:00
Michael Kerrisk de2cf061cb readdir.3: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-20 00:01:16 +02:00
Michael Kerrisk 9970ebdfac rtc.4: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 23:59:20 +02:00
Michael Kerrisk f2ee89ed85 scanf.3: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 23:54:11 +02:00
Michael Kerrisk 3b4edb13be sysconf.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 23:48:21 +02:00
Michael Kerrisk b1fec1d15c st.4: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 23:40:11 +02:00
Michael Kerrisk 2c1c7df6fa st.4: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 23:34:17 +02:00
Michael Kerrisk 08a964c97b signal.7: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 23:32:58 +02:00
Michael Kerrisk a0bc079425 resolver.3: ffix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 23:31:01 +02:00
Michael Kerrisk cdc3f1ea04 mlock.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 23:27:43 +02:00
Michael Kerrisk 243690b2e7 initrd.4: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 23:26:47 +02:00
Michael Kerrisk e8377ca574 strstr.3: srcfix: remove some ancient Linux libc details that were in comments
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:43:41 +02:00
Michael Kerrisk 4a95bc0281 utmp.5: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:37:18 +02:00
Michael Kerrisk a15037250d utmp.5: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:35:38 +02:00
Michael Kerrisk 151e4ef316 termcap.5: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:26:31 +02:00
Michael Kerrisk 83a20af064 proc.5: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:23:32 +02:00
Michael Kerrisk cbeaa70fb0 nice.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:22:32 +02:00
Michael Kerrisk 62eb1a10fd initrd.4: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:19:00 +02:00
Michael Kerrisk a3d4007cc6 pipe.2, st.4, filesystems.5: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:17:03 +02:00
Michael Kerrisk 42b070e639 proc.5: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:13:21 +02:00
Michael Kerrisk 47787557b8 rename.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:11:55 +02:00
Michael Kerrisk 34891dc551 filesystems.5: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:06:38 +02:00
Michael Kerrisk 15a75ea7ca fcntl.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:05:49 +02:00
Michael Kerrisk 923fda7a03 personality.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:03:46 +02:00
Michael Kerrisk cb4b97d9af carg.3: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:02:20 +02:00
Michael Kerrisk fb018a235d execve.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 22:01:08 +02:00
Michael Kerrisk 53dcd8d262 open.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:59:43 +02:00
Michael Kerrisk 226c685b96 hypot.3: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:57:49 +02:00
Michael Kerrisk 768f5515b5 getmntent.3: ffix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:55:11 +02:00
Michael Kerrisk 11af606752 mknod.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:54:00 +02:00
Michael Kerrisk 753e83e4f1 wavelan.4: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:47:48 +02:00
Michael Kerrisk 85a102024c x25.7: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:45:01 +02:00
Michael Kerrisk c81bddf8e8 rename.2: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:43:36 +02:00
Michael Kerrisk ff3385787f sysconf.3: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:40:04 +02:00
Michael Kerrisk 0613b79aa6 swapon.2: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:39:14 +02:00
Michael Kerrisk 4f375bfd17 strftime.3: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:37:50 +02:00
Michael Kerrisk eb6d799cd1 initrd.4: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:32:12 +02:00
Michael Kerrisk 0f2cc50c51 erf.3: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:28:57 +02:00
Michael Kerrisk 7e8b1f33fb erf.3: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:27:18 +02:00
Michael Kerrisk bf9cc31523 cpuid.4: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:25:31 +02:00
Michael Kerrisk 1cc2995abf capabilities.7: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:20:09 +02:00
Michael Kerrisk 9797c81474 gcvt.3: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 21:17:37 +02:00
Michael Kerrisk 19531dec84 capabilities.7: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-19 16:42:00 +02:00
Michael Kerrisk 858c85752a socket.7: Minor tweaks to SO_RCVLOWAT description
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 15:33:28 +02:00
Kirill Smelkov 90fb5f5225 mmap.2: srcfix: note kernel commit that caused MAP_POPULATE | MAP_NONBLOCK to be noop
Signed-off-by: Kirill Smelkov <kirr@nexedi.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 13:24:48 +02:00
Michael Kerrisk 7f9a6a9970 netlink.7: Note that NETLINK_SOCK_DIAG is preferred over NETLINK_INET_DIAG
Reported-by: Fabien Siron <fabien.siron@epita.fr>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 13:09:59 +02:00
Michael Kerrisk 157d398b9f posix_spawn.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 12:29:16 +02:00
Olivier Gayot fa0d6e6433 posix_spawn.3: Document the POSIX_SPAWN_SETSID attribute
Since glibc 2.26, posix_spawn (2) function accepts the
POSIX_SPAWN_SETSID flag. This flag has been accepted by POSIX and
should be added to the next major revision. The current support
can be enabled with _GNU_SOURCE.

Upstream commit in glibc.git:

  daeb1fa2e1 [BZ 21340] add support for POSIX_SPAWN_SETSID

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 12:25:43 +02:00
Olivier Gayot 0b78e0f5f2 posix_spawn.3: Clarify by using name of steps rather than syscalls
The implementation of the fork() step in posix_spawn(2) relies on
either fork(2), vfork(2) or clone(2) depending on the version of
the glibc and the arguments passed to posix_spawn(2).

It is sometimes ambiguous whether, when we are mentioning
"fork(2)", we are referring to the fork() step or the actual
fork(2) syscall.

This patch hopefully avoids the ambiguity by replacing confusing
occurrences by "the xxx() step" where appropriate.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 12:24:10 +02:00
Olivier Gayot 8b5b47e983 posix_spawn.3: Document POSIX_SPAWN_USEVFORK
Added a few lines about POSIX_SPAWN_USEVFORK so that it appears
clearly that since glibc 2.24, the flag has no effect.

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 12:21:53 +02:00
Olivier Gayot 0c76bb7293 posix_spawn.3: Document implementation using clone() since glibc 2.24
Since glibc 2.24, the use of posix_spawn (2) makes an
unconditional call to clone(CLONE_VM | CLONE_VFORK ...) rather
than relying on fork (2) or vfork (2).

As a consequence, the statements regarding the use of the flag
POSIX_SPAWN_USEVFORK and how the function decides whether it
should use fork (2) or vfork (2) are obsolete since glibc 2.24.

This patch makes a distinction in the manual page between glibc
2.24 and older versions.

Upstream commit in glibc.git:

  9ff72da471 posix: New Linux posix_spawn{p} implementation

Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Signed-off-by: Olivier Gayot <olivier.gayot@sigexec.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 12:19:23 +02:00
Peter Wu 0e86195223 bpf.2: Update enum bpf_map_type and enum bpf_prog_type
Taken from Linux v5.3-rc2. Add a reference to the header file to
save the future reader some time figuring out whether more entries
exist.

Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 12:08:10 +02:00
Michael Kerrisk f7d706ba9b bpf.2: srcfix: Add a note on check for unprivileged BPF_PROG_TYPE_SOCKET_FILTER programs
In Linux 4.4, the allowed BPF helper functions that could
be called was governed by a check in sk_filter_func_proto().
Nowadays (Linux 5.6), it is I think governed by the check in
sk_filter_func_proto().

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 11:58:35 +02:00
Michael Kerrisk 35732aa7a0 bpf.2: Minor tweaks to Richard Palethorpe's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 11:49:42 +02:00
Richard Palethorpe 821bf91cf6 bpf.2: Change note on unprivileged access
This notes that the kernel now allows calls to bpf() without CAP_SYS_ADMIN
under some circumstances.

Signed-off-by: Richard Palethorpe <rpalethorpe@suse.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 09:27:32 +02:00
Michael Kerrisk 2a2b2a5dd7 clone.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-17 09:06:20 +02:00
Marcus Gelderie 8f0b7d765d cgroups.7: Mention cgroup.sane_behavior file
The cgroup.sane_behavior file returns the hard-coded value "0" and
is kept for legacy purposes. Mention this in the man-page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 13:57:53 +02:00
Michael Kerrisk 4e2b112c91 bpf-helpers.7: Sync against Linux 5.7-rc1
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 13:45:41 +02:00
Michael Kerrisk d407f83e5f move_pages.2: Minor tweaks to Yang Shi's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 13:34:39 +02:00
Yang Shi e7b72190bb move_pages.2: Returning positive value is a new error case
Since commit a49bd4d71637 ("mm, numa: rework do_pages_move"), the
semantic of move_pages() has changed to return the number of
non-migrated pages if they were result of a non-fatal reasons
(usually a busy page).  This was an unintentional change that
hasn't been noticed except for LTP tests which checked for the
documented behavior.

There are two ways to go around this change.  We can even get back
to the original behavior and return -EAGAIN whenever migrate_pages
is not able to migrate pages due to non-fatal reasons.  Another
option would be to simply continue with the changed semantic and
extend move_pages documentation to clarify that -errno is returned
on an invalid input or when migration simply cannot succeed (e.g.
-ENOMEM, -EBUSY) or the number of pages that couldn't have been
migrated due to ephemeral reasons (e.g. page is pinned or locked
for other reasons).

We decided to keep the second option in kernel because this
behavior is in place for some time without anybody complaining and
possibly new users depending on it.  Also it allows to have a
slightly easier error handling as the caller knows that it is
worth to retry when err > 0.

Update man pages to reflect the new semantic.

Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 13:30:02 +02:00
Michael Kerrisk c8bbab9a6a namespaces.7: Document /proc/sys/user/max_time_namespaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 13:25:02 +02:00
Michael Kerrisk c96bc2056c namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 13:23:44 +02:00
Michael Kerrisk 40ce741410 getauxval.3: Minor tweaks to YunQiang Su's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 13:13:12 +02:00
YunQiang Su 685385df91 getauxval.3: MIPS, AT_BASE_PLATFORM passes ISA level
Since Linux 5.7, on MIPS, we use AT_BASE_PLATFORM to pass ISA level.
The values may be:
  mips2, mips3, mips4, mips5,
  mips32, mips32r2, mips32r6,
  mips64, mips64r2, mips64r6.

This behavior is different with PowerPC.

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=e585b768da111f2c2d413de6214e83bbdfee8f22
Signed-off-by: YunQiang Su <syq@debian.org>

----
v1 -> v2: fix typo

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 13:12:02 +02:00
Michael Kerrisk 34451e6ee4 s390_runtime_instr.2: Various reworking of Heiko Carstens's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 12:30:00 +02:00
Michael Kerrisk fee6e6795e s390_runtime_instr.2: srcfix: rewrap long source lines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 12:18:19 +02:00
Heiko Carstens cca27058b7 s390_runtime_instr.2: Document signum argument behavior change
Document that the signum argument is ignored in newer kernels, but
that user space should pass a valid real-time signal number for
backwards compatibility.

Cowritten-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 12:10:07 +02:00
Michael Kerrisk bff15b74e0 msgctl.2: Correct description of 'msg_ctime' field
Verified by inspecting kernel source.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 11:48:08 +02:00
Michael Kerrisk 6cd15a0567 shmctl.2: f
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 11:47:16 +02:00
Michael Kerrisk a85bc85d5d shmctl.2: Correct 'shm_ctime' description
Verified from kernel sources.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 11:41:47 +02:00
Michael Kerrisk 5fd4345e84 semctl.2: Correct description of sem_ctime field
Verified from inspection of kernel source code.

Reported-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 11:33:17 +02:00
Michael Kerrisk 6fea5f4f1d semctl.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 11:27:19 +02:00
Michael Kerrisk 191dd3b238 mremap.2: Remove mention of "Segmentation fault" in EFAULT text
"Segmentation fault" (SIGSEGV) is not exactly the same thing as
EFAULT.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 08:23:09 +02:00
Michael Kerrisk 4737f0d145 mremap.2: Move a paragraph on MREMAP_DONTUNMAP from NOTES to DESCRIPTION
I think things read slightly easier, if all of the info on
MREMAP_DONTUNMAP is in one place.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 08:21:30 +02:00
Michael Kerrisk f15e32e3b9 mremap.2: Move a paragraph from DESCRIPTION to NOTES
The paragraph on Linux VM is rather generic, and does not belong
in DESCRIPTION. In fact, I'm not sure it even belongs in this
page.  At the least, let's move it to NOTES.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 08:20:12 +02:00
Michael Kerrisk 8c97c565ee mremap.2: Move a paragraph from DESCRIPTION to NOTES
And while we are at it, remove a sentence that makes an obvious
point (that mremap() uses the Linux page table scheme).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 08:20:12 +02:00
Michael Kerrisk 2b4fecb9f6 mremap.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 08:20:12 +02:00
Michael Kerrisk 6af75e77bb mremap.2: Reorder some paragraphs in NOTES
Details of glibc 2.4, which is by now fairly old, would be
better at the end of NOTES than at the start.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 08:20:12 +02:00
Michael Kerrisk 0f0993c9b5 mremap.2: Some more improvements to Brian Geffon's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 08:20:01 +02:00
Michael Kerrisk 452bdc2f02 mremap.2: Minor tweaks to Brian Geffon's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 07:30:00 +02:00
Brian Geffon 8debc4f595 mremap.2: Document MREMAP_DONTUNMAP
Signed-off-by: Brian Geffon <bgeffon@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 07:30:00 +02:00
Michael Kerrisk cb76d6e5fe mremap.2: ffix (Add a paragraph break)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-16 07:30:00 +02:00
Michael Kerrisk 2932c4aa7e openat2.2: A few more fixes after feedback from Aleksa Sarai
Reported-by: Aleksa Sarai <cyphar@cyphar.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-14 22:07:39 +02:00
Michael Kerrisk 9154da7f05 mmap.2: Don't mark MAP_ANON as deprecated
From a mailing list conversation:

On 5/24/18 9:03 PM, Heinrich Schuchardt wrote:
> Hello Michael,
>
> in the mmap(2) man page MAP_ANON is described as deprecated.
>
> When I look at the NetBSD manpage
> http://netbsd.gw.com/cgi-bin/man-cgi?mmap+2+NetBSD-current
> I found that MAP_ANONYMOUS is not defined.
>
> https://www.dragonflybsd.org/cgi/web-man?command=mmap&section=2
> indicates MAP_ANONYMOUS is an alias for MAP_ANON and is provided for
> compatibility.
>
> https://man.openbsd.org/mmap.2 also knows MAP_ANONYMOUS as a synonym.
>
> https://www.unix.com/man-page/osx/2/mmap/ does not know MAP_ANONYMOUS.
>
> So shouldn't the man page indicate that MAP_ANON is to be favored to
> write portable code? And correspondingly mark MAP_ANONYMOUS as synonym
> only kept for compatibility.
>
> The Open Group Base Specifications Issue 7, 2018 Edition does not
> reference either of both. So both values are not POSIX but it is not
> correct to describe them as Linux only.

The text saying that MAP_ANON is deprecated is ancient (at least
20 years old). I don't know why that text was added.

Things are not simple though: it looks like there's at least
one historical implementation (HP-US) that defines MAP_ANONYMOUS
but not MAP_ANON.

I've applied the patch below.

Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-14 21:14:12 +02:00
Michael Kerrisk ebf3a7d52a ioctl_list.2: Remove hex values from constants
As noted by Heinrich Schuchardt:

he list contains hex values of different constants. I just wonder for
which architecture (alpha, i386, mips, or sparc at that time). No
information is supplied.

Current values depend on the architecture, e.g.

On amd64
0x82307201      VFAT_IOCTL_READDIR_BOTH
0x82307202      VFAT_IOCTL_READDIR_SHORT
0x80047210      FAT_IOCTL_GET_ATTRIBUTES
0x40047211      FAT_IOCTL_SET_ATTRIBUTES
0x80047213      FAT_IOCTL_GET_VOLUME_ID

On mips
0x42187201      VFAT_IOCTL_READDIR_BOTH
0x42187202      VFAT_IOCTL_READDIR_SHORT
0x40047210      FAT_IOCTL_GET_ATTRIBUTES
0x80047211      FAT_IOCTL_SET_ATTRIBUTES
0x40047213      FAT_IOCTL_GET_VOLUME_ID

Hence hex values should be removed.

Reported-by:
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-14 13:06:24 +02:00
Michael Kerrisk 5757667555 ld.so.8: ffix
Reported-by: Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-14 11:59:14 +02:00
Michael Kerrisk dfa3ae9b3f getdents.2: Tweaks to Petr Vorel's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-14 11:42:21 +02:00
Petr Vorel f5f6969dee getdents.2: Mention glibc support for getdents64()
Support was added in glibc 2.30.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-14 11:38:39 +02:00
Chris Lamb 15a8a16b8e getdents.2: Correct linux_dirent definition in example code
It is "unsigned long" earlier up in the file

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-14 11:36:51 +02:00
Goldwyn Rodrigues 1083ffb4cb utimensat: Immutable flag returns EPERM
Linux kernel commit 337684a1746f "fs: return EPERM on immutable
inode" changed (nd unified the return value of the utimensat(2)
from -EACCES to -EPERM in case of an immutable flag. Modify the
man page to reflect the same.

The entire discussion of returning the correct return value is at:
http://lists.linux.it/pipermail/ltp/2017-January/003424.html

[mtk: The change was in Linux 4.8]

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-14 10:38:58 +02:00
Urs Thuermann 6193e7abb8 strftime.3: ISO week number can be 52, add example
A year cannot only begin with week number 53 of the previous year but
also with week number 52.  Year 2011 is an example for this case, as
can be easily seen with GNU date:

$ date -d "jan 1 2011" "+%c %V %G"
Sat Jan  1 00:00:00 2011 52 2010

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-14 09:02:07 +02:00
Michael Kerrisk d7695b17b1 arch_prctl.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-14 08:36:07 +02:00
Michael Kerrisk d9e7db1b39 open.2: Tweaks to Joseph Sible's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 12:27:48 +02:00
Joseph C. Sible 2ddf885a4f open.2: Document fs.protected_fifos and fs.protected_regular
The sysctls fs.protected_fifos and fs.protected_regular can cause
open(2) to fail with EACCES (see Documentation/sysctl/fs.rst for
details.)

Signed-off-by: Joseph C. Sible <josephcsible@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 12:27:48 +02:00
Michael Kerrisk 03306e1829 proc.5: Document /proc/sys/fs/protected_regular
Text heavily based on Documentation/admin-guide/sysctl/fs.rst.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 12:27:48 +02:00
Michael Kerrisk 7dcb9d213a proc.5: Document /proc/sys/fs/protected_fifos
Text heavily based on Documentation/admin-guide/sysctl/fs.rst.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 12:27:48 +02:00
Michael Kerrisk 43c257eaf3 io_setup.2: Tweak description of /proc/sys/fs/aio-max-nr
As far as I can see, /proc/sys/fs/aio-max-nr is a
system-wide limit, not a per-user limit. This seems to be
confirmed by comments in fs/aio.c (Linux 5.6) sources).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 12:27:48 +02:00
Michael Kerrisk 9f51687a32 proc.5: Document /proc/sys/fs/aio-max-nr and /proc/sys/fs/aio-nr
Text taken nearly verbatim from
Documentation/admin-guide/sysctl/fs.rst.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 12:27:47 +02:00
Michael Kerrisk 10e29c059b sendfile.2: wfix
Reported-by: Joseph C. Sible <josephcsible@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 12:27:47 +02:00
Michael Kerrisk 3220cf5f7e signal.7: srcfix: note some implementation-specific details for process-directed signals
Reported-by: Joseph C. Sible <josephcsible@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 12:27:47 +02:00
Michael Kerrisk 731192bee0 ptrace.2: srcfix: mention strace's linux/*/set_scno.c files in relation to PTRACE_SET_SYSCALL
Reported-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 12:27:47 +02:00
Michael Kerrisk cbda5fc9de ptrace.2: Minor tweaks to Joseph Sible's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 12:27:44 +02:00
Joseph C. Sible c2254484e3 ptrace.2: Document PTRACE_SET_SYSCALL
Signed-off-by: Joseph C. Sible <josephcsible@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 10:29:03 +02:00
Michael Kerrisk 84eb2279b1 proc.5: Minor tweaks to Keno Fischer's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 09:25:42 +02:00
Keno Fischer 6a036b00bd 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] bdb4d100af

Signed-off-by: Keno Fischer <keno@juliacomputing.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 09:25:22 +02:00
Michael Kerrisk d31cdf430e 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>
2020-04-13 09:21:20 +02:00
Michael Kerrisk e7722772c3 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>
2020-04-13 09:06:45 +02:00
Michael Kerrisk 70d9d96aeb README: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-13 07:16:56 +02:00
Michael Kerrisk 1718760f88 README: Add section on "Bug reports and contributing"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-12 23:09:25 +02:00
Michael Kerrisk dfc0dcf6e0 README: Move the "Home page" section to the top of the file
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-12 22:50:08 +02:00
Michael Kerrisk 8e79683820 mbind.2: Rework Li Xinhai's patch to note historical behavior
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-12 09:35:41 +02:00
Li Xinhai dfbaab2f19 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>
2020-04-12 09:35:41 +02:00
Michael Kerrisk a47c71d066 Changes.old: Fixes to 5.06 change log
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-12 09:34:30 +02:00
Michael Kerrisk fe1e88877a strcmp.3: Add license to example programs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-12 09:11:20 +02:00
Michael Kerrisk f379a700e3 shm_open.3: Add license to example programs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-12 09:11:20 +02:00
Michael Kerrisk 1a576c5858 shmop.2: Add license to example programs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-12 09:11:20 +02:00
Michael Kerrisk 78391fde75 poll.2: Add license to example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-12 09:11:20 +02:00
Michael Kerrisk 927e2764ab semget.2: Add license to example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-12 09:11:16 +02:00
Michael Kerrisk 2f0182d20d time_namespaces.7: Minor wording fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-12 08:44:50 +02:00
Michael Kerrisk a8433b3b16 time_namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-12 08:43:56 +02:00
Michael Kerrisk ed6c998bdf Start of man-pages-5.07: updating Changes and Changes.old 2020-04-12 08:32:06 +02:00
Michael Kerrisk 2beaf2a279 Start of man-pages-5.07: updating .Announce and .lsm files 2020-04-12 08:32:06 +02:00
Michael Kerrisk 24198d8227 Start of man-pages-5.07: renaming .Announce and .lsm files 2020-04-12 08:32:06 +02:00
Michael Kerrisk 106397931e Ready for 5.06 2020-04-11 22:33:10 +02:00
Michael Kerrisk 8678102abe 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>
2020-04-11 22:33:10 +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
Michael Kerrisk bef940caef clock_getres.2: Minor tweaks to example
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-04 10:52:16 +02:00
Michael Kerrisk a04e44bd3a clock_getres.2: Clarify that CLOCK_MONOTONIC is system-wide
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-04 09:49:03 +02:00
Michael Kerrisk 9d69bebbd6 clock_getres.2: Clarify that CLOCK_TAI is nonsettable
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-04 09:49:03 +02:00
Michael Kerrisk 16fa57813e clock_getres.2: Add an example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-04 09:32:33 +02:00
Michael Kerrisk a48d19162d 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>
2020-04-02 21:54:07 +02:00
Eric Rannaud f873b37560 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>
2020-04-02 21:52:01 +02:00
Michael Kerrisk 0f1553b5fd 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>
2020-04-02 21:43:21 +02:00
Michael Kerrisk b5b0b2882e 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>
2020-04-02 14:13:51 +02:00
Michael Kerrisk 3872a3d621 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>
2020-04-02 14:08:39 +02:00
Michael Kerrisk 4222606d2a prctl.2: f
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 14:07:12 +02:00
Michael Kerrisk 91e015066f prctl.2: Minor tweaks to Mike Christie's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 14:06:28 +02:00
Mike Christie 308eb2f636 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>
2020-04-02 13:59:05 +02:00
Michael Kerrisk 98511af299 pthread_getcpuclockid.3: Minor clarification to usage of 'clockid' argument
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 12:57:25 +02:00
Michael Kerrisk 9e099e691e 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>
2020-04-02 12:57:25 +02:00
Michael Kerrisk ba1c6b2081 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>
2020-04-02 12:57:25 +02:00
Michael Kerrisk 717096082d 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>
2020-04-02 12:57:25 +02:00
Michael Kerrisk 96d951a401 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>
2020-04-02 12:57:25 +02:00
Michael Kerrisk 04e2e313fc 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>
2020-04-02 12:57:25 +02:00
Michael Kerrisk d53b0f4822 clock_nanosleep.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 12:57:25 +02:00
Michael Kerrisk 0e7984ff40 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>
2020-04-02 12:57:25 +02:00
Michael Kerrisk b24db7cb8a clock_nanosleep.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 12:57:25 +02:00
Michael Kerrisk 14df252bf8 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>
2020-04-02 12:57:18 +02:00
Michael Kerrisk 41043c0bd6 clock_getres.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 12:42:54 +02:00
Michael Kerrisk ac90b58942 clock_getres.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 12:42:54 +02:00
Michael Kerrisk eb6567fb00 clock_getres.2: Add CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 12:42:54 +02:00
Michael Kerrisk da8a95bca1 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>
2020-04-02 12:42:54 +02:00
Michael Kerrisk 0e4b87c4fd timer_create.2: Mention clock_getres(2) for further details on the various clocks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 12:42:54 +02:00
Michael Kerrisk 966051ca74 clock_nanosleep.2: clock_nanosleep() also supports CLOCK_BOOTTIME
Presumably (and from a quick glance at the source code)
since Linux 2.6.39, when CLOCK_BOOTTIME was introduced.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 09:34:37 +02:00
Michael Kerrisk 2c16f1bc28 clock_getres.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-01 21:30:37 +02:00
Michael Kerrisk 066dcd09cb timerfd_create.2: wfix
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=947091

Reported-by: Marc Lehmann <debian-reportbug@plan9.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-01 10:04:32 +02:00
Michael Kerrisk 372b58573a openat2.2: srcfix: remove a FIXME
Aleksa Sarai is okay with my text changes.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-01 08:36:49 +02:00
Michael Kerrisk 08ba10a6d5 openat2.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-01 08:18:45 +02:00
Michael Kerrisk b4e1568256 openat2.2: Improve text describing caveat for use of RESOLVE_NO_XDEV
From email discussions with Aleksa Sarai:

> .\" FIXME I find the "previously-functional systems" in the previous
> .\" sentence a little odd (since openat2() ia new sysycall), so I would
> .\" like to clarify a little...
> .\" Are you referring to the scenario where someone might take an
> .\" existing application that uses openat() and replaces the uses
> .\" of openat() with openat2()? In which case, is it correct to
> .\" understand that you mean that one should not just indiscriminately
> .\" add the RESOLVE_NO_XDEV flag to all of the openat2() calls?
> .\" If I'm not on the right track, could you point me in the right
> .\" direction please.

This is mostly meant as a warning to hopefully avoid applications
because the developer didn't realise that system paths may contain
symlinks or bind-mounts. For an application which has switched to
openat2() and then uses RESOLVE_NO_SYMLINKS for a non-security reason,
it's possible that on some distributions (or future versions of a
distribution) that their application will stop working because a system
path suddenly contains a symlink or is a bind-mount.

This was a concern which was brought up on LWN some time ago. If you can
think of a phrasing that makes this more clear, I'd appreciate it.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-01 08:16:40 +02:00
Michael Kerrisk c85ebb3c94 openat2.2: Various tweaks to the dicussion of 'resolve' flags
Some tweaks inspired by https://lwn.net/Articles/796868/

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-31 09:50:48 +02:00
Michael Kerrisk e31d5bfd36 openat2.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-31 09:11:20 +02:00
Michael Kerrisk 193f7fb272 openat2.2: Place 'resolve' flags in alphabetical order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-31 09:10:05 +02:00
Michael Kerrisk 1ae24555ba timerfd_create.2: Negetive changes to CLOCK_REALTIME may cause read() to return 0
Devi R K reported this issue, and went on to note:

> We have written a program using real time clock and it has been raised to
> the community.
>
> https://lore.kernel.org/lkml/alpine.DEB.2.21.1908191943280.1796@nanos.tec.linutronix.de/T/

[...]

Thanks for pointing me at that thread. In particular, the test
program at
https://lore.kernel.org/lkml/alpine.DEB.2.21.1908191943280.1796@nanos.tec.linutronix.de/T/#m489d81abdfbb2699743e18c37657311f8d52a4cd

[...]

I think this patch does not really capture the details
properly. The immediately preceding paragraph says:

         If  the  associated  clock  is  either  CLOCK_REALTIME   or
         CLOCK_REALTIME_ALARM,     the     timer     is     absolute
         (TFD_TIMER_ABSTIME), and the  flag  TFD_TIMER_CANCEL_ON_SET
         was  specified when calling timerfd_settime(), then read(2)
         fails with the  error  ECANCELED  if  the  real-time  clock
         undergoes a discontinuous change.  (This allows the reading
         application to discover such discontinuous changes  to  the
         clock.)

Following on from that, I think we should have a paragraph that says
something like:

         If  the  associated  clock  is  either  CLOCK_REALTIME   or
         CLOCK_REALTIME_ALARM,     the     timer     is     absolute
         (TFD_TIMER_ABSTIME), and the  flag  TFD_TIMER_CANCEL_ON_SET
         was not specified when calling timerfd_settime(), then a
         discontinuous negative change to the clock
         (e.g., clock_settime(2)) may cause read(2) to unblock, but
         return a value of 0 (i.e., no bytes read), if the clock
         change occurs after the time expired, but before the
         read(2) on the timerfd file descriptor.

This seems consistent with Thomas's observations in
https://lore.kernel.org/lkml/alpine.DEB.2.21.1908191943280.1796@nanos.tec.linutronix.de/T/#m49b78122b573a2749a05b720dc9fa036546db490

==
Thomas Gleixner replied:

Yes, that's correct. Accurate as always!

This is pretty much in line with clock_nanosleep(CLOCK_REALTIME,
TIMER_ABSTIME) which has a similar problem vs. observability in user
space.

clock_nanosleep(2) mutters:

  "POSIX.1 specifies that after changing the value of the CLOCK_REALTIME
   clock via clock_settime(2), the new clock value shall be used to
   determine the time at which a thread blocked on an absolute
   clock_nanosleep() will wake up; if the new clock value falls past the
   end of the sleep interval, then the clock_nanosleep() call will return
   immediately."

which can be interpreted as guarantee that clock_nanosleep() never
returns prematurely, i.e. the assert() in the below code would indicate
a kernel failure:

   ret = clock_nanosleep(CLOCK_REALTIME, TIMER_ABSTIME, &expiry, NULL);
   if (!ret) {
         clock_gettime(CLOCK_REALTIME, &now);
         assert(now >= expiry);
   }

But that assert can trigger when CLOCK_REALTIME was modified after the
timer fired and the kernel decided to wake up the task and let it return
to user space.

   clock_nanosleep(..., &expiry)
     arm_timer(expires);
     schedule();

   -> timer interrupt
      now = ktime_get_real();
      if (expires <= now)
              -------------------------------- After this point
         wakeup();                             clock_settime(2) or
                                               adjtimex(2) which
                                               makes CLOCK_REALTIME
                                               jump back far enough will
                                               cause the above assert
                                               to trigger.

   ...
   return from syscall (retval == 0)

There is no guarantee against clock_settime() coming after the
wakeup. Even if we put another check into the return to user path then
we won't catch a clock_settime() which comes right after that and before
user space invokes clock_gettime().

POSIX spec Issue 7 (2018 edition) says:

 The suspension for the absolute clock_nanosleep() function (that is,
 with the TIMER_ABSTIME flag set) shall be in effect at least until the
 value of the corresponding clock reaches the absolute time specified by
 rqtp.

And that's what the kernel implements for clock_nanosleep() and timerfd
behaves exactly the same way.

The wakeup of the waiter, i.e. task blocked in clock_nanosleep(2),
read(2), poll(2), is not happening _before_ the absolute time specified
is reached.

If clock_settime() happens right before the expiry check, then it does
the right thing, but any modification to the clock after the wakeup
cannot be mitigated. At least not in a way which would make the assert()
in the example code above a reliable indicator for a kernel fail.

That's the reason why I rejected the attempt to mitigate that particular
0 tick issue in timerfd as it would just scratch a particular itch but
still not provide any guarantee. So having the '0' return documented is
the right way to go.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Reported-by: devi R.K <devi.feb27@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 22:52:58 +02:00
Michael Kerrisk 1f4cf8e85e openat2.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 22:41:25 +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 7a18f60e4d openat2.2: Minor tweaks to the text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 22:26:50 +02:00
Michael Kerrisk 552f379960 openat2.2: Further tweaks to the RESOLVE_IN_ROOT text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 21:52:32 +02:00
Michael Kerrisk 9e0168b018 openat2.2: Minor tweaks to RESOLVE_IN_ROOT text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 21:41:47 +02:00
Michael Kerrisk 75cd77e3c1 openat2.2: Minor change: reword a sentence
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 21:20:41 +02:00
Michael Kerrisk 39bfd04683 openat2.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 21:17:52 +02:00
Michael Kerrisk a424f7c064 openat2.2: srcfix: Disfavor multiargument .BR and .IR usage
For me, source lines such as:

    .BR perf_setattr "(2), " perf_event_open "(2), and " clone3 (2).

is harder to read than:

    .BR perf_setattr (2),
    .BR perf_event_open (2),
    and
    .BR clone3 (2).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 14:52:47 +02:00
Michael Kerrisk d144dc36b8 openat2.2: Rework RESOLVE_IN_ROOT text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 14:52:44 +02:00
Michael Kerrisk 36c9d56de6 openat2.2: Reorganize and rework introductory text a little
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 14:52:40 +02:00
Michael Kerrisk 6c6945d461 openat2.2: Remove one of the forward references to the "Extensibility" subsection
There are currently three of these forward references (two in
DESCRIPTION, one in ERRORS). This is a little redundant.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 14:44:59 +02:00
Michael Kerrisk 4ec6d407a9 openat2.2: Various wording improvements to Aleksa Sarai's text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 14:44:59 +02:00
Michael Kerrisk 7a11fc63b8 open.2: Clarify that O_NOFOLLOW is relevant (only) for basename of 'pathname'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 12:32:07 +02:00
Michael Kerrisk 7b7aad695b openat2.2: wfix: explicitly qualify fields of 'how' argument with "how."
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 12:32:07 +02:00
Michael Kerrisk 3fcaeb806a openat2.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 12:32:07 +02:00
Michael Kerrisk 03625dc12d openat2.2: Place ERRORS in alphabetical order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 12:32:07 +02:00
Michael Kerrisk 0105739e8b openat2.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 10:20:06 +02:00
Michael Kerrisk 0389373e6e openat2.2: ffix (mainly: replace blank lines by .IP or .PP)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 10:19:20 +02:00
Michael Kerrisk 669403e99e openat2.2: spfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 10:19:20 +02:00
Michael Kerrisk 2d82152f53 openat2.2: srcfix: eliminate redundant blank lines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 10:19:20 +02:00
Michael Kerrisk 2359744f97 openat2.2: srcfix: semantic newlines and rewrap some long source lines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 10:19:20 +02:00
Michael Kerrisk 4b322a2fc8 open.2: Minor tweaks to Aleksa Sarai's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 08:45:58 +02:00
Aleksa Sarai a2dbb2e378 open.2: Add references to new openat2(2) page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 08:37:02 +02:00
Aleksa Sarai 89de505522 openat2.2: Document new openat2(2) syscall
Rather than trying to merge the new syscall documentation into
open.2 (which would probably result in the man-page being
incomprehensible), instead the new syscall gets its own dedicated
page with links between open(2) and openat2(2) to avoid
duplicating information such as the list of O_* flags or common
errors.

In addition to describing all of the key flags, information about
the extensibility design is provided so that users can better
understand why they need to pass sizeof(struct open_how) and how
their programs will work across kernels. After some discussions
with David Laight, I also included explicit instructions to zero
the structure to avoid issues when recompiling with new headers.

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

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-30 08:34:45 +02:00
Michael Kerrisk 238442a2de clock_getres.2: ERRORS: add EINVAL for attempt to set a nonsettable clock
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-29 22:36:19 +02:00
Michael Kerrisk c009a15c2e clock_getres.2: Improve description of CPU-time clocks
The current descriptions are a bit terse. Make the description
a little clearer.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-29 22:14:00 +02:00
Michael Kerrisk 71b7e2a5dc clock_getres.2: Note that CPU-time clocks are not settable.
Explicitly note that CLOCK_PROCESS_CPUTIME_ID and
CLOCK_PROCESS_CPUTIME_ID are not settable.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-29 22:11:24 +02:00
Michael Kerrisk a215069794 clock_getres.2: Move text in BUGS to NOTES
The fact that CLOCK_PROCESS_CPUTIME_ID and
CLOCK_PROCESS_CPUTIME_ID are not settable isn't a bug,
since POSIX does allow the possibility that these clocks
are not settable.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-29 22:08:10 +02:00
Michael Kerrisk 6cfa7458f7 clock_getres.2: Minor wording improvement
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-29 21:42:21 +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
Benjamin Peterson 3b9aa39b85 clock_getres.2: tfix
Signed-off-by: Benjamin Peterson <benjamin@python.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-29 09:20:58 +02:00
André Almeida c1e04f0116 futex.2: wfix
The sixth argument of futex is uaddr2, instead of uaddr.

Signed-off-by: André Almeida <andrealmeid@collabora.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-26 09:48:33 +01: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
Jakub Wilk cf178e9319 printf.3: ffix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-26 08:48:52 +01:00
Michael Kerrisk bf981e8b3b clock_getres.2: Minor tweaks to Benjamin Peterson's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-26 08:45:20 +01:00
Michael Kerrisk da9fe87d7c clock_getres.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-26 08:44:37 +01:00
Benjamin Peterson 3eee751583 clock_getres.2: Document CLOCK_TAI
Signed-off-by: Benjamin Peterson <benjamin@python.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-26 08:41:25 +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
Michael Kerrisk 3d5a6df077 sem_post.3: Add a reference to code example code in shm_open(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk 3137ba8843 sem_init.3: Add references to example code in shm_open(3) and sem_wait(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk 145b262dda shm_open.3: EXAMPLE: add some example programs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk e5d8f6046b timerfd_create.2: srcfix: remove obsolete FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk cbf25811f8 timer_getoverrun.2: srcfix: Update FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk 7f4a75814f gettid.2: Remove obsolete FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk b51c940445 execve.2: ERRORS: ENOENT does not occur for missing shared libraries
See http://sourceware.org/bugzilla/show_bug.cgi?id=12241.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk a0cdf1e1b3 shmget.2: Add a reference to the example in shmop(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk 5d7a184304 semctl.2: Add a reference to the example in shmop(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk 26c8d4bb8c semop.2: Add a reference to the semop(2) example in shmop(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk fc4774234e shmop.2: EXAMPLE: add a pair of example programs
Add example programs demonstrating usage of shmget(2), shmat(2),
semget(2), semctl(2), and semop(2).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk 88ea6ab903 ftok.3: EXAMPLE: add a reference to the example in semget(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk 90f986d35f semget.2: EXAMPLE: add an example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk c436f71fa0 statx.2: Minor tweaks to Eric Bigger's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:20:50 +01:00
Eric Biggers ba2a520059 statx.2: Document STATX_ATTR_VERITY
Document the verity attribute for statx(), which was added in
Linux 5.5.

For more context, see the fs-verity documentation:
https://www.kernel.org/doc/html/latest/filesystems/fsverity.html

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:18: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
Jakub Wilk 765a67c3ad semctl.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:16:22 +01:00
Jakub Wilk 1a5c50e36f Changes.old: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:15:46 +01:00
Krzysztof Małysa d5d482ec7a clone.2: tfix
Fix clone3() syscall description for CLONE_PARENT_SETTID: kernel uses
cl_args.parent_tid instead of the specified cl_args.child_tid.

Signed-off-by: Krzysztof Małysa <varqox@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:14:11 +01:00
Mike Frysinger deb1825fcf mlock.2: ffix
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 06:43:37 +01:00
Jakub Wilk 184d797d8c proc.5: tfix
Escape hyphens.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 06:40:25 +01:00
Michael Kerrisk cd356fa192 _exit.2: Clarify that raw _exit() system call terminates only the calling thread
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-04 22:36:31 +01:00
Michael Kerrisk 07f462e9f2 _exit.2: Minor wording tweaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-04 22:35:11 +01:00
Michael Kerrisk b2a8e05384 stat.2: Clarify definitions of timestamp fields
In particular, make it clear that atime and mtime relate to the
file *data*.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-02 17:45:05 +01:00
Michael Kerrisk cb2e25d873 getifaddrs.3: EXAMPLE: remove unneeded loop variable
Reported-by: Michael Galassi <michael@galassi.us>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-29 22:41:15 +01:00
Michael Kerrisk 64cde6e3bf poll.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-28 22:12:33 +01:00
Michael Kerrisk 232057c309 inotify_add_watch.2: EXAMPLE: add referecne to example in inotify(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-28 22:08:38 +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 ce160b21ab semctl.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-28 08:46:58 +01:00
Michael Kerrisk 1923607c30 execve.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-28 08:41:51 +01:00
Michael Kerrisk 63433c537c execve.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-28 08:38:19 +01:00
Michael Kerrisk 5d92031a43 execve.2: Explicitly note that argv[argc] == NULL in the new program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-28 08:38:19 +01:00
Michael Kerrisk 0262995818 execve.2: wfix 2020-02-28 08:32:32 +01:00
Michael Kerrisk 01b08fe410 msgop.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-27 14:00:09 +01:00
Michael Kerrisk 5abea51fba semop.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 21:48:53 +01:00
Michael Kerrisk 410ad57327 shmop.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 21:47:57 +01:00
Michael Kerrisk 55f2c84816 msgop.2, shmop.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 21:44:42 +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
Michael Kerrisk a63243b9e2 msgctl.2: Add information on permission bits (based on sysvipc(7) text)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:53:25 +01:00
Michael Kerrisk cce90cf33a msgctl.2: Copy information on 'msqid_ds' fields from sysvipc(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:53:25 +01:00
Michael Kerrisk dd7f869f66 semctl.2: Minor wording fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:53:25 +01:00
Michael Kerrisk 702f1a76e1 semctl.2: Add information on permission bits (based on sysvipc(7) text)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:53:25 +01:00
Michael Kerrisk c7d32a9ee7 semctl.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:53:25 +01:00
Michael Kerrisk 1c9b3f5ff2 semctl.2: Copy information on 'semid_ds' fields from sysvipc(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:53:25 +01:00
Michael Kerrisk bede9ac097 shmctl.2: Note that execute permission is not needed for shmat() SHM_EXEC
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:53:25 +01:00
Michael Kerrisk aa3b28505e shmctl.2: Add information on permission bits (based on sysvipc(7) text)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:53:25 +01:00
Michael Kerrisk 5ec2120137 shmctl.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:53:25 +01:00
Michael Kerrisk fc11d0e500 shmctl.2: Some small improvements to the description of the 'shmid_ds' structure
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:53:25 +01:00
Michael Kerrisk c41cf60e5c shmctl.2: Copy information on 'shmid_ds' fields from sysvipc(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-25 16:53:25 +01:00
Eugene Syromyatnikov 5c6233fd47 strftime.3: tfix
Fixes: 13e5f960f3 "strftime.3: Minor tweaks to Eugene Syromyatnikov's patch"
Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-24 10:28:21 +01:00
Michael Kerrisk 7776aac98a exit.3: Small improvement to the discussion of 'status' argument
Reported-by: Walter Harms <wharms@bfs.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-24 09:00:30 +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 13e5f960f3 strftime.3: Minor tweaks to Eugene Syromyatnikov's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov b0f9cb5e85 strftime.3: Expand %E and %O description
* man3/strftime.3 (%C): Describe the meaning of %EC conversion
specification.
(%E): Mention the concept of "era" in description.
(%O): Mention that alternative format is related to numeric
representation.
(%y): Describe the meaning of %Ey conversion specification.
(%Y): Describe the meaning of %EY conversion specification.
(.SH DESCRIPTION): Mention that the behaviour of %E modifier is governed
by ERA locale element and provide ja_JP locale as an example.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Alexander Miller 3b9cbcdc61 pidfd_open.2: wfix
Signed-off-by: Alexander Miller <alex.miller@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Michael Kerrisk 9c85099e92 strftime.3: Tweaks to Eugene Syromyatnikov's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov a748a16aaf strftime.3: Refer to the relevant nl_langinfo(3) items
As it wasn't clear before where this kind of information can be
obtained from.

* man3/strftime.3 (%a, %A, %b, %B, %c, %p, %r, %x, %X): Add information
about the locale elements that can be used to retrieve the relevant
information using nl_langinfo() library call.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov cb573e410b strftime.3: Consistently document fall-back format string
The information is taken from POSIX[1] and the
implementations[2][3][4].

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_05_03
[2] https://sourceware.org/git/?p=glibc.git;a=blob;f=time/strftime_l.c
[3] https://git.musl-libc.org/cgit/musl/tree/src/locale/langinfo.c#n15
[4] https://git.uclibc.org/uClibc/tree/libc/misc/locale/locale.c#n992

* man3/strftime.3 (%c, %x, %X): Add information about fall-back format.
(%r): Move it behind SU comment.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Michael Kerrisk b18f942307 nl_langinfo.3: Tweaks to Eugene Syromyatnikov's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov 2969f2cc3d nl_langinfo.3: Document era-related locale elements
Information is mostly taken from POSIX[1], GNU C Library
documentation[2], glibc strftime implementation[3], and Japanese
locale definition[4].

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_05_02
[2] https://www.gnu.org/software/libc/manual/html_node/The-Elegant-and-Fast-Way.html
[3] https://sourceware.org/git/?p=glibc.git;a=blob;f=time/strftime_l.c
[4] https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/locales/ja_JP

* man3/nl_langinfo.3 (.SH DESCRIPTION): Add information about ERA,
ERA_D_T_FMT, ERA_D_FMT, and ERA_T_FMT locale elements.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov 6602e55a7c nl_langinfo.3: Add information about AM/PM time format locale elements
* man3/nl_langinfo.3 (.SH DESCRIPTION): Add description for AM_STR,
PM_STR, T_FMT_AMPM locale elements.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov 6c21e49f97 nl_langinfo.3: mention the respective strftime(3) conversion specifications
* man3/nl_langinfo.3 (D_T_FMT, D_FMT, T_FMT, DAY_{1–7},
ABDAY_{1–7}, MON_{1–12}, ABMON_{1–12}): Mention the respective
strftime(3) conversion specifications.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Michael Kerrisk 7b9f319555 clock_getres.2: Tweaks to Helge Deller's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Helge Deller 7b02075b19 clock_getres.2: Consecutive calls for CLOCK_MONOTONIC may return same value
Consecutive calls to clock_gettime(CLOCK_MONOTONIC) are guaranteed
to return MONOTONIC values, which means that they either return
the *SAME* time value like the last call, or a later (higher) time
value.

Due to high resolution counters, like TSC on x86, most people see
that the values returned increase, but on other less common
platforms it's less likely that consecutive calls return newer
values, and instead users may unexpectedly get back the SAME time
value.

I think it makes sense to document that people should not expect
to see "always-growing" time values. For example in Debian I've
seen in quite some source packages where return values of
consecutive calls are compared against each other and then the
package build fails if they are equal (e.g.  ruby-hitimes, ...).

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:26 +01:00
Eugene Syromyatnikov ea09dfe60c syscalls.2: ffix (trying to fit the table into 80 columns)
* man2/syscalls.2 (.SH DESCRIPTION) <\fBgetdtablesize\fP(2)>: Remove "since
Linux 2.0" part for the osf_getdtablesize note, as syscall is generally
available since Linux 2.0; add line break after the word "as".
(.SH DESCRIPTION) <\fBpwrite\fP(2)>: Add line breaks.
(.SH DESCRIPTION) <\fBvm86old\fP(2)>: Add a line break after "in".

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 21:46:22 +01:00
Michael Kerrisk ea5c73026f syscalls.2: Note that the 5.x series followed 4.20
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 21:42:31 +01:00
Eugene Syromyatnikov 6ba949de0a filesystems.5: tfix
Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 21:38:29 +01:00
Michael Kerrisk 3ed6ea8db5 msgget.2, semget.2, shmget.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 0f1e53ec43 ioctl_ficlonerange.2, ioctl_fideduperange.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 58a114f1d9 execve.2: Add a subhead for the discussion of effect on process attributes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 1e980a0e8b sched_setattr.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk a2d56dbbe3 mmap.2: Add a subhead for the 'flags' argument
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk dd6ceee6f7 mmap.2: Move some text hidden at the end of DESCRIPTION to NOTES
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 8762c93c83 ioctl_fat.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 390f1f349a termios.3: srcfix: Add self to copyright
I've added quite a few pieces to this page over the years.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk db4a4ba77d malloc.3: srcfix: Add self to copyright
By now, I've written quite a bit of the text of this page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk af88b3d3bd getopt.3: srcfix: add self to copyright
I'm the author of various parts of the page, and one
of the example programs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 8a76077272 read.2: srcfix: Add self to copyright
By now, I'm the author of perhaps the majority of the text.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk e6356d613f msgop.2: arcfix: add Bill Pemberton to copyright
The example program in this page is from Bill Pemberton.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk b2a44c2ecc capget.2: srcfix: Add self to copyright
By now, I'm the author of a substantial part of the text.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 7a5f235074 brk.2: srcfix: Add self to copyright
I'm the author of the majority of the text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 35e6d17bde bind.2: srcfix: Add self to copyright
I'm the author of the example program and various
other additions to the page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 50fd1cfe6f poll.2, atoi.3, gsignal.3, posix_memalign.3, scanf.3: Remove a few mentions of the ancient "Linux libc"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 38e17cbacc sigaction.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +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 caec8a9230 ld.so.8: ffix
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 e41f05af22 splice.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 962a269d97 epoll_create.2: srcfix: Add self to copyright
By now, I'm the author of the majority of the text.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk cce4f97420 epoll_create.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:22 +01:00
Michael Kerrisk 23a169f749 epoll_wait.2: A few minor additions and rewrites
And add self to copyright, since, by now, the majority of the
text in the page has now been (re)written by me.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:22 +01:00
Michael Kerrisk ee9c94436f epoll_ctl.2: Various minor additions and clarifications
And add self to copyright, since, by now, I'm the author of
substantial parts of the page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:22 +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 733192cba6 poll.2: srcfix: Amend copyright
By now, I've written or rewritten pretty much the entire page

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:22 +01:00
Michael Kerrisk 342819c832 poll.2: Improve description of EFAULT error
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:22 +01:00
Michael Kerrisk 8bcfd68889 poll.2: Fix description of ENOMEM error
No file descriptors are being allocated...

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:22 +01:00
Michael Kerrisk 836efc18d7 poll.2: Add an example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:22 +01:00
Michael Kerrisk 83bb822c4f poll.2: Mention epoll(7) in the introductory paragraph
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-19 09:38:22 +01:00
Michael Kerrisk 6c485bbb3a poll.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-19 09:38:22 +01:00
Michael Kerrisk 4628e3eca7 select.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-19 09:38:22 +01:00
Michael Kerrisk 602b388d07 select.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-19 09:38:22 +01:00
Michael Kerrisk 95a85f1438 select.2: Note that FD_SET() and FD_CLR() do not return errors
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-19 09:38:22 +01:00
Michael Kerrisk a84ed70098 select.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-19 09:38:22 +01:00
Michael Kerrisk 0a4d109d22 select.2: Consolidate historical glibc pselect() details under one subhead
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-19 09:38:22 +01:00
Michael Kerrisk d221e421a5 select.2: Place the discussion of the self-pipe technique in a headed subsection
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-19 09:38:22 +01:00
Michael Kerrisk 73e8f3b4c1 select_tut.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-19 09:38:22 +01:00
Michael Kerrisk 4551a1b1d1 select_tut.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 22:59:35 +01:00
Michael Kerrisk a1f163d6c0 select_tut.2: wfix: break up a long paragraph
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 22:59:35 +01:00
Michael Kerrisk 97a5a8d838 select_tut.2: Adjust header file includes in example
Employ <sys/select.h>, rather than the historical header files.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 22:59:35 +01:00
Michael Kerrisk 21677b1bb5 select_tut.2: SEE ALSO: shorten this list
select(2) already lists most of these.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 22:59:35 +01:00
Michael Kerrisk 82cf8e8850 select_tut.2: RETURN VALUE: defer to select(2)
Defer to select(2), rather than repeating the information
in this page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 22:59:35 +01:00
Michael Kerrisk c9a275a703 select_tut.2: DESCRIPTION: defer to select(2)
Avoid duplicating the same information in two pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 22:59:35 +01:00
Michael Kerrisk b3b45b2b16 select_tut.2: SYNOPSIS: defer to select(2), rather than repeating the same info
Remove the prototypes, which are detailed in select(2).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 22:59:35 +01:00
Michael Kerrisk 095d8388cf select.2: Rewrite DESCRIPTION
Improve structure and readability, at the same time incorporating
text and details that were formerly in select_tut(2). Also
move a few details in other parts of the page into DESCRIPTION.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 22:59:35 +01:00
Michael Kerrisk f7cd286592 select.2: Minor wording fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 11:55:51 +01:00
Michael Kerrisk e5704b1a7a select.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 11:55:51 +01:00
Michael Kerrisk b397824f99 select.2: srcfix: add myself to copyright
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 11:55:51 +01:00
Michael Kerrisk bd89babbed select.2, select_tut.2: Consolidate info on usleep() emulation in one place
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 11:55:51 +01:00
Michael Kerrisk a63fef4359 select.2: Remove details of historical #include requirements
The POSIX situation has been the norm for a long time now,
and including ancient details overcomplicates the page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 11:55:51 +01:00
Michael Kerrisk f0e902c3a1 select.2: Remove some ancient information about pre-POSIX types for 'timeout'
The discussion about pre-POSIX types for 'timeval' and 'timespec'
is rather old, and these days serves mainly to complicate the
page. Remove it.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 10:14:13 +01:00
Michael Kerrisk b8f8864d29 select.2: Minor fix: add forward reference to 'timeval' description
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 10:14:13 +01:00
Michael Kerrisk 01901530b2 select.2: Consolidate the discussion of pselect into a headed subsection
The current text layout is a little hard to parse, with details of
pselect() spread in the main description.  Move some of that text
to a headed subsection, and add a one-sentence introduction
describing the purpose of pselect().

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 10:14:13 +01:00
Michael Kerrisk 1eda1a3a5b select.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-18 08:40:54 +01:00
Michael Kerrisk 2054c92aa1 syscalls.2: Add new Linux 5.6 system calls
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-15 23:18:58 +01:00
Michael Kerrisk 3b31da1a4d Start of man-pages-5.06: updating Changes and Changes.old 2020-02-09 17:49:10 +01:00
Michael Kerrisk dbf7b7abb6 Start of man-pages-5.06: updating .Announce and .lsm files 2020-02-09 17:49:10 +01:00
Michael Kerrisk 647ac92b7f Start of man-pages-5.06: renaming .Announce and .lsm files 2020-02-09 17:49:10 +01:00
Michael Kerrisk 512669dce1 Ready for 5.05 2020-02-09 12:24:58 +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 c8f25a0524 Changes: Ready for 5.05
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-09 10:25:48 +01:00
Michael Kerrisk 93902a96eb stime.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-09 10:25:48 +01:00
Michael Kerrisk 9ec6412745 malloc.3: Minor tweaks to Vegard Nossum's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 23:37:21 +01:00
Vegard Nossum 813d606b00 malloc.3: realloc() return value
One might be tempted to think that realloc() always requests a new
allocation before moving the contents over (at least in the case
where the new size is bigger than the original). This is not the
case; for example, on my system the following program:

	#include <stdlib.h>
	#include <stdio.h>
	#include <unistd.h>

	int main(int argc, char *argv[])
	{
		void *x = malloc(15);
		void *y = malloc(32);

		printf("x = %p\n", x);
		printf("y = %p\n", y);
		printf("usable_size(x) = %lu\n", malloc_usable_size(x));

		void *z = realloc(x, 24);
		printf("z = %p\n", z);

		return 0;
	}

prints:

	x = 0x1b3a010
	y = 0x1b3a030
	usable_size(x) = 24
	z = 0x1b3a010

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 23:37:10 +01:00
Michael Kerrisk f3aa51b217 fcntl.2: Further tweaks to F_SEAL_FUTURE_WRITE text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 14:10:31 +01:00
Michael Kerrisk e15b10ba32 memfd_create.2: Minor tweaks's to Joel Fernandes's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 13:04:07 +01:00
Michael Kerrisk fc6a14f557 memfd_create.2: srcfix: semantic line breaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 13:04:07 +01:00
Joel Fernandes (Google) 98eff9f7e5 memfd_create.2: Update manpage with new memfd F_SEAL_FUTURE_WRITE seal
More details of the seal can be found in the LKML patch:
https://lore.kernel.org/lkml/20181120052137.74317-1-joel@joelfernandes.org/T/#t

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 13:04:07 +01:00
Michael Kerrisk e1cd30eb5e fcntl.2: Note kernel version for F_SEAL_FUTURE_WRITE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 13:04:07 +01:00
Michael Kerrisk e9a2c239b3 fcntl.2: Minor tweaks to Joel Fernandes's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 12:37:39 +01:00
Michael Kerrisk 9341a793d0 fcntl.2: srcfix: rewrap source lines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 12:31:11 +01:00
Michael Kerrisk e38bb9196d fcntl.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 12:09:56 +01:00
Joel Fernandes (Google) 7b7d3b200a fcntl.2: Update manpage with new memfd F_SEAL_FUTURE_WRITE seal
More details of the seal can be found in the LKML patch:
https://lore.kernel.org/lkml/20181120052137.74317-1-joel@joelfernandes.org/T/#t

Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 12:09:07 +01:00
Benjamin Peterson f3491e47ba exit.3: Use hex for the status mask
Admittedly, the POSIX specification for exit() also uses octal.
However, 0xFF immediately indicates the lowest 8 bits to me
whereas I had to think a bit about the octal mask.

Cowritten-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 11:59:37 +01:00
Michael Kerrisk ba9ae75ddb clone.2: Add old EINVAL error for AArch64
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 09:11:01 +01:00
Michael Kerrisk f44b032900 listen.2: The 'somaxconn' default value has increased to 4096
See https://bugzilla.suse.com/show_bug.cgi?id=1162464

Reported-by: Peter Gajdos <pgajdos@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 18:02:52 +01:00
Michael Kerrisk a2587fbb2e open.2: In O_TMPFILE example, describe alternative linkat() call
This was already shown in an earlier version of the page,
but Adam Borowski's patch replaced it with an alternative.
Probably, it is better to show both possibilities.

Reported-by: "Joseph C. Sible" <josephcsible@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 17:59:34 +01:00
Adam Borowski fc29a199d9 open.2: No need for /proc to make an O_TMPFILE file permanent
In the example snippet, we already have the fd, thus there's no
need to refer to the file by name.  And, /proc/ might be not
mounted or not accessible.

Noticed-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 17:30:45 +01:00
Michael Kerrisk cb83181db3 console_codes.4: Minor tweaks to Adam Borowski's patches
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 17:26:21 +01:00
Michael Kerrisk 40fe605beb console_codes.4: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 17:18:39 +01:00
Adam Borowski 329eb744fa console_codes.4: Document \e[90m to 97, 100 to 107
Supported since fadb4244085cd04fd9c8b3a4b3bc161f506431f3 (4.9),
100..107 are supposed to be bright but this does not yet work
(unmerged patches to do so exist).

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 16:35:48 +01:00
Adam Borowski f1779b1234 console_codes.4: Update \e[38m and \e[48m
Supported since cec5b2a97a11ade56a701e83044d0a2a984c67b4 (3.16).

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 16:33:15 +01:00
Adam Borowski a133a6bc03 console_codes.4: \e[21m is now underline
Since 65d9982d7e523a1a8e7c9af012da0d166f72fc56 (4.17), it follows
xterm rather than common sense and consistency, being the only
command 1..9 where N+20 doesn't undo what N did.  As libvte
0.51.90 got changed the same way, this behaviour will probably
stay.

Signed-off-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 16:28:50 +01:00
Yu Jian Wu 03ba66f3a6 ioctl_userfaultfd.2: wfix
Hi,

Patch as attached. I think the comment on the variables in the struct is
reversed.

Thanks!

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 16:21:18 +01:00
Dmitry V. Levin 0482a85341 cmsg.3: ffix
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 16:16:34 +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
Michael Kerrisk e4c98f64d1 cmsg.3: Modify CMSG_DATA() example to use memcpy()
See previous patch to this page for rationale

Reported-by: Rich Felker <dalias@libc.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-05 01:21:17 +01:00
Rich Felker 36d25246b4 cmsg.3: Clarify alignment issues and correct method of accessing CMSG_DATA()
From an email by Rich Felker:

It came to my attention while reviewing possible breakage with
move to 64-bit time_t that some applications are dereferencing
data in socket control messages (particularly SCM_TIMESTAMP*)
in-place as the message type, rather than memcpy'ing it to
appropriate storage. This necessarily does not work and is not
supportable if the message contains data with greater alignment
requirement than the header. In particular, on 32-bit archs,
cmsghdr has size 12 and alignment 4, but struct timeval and
timespec may have alignment requirement 8.

I found at least ptpd, socat, and ssmping doing this via Debian
Code Search:

https://sources.debian.org/src/ptpd/2.3.1-debian1-4/src/dep/net.c/?hl=1578#L1578
https://sources.debian.org/src/socat/1.7.3.3-2/xio-socket.c/?hl=1839#L1839
https://sources.debian.org/src/ssmping/0.9.1-3/ssmpngcl.c/?hl=307#L307

and I suspect there are a good deal more out there. On most archs
they won't break, or will visibly break with SIGBUS, but in theory
it's possible that they silently read wrong data and this might
happen on some older and more tiny-embedded-oriented archs.

I think it's clear to someone who understands alignment and who's
thought about it that applications just can't do this, but it
doesn't seem to be documented, and an example in cmsg(3) even
shows access to int payload via *(int *)CMSG_DATA(cmsg) (of course
int is safe because its alignment is <= header alignment, but this
is not mentioned).

Could we add text, and perhaps change the example, to indicate
that in general memcpy needs to be used to copy the payload
to/from a suitable object?

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-05 01:16:10 +01:00
Michael Kerrisk 477b8f4b6f exec.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-04 00:42:34 +01:00
Michael Kerrisk c98fe9f8ad seccomp.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-22 05:23:50 +01:00
Michael Kerrisk b386cee344 clone.2: Note the kernel version that added the 'set_tid' feature
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-22 02:19:09 +01:00
Michael Kerrisk 27f14b447a clone.2: Document CLONE_CLEAR_SIGHAND
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-22 02:09:17 +01:00
Denys Vlasenko 302c512cef ptrace.2: PTRACE_EVENT_STOP does not always report SIGTRAP
PTRACE_EVENT_STOP does not always report SIGTRAP, can be the
signal which stopped us

While at it, fix an obvious copy/paste error in
PTRACE_GET_SYSCALL_INFO description.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-22 01:14:19 +01:00
Michael Kerrisk 2b6923ba65 userfaultfd.2: Note that CAP_SYS_PTRACE is checked in the *initial* user namespace
(Add a detail missing in Yang Xu's patch.)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 22:02:04 +01:00
Michael Kerrisk 465b6c35e9 proc.5: Document /proc/sys/vm/unprivileged_userfaultfd
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 22:01:35 +01:00
Michael Kerrisk c4f13bc72a userfaultfd.2: Tweaks to Yang Xu's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 22:01:35 +01:00
Yang Xu 339b899c4c userfaultfd.2: Add EPERM error
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 21:46:23 +01:00
Michael Kerrisk f7eff3e7e0 loop.4: Minor tweaks to Yang Xu's patches
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 21:21:27 +01:00
Michael Kerrisk eb39881da1 loop.4: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 21:04:34 +01:00
Michael Kerrisk 38ad865260 loop.4: srcfix: semantic line breaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 21:04:34 +01:00
Yang Xu 89593f2df6 loop.4: Document LOOP_SET_BLOCK_SIZE
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 21:00:59 +01:00
Yang Xu 9d40af2a55 loop.4: Document LOOP_SET_DIRECT_IO
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 21:00:45 +01:00
Daniel Colascione f46304f747 perf_event_open.2: Mention EINTR for perf_event_open
Somewhat surprisingly, perf_event_open() can fail with EINTR when
trying to enable perf reporting for a uprobe that's already been
configured for use with ftrace. Mention this error in the man
page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 20:48:28 +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
Mike Salvatore 4207253f85 getcwd.3: wfix
This patch is a minor wording fix in getcwd.3 that changes "In the case getcwd()" to "In the case of getcwd()". This patch should apply cleanly to the master branch of the git repository.

Regards,
Mike Salvatore

From 3b68ad225dbaada2b1b55153dc57807b04531cd6 Mon Sep 17 00:00:00 2001
From: Mike Salvatore <mike.salvatore@canonical.com>
Date: Thu, 16 Jan 2020 16:08:08 -0500
Subject: [PATCH] getcwd.3: wfix

Signed-off-by: Mike Salvatore <mike.salvatore@canonical.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 20:13:56 +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 a473f8a707 fanotify_init.2: srcfix
Reported-by: Sam Varshavchik <mrsam@courier-mta.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 20:07:34 +01:00
Michael Kerrisk ee8bb310d8 clone.2: Minor tweaks to Adrian Reber's 'set_tid' patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-12 21:47:35 +01:00
Michael Kerrisk 09007c4b88 clone.2: srcfix: semantic line breaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-12 21:47:35 +01:00
Adrian Reber bf031aaa54 clone.2: Add clone3() set_tid information
Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-12 21:47:29 +01:00
Ponnuvel Palaniyappan 09e456c2d0 futex.2: Fix a bug in the example
The man page contains a trivial bug that's discussed here:
https://stackoverflow.com/q/59628958

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-10 21:30:29 +01:00
Michael Kerrisk 4897b19d4e syscall.2: Minor tweaks to Petr Vorel's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-10 21:12:20 +01:00
Petr Vorel ce0f522790 syscall.2: Update feature test macro requirements
Reported-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-10 21:07:55 +01:00
Petr Vorel d1715bcd15 malloc.3: Remove duplicate _GNU_SOURCE
Fixes: d8d701003 ("malloc.3: Since glibc 2.29, realloc() is exposed by
defining _DEFAULT_SOURCE")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-10 20:57:14 +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
Samuel Thibault 378e5745a4 getpt.3: Remove mention of O_NOCTTY
The glibc implementation of getpt has actually never been setting
O_NOCTTY when opening /dev/ptmx or BSD ptys.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-01 08:26:31 +01:00
Marko Myllynen 305c001324 ldconfig.8: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-30 19:55:30 +01:00
John Hubbard e15ff1e76d move_pages.2: Remove ENOENT from the list of possible return values
Linux kernel commit e78bbfa82624 ("mm: stop returning -ENOENT from
sys_move_pages() if nothing got migrated") had the effect of
*never* returning -ENOENT, in any situation. So we need to update
the man page to reflect that ENOENT is not a possible return
value.

Acked-by: Michal Hocko <mhocko@suse.com>
Cc: Brice Goglin <Brice.Goglin@inria.fr>
Cc: Yang Shi <yang.shi@linux.alibaba.com>
Cc: Christoph Lameter <cl@linux.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-30 19:53:31 +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
Michael Kerrisk ef0ba060b3 capabilities.7: Minor clarification of historical behavior
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-30 11:01:01 +01:00
Michael Kerrisk bafa494386 capabilities.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-30 11:01:01 +01:00
Michael Kerrisk 5373f62f1e ldconfig.8: srcfix: semantic line breaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-14 05:53:47 +01:00
DJ Delorie 9ad4c53515 ldconfig.8: Document file filter and symlink pattern expectations
Information gleaned from comments in glibc's elf/ldconfig.c

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-14 05:53:47 +01:00
Andy Lutomirski 59b191dc04 modify_ldt.2, set_thread_area.2: Fix type of base_addr
Historically (before Linux 2.6.23), base_addr was unsigned long
for 32-bit code and unsigned int for 64-bit code.  In other words,
it was always a 32-bit value.  When the ldt.h header files were
unified, the type became unsigned int on all systems.  Update
modify_ldt.2 and set_thread_area.2 accordingly.

Indeed, on x86, the GDT and LDT specify 32-bit bases for code and
data segments, and this has nothing to do with the kernel.

Reported-by: "Metzger, Markus T" <markus.t.metzger@intel.com>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-14 05:53:47 +01:00
Michael Kerrisk 36a35d6735 quotactl.2: Don't show numeric values of Q_XQUOTAON XFS_QUOTA_?DQ_* flags
The programmer should not need to care about the numeric values,
and their inclusion is verbosity.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-13 18:07:27 +01:00
Michael Kerrisk 0674437054 quotactl.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-13 18:03:33 +01:00
Michael Kerrisk fcd4007bfa quotactl.2: srcfix: semantic line breaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-13 18:03:14 +01:00
Michael Kerrisk 64e4eac9ea quotactl.2: Tweaks to Yang Xu's Q_XQUOTARM EINVAL patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-13 18:03:08 +01:00
Yang Xu ef9e5be04f quotactl.2: Add EINVAL error of Q_XQUOTARM operation
Since kernel commit 3dd4d40b4208("xfs: Sanity check flags
of Q_XQUOTARM call"), it has added flags check. If it is
not usr,grp,prj quota type, it will report EINVAL.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-13 17:51:09 +01:00
Michael Kerrisk 8bdc484e43 packet.7: Add comment noting when 'tp_vlan_tpid' field appeared
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-12 09:55:38 +01:00
kevin sztern 68d16cd0ae packet.7: Add missing tpacket_auxdata field (tp_vlan_tpid)
The definition of the tpacket_auxdata struct in the manpage is not
the same as the definition found in
/include/uapi/linux/if_packet.h.

In particular, instead of a tp_padding field, there is a
tp_vlan_tpid field. An example of a project using this field is
libpcap[1].

[1]: https://github.com/the-tcpdump-group/libpcap/blob/master/pcap-linux.c#L349

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-12 09:55:30 +01:00
Nikola Forró b9827733ba copy_file_range.2: tfix
Signed-off-by: Nikola Forró <nforro@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-12 09:36:30 +01:00
Brennan Vincent d1203f4537 inotify.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-12 09:35:08 +01:00
Michael Kerrisk 782715806c capget.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-12 09:33:00 +01:00
Michael Kerrisk c0188da633 capget.2: Add missing details in EPERM error for setting inheritable capabilities
Reported-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-12 09:27:28 +01:00
Michael Kerrisk dca4bbfc0a elf.5: tfix
Reported-by: Robin Kuzmin <kuzmin.robin@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-11 23:01:08 +01:00
Michael Kerrisk 5dc3d7b78f sysctl.2: This system call was removed in Linux 5.5; adjust the page accordingly
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-11 23:01:08 +01:00
Michael Kerrisk 5afb9373df nl_langinfo.3: tfix
See https://sourceware.org/bugzilla/show_bug.cgi?id=25255

Reported-by: Weitian LI <liweitianux@live.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-11 23:01:08 +01:00
Adrian Reber bc03b11659 clone.2: tfix
Added two missing parentheses

Acked-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Adrian Reber <areber@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-01 09:03:31 +01:00
Michael Kerrisk daf57a6ae0 cgroups.7: Improve the discussion of the advantages of v2 release notification
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-29 13:39:55 +01:00
Michael Kerrisk c309dee7e1 cgroups.7: Describe the cgroup.events "frozen" key
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-29 13:39:55 +01:00
Michael Kerrisk 71e2545e90 cgroups.7: Split discussion of cgroups.events file and v2 release notification
In preparation for adding a description of the "frozen" key.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-29 13:39:55 +01:00
Michael Kerrisk 31261a5dcc cgroups.7: The v2 freezer controller was added in Linux 5.2
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-29 11:27:48 +01:00
Michael Kerrisk 445fc03eeb stime.2: Note that stime() is deprecated
As per glibc 2.31 feature notes.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-23 10:53:56 +01:00
Michael Kerrisk d279876353 gettimeofday.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-23 10:45:43 +01:00
Michael Kerrisk 0f18a233a3 ftime.3: Note that this function is deprecated
As noted in glibc 2.31 feature notes.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-23 10:38:28 +01:00
Christian Brauner 97883faea2 clone.2: tfix
This surely meant to say clone3() and not clone(3).

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-21 12:24:24 +01:00
Michael Kerrisk be479fdf02 clone.2: ERRORS: add EINVAL for use of CLONE_PARENT by an init process
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-21 10:52:14 +01:00
Michael Kerrisk 4269a6ab8b clone.2: Some reworking of Christian Braunner's CLONE_PARENT init text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-21 10:52:14 +01:00
Michael Kerrisk d36198870c clone.2: srcfix: rewrap source lines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-21 10:52:14 +01:00
Christian Brauner a17b9d28c3 clone.2: Mention that CLONE_PARENT is off-limits for inits
The CLONE_PARENT flag cannot but used by init processes. Let's mention
this in the manpages to prevent surprises.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-21 10:52:14 +01:00
Michael Kerrisk a10c5a33de clone.2: Note that CLONE_THREAD causes similar behavior to CLONE_PARENT
The introductory paragraphs note that "the calling process" is
normally synonymous with the "the parent process", except in the
case of CLONE_PARENT. The same is also true of CLONE_THREAD.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-21 10:52:14 +01:00
Michael Kerrisk cf4e631c96 vsock.7: Show size of svm_zero field in sockaddr_vm structure
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-21 10:52:14 +01:00
Michael Kerrisk 4475e3f07a vsock.7: Minor tweaks to Mikhail Golubev's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-21 10:52:14 +01:00
Mikhail Golubev 552c121013 vsock.7: Add missing structure element
The structure 'struct sockaddr_vm' has additional element
'unsigned char svm_zero[]' since version v3.9-rc1
(include/uapi/linux/vm_sockets.h).  Linux kernel checks that this
element is zeroed (net/vmw_vsock/vsock_addr.c). Reflect this on
the vsock man page.

Fixes: https://bugzilla.kernel.org/show_bug.cgi?id=205583
Signed-off-by: Mikhail Golubev <Mikhail.Golubev@opensynergy.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-21 10:52:14 +01:00
Jashank Jeremy 96605dde98 strtok.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-21 09:31:27 +01:00
Michael Kerrisk c3e1c677fa Start of man-pages-5.05: updating Changes and Changes.old 2019-11-19 22:09:30 +01:00
Michael Kerrisk ab272193ef Start of man-pages-5.05: updating .Announce and .lsm files 2019-11-19 22:09:30 +01:00
Michael Kerrisk 4783bc5f9b Start of man-pages-5.05: renaming .Announce and .lsm files 2019-11-19 22:09:30 +01:00
Michael Kerrisk 68e52ecf97 Ready for 5.04 2019-11-19 15:31:20 +01:00
Michael Kerrisk 324f6154f4 Removed trailing white space at end of lines 2019-11-19 15:31:20 +01:00
Michael Kerrisk e46733c47e bpf-helpers.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-19 15:31:20 +01:00
Michael Kerrisk a5409de92c clone.2, fallocate.2, ioctl_iflags.2, ioctl_list.2, pidfd_open.2, pivot_root.2, quotactl.2, seccomp.2, select.2, wait.2, proc.5, cgroups.7, netdevice.7, uts_namespaces.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-19 15:31:20 +01:00
Michael Kerrisk 15826ab929 Changes: Ready for 5.04
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-19 15:31:20 +01:00
Michael Kerrisk edca873239 bpf-helpers.7: Fix .TH line
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-19 12:50:47 +01:00
Michael Kerrisk 29965ffceb bpf-helpers.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-19 12:39:37 +01:00
Michael Kerrisk e6107b296a bpf-helpers.7: Refresh against kernel v5.4-rc7
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-19 12:36:56 +01:00
Christian Brauner be66dbc7a7 clone.2: Use pid_t for clone3() {child,parent}_tid
Advertise to userspace that they should use proper pid_t types
for arguments returning a pid.

The kernel-internal struct kernel_clone_args currently uses int
as type and since POSIX mandates that pid_t is a signed integer
type and glibc and friends use int this is not an issue. After
the merge window for v5.5 closes we can switch struct
kernel_clone_args over to using pid_t as well without any danger
in regressing current userspace.

Also note, that the new set tid feature which will be merged for
v5.5 uses pid_t types as well.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-17 18:58:24 +01:00
Christian Brauner 8eea66b8bb clone.2: Check for MAP_FAILED not NULL on mmap()
If mmap() fails it will return MAP_FAILED which according to the manpage
is (void *)-1 not NULL.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-17 18:56:07 +01:00
Christian Brauner 225f5da8ac clone.2: tfix
Fix two spelling mistakes in manpage describing the clone{2,3}()
syscalls/syscall wrappers.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-17 18:55:46 +01:00
Michael Kerrisk efc7fb935e mmap.2: tfix
Reported-by: Marko Myllynen <myllynen@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-16 23:35:14 +01:00
Michael Kerrisk 91243dad42 mmap.2: Some rewording of the description of MAP_STACK
Reword a little to allow for the fact that there are now
*two* reasons to consider using this flag.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-14 22:24:52 +01:00
Michael Kerrisk d3d881232b mmap.2: Note that MAP_STACK exists on some other systems
As noted in man-pages commit 99c3a00027,
MAP_STACK exists on at least OpenBSD and FreeBSD.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-14 22:24:52 +01:00
Michael Kerrisk 1b54731692 pivot_root.2: EXAMPLE: allocate stack using mmap() MAP_STACK rather than malloc()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-14 22:24:45 +01:00
Michael Kerrisk 99c3a00027 clone.2: Allocate child's stack using mmap(2) rather than malloc(3)
Christian Brauner suggested mmap(MAP_STACKED), rather than
malloc(), as the canonical way of allocating a stack for the
child of clone(), and Jann Horn noted some reasons why:

    Not on Linux, but on OpenBSD, they do use MAP_STACK now
    AFAIK; this was announced here:
    <http://openbsd-archive.7691.n7.nabble.com/stack-register-checking-td338238.html>.
    Basically they periodically check whether the userspace
    stack pointer points into a MAP_STACK region, and if not,
    they kill the process. So even if it's a no-op on Linux, it
    might make sense to advise people to use the flag to improve
    portability? I'm not sure if that's something that belongs
    in Linux manpages.

    Another reason against malloc() is that when setting up
    thread stacks in proper, reliable software, you'll probably
    want to place a guard page (in other words, a 4K PROT_NONE
    VMA) at the bottom of the stack to reliably catch stack
    overflows; and you probably don't want to do that with
    malloc, in particular with non-page-aligned allocations.

And the OpenBSD 6.5 manual pages says:

    MAP_STACK
        Indicate that the mapping is used as a stack. This
        flag must be used in combination with MAP_ANON and
        MAP_PRIVATE.

And I then noticed that MAP_STACK seems already to be on
FreeBSD for a long time:

    MAP_STACK
        Map the area as a stack.  MAP_ANON is implied.
        Offset should be 0, fd must be -1, and prot should
        include at least PROT_READ and PROT_WRITE.  This
        option creates a memory region that grows to at
        most len bytes in size, starting from the stack
        top and growing down.  The stack top is the start‐
        ing address returned by the call, plus len bytes.
        The bottom of the stack at maximum growth is the
        starting address returned by the call.

        The entire area is reserved from the point of view
        of other mmap() calls, even if not faulted in yet.

Reported-by: Jann Horn <jannh@google.com>
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-14 12:19:21 +01:00
Jakub Wilk 0f2b59f5ca strftime.3: wfix
Fix comma splice.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-13 20:35:53 +01:00
Michael Kerrisk 8dd6b0bcd2 clone.2: Minor tweaks after feedback from Christian Brauner
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-10 20:39:17 +01:00
Jakub Wilk edf93e146d clone.2: tfix
Remove duplicated word.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-09 12:54:41 +01:00
Michael Kerrisk baa435c66c clone.2: Tidy up the description of CLONE_DETACHED
The obsolete CLONE_DETACHED flag has never been properly
documented, but now the discussion CLONE_PIDFD also requires
mention of CLONE_DETACHED. So, properly document CLONE_DETACHED,
and mention its interactions with CLONE_PIDFD.

Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-09 09:09:18 +01:00
Michael Kerrisk f6183e5b21 clone.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-09 09:09:18 +01:00
Michael Kerrisk 981eda4aa5 clone.2: Consistently order paragraphs for CLONE_NEW* flags
Sometimes the descriptions of these flags mentioned the
corresponding section 7 namespace manual page and then the
required capabilities, and sometimes the order was the was
the reverse. Make it consistent.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-09 09:09:18 +01:00
Michael Kerrisk d2799a466c clone.2: Remove various details that are already covered in namespaces pages
Remove details of UTS, IPC, and network namespaces that are
already covered in the corresponding namespaces pages in
section 7. This change is for consistency, since corresponding
details were not provided for other namespace types in clone(2)
and these details do not appear in unshare(2).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-09 09:09:18 +01:00
Michael Kerrisk 4791ea7fda uts_namespaces.7: Add a little more detail on scope of UTS namespaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-09 09:09:18 +01:00
Michael Kerrisk 1270276bc3 clone.2: Remove wording that suggests CLONE_NEW* flags are for containers
These flags are used for implementing many other interesting
things by now.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-09 09:09:18 +01:00
Michael Kerrisk f5d5180f5c clone.2: Adjustments to clone3() text as well as some other details in the page
After feedback from Christian Brauner [1], I've adjusted a few pieces
of the clone3() text, and also adjusted some of the older text in
the page.

[1] https://lore.kernel.org/linux-man/20191107151941.dw4gtul5lrtax4se@wittgenstein/

Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-09 09:09:02 +01:00
Michael Kerrisk 1033756742 clone.2: Give the introductory paragraph a new coat of paint
Change the text in the introductory paragraph (which was written
20 years ago) to reflect the fact that clone*() does more things
nowadays.

Cowritten-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-08 16:32:38 +01:00
Michael Kerrisk 85d764718b resolv.conf.5: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-07 13:21:53 +01:00
Florian Weimer 551162f54f resolv.conf.5: Attempt clarify domain/search interaction
The domain directive is historic at this point; it should not
be used.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-07 13:20:35 +01:00
Michael Kerrisk 49cb13ca52 signal-safety.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-05 10:38:54 +01:00
Michael Kerrisk 1373b98190 ioctl_iflags.2: Emphasize that FS_IOC_GETFLAGS and FS_IOC_SETFLAGS argument is 'int *'
Reported-by: Robert Edmonds <edmonds@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-05 10:31:39 +01:00
Michael Kerrisk 556e715a8a ioctl_list.2: Add reference to ioctl(2) SEE ALSO section
The referenced section lists various pages that document ioctls.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-05 10:06:03 +01:00
Michael Kerrisk a1b3319b7c netdevice.7: Small wording fix in description of SIOCGIFCONF
SIOCGIFCONF returns "network layer" addresses (not "transport
layer").

Reported-by: Silviu Popescu <silviupopescu1990@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-05 09:25:21 +01:00
Andrew Price 3bf86e7d53 fallocate.2: Add gfs2 to the list of punch hole-capable filesystems
Also remove a stray " from the previous item.

Signed-off-by: Andrew Price <anprice@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-01 09:35:12 +01:00
Michael Kerrisk 75e28ebad4 clone.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-31 14:22:13 +01:00
Michael Kerrisk 400027959e clone.2, proc.5: Adjust references to namespaces(7)
Adjust references to namespaces(7) to be references to pages
describing specific namespace types.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-31 11:34:08 +01:00
Michael Kerrisk 96e60ae500 quotactl.2: wfix: consistently use 'operation', rather than 'command'
A mix of the two words was being used, with 'operation' being
more common.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-31 07:02:10 +01:00
Michael Kerrisk a5394cba1c quotactl.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-31 07:02:10 +01:00
Michael Kerrisk f5fd82cc4e quotactl.2: Minor tweaks to Yang Xu's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-31 07:02:10 +01:00
Yang Xu ae848b1d80 quotactl.2: Add some details about Q_QUOTAON
For Q_QUOTAON, on old kernel we can use quotacheck -ug to generate
quota files. But in current kernel, we can also hide them in
system inodes and indicate them by using "quota" or project
feature.

For user or group quota, we can do as below (etc ext4):

mkfs.ext4 -F -o quota /dev/sda5
mount /dev/sda5 /mnt
quotactl(QCMD(Q_QUOTAON, USRQUOTA), /dev/sda5, QFMT_VFS_V0, NULL);

For project quota, we can do as below (etc ext4):

mkfs.ext4 -F -o quota,project /dev/sda5
mount /dev/sda5 /mnt
quotactl(QCMD(Q_QUOTAON, PRJQUOTA), /dev/sda5, QFMT_VFS_V0, NULL);

Reported-by: Jan Kara <jack@suse.cz>
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-31 07:01:59 +01:00
Yang Xu 13a07cc485 copy_file_range.2: tfix
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-31 06:24:58 +01:00
Jakub Wilk a9e52b437f clone.2: Include clone3 in NAME section.
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-31 06:22:15 +01:00
Jakub Wilk 1191b4e7b2 netlink.7: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-31 06:21:50 +01:00
Torin Carey 897367f900 unix.7: tfix
In the given example, the second recvmsg(2) call should receive four bytes,
as the third sendmsg(2) call only sends four.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-31 06:18:30 +01:00
Torin Carey 6a14132925 unix.7: tfix
Signed-off-by: Torin Carey <torin@tcarey.uk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-31 06:18:19 +01:00
Michael Kerrisk 4e4e9e83b6 pidfd_open.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-30 10:23:10 +01:00
Michael Kerrisk 640453bbea cgroups.7: Switch to "considerate language"
Thanks-to: https://twitter.com/expensivestevie
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-28 14:32:07 +01:00
Michael Kerrisk 462ce23d49 seccomp.2: Switch to "considerate language"
Thanks-to: https://twitter.com/expensivestevie
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-28 12:40:36 +01:00
Michael Kerrisk 16853a31ee clone.2: Introduce "flags mask" as a generic term for clone()/clone3()
Use "flags mask" as a generic term to refer to the clone()
'flags' argument and the clone3() 'cl_args.flags' field.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-25 21:51:04 +02:00
Michael Kerrisk 5261b0fe75 clone.2: Minor improvements following clone3() additions
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-25 21:20:38 +02:00
Michael Kerrisk fb1fa92b0a clone.2: srcfix: update copyright
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-25 20:25:53 +02:00
Michael Kerrisk d89d14246a clone3.2: New link to clone(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-25 16:32:33 +02:00
Michael Kerrisk faa0e55ae9 clone.2: Document clone3()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-25 15:39:04 +02:00
Michael Kerrisk e2bf12346d clone.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24 15:34:14 +02:00
Michael Kerrisk b7cf324fd8 clone.2: Minor change: move a paragraph from DESCRIPTION to NOTES
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24 09:26:26 +02:00
Michael Kerrisk 5fbce8f22b clone.2: Add some subsection headings
Again, in preparation for adding clone3() documentation.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24 09:25:14 +02:00
Michael Kerrisk 81c2368f46 clone.2: Rename arguments for consistency with clone3()
Sometime soon, we'll have to add documentation of clone3() to this
page. As a preparatorys step, make the names of the clone()
arguments the same as the fields in the clone3() 'args' struct:

    ctid        ==> child_pid
    ptid        ==> parent_tid
    newtls      ==> tld
    child_stack ==> stack

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-24 09:13:44 +02:00
Michael Kerrisk 576b9ea7ae abort.3: wfix
Reported-by: Mikael Magnusson <mikachu@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-16 21:47:20 +02:00
Michael Kerrisk f83eb6bf0d mount.2, pidfd_open.2, fuse.4: Minor fix: s/file system/filesystem/
Reported-by: Marko Myllynen <myllynen@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-13 21:04:32 +02:00
Michael Kerrisk ff8ddd1121 wait.2: Clarify semantics of waitpid(0, ...)
As noted in kernel commit 821cc7b0b205c0df64cce59aacc330af251fa8f7,
threads create an ambiguity: what if the calling process's PGID
is changed by another thread while waitpid(0, ...) is blocked?
So, clarify that waitpid(0, ...) means wait for children whose
PGID matches the caller's PGID at the time of the call to
waitpid().

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-13 00:20:46 +02:00
Michael Kerrisk bc4a678613 wait.2: waitid() can be used to wait on children in same process group as caller
Since Linux 5.4, idtype == P_PGID && id == 0 can be used to wait
on children in same process group as caller.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:41:40 +02:00
Michael Kerrisk f3ea12fb84 wait.2: Add P_PIDFD for waiting on a child referred to by a PID file descriptor
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:41:40 +02:00
Michael Kerrisk 9e1b1cd286 pidfd_open.2: Note the waitid() use case for PID file descriptors
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:41:40 +02:00
Michael Kerrisk d069725512 pidfd_open.2: Minor fix: add some structure to text on use cases
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:41:40 +02:00
Michael Kerrisk ecefd5997f pidfd_open.2: Add a subsection header "Use cases for PID file descriptors"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:41:35 +02:00
Michael Kerrisk ecf77dbc1c pidfd_open.2: Make it a little more explicit the CLONE_PIDFD returns a PID FD
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:39:53 +02:00
Michael Kerrisk 6c7331a414 pidfd_open.2: Minor wording improvement
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:39:53 +02:00
Michael Kerrisk 441632abcc pidfd_open.2: Remove a redundant sentence
clone() CLONE_PIDFD is already mentioned elsewhere in NOTES.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 23:39:46 +02:00
Michael Kerrisk 0b1348ba35 getauxval.3: Clarify that AT_BASE_PLATFORM and AT_EXECFN return pointers to strings
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942207

Reported-by: Witold Baryluk <witold.baryluk@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 14:23:15 +02:00
Michael Kerrisk 23c167c6a5 select.2: POLLIN_SET/POLLOUT_SET/POLLEX_SET are now defined in terms of EPOLL*
Since kernel commit a9a08845e9acbd224e4ee466f5c1275ed50054e8, the
equivalence between select() and poll()/epoll is defined in terms
of the EPOLL* constants, rather than the POLL* constants.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 13:49:27 +02:00
Jakub Wilk bce2cf9805 mount_namespaces.7: tfix
Remove duplicated word.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-11 23:45:12 +02:00
Jakub Wilk 22bff75859 strptime.3: tfix
Escape hyphens.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-11 23:45:02 +02:00
Michael Kerrisk 5eb7b3cb3a Ready for 5.04 2019-10-11 23:07:30 +02:00
Michael Kerrisk 5d5a4ce13b Changes.old: Fix typos in 5.03 change log
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-11 22:36:08 +02:00
Michael Kerrisk 3bbd397157 Ready for 5.04 2019-10-11 22:15:52 +02:00
Michael Kerrisk c9f0cf93bb Start of man-pages-5.04: updating Changes and Changes.old 2019-10-11 11:01:23 +02:00
Michael Kerrisk 2c5d0a7d93 Start of man-pages-5.04: updating .Announce and .lsm files 2019-10-11 11:01:23 +02:00
Michael Kerrisk 7e3d2b865b Start of man-pages-5.04: renaming .Announce and .lsm files 2019-10-11 11:01:23 +02:00
Michael Kerrisk e12e9986fa Ready for 5.03 2019-10-11 10:56:00 +02:00
Michael Kerrisk 867c9b3408 localedef.1, close.2, copy_file_range.2, execve.2, get_robust_list.2, getdomainname.2, gethostname.2, inotify_add_watch.2, io_submit.2, ioctl_fideduperange.2, kcmp.2, kill.2, mmap.2, move_pages.2, perf_event_open.2, ptrace.2, rt_sigqueueinfo.2, sched_setaffinity.2, sched_setparam.2, setns.2, sigaction.2, signalfd.2, statx.2, syscall.2, syscalls.2, uname.2, write.2, errno.3, fexecve.3, getauxval.3, printf.3, pthread_mutex_consistent.3, pthread_mutexattr_init.3, pthread_mutexattr_setrobust.3, pthread_setcancelstate.3, regex.3, strtok.3, strtol.3, ttyname.3, smartpqi.4, core.5, resolv.conf.5, man-pages.7, mq_overview.7, operator.7, pthreads.7, signal-safety.7, sysvipc.7: Update timestamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-11 10:45:02 +02:00
Michael Kerrisk cdb9217972 Changes: Ready for 5.03
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-11 10:45:02 +02:00
Michael Kerrisk 20a3713221 pidfd_open.2: Further enhancements to fork() + pidfd_open() text
Christian noted that SA_NOCLDWAIT also matters in this scenario.

Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk b869edcbc9 pidfd_open.2: wfix
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 8f57d60f5c pidfd_open.2: tfix
Reported-by: Florian Weimer <fw@deneb.enyo.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 13ad736507 pidfd_open.2: Enhance the discussion of usage of fork() + pidfd_open()
After review comments from Christian and Daniel.

Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Reported-by: Daniel Colascione <dancol@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 59341b5269 pidfd_open.2: Explain how pidfd_open() can be used to with fork()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 6059228b26 pidfd_send_signal.2: Minor wording improvement
Reported-by: Daniel Colascione <dancol@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 6ff9a0d85e pidfd_send_signal.2: tfix
Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk d651cc6015 pidfd_send_signal.2: Fixes after review comments from Florian Weimer
Reported-by: Florian Weimer <fw@deneb.enyo.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk f831492d2b pidfd_send_signal.2: wfix
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 1a5adccc69 pidfd_open.2: Add some missing errors
Reported-by: Florian Weimer <fw@deneb.enyo.de>
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 57a436eb4c pidfd_open.2: Improve description in example
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 4e547536bb pidfd_open.2: Add a comment on system call number in example code
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk ad0434de58 pidfd_open.2: read(2) of a PID file descriptor fails with EINVAL
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 9e9bf5383a pidfd_open.2: wfix
Reported-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 1523b08d3b pidfd_open.2: wfix
Reported-by: Florian Weimer <fw@deneb.enyo.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 465f610c4c pidfd_open.2: Add <sys/types.h> to SYNOPSIS
Reported-by: Florian Weimer <fw@deneb.enyo.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 4654d63c35 pidfd_send_signal.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 690fbab2ee pidfd_open.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk d883766832 clone.2: SEE ALSO: add pidfd_open(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 30d0d39a4f pidfd_open.2: Opening /proc/PID doesn't yield a pollable file descriptor
Thus, pidfd_open() is the preferred way of obtaining a PID
file descriptor.

Notes from a conversation with Christian Brauner:

[[
> A further question... We now have three ways of getting a
> process file descriptor [*]:
>
> open() of /proc/PID
> pidfd_open()
> clone()/clone3() with CLONE_PIDFD
>
> I thought the FD was supposed to be equivalent in all three cases.
> However, if I try (on kernel 5.3) poll() an FD returned by opening
> /proc/PID, poll() tells me POLLNVAL for the FD. Is that difference
> intentional? (I am guessing it is not.)

It's intentional.
The short answer is that /proc/<pid> is a convenience for sending
signals.
The longer answer is that this stems from a heavy debate about what a
process file descriptor was supposed to be and some people pushing for
at least being able to use /proc/<pid> dirfds while ignoring security
problems as soon as you're talking about returning those fds from
clone(); not to mention the additional problems discovered when trying
to implementing this.
A "real" pidfd is one from CLONE_PIDFD or pidfd_open() and all features
such as exit notification, read, and other future extensions will only
be implemented on top of them.
As much as we'd have liked to get rid of two different file descriptor
types it doesn't hurt us much and is not that much different from what
we will e.g. see with fsinfo() in the new mount api which needs to work
on regular fds gotten via open()/openat() and mountfds gotten from
fsopen() and fspick(). The mountfds will also allow for advanced
operations that the other ones will not. There's even an argument to be
made that fds you will get from open()/openat() and openat2() are
different types since they have very different behavior; openat2()
returning fds that are non arbitrarily upgradable etc.
]]

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 4b5f60c597 sigaction.2: SEE ALSO: add pidfd_send_signal(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 8c2bb83d9b rt_sigqueueinfo.2: SEE ALSO: add pidfd_send_signal(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 86fd6bad0a signal.7: SEE ALSO: add pidfd_send_signal(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 86314949ad kill.2: SEE ALSO: add pidfd_send_signal(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 9517cf56fc pidfd_send_signal.2: New page documenting pidfd_send_signal(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk f110d8350c pidfd_open.2: New page documenting pidfd_open(2)
Notes from a conversation on linux-man@ with Christian Brauner:

[[
> [*} By the way, going forward, can we call these things
> "process FDs", rather than "PID FDs"? The API names are what
> they are, an that's okay, but these just as we have socket
> FDs that refer to sockets, directory FDs that refer to
> directories, and timer FDs that refer to timers, and so on,
> these are FDs that refer to *processes*, not "process IDs".
> It's a little thing, but I think the naming better, and
> it's what I propose to use in the manual pages.

The naming was another debate and we ended with this compromise.
I would just clarify that a pidfd is a process file descriptor. I
wouldn't make too much of a deal of hiding the shortcut "pidfd".
People are already using it out there in the wild and it's never
proven a good idea to go against accepted practice.
]]

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 34a975f8ae clone.2: Refer to pidfd_open(2) for the purpose of PID file descriptors
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk b97cc7ae40 clone.2: Minor wording improvements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 7d7dc1877f clone.2: Remove a CLONE_PIDFD detail that wasn't true in the final implementation
Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk b4ebffb230 clone.2: The close-on-exec flag is set on the new FD returned by CLONE_PIDFD
In the kernel source (kernel/fork.c::copy_process()), there is:

        pidfile = anon_inode_getfile("[pidfd]", &pidfd_fops, pid,
                                      O_RDWR | O_CLOEXEC);

Reviewed-by: Christian Brauner <christian.brauner@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 0eec009fb3 clone.2: ffix (split a paragraph)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 4e98b07476 clone.2: Minor tweaks to Christian Brauner's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 99f6c1d734 clone.2: srcfix: wrap source at sentence boundaries
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Christian Brauner 9f93898154 clone.2: Document CLONE_PIDFD
Add an entry for CLONE_PIDFD. This flag is available starting
with kernel 5.2. If specified, a process file descriptor
("pidfd") referring to the child process will be returned in
the ptid argument.

Signed-off-by: Christian Brauner <christian@brauner.io>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk a2dd6388a7 pivot_root.2: Update the copyright and license
After my rewriting, almost nothing of the original page remains,
so update the copyright. As the author, I'm relicensing to the
"verbatim" license most commonly used in man pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 875298005d pivot_root.2: Minor wording tweaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk ba4b07c30f pivot_root.2: Another couple of s/filesystem/mount/
This is consistent with some earlier changes suggested by
Eric Biederman.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 542175d8e4 pivot_root.2: Tweak text of an EINVAL error to correspond to DESCRIPTION
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 01c64c3b4b pivot_root.2: Relegate text about what pivot_root() may or may not do to NOTES
The text stating that "pivot_root() may or may not change the
current root and the current working directory of any processes
or threads which use the old root directory" was written 19 years
ago, before the system call itself was even finalized in the
kernel. The implementation has never changed, and it won't
change in the future, since that would cause user-space breakage.
The existence of that text in DESCRIPTION, followed by qualifying
text stating what the implementation actually does (and has always
done) makes for confusing reading. Therefore, relegate this text
to a historical note in NOTES (so that readers with long memories
can see why the manual page was changed) and rework the text in
DESCRIPTION accordingly.

Reported-by: Philipp Wendler <ml@philippwendler.de>
Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Reported-by: Reid Priedhorsky <reidpr@lanl.gov>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 3db820fe18 pivot_root.2: Add a subsection header for the pivot_root(".", ".") discussion
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 97076c5a0b pivot_root.2: Minor change: relocate a paragraph in NOTES
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 12:24:28 +02:00
Michael Kerrisk 0843016c9b pivot_root.2: s/root filesystem/root mount/
As suggested by Eric Biederman.

Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-10 11:37:02 +02:00
Michael Kerrisk 666373fc08 pivot_root.2: Reword one of the restrictions on 'new_root'
A suggested by Eric Biederman

Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-09 23:26:54 +02:00
Michael Kerrisk 33313a260c pivot_root.2: Change "filesystem" to "mount" in various places
Quoting Eric:

    If we are going to be pedantic "filesystem" is really the
    wrong concept here.  The section about bind mount clarifies
    it, but I wonder if there is a better term.

    I think I would say: "new_root and put_old must not be on
    the same mount as the current root."

    I think using "mount" instead of "filesystem" keeps the
    concepts less confusing.

    As I am reading through this email and seeing text that is
    trying to be precise and clear then hitting the term
    "filesystem" is a bit jarring.  pivot_root doesn't care a
    thing for file systems.  pivot_root only cares about mounts.

    And by a "mount" I mean the thing that you get when you
    create a bind mount or you call mount normally.

Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-09 12:14:35 +02:00
Michael Kerrisk 9f3af6b8c8 pivot_root.2: Simplify discussion of restrictions for 'new_root'
Philipp Wendler noted that the text on the restrictions for
'new_root' was slightly contradictory, and things could be
clarified and simplified by describing the restrictions on
'new_root' in one place.

Reported-by: Philipp Wendler <ml@philippwendler.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-09 09:40:15 +02:00
Michael Kerrisk b27d444f34 pivot_root.2: Remove an imprecision in description
Remove the text that suggests that pivot_root() changes the root
directory and CWD of process that have directory and CWD on the
old root *filesystem*. Change "filesystem" to "directory".

Reported-by: Philipp Wendler <ml@philippwendler.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-09 09:40:09 +02:00
Michael Kerrisk ee81d7e418 namespaces.7: Include manual page references in the summary table of namespace types
Make the page more compact by removing the stub subsections that
list the manual pages for the namespace types. And while we're
here, add an explanation of the table columns.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-09 08:59:22 +02:00
Michael Kerrisk 4d75df3711 mount_namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-09 08:25:04 +02:00
Michael Kerrisk 19416046c5 mount_namespaces.7: Tweak discussion of "less privileged" mount namespace
Eric Biederman:

    I hate to nitpick, but I am going to say that when I read
    the text above the phrase "mount namespace of the process
    that created the new mount namespace" feels wrong.

    Either you use unshare(2) and the mount namespace of the
    process that created the mount namespace changes.

    Or you use clone(2) and you could argue it is the new child
    that created the mount namespace.

    Having a different mount namespace at the end of the
    creation operation feels like it makes your phrase confusing
    about what the starting mount namespace is.  I hate to use
    references that are ambiguous when things are changing.

Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08 23:30:55 +02:00
Michael Kerrisk 534755eed9 mount_namespaces.7: Explain how a namespace's mount point list is initialized
Provide a more detailed explanation of the initialization of
the mount point list in a new mount namespace.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08 22:51:59 +02:00
Michael Kerrisk 47b69a37cf pivot_root.2: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08 21:29:28 +02:00
Michael Kerrisk 8f2a9129e6 pivot_root.2: Remove the term 'old_root'
Reid noted a confusion between 'old_root' (my attempt at a
shorthand for the old root point) and 'put_old. Eliminate the
confusion by replacing the shorthand with "old root mount point".

Reported-by: Reid Priedhorsky <reidpr@lanl.gov>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08 20:57:55 +02:00
Michael Kerrisk 459fe99546 mount.2: Describe the concept of "parent mounts"
Reported-by: Reid Priedhorsky <reidpr@lanl.gov>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08 17:26:51 +02:00
Michael Kerrisk e0e0ba7d01 mount.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08 17:23:20 +02:00
Michael Kerrisk dd858bfd5e mount.2: Rework the text on mount namespaces a little
Eliminate the term "Per-process namespaces" and add a reference
to mount_namespaces(7).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08 16:44:58 +02:00
Michael Kerrisk 5d3bcce72d mount.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08 16:44:58 +02:00
Michael Kerrisk 632940d96d mount.2: NOTES: add subsection heading for /proc/[pid]/{mounts,mountinfo}
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08 16:44:58 +02:00
Michael Kerrisk ed425459c5 mount_namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08 16:26:15 +02:00
Michael Kerrisk a0c9733194 mount_namespaces.7: Clarify description of "less privileged" mount namespaces
The current text talks about "parent mount namespaces", but there
is no such concept. As confirmed by Eric Biederman, what is mean
here is "the mount namespace this mount namespace started as a
copy of". So, this change writes up Eric's description in a more
detailed way.

Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-08 16:20:59 +02:00
Michael Kerrisk 93cc3b3827 pivot_root.2: Simplify pivot_root(".", ".") example
Eric Biederman notes that the change in commit f646ac88ef was
not strictly necessary for this example, since one of the already
documented requirements is that various mount points must not have
shared propagation, or else pivot_root() will fail. So, simplify
the example.

Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-07 14:02:42 +03:00
Michael Kerrisk a2fc45a9f8 mount_namespaces.7: It may be desirable to disable propagation after creating a namespace
After creating a new mount namespace, it may be desirable to
disable mount propagation. Give the reader a more explicit
hint about this.

Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-07 12:11:30 +03:00
Michael Kerrisk 0b6cf5d26e pthreads.7: Minor tweaks to Carlos O'Donell's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-05 14:54:24 +03:00
Michael Kerrisk 50639a2a18 pthread_setcancelstate.3, pthreads.7: srcfix: wrap source lines at sentence boundaries
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-05 14:54:15 +03:00
Carlos O'Donell dbb01cbbdb pthread_setcancelstate.3, pthreads.7, signal-safety.7: Describe issues with cancellation points in signal handlers
In a recent conversation with Mathieu Desnoyers I was reminded
that we haven't written up anything about how deferred
cancellation and asynchronous signal handlers interact. Mathieu
ran into some of this behaviour and I promised to improve the
documentation in this area to point out the potential pitfall.

Thoughts?

8< --- 8< --- 8<
In pthread_setcancelstate.3, pthreads.7, and signal-safety.7 we
describe that if you have an asynchronous signal nesting over a
deferred cancellation region that any cancellation point in the
signal handler may trigger a cancellation that will behave
as-if it was an asynchronous cancellation. This asynchronous
cancellation may have unexpected effects on the consistency of
the application. Therefore care should be taken with asynchronous
signals and deferred cancellation.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-05 14:54:02 +03:00
Michael Kerrisk c6ed23c5da perf_event_open.2: SEE ALSO: add Documentation/admin-guide/perf-security.rst
Reported-by: Alexey Budankov <alexey.budankov@linux.intel.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-05 11:30:42 +03:00
Michael Kerrisk 1ff5960b23 prctl.2: Clarify that PR_MCE_KILL_GET returns value via function result
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02 07:20:45 +03:00
Michael Kerrisk 035a7bf179 prctl.2: wfix (for consistency)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02 07:19:53 +03:00
Michael Kerrisk 7f5d84426c prctl.2: RETURN VALUE: add some missing entries
Note success return for PR_GET_SPECULATION_CTRL and PR_GET_FP_MODE.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02 07:09:38 +03:00
Michael Kerrisk 1cea09b38b prctl.2: Clarify that PR_GET_SPECULATION_CTRL returns value as function result
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02 06:56:50 +03:00
Michael Kerrisk f1bb579885 prctl.2: grfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02 06:11:02 +03:00
Michael Kerrisk f1ba3ad272 prctl.2: wfix (for consistency with usage in rest of this page)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02 06:07:52 +03:00
Michael Kerrisk 3946602978 prctl.2: Clarify that PR_GET_FP_MODE returns value as function result
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-02 06:05:50 +03:00
Michael Kerrisk 27f942adbc sched_setparam.2, pthread_mutexattr_init.3, pthread_mutexattr_setrobust.3, pthread_mutex_consistent.3, strtol.3, sched.7, uts_namespaces.7: SEE ALSO: correct list order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27 14:18:46 +02:00
Michael Kerrisk 1c6f266407 res_nclose.3: Add NEW link to resolver.3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27 14:18:46 +02:00
Michael Kerrisk c148832982 veth.4, persistent-keyring.7, process-keyring.7, session-keyring.7, thread-keyring.7, user-keyring.7, user-session-keyring.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27 14:18:46 +02:00
Michael Kerrisk 549597a85f close.2, execve.2, io_submit.2, prctl.2, write.2: Remove section number from references to function in its own page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27 14:18:46 +02:00
Michael Kerrisk 8f4f2de329 getlogin.3: grfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27 14:18:46 +02:00
Michael Kerrisk 49a2a1052b copy_file_range.2, fanotify_mark.2, inotify_add_watch.2, ioctl_fideduperange.2, kcmp.2, prctl.2, get_robust_list.2, tkill.2, ttyname.3: ERRORS: correct alphabetical order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27 14:18:08 +02:00
Amir Goldstein 88e75e2c56 copy_file_range.2: Kernel v5.3 updates
Update with all the missing errors the syscall can return, the
behaviour the syscall should have w.r.t. to copies within single
files, etc.

[Amir] updates for final released version.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27 13:26:03 +02:00
Michael Kerrisk 4985364098 epoll_wait.2: tfix
Reported-by: nilsocket <nilsocket@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-27 08:36:52 +02:00
Michael Kerrisk e72ae85154 strtok.3: Add portability note for strtok_r() '*saveptr' value
On some implementations, '*saveptr' must be NULL on first call
to strtok_r().

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-26 08:01:52 +02:00
Michael Kerrisk 85987f9818 strtok.3: The caller should not modify 'saveptr' between strtok_r() calls
Reported-by: eponymous alias <eponymousalias@yahoo.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-26 07:53:24 +02:00
Michael Kerrisk 362310a7bd signalfd.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-25 23:20:08 +02:00
Jakub Wilk bf421740d4 pivot_root.2: tfix
Remove duplicated words.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-25 20:41:48 +02:00
Michael Kerrisk d703afe9a6 sched_setaffinity.2: RETURN VALUE: sched_getaffinity() syscall differs from the wrapper
In RETURN VALUE, point reader at subsection noting that the return
value of the raw sched_setaffinity() system call differs from the
wrapper function in glibc.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-25 14:35:27 +02:00
Michael Kerrisk 618b1e7eca getauxval.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-24 22:02:22 +02:00
Michael Kerrisk be2e899b49 getauxval.3: srcfix: rewrap source lines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-24 22:01:19 +02:00
Raphael Moreira Zinsly a81869d0e6 getauxval.3: Add new cache geometry entries
Add entries for the new cache geometry values of the auxiliary
vector that got included in the kernel.

Signed-off-by: Raphael Moreira Zinsly <rzinsly@linux.vnet.ibm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-24 21:57:51 +02:00
Michael Kerrisk f3fdbe2812 open.2: tfix
Reported-by: Дилян Палаузов <dilyan.palauzov@aegee.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-24 12:16:07 +02:00
Michael Kerrisk b892d64f4f signalfd.2: Rewrite the text on epoll semantics
I also verified the behavior reported by Andrew Clayton
with the program below.

$ ./epoll_signalfd
PID of parent: 5661
PID of child:  5662
epoll_wait() returned 0
PID 5662: got signal 10
Successfully read signal, even though epoll_wait() didn't say FD was ready!

8x----8x----8x----8x----8x----8x----8x----8x----8x----8x----8x----8x----
/* epoll_signalfd.c */

#include <sys/signalfd.h>
#include <signal.h>
#include <sys/epoll.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

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

static void
signalTest(int sfd, int epfd)
{
    struct signalfd_siginfo fdsi;
    struct epoll_event rev;
    int ready;
    ssize_t s;

    usleep(50000);
    ready = epoll_wait(epfd, &rev, 1, 0);
    if (ready == -1)
        errExit("epoll_wait");

    printf("epoll_wait() returned %d\n", ready);

    s = read(sfd, &fdsi, sizeof(struct signalfd_siginfo));
    if (s != sizeof(struct signalfd_siginfo))
        errExit("read");

    printf("PID %ld: got signal %d\n", (long) getpid(), fdsi.ssi_signo);

    if (ready == 0 && s > 0)
        printf("Successfully read signal, even though epoll_wait() "
                "didn't say FD was ready!\n");
}

int
main(int argc, char *argv[])
{
    struct epoll_event ev;
    sigset_t mask;
    int sfd, epfd;

    sigfillset(&mask);
    sigdelset(&mask, SIGINT);

    if (sigprocmask(SIG_BLOCK, &mask, NULL) == -1)
        errExit("sigprocmask");

    sfd = signalfd(-1, &mask, SFD_NONBLOCK);
    if (sfd == -1)
        errExit("signalfd");

    epfd = epoll_create(5);
    if (epfd == -1)
        errExit("epoll_create");

    ev.data.fd = sfd;
    ev.events = EPOLLIN;
    if (epoll_ctl(epfd, EPOLL_CTL_ADD, sfd, &ev) == -1)
        errExit("epoll_ctl");

    switch (fork()) {
    case -1:
        errExit("fork");
    case 0:
        printf("PID of child:  %ld\n", (long) getpid());
        raise(SIGUSR1);
        signalTest(sfd, epfd);
        break;
    default:
        printf("PID of parent: %ld\n", (long) getpid());
        wait(NULL);
        break;
    }

    exit(EXIT_SUCCESS);
}
8x----8x----8x----8x----8x----8x----8x----8x----8x----8x----8x----8x----

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 16:48:36 +02:00
Andrew Clayton e95f6bf482 signalfd.2: Note about interactions with epoll & fork
Using signalfd(2) with epoll(7) and fork(2) can lead to some head
scratching.

It seems that when a signalfd file descriptor is added to epoll
you will only get notifications for signals sent to the process
that added the file descriptor to epoll.

So if you have a signalfd fd registered with epoll and then call
fork(2), perhaps by way of daemon(3) for example. Then you will
find that you no longer get notifications for signals sent to the
newly forked process.

User kentonv on ycombinator[0] explained it thus

    "One place where the inconsistency gets weird is when you
     use signalfd with epoll. The epoll will flag events on the
     signalfd based on the process where the signalfd was
     registered with epoll, not the process where the epoll is
     being used. One case where this can be surprising is if you
     set up a signalfd and an epoll and then fork() for the
     purpose of daemonizing -- now you will find that your epoll
     mysteriously doesn't deliver any events for the signalfd
     despite the signalfd otherwise appearing to function as
     expected."

And another post from the same person[1].

And then there is this snippet from this kernel commit message[2]

    "If you share epoll fd which contains our sigfd with another
     process you should blame yourself. signalfd is "really
     special"."

So add a note to the man page that points this out where people
will hopefully find it sooner rather than later!

[0]: https://news.ycombinator.com/item?id=9564975
[1]: https://stackoverflow.com/questions/26701159/sending-signalfd-to-another-process/29751604#29751604
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=d80e731ecab420ddcb79ee9d0ac427acbc187b4b

Signed-off-by: Andrew Clayton <andrew@digital-domain.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 15:57:21 +02:00
Michael Kerrisk 6c578de29d strtok.3: Correct description of use of 'saveptr' argument in strtok_r()
Reported-by: eponymous alias <eponymousalias@yahoo.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 15:57:11 +02:00
Michael Kerrisk 9d33e03b95 pivot_root.2: Explain why various mount points can't have shared propagation
Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk d4b2104ae5 pivot_root.2: Correct the list of mount points that can't be MS_SHARED
Eric Biederman noted that my list of directories that could not
have shared propagation was incorrect.  I had written that
new_root could not be shared; rather it should be: the parent of
the current root mount point.

Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk f646ac88ef pivot_root.2: Tweak pivot_root(".", ".") example
Quoting Eric Biederman:

    The concern from our conversation at the container
    mini-summit was that there is a pathology if in your initial
    mount namespace all of the mounts are marked MS_SHARED like
    systemd does (and is almost necessary if you are going to
    use mount propagation), that if new_root itself is MS_SHARED
    then unmounting the old_root could propagate.

    So I believe the desired sequence is:

    >>>            chdir(new_root);
    +++            mount("", ".", MS_SLAVE | MS_REC, NULL);
    >>>            pivot_root(".", ".");
    >>>            umount2(".", MNT_DETACH);

    The change to new new_root could be either MS_SLAVE or
    MS_PRIVATE.  So long as it is not MS_SHARED the mount won't
    propagate back to the parent mount namespace.

Reported-by: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 57bab66a92 pivot_root.2: pivot_root(".", ".") really is a thing
LXC uses this [1]. I tested, to double-check, and it works.

The fchdir() dance done by LXC is not needed though:

fchdir(old_root); umount(".", MNT_DETACH); fchdir(new_root);

As far as I can see, just the umount() is sufficient, since,
after pivot_root(), oldi_root is at the top of the stack
of mounts at "/" and thus (so long as CWD is at "/")
the umount will remove the mount at the top of the stack.
Eric Biederman confirmed my understanding by mail, and
Philipp Wendler verified my results by experiment.

[1] See the following commit in LXC:

    commit 2d489f9e87fa0cccd8a1762680a43eeff2fe1b6e
    Author: Serge Hallyn <serge.hallyn@ubuntu.com>
    Date:   Sat Sep 20 03:15:44 2014 +0000

        pivot_root: switch to a new mechanism (v2)

Helped-by: Eric W. Biederman <ebiederm@xmission.com>
Helped-by: Philipp Wendler <ml@philippwendler.de>
Helped-by: Aleksa Sarai <asarai@suse.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 682e1329f9 pivot_root.2: Eliminate text suggesting that behavior may change in the future
After around 19 years, the behavior of pivot_root() has not been
changed, and will almost certainly not change in the future.
So, reword to remove the suggestion that the behavior may change.
Also, more clearly document the effect of pivot_root() on
the calling process's current working directory.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 4a8b7d7b13 pivot_root.2: Rework a "hanging" description into an earlier paragraph
The reference of "Note that this also applies" was vague. So
combine this paragraph with an earlier one to make the linkage
clearer.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk aff78c76f7 pivot_root.2: Remove a note about a historical idea/expectation
The idea that there might one day be a mechanism for kernel
threads to explicitly relinquish access to the filesystem never
came to pass (after 20 years), and the presence of text
describing this idea is, IMO, a distraction. So, remove it.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk c4bf33331b pivot_root.2: ffix (break up a paragraph)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk eb9078a7a9 pivot_root.2: Remove text describing case where current root is not a mount point
One kernel printk() later, my suspicions seem confirmed: the text
describing the situation where the current root is not a mount
point (because of a chroot()) seems to be bogus. (Perhaps it was
true once upon a time.) In my testing, if the current root is not
a mount point, an EINVAL error results.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk fc17fc6502 pivot_root.2: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk d761305516 pivot_root.2: Fix a technical detail
In this text:

        If the current root is not a mount point (e.g., after an
        earlier chroot(2) or pivot_root())...

mention of pivot_root() makes no sense, since (as noted in an
earlier commit message for this page) 'new_root' in a previous
pivot_root() must (since Linux 2.4.5) have been a mount point.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 14caaed2c1 pivot_root.2: Minor change: rewrite the reference to pivot_root(8)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk bbae63c580 pivot_root.2: Remove BUGS section
One of these "bugs" is a philosophical point already covered
elsewhere in the page, while the other is a somewhat obscure joke.
Both pieces are a bit of a distraction, really.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 41d4557c09 pivot_root.2: Minor wording fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk fc2f474d77 pivot_root.2: Relocate details about kernel threads to NOTES
This text is a side point that somewhat distracts from the
flow in DESCRIPTION.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk b647c4c93a pivot_root.2: Add some more detail to the remaining EBUSY error
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 071505e9fb pivot_root.2: Remove bogus a bogus EBUSY error case
The note that EBUSY is given if a filesystem is already mounted
on 'Iput_old' was never really true. That restriction was in
Linux 2.3.14, but removed in Linux 2.3.99-pre6 so it never made
it to mainline.

The relevant diff in pivot_root() was:

        error = -EBUSY;
-       if (d_new_root->d_sb == root->d_sb || d_put_old->d_sb == root->d_sb)
+       if (new_nd.mnt == root_mnt || old_nd.mnt == root_mnt)
                goto out2; /* loop */
-       if (d_put_old != d_put_old->d_covers)
-               goto out2; /* mount point is busy */
        error = -EINVAL;

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 43d438e29b mount_namespaces.7: SEE ALSO: refer to example in pivot_root(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 2f2e1a2296 pivot_root.2: Add an example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 0c2329cdbe pivot_root.2: Minor fix: add a reference to a relevant piece in NOTES
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 422e36b7f2 pivot_root.2: Relocate text on use cases and add text on purpose of pivot_root(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk a94f69d6db pivot_root.2: Rework the text on "future changes" to reflect that 20 years have passed
Some of the text was written long ago, and hinted that things
might change in the future. However, 20 years have passed
and these details have not changed, so rework the text to
hint at that fact.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 3afc97b20b pivot_root.2: Mention containers as a use case for pivot_root()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 0ac6f9008e pivot_root.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk b16dd3037d pivot_root.2: There is no restriction against 'put_old' being a mount point
As far as I can see from the source code, the statement that
"No other filesystem may be mounted on 'put_old'" is incorrect.
Even looking at the 2.4.0 source code, there I can't see such
a restriction. In addition, some testing on a 5.0 kernel
(mounting 'put_old' in the new mount namespace just before
pivot_root()) did not result in an error for this case when
calling pivot_root().

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:19 +02:00
Michael Kerrisk 83cc245d6d pivot_root.2: srcfix: add self to copyright
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk ac2eb791b3 pivot_root.2: pivot_root() affects only other processes in the same mount namespace
pivot_root() only affects the current working directory and root
directory of other processes in the same mount namespace as the
caller.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk 7cc1a16df6 pivot_root.2: Introduce mount namespaces in the very first sentence
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk fdc558bda9 pivot_root.2: Note capability requirements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk 81b24320d8 pivot_root.2: Mention mount namespaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk f42778c4e5 pivot_root.2: SEE ALSO: add mount_namespaces(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk 78f662e1c7 pivot_root.2: wfix
"At the time of writing" was ~20 years ago. Things
have not so far changed.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk 93dc6336f3 pivot_root.2: Reword some text that is currently rather hard to parse
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk 5f5751d37f pivot_root.2: Minor tweak
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk 14e47dbe60 pivot_root.2: Minor fix: place some text at a more logical location in the page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-23 13:11:18 +02:00
Michael Kerrisk cc245e5bf8 operator.7: Prefix and postfix ++/-- have different precedences
Harbison and Steele also agree on this.

Reported-by: Rick Stanley <rstanley@rsiny.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-22 22:58:45 +02:00
Michael Kerrisk e5f5563cba kill.2: Minor clarification
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19 21:34:26 +02:00
Michael Kerrisk a24fc082d0 rt_sigqueueinfo.2: Rename 'uinfo' argument to 'info'
This is more consistent with the naming in other pages
that refer to a 'siginfo_t' structure.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19 21:27:44 +02:00
Michael Kerrisk 8637b7a635 rt_sigqueueinfo.2: The rules for 'si_code' don't apply when sending a signal to oneself
The restriction on what values may be specified in 'si_code'
apply only when sending a signal to a process other than the
caller itself.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19 21:26:04 +02:00
Michael Kerrisk 1573536578 rt_sigqueueinfo.2: Note that 'si_code' can't be specified as SI_KERNEL
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19 20:55:00 +02:00
Michael Kerrisk debedd946c rt_sigqueueinfo.2: Minor restructuring in preparation for next patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19 20:51:15 +02:00
Mike Frysinger 5dd76c4449 setns.2: Fix CLONE_NEWNS restriction info
Threads are allowed to switch mount namespaces if the filesystem
details aren't being shared.  That's the purpose of the check in
the kernel quoted by the comment:

    if (fs->users != 1)
        return -EINVAL;

It's been this way since the code was originally merged in v3.8.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-19 08:37:45 +02:00
Michael Kerrisk 9914d8bdb8 ptrace.2: Fix description of 'is_error' field in 'struct ptrace_syscall_info'
Reported-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 20:48:34 +02:00
Nikola Forró c4f0c33fb6 mmap.2: Fix EINVAL conditions
Since introduction of MAP_SHARED_VALIDATE, in case flags contain
both MAP_PRIVATE and MAP_SHARED, mmap() doesn't fail with EINVAL,
it succeeds.

The reason for that is that MAP_SHARED_VALIDATE is in fact equal
to MAP_PRIVATE | MAP_SHARED.

This is intended behavior, see:
https://lwn.net/Articles/758594/
https://lwn.net/Articles/758598/

Signed-off-by: Nikola Forró <nforro@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 16:26:22 +02:00
Michael Kerrisk 8952468409 resolv.conf.5: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 16:01:58 +02:00
Nikola Forró c594a728b2 resolv.conf.5: Update information about search list
Since glibc 2.26, the number of domains in the search list is
no longer limited.

Reference:
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=3f853f22c87f0b671c0366eb290919719fa56c0e

Signed-off-by: Nikola Forró <nforro@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 16:00:27 +02:00
Michael Kerrisk 0fd4a9ef6d CONTRIBUTING: New file with some starting tips on how to contribute
Reported-by: Paul Wise <pabs3@bonedaddy.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 15:59:08 +02:00
Michael Kerrisk 4dfeb670df man-pages.7: Relocate and enhance the text on semantic newlines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 15:39:04 +02:00
Michael Kerrisk 724ca69c82 man-pages.7: Paragraphs should not be separated by blank lines
Reported-by: Paul Wise <pabs3@bonedaddy.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 15:26:13 +02:00
Michael Kerrisk 344bbbd16a core.5: Minor tweaks to Paul Wise's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 15:01:33 +02:00
Paul Wise a33adb814a core.5: Explain the new situation with argument splitting
Things changed in Linux v5.3-rc3 commit 315c69261dd3 from
splitting after template expansion to splitting beforehand.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 14:58:55 +02:00
Vincent Lefevre 986d5d0048 printf.3: Add detail on the first digit with the %e format
This requirement on the first digit with the %e format comes from
the ISO C standard. It ensures that all the digits in the output are
significant and forbids output with a precision less than requested.

Signed-off-by: Vincent Lefevre <vincent@vinc17.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 14:57:53 +02:00
Michael Kerrisk 5a7f305a18 fexecve.3: ERRORS: add ENOENT
Reported-by: Simone Piccardi <piccardi@truelite.it>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 14:57:53 +02:00
Michael Kerrisk 56b242b1b6 fexecve.3: ENOSYS occurs only if the kernel provides no execveat() syscall
Reported-by: Simone Piccardi <piccardi@truelite.it>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 14:57:53 +02:00
Matti Moell 17ea6db2d6 io_submit.2: Fix kernel version numbers for 'aio_rw_flags' flags
Even though the RFW_* flags were first introduced in Linux 4.6,
they could not be used with aio until 4.13 where the aio_rw_flags
field was added to struct iocb (9830f4be159b "fs: Use RWF_* flags
for AIO operations"). Correct the stated version for each flag.

Fixes: 2f72816f86 ("io_submit.2: Add kernel version numbers for various 'aio_rw_flags' flags")

Signed-off-by: Matti Möll <Matti.Moell@opensynergy.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 14:57:53 +02:00
Michael Kerrisk 6812112d03 move_pages.2: Some reworking of Yang Xu's text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 14:57:53 +02:00
Yang Xu b5874806cb move_pages.2: Mark E2BIG as deprecated
E2BIG was removed in 2.6.29, we should mark it as deprecated.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 13:48:18 +02:00
Michael Kerrisk 2896c55242 regex.3: Minor rewording
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 13:48:18 +02:00
Michael Kerrisk ce0fd56bd7 regex.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 12:47:32 +02:00
Michael Kerrisk e7a1bf89a2 regex.3: srcfix: Wrap source lines at sentence boundaries
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 12:44:34 +02:00
Rob Landley f8c3a92763 regex.3: Document REG_STARTEND
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 12:43:06 +02:00
Shawn Anastasio 6e164fba7e syscall.2: Add information for powerpc64
Add powerpc64 to the calling convention tables.

Signed-off-by: Shawn Anastasio <shawn@anastas.io>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-13 11:54:11 +02:00
Michael Kerrisk 227a368231 ptrace.2: Clarify meaning of ptrace_syscall_info 'is_error' field
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 10:50:02 +02:00
Michael Kerrisk 9d8f542d1f ptrace.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 10:50:02 +02:00
Michael Kerrisk f04534d22c ptrace.2: Describe the PTRACE_GET_SYSCALL_INFO 'op' value in more detail
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 10:49:56 +02:00
Michael Kerrisk 93c37f08be ptrace.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 10:49:56 +02:00
Michael Kerrisk 1c0955b15a ptrace.2: Minor tweaks to Dmitry Levin's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 10:49:51 +02:00
Dmitry V. Levin a60e8f1bb3 ptrace.2: Document struct ptrace_syscall_info
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-12 08:48:26 +02:00
Christopher M. Riedl 5f0922e7a0 mprotect.2: wfix
Signed-off-by: Christopher M. Riedl <cmr@informatik.wtf>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-11 15:00:19 +02:00
Michael Kerrisk 7fd5cf65c4 syscalls.2: Add clone3() and pidfd_open()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 13:43:56 +02:00
Michael Kerrisk 519f86ca43 syscalls.2: Add fsconfig(), fsmount(), fsopen(), fspick(), move_mount(), open_tree()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 13:43:56 +02:00
Michael Kerrisk 6d2c81ea36 syscalls.2: Add new syscalls in 5.1
Add io_uring_enter(), io_uring_register(), io_uring_setup(), and
pidfd_send_signal().

Signed-off-by:(), Michael(), Kerrisk(), <mtk.manpages@gmail.com>
2019-09-10 13:33:08 +02:00
Michael Kerrisk c3543fab53 ptrace.2: Minor tweaks to Dmitry Levin's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 12:49:01 +02:00
Dmitry V. Levin fc91449cb5 ptrace.2: Document PTRACE_GET_SYSCALL_INFO
PTRACE_GET_SYSCALL_INFO request was introduced by Linux kernel
commit 201766a20e30f982ccfe36bebfad9602c3ff574a aka
v5.3-rc1~65^2~23.

Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 12:45:14 +02:00
Michael Kerrisk fec82988e7 syscall.2: Update name of syscall instruction for riscv
As reported by Florin:

    In the first table, for the riscv Arch/ABI, the instruction
    should be ecall instead of scall.

    According the official manual, the instruction has been
    renamed.
    https://content.riscv.org/wp-content/uploads/2017/05/riscv-spec-v2.2.pdf

    "The SCALL and SBREAK instructions have been renamed to
    ECALL and EBREAK, respectively. Their encoding and
    functionality are unchanged."

Reported-by: Florin Blanaru <florin.blanaru96@gmail.com>
Reviewed-by: Adam Borowski <kilobyte@angband.pl>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 12:45:14 +02:00
Jakub Wilk b5e1b804f9 fanotify_mark.2: Document FAN_MOVE_SELF
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 12:45:14 +02:00
Jakub Wilk 10fa1da2a3 fanotify_mark.2: Add kernel version numbers for some FAN_* constants
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 12:45:14 +02:00
Jakub Wilk bbd7edea6e fanotify_mark.2: ffix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 12:45:14 +02:00
Jakub Wilk 8f397fb4a1 fanotify.7: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-10 12:45:14 +02:00
Michael Kerrisk 07b973b2f3 errno.3: Minor tweaks to Rasmus Villemoes's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-01 16:23:48 +02:00
Rasmus Villemoes 7a008ecff1 errno.3: Add some comments on EAGAIN/EWOULDBLOCK and EDEADLK/EDEADLOCK
Signed-off-by: Rasmus Villemoes <rv@rasmusvillemoes.dk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-09-01 16:14:43 +02:00
Michael Kerrisk 96f49e54da signal.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-28 11:58:00 +02:00
Michael Kerrisk b6088873ae prctl.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-27 13:56:13 +02:00
Michael Kerrisk 12e50d8079 smartpqi.4: wfix
Reported-by: Don Brace <Don.Brace@microchip.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-27 00:01:24 +02:00
Michael Kerrisk eb97197356 smartpqi.4: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:51:42 +02:00
Michael Kerrisk 14e400a77e smartpqi.4: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:50:48 +02:00
Murthy Bhat 22b3ed3dff smartpqi.4: Add sysfs entries
Reviewed-by: Matt Perricone <matt.perricone@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Signed-off-by: Murthy Bhat <Murthy.Bhat@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:49:38 +02:00
Dave Carroll e2c810de60 smartpqi.4: Add module param to hide vsep
Reviewed-by: Matt Perricone <matt.perricone@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Dave Carroll <david.carroll@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:47:27 +02:00
Gilbert Wu d7597d3395 smartpqi.4: Add module param expose ld first
Reviewed-by: Matt Perricone <matt.perricone@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Gilbert Wu <gilbert.wu@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:44:04 +02:00
Don Brace a099f728fc smartpqi.4: Update copyright
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:43:51 +02:00
Don Brace 1067062f22 smartpqi.4: tfix
- correct smarpqi to smartpqi

Reviewed-by: Scott Teel <scott.teel@microsemi.com>
Reviewed-by: Scott Benesh <scott.benesh@microsemi.com>
Reviewed-by: Kevin Barnett <kevin.barnett@microsemi.com>
Signed-off-by: Don Brace <don.brace@microsemi.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:42:04 +02:00
Marko Myllynen c27b4907fe localedef.1: describe recently added options
Describe few recently added options (present in glibc-2.29).

Sort the options a bit more logically and alphabetically.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:26:15 +02:00
Eric Biggers 15f2303db3 cgroups.7: tfix
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Eric Biggers ff085a5e44 socket.2: tfix
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Marko Myllynen d6094c8a3b capabilities.7: tfix
Hi Michael, it's been a while but few simple patches today..

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Marko Myllynen 8a6c2ad5a8 user_namespaces.7: tfix
This and the previous were the only ones grep found.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk d837569d1e uname.2: Replace reference to namespaces(7) with reference to uts_namespaces(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk 16ea6936c7 getdomainname.2: Add mention of UTS namespaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk 252bba449e uts_namespaces.7: SEE ALSO: add gethostname(2), getdomainname(2), uname(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk 79ea68831f gethostname.2: Mention UTS namespaces
Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk 30e022e516 namespaces.7: Remove content migrated to uts_namespaces(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk 57829a0e87 uts_namespaces.7: New page with content migrated from namespaces(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk ab1dc74922 mq_overview.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk c4279d2660 mq_overview.7, sysvipc.7: Adjust references to namespaces(7) to ipc_namespaces(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk 25e96f04bc namespaces.7: Remove content migrated to new ipc_namespaces(7) page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk 1d36b4e17b ipc_namespaces.7: New page with content migrated from namespaces(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Jakub Wilk 872e676db5 ld.so.8: tfix
Escape hyphens.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:49 +02:00
Michael Kerrisk 3b9d44099f signal.7: Enhance the text on process-directed and thread-directed signals
clone(2) has a good description of these concepts; borrow
from it liberally.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 23:14:42 +02:00
Michael Kerrisk ed4f87f0c8 clone.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 21:54:16 +02:00
Michael Kerrisk 96e472175c signal.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-26 21:45:13 +02:00
Michael Kerrisk 18b028be2d user_namespaces.7: Improve explanation of meaning of ownership of nonuser namespaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-20 09:56:33 +02:00
Michael Kerrisk c031ffcc56 statx.2: Clarify details of a case where an invalid 'mask' value may be rejected
As reported by Simone:

    I was looking at version from 2017-09-15 but it's the same
    on: http://man7.org/linux/man-pages/man2/statx.2.html
    (2019-03-06)

    There is reported (about the mask argument) after the list
    of constants:

    > Note that the kernel does not reject values in mask other
    > than the above.  Instead, it simply informs the caller which
    > values are sup‐ ported by this kernel and filesystem via the
    > statx.stx_mask field.

    But as reported in the error values, there can be EINVAL if
    mask has a reserved valued, and I found a check against
    STATX__RESERVED in fs/stat.c for this. So if you use a that
    bit (0x80000000U) the kernel will reject the value.

    Probably is better to say that the kernel do not enforce the
    use of only the listed values, but there are anyway reserved
    values so and so you cannot put whatever you want on mask
    (that apply to more values than UINT_MAX).

Reported-by: Simone Piccardi <piccardi@truelite.it>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-20 09:29:49 +02:00
Jakub Wilk 8d839a5673 proc.5: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-03 13:59:35 +02:00
Ingo Schwarze 8bfbac5d14 proc.5: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-02 14:35:07 +02:00
Michael Kerrisk 7e7e8de32e capabilities.7: CAP_SYS_ADMIN allows modifying autogroup nice values
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-02 13:57:10 +02:00
Michael Kerrisk 2af31be94a Changes.old: Fixes to 5.02 log
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-02 11:26:00 +02:00
Michael Kerrisk 22cacdfc94 Start of man-pages-5.03: updating Changes and Changes.old 2019-08-02 10:31:40 +02:00
Michael Kerrisk c8581488a4 Start of man-pages-5.03: updating .Announce and .lsm files 2019-08-02 10:31:40 +02:00
Michael Kerrisk 2c3fb83708 Start of man-pages-5.03: renaming .Announce and .lsm files 2019-08-02 10:31:40 +02:00
Michael Kerrisk 157de0be21 Ready for 5.02 2019-08-02 08:47:19 +02:00
Michael Kerrisk adb5263fcc proc.5: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-02 08:37:26 +02:00
Michael Kerrisk 0b9a799587 prctl.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-02 08:35:43 +02:00
Michael Kerrisk 63121bd499 pldd.1, bpf.2, chdir.2, clone.2, fanotify_init.2, fanotify_mark.2, intro.2, ipc.2, mount.2, mprotect.2, msgctl.2, msgget.2, msgop.2, pivot_root.2, pkey_alloc.2, poll.2, prctl.2, semctl.2, semget.2, semop.2, setxattr.2, shmctl.2, shmget.2, shmop.2, tkill.2, dlopen.3, exec.3, ftok.3, getutent.3, on_exit.3, strcat.3, cpuid.4, proc.5, capabilities.7, cgroup_namespaces.7, credentials.7, fanotify.7, mount_namespaces.7, namespaces.7, sched.7, signal.7, socket.7, unix.7, user_namespaces.7, vdso.7, xattr.7, ld.so.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-02 08:34:32 +02:00
Michael Kerrisk 962708055e Changes: Ready for 5.02
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-02 08:32:54 +02:00
Michael Kerrisk 8d7dde9f9c setxattr.2: Place new ERANGE error in correct alphabetical order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-01 19:33:38 +02:00
Michael Kerrisk cada754ad1 setxattr.2: Tweaks to Finn O'Leary's text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-01 19:33:38 +02:00
Finn O'Leary acea950099 setxattr.2: Add ERANGE to 'ERRORS' section
Hi,

Both the Ext2 filesystem handler and the Ext4 filesystem handler will
return the ERANGE error code. Ext2 will return it if the name or value is
too long to be able to be stored, Ext4 will return it if the name is too
long. For reference, the relevant files/lines (with excerpts) are:

fs/ext2/xattr.c: lines 394 to 396 in ext2_xattr_set
>  394         name_len = strlen(name);
>  395         if (name_len > 255 || value_len > sb->s_blocksize)
>  396                 return -ERANGE;

fs/ext4/xattr.c: lines 2317 to 2318 in ext4_xattr_set_handle
> 2317         if (strlen(name) > 255)
> 2318                 return -ERANGE;

Other filesystems also return this code:

xfs/libxfs/xfs_attr.h: lines 53 to 55
> * The maximum size (into the kernel or returned from the kernel) of an
> * attribute value or the buffer used for an attr_list() call.  Larger
> * sizes will result in an ERANGE return code.

It's possible that more filesystem handlers do this, a cursory grep shows
that most of the filesystem xattr handler files mention ERANGE in some
form. A suggested patch is below (I'm not 100% sure on the wording through).

Thanks

--
- Finn

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-08-01 19:33:38 +02:00
Michael Kerrisk fd6307c47f mount_namespaces.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-30 08:25:37 +02:00
Yang Xu c14f79303f prctl.2: Correct some details for PR_SET_TIMERSLACK
In kernel/sys.c, arg2 is an unsigned long value and it will never
less than 0. Also, since kernel commit id da8b44d5a9f8 (Linux
4.6), timer_slack_ns and default timer_slack_ns have been
converted into u64, the return value of PR_GET_TIMERSLACK has been
limited under ULONG_MAX.

The timer slack value also can be inherited by a child created via
fork(2).

Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-30 08:25:37 +02:00
Michael Kerrisk 2f368cc328 sched.7: SEE ALSO: add pthread_getschedparam(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-30 08:25:37 +02:00
Michael Kerrisk 0bdda5d08e poll.2: Note that poll() equivalent code for ppoll() is not quite equivalent
As reported by Alan Stern:

Here are two extracts from the man page for ppoll(2):

     Specifying a negative value in timeout means an infinite
     timeout.

     Other than the difference in the precision of the timeout
     argument, the following ppoll() call:

       ready = ppoll(&fds, nfds, tmo_p, &sigmask);

     is equivalent to atomically executing the following calls:

       sigset_t origmask;
       int timeout;

       timeout = (tmo_p == NULL) ? -1 :
                 (tmo_p->tv_sec * 1000 + tmo_p->tv_nsec / 1000000);
       pthread_sigmask(SIG_SETMASK, &sigmask, &origmask);
       ready = poll(&fds, nfds, timeout);
       pthread_sigmask(SIG_SETMASK, &origmask, NULL);

But if tmo_p->tv_sec is negative, the ppoll() call is not
equivalent to the corresponding poll() call.  The kernel rejects
negative values of tv_sec with an EINVAL error; it does not
interpret the value as meaning an infinite timeout.

(Yes, the kernel interprets tmo_p == NULL as an infinite timeout,
but the man page is still wrong for the case tmo_p->tv_sec < 0.)

Suggested fix: Following the end of the second extract above, add:

    except that negative time values in tmo_p are not
    interpreted as an infinite timeout.

Also, in the ERRORS section, change the text for EINVAL to:

    EINVAL The nfds value exceeds the RLIMIT_NOFILE value or
    *tmo_p contains an invalid (negative) time value.

Reported-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-30 08:25:27 +02:00
Michael Kerrisk 40ca38806d capabilities.7: Add pivot_root(2) to CAP_SYS_ADMIN list
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-28 13:34:28 +02:00
Michael Kerrisk 6f4a00d62f mount.2: ERRORS: Add a couple of EINVAL errors for MS_MOVE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-28 09:17:06 +02:00
Michael Kerrisk 0610c6f1f8 mount.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26 23:28:08 +02:00
Michael Kerrisk a68bb0b38d mount.2: SEE ALSO: add chroot(2) and pivot_root(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26 23:27:18 +02:00
Michael Kerrisk a39e880f67 pivot_root.2: 'put_old' can't be a mount point with MS_SHARED propagation
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26 23:22:59 +02:00
Michael Kerrisk 34a0f19c76 pivot_root.2: SEE ALSO: add mount(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26 17:10:58 +02:00
Michael Kerrisk 1a0b1fd76b pivot_root.2: ERRORS: EINVAL occurs if 'new_root' or its parent has shared propagation
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26 17:10:06 +02:00
Michael Kerrisk 37704bfc8f pivot_root.2: 'new_root' must be a mount point
It appears that 'new_root' may not have needed to be a mount
point on ancient kernels, but already in Linux 2.4.5, there
was the diff shown below. Verified also by testing.

@@ -1631,8 +1605,9 @@
  *  - we don't move root/cwd if they are not at the root (reason: if something
  *    cared enough to change them, it's probably wrong to force them elsewhere)
  *  - it's okay to pick a root that isn't the root of a file system, e.g.
- *    /nfs/my_root where /nfs is the mount point. Better avoid creating
- *    unreachable mount points this way, though.
+ *    /nfs/my_root where /nfs is the mount point. It must be a mountpoint,
+ *    though, so you may need to say mount --bind /nfs/my_root /nfs/my_root
+ *    first.
  */

 asmlinkage long sys_pivot_root(const char *new_root, const char *put_old)
@@ -1640,7 +1615,7 @@
        struct dentry *root;
        struct vfsmount *root_mnt;
        struct vfsmount *tmp;
-       struct nameidata new_nd, old_nd;
+       struct nameidata new_nd, old_nd, parent_nd, root_parent;
        char *name;
        int error;

@@ -1688,6 +1663,10 @@
        if (new_nd.mnt == root_mnt || old_nd.mnt == root_mnt)
                goto out2; /* loop */
        error = -EINVAL;
+       if (root_mnt->mnt_root != root)
+               goto out2;
+       if (new_nd.mnt->mnt_root != new_nd.dentry)
+               goto out2; /* not a mountpoint */
        tmp = old_nd.mnt; /* make sure we can reach put_old from new_root */
        spin_lock(&dcache_lock);
        if (tmp != new_nd.mnt) {

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-26 16:54:16 +02:00
Michael Kerrisk dc95a3a39f mount_namespaces.7: Clarify implications for other NS if mount point is removed in one NS
If a mount point is deleted or renamed or removed in one mount
namespace, this will cause an object that is mounted at that
location in another mount namespace to be unmounted (as verified
by experiment). This was implied by the existing text, but it is
better to make this detail explicit.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-24 07:11:35 +02:00
Michael Kerrisk 930e2ffac4 namespaces.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-23 21:42:58 +02:00
Michael Kerrisk e70abf48ff mount_namespaces.7: SEE ALSO: add pivot_root(2), pivot_root(8)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-22 20:59:38 +02:00
Michael Kerrisk ae4452ab98 namespaces.7: Note initial values of hostname and domainname in a new UTS namespace
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-20 23:50:50 +02:00
Michael Kerrisk ed9e645a84 getutent.3: Fix missing include file in EXAMPLE
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=932382

Reported-by: Thorsten Glaser <tg@mirbsd.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-20 15:56:34 +02:00
Michael Kerrisk 3b13efed75 capabilities.7: Add a note about using strace on binaries that have capabilities
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-17 04:19:01 +02:00
Michael Kerrisk 4d4708bfd2 getgroups.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-16 13:50:05 +02:00
Michael Kerrisk 6549145309 pldd.1: ffix
Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 13:03:00 -06:00
Michael Kerrisk 3319789c6a pldd.1: ffix: replace tab with spaces
Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 13:00:26 -06:00
Michael Kerrisk fb11d20834 pldd.1: Note that the glibc 2.30 pldd fix has been backported on some distros
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 12:58:51 -06:00
G. Branden Robinson da80c365d8 pldd.1: Minor wording fixes
* Establish the abbreviations DSO and PID in the lead paragraph
  since they are used later.
* Parallelize descriptions of help, usage, and version options
  with the "and exit" language used in getent(1), iconv(1),
  locale(1), localedef(1), memusage(1), memusagestat(1),
  mtrace(1), pldd(1), sprof(1), time(1), iconvconfig(8),
  zdump(8), and zic(8).

Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 12:50:48 -06:00
G. Branden Robinson d3863db865 pldd.1: Document glibc's unbreakage of tool.
glibc 2.30 isn't released yet, but a fix has been committed, and
Debian has even cherry-picked it for Debian GNU/Linux 10
("buster").  pldd works nicely now.

Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 12:48:55 -06:00
Michael Kerrisk 705ac54d0f signal.7: Minor text rework
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 12:18:08 -06:00
Michael Kerrisk 9b6aa9d133 signal.7: Some reworking of Michal Sekletar's text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 12:15:32 -06:00
Michael Kerrisk cd9b34fc58 signal.7: Relocate Michal Sekletar's text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 11:49:04 -06:00
Michal Sekletar e447e5bad3 signal.7: Clarify that siginfo_t isn't changed on coalescing
Confirmed by experiment by mtk:

$ cat siginfo_nonqueuing.c

                        } while (0)

static void
grimReaper(int sig, siginfo_t *si, void *ucontext)
{
    printf("caught signal %d\n", sig);

    printf("    si_pid=%ld, si_uid=%ld, si_status=%d\n",
            (long) si->si_pid, (long) si->si_uid, si->si_status);
}

static void
child(int sleepTime, uid_t uid, int status)
{
    switch (fork()) {
    case -1:
        errExit("fork");
    case 0:
        sleep(sleepTime);
        if (geteuid() == 0)
            setuid(uid);

        printf("Child %ld with UID %ld exiting with status %d\n",
                (long) getpid(),(long) getuid(), status);
        exit(status);
    default:
        return;
    }
}

int
main(int argc, char *argv[])
{
    struct sigaction sa;
    sigset_t blocking;

    sa.sa_sigaction = grimReaper;
    sa.sa_flags = SA_SIGINFO;
    sigemptyset(&sa.sa_mask);

    if (sigaction(SIGCHLD, &sa, NULL) == -1)
        errExit("sigaction");

    sigemptyset(&blocking);
    sigaddset(&blocking, SIGCHLD);
    if (sigprocmask(SIG_BLOCK, &blocking, NULL) == -1)
        errExit("sigprocmask");

    child(2, 20000, 20);
    child(3, 30000, 30);
    child(1, 10000, 10);

    sleep(5);

    if (sigprocmask(SIG_UNBLOCK, &blocking, NULL) == -1)
        errExit("sigprocmask");

    exit(EXIT_SUCCESS);
}
$ ./siginfo_nonqueuing
Child 4042 with UID 1000 exiting with status 10
Child 4040 with UID 1000 exiting with status 20
Child 4041 with UID 1000 exiting with status 30
caught signal 17
    si_pid=4042, si_uid=1000, si_status=10

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Lennart Poettering <lennart@poettering.net>

Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Michal Sekletar <msekleta@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 11:44:12 -06:00
Michael Kerrisk c7871135df signal.7: Add subsection on queuing and delivery semantics for standard signals
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 11:44:12 -06:00
Jakub Wilk ed386413f8 execve.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 10:15:48 -06:00
Michael Kerrisk 069be4fd22 bpf.2: Correct kernel version for JIT support on s390
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-13 18:05:50 +02:00
Michael Kerrisk ed33c6886c credentials.7: Note that /proc/PID/status shows a process's credentials
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-10 15:44:47 +02:00
Michael Kerrisk aa16684c95 signal.7: Various fields in /proc/PID/status show signal-related information
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-10 15:19:31 +02:00
Michael Kerrisk 9b8887eb94 proc.5: Correct description of /pro/PID/status 'ShdPnd' and 'SigPnd' fields
These fields are signal masks, not counters.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-10 14:54:10 +02:00
Michael Kerrisk a4e6603a52 proc.5: Clarify that various mask fields in /proc/PID/status are in hexadecimal
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-10 14:14:03 +02:00
Michael Kerrisk 8e2ca125e4 proc.5: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-10 14:11:07 +02:00
Michael Kerrisk 4c63ee20b0 tkill.2: glibc 2.30 provides a wrapper for tgkill()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-08 12:23:55 +02:00
Michael Kerrisk 5f2efacf9f ld.so.8: wfix: fix a clumsy wording that is hard to parse
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-05 10:16:01 +02:00
Michael Kerrisk ec8a211ed1 ld.so.8: Minor rewordings to ease readability
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 14:17:58 +02:00
Michael Kerrisk f642cc55db dlopen.3: wfix: consistently use "object" rather than "library"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 13:59:36 +02:00
Michael Kerrisk d031ca920e dlopen.3: Make it clear that RTLD_NODELETE also affects global variables
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 11:46:16 +02:00
Michael Kerrisk 9bdbaa8ab2 dlopen.3: An object opened with RTLD_LOCAL can be promoted to RTLD_GLOBAL
Verified by experiment:

$ cat prog.c
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

static int
callback(struct dl_phdr_info *info, size_t size, void *data)
{
    printf("\tName = %s\n", info->dlpi_name);

    return 0;
}

int
main(int argc, char *argv[])
{
    void *x1Handle, *x2Handle, *yHandle;
    void (*funcp)(void);
    char *err;

    x1Handle = dlopen("./lib_x1.so", RTLD_NOW | RTLD_LOCAL);
    if (x1Handle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    if (argc > 1) {
        x2Handle = dlopen("./lib_x2.so", RTLD_NOW | RTLD_GLOBAL);
        if (x2Handle == NULL) {
            fprintf(stderr, "dlopen: %s\n", dlerror());
            exit(EXIT_FAILURE);
        }
    }

    yHandle = dlopen("./lib_y1.so", RTLD_NOW | RTLD_LOCAL);
    if (yHandle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    (void) dlerror();                           /* Clear dlerror() */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
    funcp = (void (*)(void)) dlsym(yHandle, "y1_enter");
#pragma GCC diagnostic pop
    err = dlerror();
    if (err != NULL) {
        fprintf(stderr, "dlsym: %s", err);
        exit(EXIT_FAILURE);
    }

    (*funcp)();

    exit(EXIT_SUCCESS);
}

$ cat lib_x1.c
#include <stdio.h>

void
x1_enter(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat lib_x2.c
#include <stdio.h>

void
testfunc(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat lib_y1.c
#include <stdio.h>

void
testfunc(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void
y1_enter(void)
{
    extern void y2(void);

    printf("Called %s\n\n", __func__);

    testfunc();
}

$ cat Build.sh
#!/bin/sh

CFLAGS="-Wno-implicit-function-declaration -Wl,--no-as-needed"

cc $CFLAGS -g -fPIC -shared -o lib_x2.so lib_x2.c
cc $CFLAGS -g -fPIC -shared -o lib_x1.so lib_x1.c ./lib_x2.so
cc $CFLAGS -g -fPIC -shared -o lib_y1.so lib_y1.c

cc $CFLAGS -o prog prog.c -ldl

$ sh Build.sh

$ ./prog
Called y1_enter

Called lib_y1.c::testfunc
$ ./prog x
Called y1_enter

Called lib_x2.c::testfunc

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 11:15:12 +02:00
Michael Kerrisk da6b9a6172 dlopen.3: Minor wording fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 10:55:49 +02:00
Michael Kerrisk 58a4ac49d4 dlopen.3: Clarify when an executable's symbols can be used for symbol resolution
The --export-dynamic linker option is not the only way that main's
global symbols may end up in the dynamic symbol table and thus be
used to satisfy symbol reference in a shared object. A symbol
may also be placed into the dynamic symbol table if ld(1)
notices a dependency in another object during the static link.

Verified by experiment; see previous commit.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 10:06:36 +02:00
Michael Kerrisk 43898de488 dlopen.3: Clarify the rules for symbol resolution in a dlopen'ed object
The existing text wrongly implied that symbol look up first
occurred in the object and then in main, and did not mention
whether dependencies of main where used for symbol resolution.

Verified by experiment:

$ cat prog.c
#define _GNU_SOURCE
#include <link.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void            /* A function defined in both main and lib_x1 */
prog_x1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

/* The following function is forced into prog's dynamic symbol table
   because of the static link-time reference in lib_m1.so */

void            /* A function defined in both main and lib_y1 */
prog_y1_exp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

/* The following function is not forced into prog's dynamic symbol table */

void            /* A function defined in both main and lib_y1 */
prog_y1_noexp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

static int
callback(struct dl_phdr_info *info, size_t size, void *data)
{
    printf("\tName = %s\n", info->dlpi_name);

    return 0;
}

int
main(int argc, char *argv[])
{
    void *xHandle, *yHandle;
    void (*funcp)(void);
    char *err;

    xHandle = dlopen("./lib_x1.so", RTLD_NOW | RTLD_GLOBAL);
    if (xHandle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    yHandle = dlopen("./lib_y1.so", RTLD_NOW | RTLD_GLOBAL);
    if (yHandle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    /* Optionally display the link map() */

    if (argc > 1) {
        printf("Link map as shown from dl_iterate_phdr() callbacks:\n");
        dl_iterate_phdr(callback, NULL);
        printf("\n");
    }

    (void) dlerror();                           /* Clear dlerror() */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
    funcp = (void (*)(void)) dlsym(yHandle, "y1_enter");
#pragma GCC diagnostic pop
    err = dlerror();
    if (err != NULL) {
        fprintf(stderr, "dlsym: %s", err);
        exit(EXIT_FAILURE);
    }

    (*funcp)();

    exit(EXIT_SUCCESS);
}

$ cat lib_m1.c
#include <stdio.h>

void		/* A function defined in both lib_m1 and lib_y1 */
m1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

#if 1
void
dummy(void)
{
    extern void prog_y1_exp(void);

    prog_y1_exp();	/* Forces prog_y1_exp into prog's dynamic symbol table,
			   so that it will be visible also to lib_y1.so */
}
#endif

$ cat lib_x1.c
#include <stdio.h>

void		/* A function defined in both main and lib_x1 */
prog_x1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void		/* A function defined in both lib_x1 and lib_y1 */
x1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat lib_y1.c
#include <stdio.h>

void		/* A function defined in both lib_x1 and lib_y1 */
x1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void		/* A function defined in both main and lib_y1 */
prog_y1_exp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void		/* A function defined in both lib_m1 and lib_y1 */
m1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void		/* A function defined in both main and lib_y1 */
prog_y1_noexp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void
y1_enter(void)
{
    extern void y2(void);

    printf("Called %s\n\n", __func__);

    prog_x1();
    prog_y1_exp();
    prog_y1_noexp();
    x1_y1();
    m1_y1();
    y2();
}

$ cat lib_y2.c
#include <stdio.h>

void
y2(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat Build.sh
#!/bin/sh

CFLAGS="-Wno-implicit-function-declaration -Wl,--no-as-needed"

cc $CFLAGS -g -fPIC -shared -o lib_x1.so lib_x1.c
cc $CFLAGS -g -fPIC -shared -o lib_y2.so lib_y2.c
cc $CFLAGS -g -fPIC -shared -o lib_y1.so lib_y1.c ./lib_y2.so
cc $CFLAGS -g -fPIC -shared -o lib_m1.so lib_m1.c

#ED="-Wl,--export-dynamic"
cc $CFLAGS $ED -Wl,--rpath,$PWD -o prog prog.c -ldl lib_m1.so

$ sh Build.sh

$ ./prog x
Link map as shown from dl_iterate_phdr() callbacks:
	Name =
	Name = linux-vdso.so.1
	Name = /lib64/libdl.so.2
	Name = /home/mtk/tlpi/code/shlibs/dlopen_sym_res_expt/lib_m1.so
	Name = /lib64/libc.so.6
	Name = /lib64/ld-linux-x86-64.so.2
	Name = ./lib_x1.so
	Name = ./lib_y1.so
	Name = ./lib_y2.so

Called y1_enter

Called lib_x1.c::prog_x1
Called prog.c::prog_y1_exp
Called lib_y1.c::prog_y1_noexp
Called lib_x1.c::x1_y1
Called lib_m1.c::m1_y1
Called lib_y2.c::y2

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-03 09:45:55 +02:00
Michael Kerrisk ba20328e27 dlopen.3: Note that symbol use might keep a dlclose'd object in memory
My earlier commit was in error:

    commit 4a1af09bd1
    Author: Michael Kerrisk <mtk.manpages@gmail.com>
    Date:   Sat Mar 14 21:40:35 2015 +0100

        dlopen.3: Amend error in description of dlclose() behavior

    -If the reference count drops to zero and no other loaded libraries use
    -symbols in it, then the dynamic library is unloaded.
    +If the reference count drops to zero,
    +then the dynamic library is unloaded.

I doubted the removed text, because it provide little clue about
the scenario. The POSIX dlclose(3) specification actually details
the scenario sufficiently:

       Although  a dlclose() operation is not required to remove
       any functions or data objects  from  the  address  space,
       neither  is  an  implementation prohibited from doing so.
       The only restriction on such a removal is that  no  func‐
       tion nor data object shall be removed to which references
       have been relocated, until or unless all such  references
       are removed. For instance, an executable object file that
       had been loaded with a dlopen() operation specifying  the
       RTLD_GLOBAL flag might provide a target for dynamic relo‐
       cations performed in the processing of other  relocatable
       objects—in  such  environments, an application may assume
       that no relocation, once made, shall be undone or  remade
       unless  the  executable  object file containing the relo‐
       cated object has itself been removed.

Verified by experiment:

$ cat openlibs.c       # Test program

int
main(int argc, char *argv[])
{
    void *libHandle[MAX_LIBS];
    int lcnt;

    if (argc < 2) {
        fprintf(stderr, "Usage: %s lib-path...\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    lcnt = 0;

    for (int j = 1; j < argc; j++) {
        if (argv[j][0] != '-') {
            if (lcnt >= MAX_LIBS) {
                fprintf(stderr, "Too many libraries (limit: %d)\n", MAX_LIBS);
                exit(EXIT_FAILURE);
            }

            printf("[%d] Opening %s\n", lcnt, argv[j]);
            libHandle[lcnt] = dlopen(argv[j], RTLD_NOW | RTLD_GLOBAL);
            if (libHandle[lcnt] == NULL) {
                fprintf(stderr, "dlopen: %s\n", dlerror());
                exit(EXIT_FAILURE);
            }
            lcnt++;

        } else {    /* "-N" closes the Nth handle */

            int i = atoi(&argv[j][1]);
            printf("Closing handle %d\n", i);
            dlclose(libHandle[i]);
        }

        sleep(1);
        printf("\n");
    }

    printf("Program about to exit\n");

    exit(EXIT_SUCCESS);
}

$ cat lib_x1.c

void x1_func(void) { printf("Hello world\n"); }

__attribute__((constructor)) void x1_cstor(void)
{ printf("Called %s\n", __FUNCTION__); }

__attribute__((destructor)) void x1_dstor(void)
{ printf("Called %s\n", __FUNCTION__); }

$ cat lib_y1.c

void y1_func(void) { printf("Hello world\n"); }

__attribute__((constructor)) void y1_cstor(void)
{ printf("Called %s\n", __FUNCTION__); }

__attribute__((destructor)) void y1_dstor(void)
{ printf("Called %s\n", __FUNCTION__); }

static void testref(void) {
    /* The following reference, to a symbol in lib_x1.so shows that
       RTLD_GLOBAL may pin a library when it might otherwise have been
       released with dlclose() */
    extern void x1_func(void);
    x1_func();
}

$ cc -shared -fPIC -o lib_x1.so lib_x1.c
$ cc -shared -fPIC -o lib_y1.so lib_y1.c
$ cc -o openlibs openlibs.c -ldl

$ LD_LIBRARY_PATH=. ./openlibs lib_x1.so lib_y1.so -0 -1
[0] Opening lib_x1.so
Called x1_cstor

[1] Opening lib_y1.so
Called y1_cstor

Closing handle 0

Closing handle 1
Called y1_dstor
Called x1_dstor

Program about to exit
<end program output>

Note that x1_dstor was called only when handle 1 (lib_y1.so) was closed.
But, if we edit lib_y1 to remove the reference to x1_func(), things are
different:

$ cat lib_y1.c      # After editing

void y1_func(void) { printf("Hello world\n"); }

__attribute__((constructor)) void y1_cstor(void)
{ printf("Called %s\n", __FUNCTION__); }

__attribute__((destructor)) void y1_dstor(void)
{ printf("Called %s\n", __FUNCTION__); }

static void testref(void) {
    // extern void x1_func(void);
    // x1_func();
}

$ cc -shared -fPIC -o lib_y1.so lib_y1.c
$ LD_LIBRARY_PATH=. ./openlibs lib_x1.so lib_y1.so -0 -1
[0] Opening lib_x1.so
Called x1_cstor

[1] Opening lib_y1.so
Called y1_cstor

Closing handle 0
Called x1_dstor

Closing handle 1
Called y1_dstor

Program about to exit
<end program output>

This time, x1_dstor was called when handle 0 (lib_x1.so) was closed.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 15:55:09 +02:00
Michael Kerrisk df77f62baf dlopen.3: Clarify that constructors are called only when library is first loaded
And fix a wording error that I introduced back in 2015.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 15:01:20 +02:00
Michael Kerrisk cbd8927ff5 dlopen.3: On dlclose(), destructors are called when reference count falls to 0
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 14:56:15 +02:00
Michael Kerrisk df02277902 getauxval.3: grfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 10:19:00 +02:00
Michael Kerrisk b8cf6c2435 user_namespaces.7: Minor rewordings of recently added text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 10:09:24 +02:00
Michael Kerrisk 89a0bd8283 user_namespaces.7: Minor wording fix to recently added text
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-02 06:20:44 +02:00
Michael Kerrisk 43f4bec190 user_namespaces.7: Describe the effect of file-related capabilities inside use namespaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-01 12:18:44 +02:00
Michael Kerrisk ea8ec5785c user_namespaces.7: Describe how kernel treats UIDs/GIDs when a process access to files
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-01 11:11:19 +02:00
Michael Kerrisk c99eb2b204 capabilities.7: CAP_FOWNER also allows modifying user xattrs on sticky directories
See fs/xattr.c::xattr_permission()"

        /*
         * In the user.* namespace, only regular files and directories can have
         * extended attributes. For sticky directories, only the owner and
         * privileged users can write attributes.
         */
        if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) {
                if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
                        return (mask & MAY_WRITE) ? -EPERM : -ENODATA;
                if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
                    (mask & MAY_WRITE) && !inode_owner_or_capable(inode))
                        return -EPERM;
        }

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-01 09:59:37 +02:00
Michael Kerrisk fc8d1db1b4 xattr.7: s/extended system attributes/system extended attributes/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-01 09:59:06 +02:00
Michael Kerrisk b25d3e704c xattr.7: wfix: s/extended user attributes/user extended attributes/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-07-01 09:59:06 +02:00
Michael Kerrisk e2340cf748 unix.7: Note SCM_RIGHTS interaction with RLIMIT_NOFILE
If the file descriptors received in SCM_RIGHTS would cause
the process to its exceed RLIMIT_NOFILE limit, the excess
FDs are discarded.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-29 22:13:25 +02:00
Michael Kerrisk 1d03bca07f ipc.5: Remove old link to svipc.7/sysvipc.7 page
Long ago, the sysvipc.7 page was called ipc.5, which was both a
misnaming (too general a name) and an inconsistent section. The
page was renamed (to svipc.7) many years ago, and the link with
the old name has probably ceased to be needed. So, remove it.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-25 06:40:21 +02:00
Michael Kerrisk 015f61c72a svipc.7: Add old name of sysvipc(7) page as a link
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-25 06:39:05 +02:00
Michael Kerrisk 343cdc5ac9 clone.2, intro.2, ipc.2, msgctl.2, msgget.2, msgop.2, semctl.2, semget.2, semop.2, shmctl.2, shmget.2, shmop.2, ftok.3, proc.5, namespaces.7: Change reference to svipc(7) to sysvipc(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-25 06:38:01 +02:00
Michael Kerrisk 880c105e22 sysvipc.7: Minor fixes for page renaming
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-25 06:33:16 +02:00
Michael Kerrisk 0587dba23b sysvipc.7: Rename svipc.7 to sysvipc.7
The name sysvipc is a bit more natural, and is the name used in
/proc/sysvipc.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-25 06:31:50 +02:00
Michael Kerrisk 16f3fc8828 pid_namespaces.7: tfix
Reported-by: Guillaume Laporte <guillaume.laporte.adm@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-24 16:26:51 +02:00
Michael Kerrisk 173eb06cd8 ptrace.2: wfix: s/proper superset/superset/ in "Ptrace access mode checking"
Reported-by: Alexey Izbyshev <izbyshev@ispras.ru>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21 08:04:58 +02:00
Michael Kerrisk 63059c4b52 execve.2: Some tweaks to Shawn Landden's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21 08:02:38 +02:00
Shawn Landden 60f16bf2fe execve.2: Add more detail about Shebangs
Signed-off-by: Shawn Landden <shawn@git.icu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-21 08:02:37 +02:00
Michael Kerrisk 44dceef0cd execve.2: Since Linux 5.1, the limit on the #! line is 255 chars (rather than 127)
Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 21:06:11 +02:00
Michael Kerrisk 815d0561d0 execve.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 20:47:10 +02:00
Michael Kerrisk 8fa1a0223e execve.2: ffix: remove spaces that suggest a space is needed after #!
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 20:45:00 +02:00
Michael Kerrisk fc894c8f55 execve.2: Linux is not alone in ignoring the set-UID and set-GID bits for scripts
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-19 20:42:10 +02:00
Michael Kerrisk b7921eb677 credentials.7: SEE ALSO: add tcgetsid(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-18 20:51:11 +02:00
Michael Kerrisk 8adf58622f proc.5: Minor fix: add some paragraph breaks to /proc/[pid]/attr/current text
Break the text up a little, to improve readability.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-18 20:51:11 +02:00
Michael Kerrisk 283db6f607 chdir.2: Add ENOTDIR error for fchdir()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-17 20:36:37 +02:00
Michael Kerrisk 7c17e8f3cb on_exit.3: Atack variables may be out of scope when exit handler is invoked
Here's a program for doing experiments:

/* on_expt_scope_expt.c

   (C) Michael Kerrisk, 2019, Licensed GNU GPLv2+
*/

char *tos;

static void
exitFunc(int status, void *p)
{
    int efloc;
    int *xp = (int *) p;

    printf("====== Entered exit handler\n");
    printf("&efloc = %p (0x%llx)\n",
            (void *) &efloc, (long long) (tos - (char *) &efloc));
    printf("xp     = %p (value: %d)\n", (void *) xp, *xp);

    if (*xp != INIT_VALUE)
        printf("It looks like the variable passed to the exit handler "
                "has gone out of scope\n");

    /* Produce a core dump, which we can examine with GDB to look at the
       frames on the stack, if desired */

    printf("===\n");
    printf("About to abort\n");
    abort();
}

static void
recur(int lev, int *xp)
{
    int rloc;
    int big[65536-12];  /* 12*4 == 48 other bytes allocated on
                           this stack frame */
    tos = (char *) &rloc;

    big[0] = lev;
    big[0]++;

    printf("&rloc = %p (%d)    (%d)\n", (void *) &rloc, lev, *xp);

    if (lev > 1)
        recur(lev - 1, xp);
    else {
        printf("exit() from recur()\n");
        exit(EXIT_SUCCESS);
    }
}

int
main(int argc, char *argv[])
{
    int lev;
    int *xp;
    int xx;

    if (argc < 2) {
        fprintf(stderr, "Usage: %s {s|h} [how]\n", argv[0]);
        fprintf(stderr, "\ts => exitFunc() arg is in main() stack\n");
        fprintf(stderr, "\th => exitFunc() arg is allocated on heapn");
        fprintf(stderr, "\tIf 'how' is not present, then return from main()\n");
        fprintf(stderr, "\tIf 'how' is 0, then exit() from main()\n");
        fprintf(stderr, "\tIf 'how' is > 0, then make 'how' recursive "
                        "function calls, and then exit()\n");
        exit(EXIT_FAILURE);
    }

    tos = (char *) &xp;

    if (argv[1][0] == 'h') {
        xp = malloc(sizeof(int));
        if (xp == NULL) {
            perror("malloc");
            exit(EXIT_FAILURE);
        }
        printf("Argument for exitFunc() is allocated on heap\n");
    } else {
        xp = &xx;
        printf("Argument for exitFunc() is allocated on stack in main()\n");
    }

    *xp = INIT_VALUE;

    printf("xp     = %p (value: %d)\n", (void *) xp, *xp);
    printf("===\n");

    on_exit(exitFunc, xp);

    if (argc == 2) {
        printf("return from main\n");
        return 0;
    }

    lev = atoi(argv[2]);

    if (lev < 1) {
        printf("Calling exit() from main\n");
        exit(EXIT_SUCCESS);
    } else {
        recur(lev, xp);
    }
}

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-15 13:57:31 +02:00
Mark Wielaard f92ea96bab pkey_alloc.2, mprotect.2: _GNU_SOURCE is required for the pkey functions.
To get the pkey_alloc, pkey_free and pkey_mprotect functions
_GNU_SOURCE needs to be defined before including sys/mman.h.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-14 17:09:00 +02:00
Mark Wielaard a4a0b74234 mprotect.2: pkey_mprotect() acts like mprotect() if pkey is set to -1, not 0
The mprotect.2 NOTES say:

    On systems that do not support protection keys in
    hardware, pkey_mprotect() may still be used, but pkey must
    be set to 0.  When called this way, the operation of
    pkey_mprotect() is equivalent to mprotect().

But this is not what the glibc manual says:

    It is also possible to call pkey_mprotect with a key value
    of -1, in which case it will behave in the same way as
    mprotect.

Which is correct. Both the glibc implementation and the
kernel check whether pkey is -1. 0 is not a valid pkey when
memory protection keys are not supported in hardware.

Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-14 17:06:50 +02:00
Michael Kerrisk e6017d5615 exec.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-13 21:52:57 +02:00
Michael Kerrisk 3c2423ee69 exec.3: Minor tweaks to Matthew Kenigsberg's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-13 21:52:57 +02:00
Matthew Kenigsberg df7271bb32 exec.3: Explain function groupings
I've found the exec man page quite difficult to read when trying
to find the behavior for a specific function. Since the names of
the functions are inline and the order of the descriptions isn't
clear, it's hard to find which paragraphs apply to each function.
I thought it would be much easier to read if the grouping based on
letters is stated.
2019-06-13 21:52:01 +02:00
Tobias Klauser ec7c749319 vdso.7: Mention removal of Blackfin port
The Blackfin port was removed in Linux 4.17. Mention this in the
section concerning Blackfin vDSO functions.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-13 21:27:27 +02:00
Michael Kerrisk 58ba48e40a fanotify.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-12 23:13:43 +02:00
Matthew Bobrowski f5230cf176 fanotify.7: Reword FAN_REPORT_FID data structure inclusion semantics
Improved the readability of a sentence that describes the use of
FAN_REPORT_FID and how this particular flag influences what data
structures a listening application could expect to receive when
describing an event.

Signed-off-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-12 23:12:45 +02:00
Tobias Klauser 77479ef629 vdso.7: Document vDSO for RISCV
Document the symbols exported by the RISCV vDSO which is present
from kernel 4.15 onwards.

See kernel source files in arch/riscv/kernel/vdso.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-12 22:40:27 +02:00
Michael Kerrisk 794b5143e4 fanotify.7: Minor fixes after feedback from Matthew Bobrowski
Reported-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-10 11:11:01 +02:00
Jakub Wilk ed7e38aded Changes.old: tfix
Remove duplicated word.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 14:04:14 +02:00
Michael Kerrisk 3051b98c42 fanotify.7: Reorder text in EXAMPLE
Group each example shell session together with each example
program.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 13:56:07 +02:00
Michael Kerrisk 26f6196ab6 fanotify.7: ffix: boldface user commands in shell sessions
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 13:56:07 +02:00
Michael Kerrisk 7877c84647 fanotify.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 13:56:07 +02:00
Michael Kerrisk 525b88e128 fanotify.7: Reformat program output to fit in 80 columns
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 13:56:07 +02:00
Michael Kerrisk 2d26ddfa55 fanotify.7: Clarify logic in ESTALE check
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 13:56:00 +02:00
Michael Kerrisk 6f10bd3260 fanotify.7: Minor code consistency clean-ups
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 12:36:46 +02:00
Michael Kerrisk c662400632 fanotify.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 12:36:46 +02:00
Michael Kerrisk 5ff63f5163 fanotify.7: Minor code typesetting fix-ups
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 12:36:46 +02:00
Michael Kerrisk 87d12b1b2f fanotify.7: Minor fix: format comments consistently
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 12:21:07 +02:00
Michael Kerrisk fa6d3b26e1 fanotify.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 12:21:07 +02:00
Michael Kerrisk eae836e071 fanotify_init.2, fanotify_mark.2, fanotify.7: Minor tweak: s/object/filesystem object/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 11:45:06 +02:00
Michael Kerrisk 817c8240f3 fanotify_init.2, fanotify_mark.2, fanotify.7: Minor fixes to Matthew Bobrowski's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 11:45:06 +02:00
Matthew Bobrowski 0a4db6dc74 fanotify.7, fanotify_init.2, fanotify_mark.2: Document FAN_REPORT_FID and directory modification events
Details relating to the new initialization flag FAN_REPORT_FID has been
added. As part of the FAN_REPORT_FID feature, a new set of event masks are
available and have been documented accordingly.

A simple example program has been added to also support the understanding
and use of FAN_REPORT_FID and directory modification events.

Signed-off-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 08:37:54 +02:00
Petr Vaněk 59a4d9b398 syscalls.2: tfix
Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 08:22:36 +02:00
Michael Kerrisk ada54d9f2e strcat.3: Fix off-by-one error in example code
Reported-by: Eric Sanchis <eric.sanchis@iut-rodez.fr>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-08 08:09:45 +02:00
Michael Kerrisk c0f8924419 man-pages-5.02.lsm: Update primary site; remove alternate site
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-06-07 05:51:12 +02:00
Michael Kerrisk 44a0081973 socket.7: select()/poll()/epoll honor SO_RCVLOWAT since Linux 2.6.28
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-31 16:45:51 +02:00
Michael Kerrisk defef3518e elf.5: SEE ALSO: add ld.so(8)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-28 09:32:40 +02:00
Michael Kerrisk d339d3feb7 cpuid.4: SEE ALSO: add cpuid(1)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-23 13:18:26 +02:00
Michael Kerrisk bc7d51d2bc ld.so.8: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-23 12:28:23 +02:00
Michael Kerrisk 0e1ad2f01a ld.so.8: Note some further details of secure-execution mode
Note some further details of the treatment of environment
variables in secure execution mode. In particular (as noted by
Matthias Hertel), note that ignored environment variables are also
stripped from the environment. Furthermore, there are some other
variables, not used by the dynamic linker itself, that are also
treated in this way (see the glibc source file
sysdeps/generic/unsecvars.h).

Reported-by: Matthias Hertel <Matthias.Hertel@rohde-schwarz.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-23 09:48:16 +02:00
Michael Kerrisk f3da99c4ee cgroup_namespaces.7: In the example shell session, give second shell a different prompt
Give the shell in the second cgroup namespace a different prompt,
so as to clearly distinguish the two namespaces.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-20 21:55:01 +02:00
Michael Kerrisk 727e560920 cgroup_namespaces.7: Some wording fixes to improve clarity
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-20 21:54:50 +02:00
Michael Kerrisk c9d68a690b cgroup_namespaces.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-20 21:50:41 +02:00
Michael Kerrisk ad34717f77 cgroup_namespaces.7: wfix: s/original namespace/initial namespace/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-20 21:16:36 +02:00
Michael Kerrisk ef12969735 cgroup_namespaces.7: wfix: remove some superfluous (and slightly misleading) words
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-20 21:14:05 +02:00
Michael Kerrisk 3859874937 user_namespaces.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-18 22:00:05 +02:00
Michael Kerrisk cb7c96bfdd prctl.2: tfix
Reported-by: Tomas Skäre <tomas.skare@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-16 12:22:32 -05:00
Michael Kerrisk a546e6601b pthread_spin_init.3: tfix
Reported-by: Kumar Chaudhary, Naveen <naveen.kumar.chaudhary@intel.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-16 12:20:09 -05:00
Michael Kerrisk 9e7cbbc25a Changes.old: Tweaks to 5.01 changelog
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-05-09 14:07:02 +02:00
Michael Kerrisk 480d885861 Start of man-pages-5.02: updating Changes and Changes.old 2019-05-09 09:46:26 +02:00
Michael Kerrisk bbe5764f06 Start of man-pages-5.02: updating .Announce and .lsm files 2019-05-09 09:46:26 +02:00
Michael Kerrisk 0fa09084ec Start of man-pages-5.02: renaming .Announce and .lsm files 2019-05-09 09:46:26 +02:00
1223 changed files with 45286 additions and 18071 deletions

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
# Ignore everything new by default
/*
# Ignore everything in man?/ that doesn't follow conventions (e.g., tmp files)
!/man?/
/man?/*
!/man?/*.[1-8]
# These files change name in each release
!/man-pages*.Announce
!/man-pages*.lsm
!/scripts/

13
CONTRIBUTING Normal file
View File

@ -0,0 +1,13 @@
For general information about how to contribute, see:
https://www.kernel.org/doc/man-pages/contributing.html
For information on how to send patches, see:
https://www.kernel.org/doc/man-pages/patches.html
For a description of the preferred layout of manual pages,
as well as some style guide notes, see:
$ man 7 man-pages
For information about reporting bugs, see:
https://www.kernel.org/doc/man-pages/reporting_bugs.html

230
Changes
View File

@ -1,6 +1,6 @@
==================== Changes in man-pages-5.01 ====================
==================== Changes in man-pages-5.14 ====================
Released: 2019-05-09, Munich
Released: ????-??-??, Munich
Contributors
@ -10,238 +10,26 @@ The following people contributed patches/fixes or (noted in brackets
in the changelog below) reports, notes, and ideas that have been
incorporated in changes in this release:
Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com>
Andreas Korb <andreas.d.korb@gmail.com>
Anisse Astier <anisse@astier.eu>
Brice Goglin <Brice.Goglin@inria.fr>
Carlos O'Donell <carlos@redhat.com>
Dr. Jürgen Sauermann <mail@xn--jrgen-sauermann-zvb.de>
Egmont Koblinger <egmont@gmail.com>
Elias Benali <stackptr@users.sourceforge.net>
Elliot Hughes <enh@google.com>
Florian Weimer <fweimer@redhat.com>
Hugues Evrard <hevrard@google.com>
Jakub Nowak <jakub.jakub.nowak@gmail.com>
Jakub Wilk <jwilk@jwilk.net>
Keegan Saunders <keeganwsaunders@gmail.com>
Lucas Werkmeister <mail@lucaswerkmeister.de>
Marcus Huewe <suse-tux@gmx.de>
Michael Kerrisk <mtk.manpages@gmail.com>
Michael Witten <mfwitten@gmail.com>
Seth Troisi <sethtroisi@google.com>
Slavomir Kaslev <kaslevs@vmware.com>
Vincent Lefevre <vincent@vinc17.net>
Wladimir Mutel <muwlgr@gmail.com>
Apologies if I missed anyone!
New and rewritten pages
-----------------------
Newly documented interfaces in existing pages
---------------------------------------------
tsearch.3
Florian Weimer [Michael Kerrisk]
Document the twalk_r() function added in glibc 2.30
New and changed links
---------------------
twalk_r.3
Michael Kerrisk
New link to twalk(3) page
Global changes
--------------
Changes to individual pages
---------------------------
accept.2
Michael Kerrisk
Note that 'addrlen' is left unchanged in the event of an error
See http://austingroupbugs.net/view.php?id=836.
bpf.2
Michael Kerrisk
Update kernel version info for JIT compiler
clone.2
Michael Kerrisk [Jakub Nowak]
CLONE_CHILD_SETTID has effect before clone() returns *in the child*
CLONE_CHILD_SETTID may not have had effect by the time clone()
returns in the parent, which could be relevant if the
CLONE_VM flag is employed. The relevant kernel code is in
schedule_tail(), which is called in ret_from_fork()
in the child.
See https://bugzilla.kernel.org/show_bug.cgi?id=203105
execve.2
exec.3
Michael Kerrisk [Dr. Jürgen Sauermann]
Consistently use the term 'pathname' (not 'path')
execve.2
Michael Kerrisk
Note that stack+environ size is also limited to 3/4 of _STK_LIM
In fs/exec.c::prepare_arg_pages(), we have:
limit = _STK_LIM / 4 * 3;
limit = min(limit, bprm->rlim_stack.rlim_cur / 4);
Michael Kerrisk [Dr. Jürgen Sauermann]
SEE ALSO: refer to exec(3) (rather than execl(3))
pipe.2
Michael Kerrisk
Note that 'pipefd' is left unchanged in the event of an error
See http://austingroupbugs.net/view.php?id=467.
sched_setaffinity.2
Michael Kerrisk [Brice Goglin]
Correct details of return value of sched_getaffinity() syscall
Things changed a little with:
commit cd3d8031eb4311e516329aee03c79a08333141f1
Author: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Date: Fri Mar 12 16:15:36 2010 +0900
setfsgid.2
Michael Kerrisk
Rewrite for improved clarity and defer to setfsuid() for details
Rewrite for improved clarity and defer to setfsuid(2) for the
rationale of the fsGID rather than repeating the same details
in this page.
setfsuid.2
Michael Kerrisk
Rewrite for improved clarity and to hint history more explicitly
The current text reads somewhat clumsily. Rewrite it to introduce
the eUID and fsUID in parallel, and more clearly hint at the the
historical rationale for the fsUID, which is detailed lower in
the page.
socketpair.2
Michael Kerrisk
Clarify that 'sv' is left unchanged in the event of an error
See also http://austingroupbugs.net/view.php?id=483.
splice.2
Slavomir Kaslev
EAGAIN can occur when called on nonblocking file descriptors
syscalls.2
Michael Kerrisk [Andreas Korb]
Remove crufty text about i386 syscall dispatch table
The removed text long ago ceased to be accurate. Nowadays, the
dispatch table is autogenerated when building the kernel (via
the kernel makefile, arch/x86/entry/syscalls/Makefile).
tee.2
Slavomir Kaslev
EAGAIN can occur when called on nonblocking file descriptors
fopen.3
Elliot Hughes
Explain BSD vs glibc "a+" difference
Where is the initial read position for an "a+" stream?
POSIX leaves this unspecified. Most BSD man pages are silent, and
MacOS has the ambiguous "The stream is positioned at the end of
the file", not differentiating between reads and writes other than
to say that fseek(3) does not affect writes. glibc's documentation
explicitly specifies that the initial read position is the
beginning of the file.
My new wording is based on the BSD implementations, so you may
prefer to replace the non-glibc section with "unspecified", or
indeed remove all claims about the initial read position.
mallinfo.3
Elliott Hughes
Further discourage use of mallinfo()
The BUGS section already explains why you need to be cautious
about using mallinfo, but given the number of bug reports we see
on Android, it seems not many people are reading that far. Call it
out up front.
malloc_trim.3
Carlos O'Donell
Update trimming information
Since glibc 2.8, commit 68631c8eb92, the malloc_trim function has
iterated over all arenas and free'd back to the OS all page runs
that were free. This allows an application to call malloc_trim to
consolidate fragmented chunks and free back any pages it can to
potentially reduce RSS usage.
posix_memalign.3
Elliot Hughes
Some functions set errno
True of bionic, glibc, and musl. (I didn't check elsewhere.)
resolver.3
Michael Kerrisk [Wladimir Mutel]
Mention that some functions set 'h_errno'
stdarg.3
Michael Kerrisk [Vincent Lefevre]
Remove the NOTES section describing the ancient varargs macros
stdarg.h is now 30 years old, and gcc long ago (2004) ceased to
implement <varargs.h>. There seems little value in keeping this
text.
See https://bugzilla.kernel.org/show_bug.cgi?id=202907
Michael Kerrisk [Egmont Koblinger]
Add a note that "..." in function signature means a variadic function
Egmont suggested adding this, because the string "..." appears
at several other points in the page, but just to indicate that
some text is omitted from example code.
strerror.3
Jakub Wilk
Don't discuss buffer size for strerror_l()
Unlike strerror_r(), strerror_l() doesn't take buffer length as an
argument.
strtol.3
strtoul.3
Jakub Wilk
SEE ALSO: add strtoimax(3), strtoumax(3)
sysconf.3
Michael Kerrisk [Hugues Evrard]
Clearly note that _SC_PAGESIZE and _SC_PAGE_SIZE are synonyms
tsearch.3
Florian Weimer
Do not use const arguments in twalk() callback
The const specifier is not part of the prototype (it only applies
to the implementation), so showing it here confuses the reader.
Michael Kerrisk
SYNOPSIS: add missing definition of 'VISIT' type
Michael Kerrisk
Reformat twalk() and twalk_r() prototypes for easier readability
console_codes.4
Jakub Wilk
Document that \e[1;n] and \e[2;n] support 16 colors
Source: setterm_command() in drivers/tty/vt/vt.c
elf.5
Michael Kerrisk [Keegan Saunders]
A data segment does not have PF_X
proc.5
Michael Witten [Anisse Astier]
Add missing Inode field to /proc/net/unix
hostname.7
Florian Weimer
HOSTALIASES/search path processing is DNS-specific
Other NSS modules do not necessarily honor these settings.
inode.7
Michael Kerrisk
Note that timestamp fields measure time starting at the Epoch
Michael Kerrisk
Timestamp fields are structures that include a nanosecond component
Michael Kerrisk
Add references to execve(2) to describe set-UID/set-GID behaviors

File diff suppressed because it is too large Load Diff

12
MAINTAINER_NOTES Normal file
View File

@ -0,0 +1,12 @@
Externally generated pages
==========================
A few pages come from external sources. Fixes to the pages should really
go to the upstream source.
tzfile(5), zdump(8), and zic(8) come from the tz project
(https://www.iana.org/time-zones).
bpf-helpers(7) is autogenerated from the kernel sources using scripts.
See man-pages commit 53666f6c30451cde022f65d35a8d448f5a7132ba for
details.

277
Makefile
View File

@ -1,35 +1,260 @@
DESTDIR=
prefix?=/usr
MANDIR=$(prefix)/share/man
########################################################################
# Copyright (C) 2021 Alejandro Colomar <alx.manpages@gmail.com>
# SPDX-License-Identifier: GPL-2.0 OR LGPL-2.0
########################################################################
# Conventions:
#
# - Follow "Makefile Conventions" from the "GNU Coding Standards" closely.
# However, when something could be improved, don't follow those.
# - Uppercase variables, when referring files, refer to files in this repo.
# - Lowercase variables, when referring files, refer to system files.
# - Variables starting with '_' refer to absolute paths, including $(DESTDIR).
# - Variables ending with '_' refer to a subdir of their parent dir, which
# is in a variable of the same name but without the '_'. The subdir is
# named after this project: <*/man>.
# - Variables ending in '_rm' refer to files that can be removed (exist).
# - Variables ending in '_rmdir' refer to dirs that can be removed (exist).
# - Targets of the form '%-rm' remove their corresponding file '%'.
# - Targets of the form '%/.-rmdir' remove their corresponding dir '%/'.
# - Targets of the form '%/.' create their corresponding directory '%/'.
# - Every file or directory to be created depends on its parent directory.
# This avoids race conditions caused by `mkdir -p`. Only the root
# directories are created with parents.
# - The 'FORCE' target is used to make phony some variables that can't be
# .PHONY to avoid some optimizations.
#
########################################################################
all: remove install
MAKEFLAGS += --no-print-directory
MAKEFLAGS += --silent
MAKEFLAGS += --warn-undefined-variables
uninstall remove:
for i in man?/*; do \
rm -f $(MANDIR)/"$$i" $(MANDIR)/"$$i".*; \
done
htmlbuilddir := $(CURDIR)/.html
HTOPTS :=
DESTDIR :=
prefix := /usr/local
datarootdir := $(prefix)/share
docdir := $(datarootdir)/doc
MANDIR := $(CURDIR)
mandir := $(datarootdir)/man
MAN1DIR := $(MANDIR)/man1
MAN2DIR := $(MANDIR)/man2
MAN3DIR := $(MANDIR)/man3
MAN4DIR := $(MANDIR)/man4
MAN5DIR := $(MANDIR)/man5
MAN6DIR := $(MANDIR)/man6
MAN7DIR := $(MANDIR)/man7
MAN8DIR := $(MANDIR)/man8
man1dir := $(mandir)/man1
man2dir := $(mandir)/man2
man3dir := $(mandir)/man3
man4dir := $(mandir)/man4
man5dir := $(mandir)/man5
man6dir := $(mandir)/man6
man7dir := $(mandir)/man7
man8dir := $(mandir)/man8
manext := \.[0-9]
man1ext := .1
man2ext := .2
man3ext := .3
man4ext := .4
man5ext := .5
man6ext := .6
man7ext := .7
man8ext := .8
htmldir := $(docdir)
htmldir_ := $(htmldir)/man
htmlext := .html
INSTALL := install
INSTALL_DATA := $(INSTALL) -m 644
INSTALL_DIR := $(INSTALL) -m 755 -d
RM := rm
RMDIR := rmdir --ignore-fail-on-non-empty
MAN_SECTIONS := 1 2 3 4 5 6 7 8
.PHONY: all
all:
$(MAKE) uninstall
$(MAKE) install
%/.:
$(info - INSTALL $(@D))
$(INSTALL_DIR) $(@D)
%-rm:
$(info - RM $*)
$(RM) $*
%-rmdir:
$(info - RMDIR $(@D))
$(RMDIR) $(@D)
.PHONY: install
install: install-man | installdirs
@:
.PHONY: installdirs
installdirs: | installdirs-man
@:
.PHONY: uninstall remove
uninstall remove: uninstall-man
@:
.PHONY: clean
clean:
find man?/ -type f \
|while read f; do \
rm -f "$(htmlbuilddir)/$$f".*; \
done;
########################################################################
# man
MANPAGES := $(sort $(shell find $(MANDIR)/man?/ -type f | grep '$(manext)$$'))
_manpages := $(patsubst $(MANDIR)/%,$(DESTDIR)$(mandir)/%,$(MANPAGES))
_man1pages := $(filter %$(man1ext),$(_manpages))
_man2pages := $(filter %$(man2ext),$(_manpages))
_man3pages := $(filter %$(man3ext),$(_manpages))
_man4pages := $(filter %$(man4ext),$(_manpages))
_man5pages := $(filter %$(man5ext),$(_manpages))
_man6pages := $(filter %$(man6ext),$(_manpages))
_man7pages := $(filter %$(man7ext),$(_manpages))
_man8pages := $(filter %$(man8ext),$(_manpages))
MANDIRS := $(sort $(shell find $(MANDIR)/man? -type d))
_mandirs := $(patsubst $(MANDIR)/%,$(DESTDIR)$(mandir)/%/.,$(MANDIRS))
_man1dir := $(filter %man1/.,$(_mandirs))
_man2dir := $(filter %man2/.,$(_mandirs))
_man3dir := $(filter %man3/.,$(_mandirs))
_man4dir := $(filter %man4/.,$(_mandirs))
_man5dir := $(filter %man5/.,$(_mandirs))
_man6dir := $(filter %man6/.,$(_mandirs))
_man7dir := $(filter %man7/.,$(_mandirs))
_man8dir := $(filter %man8/.,$(_mandirs))
_mandir := $(DESTDIR)$(mandir)/.
_manpages_rm := $(addsuffix -rm,$(wildcard $(_manpages)))
_man1pages_rm := $(filter %$(man1ext)-rm,$(_manpages_rm))
_man2pages_rm := $(filter %$(man2ext)-rm,$(_manpages_rm))
_man3pages_rm := $(filter %$(man3ext)-rm,$(_manpages_rm))
_man4pages_rm := $(filter %$(man4ext)-rm,$(_manpages_rm))
_man5pages_rm := $(filter %$(man5ext)-rm,$(_manpages_rm))
_man6pages_rm := $(filter %$(man6ext)-rm,$(_manpages_rm))
_man7pages_rm := $(filter %$(man7ext)-rm,$(_manpages_rm))
_man8pages_rm := $(filter %$(man8ext)-rm,$(_manpages_rm))
_mandirs_rmdir := $(addsuffix -rmdir,$(wildcard $(_mandirs)))
_man1dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man1dir)))
_man2dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man2dir)))
_man3dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man3dir)))
_man4dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man4dir)))
_man5dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man5dir)))
_man6dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man6dir)))
_man7dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man7dir)))
_man8dir_rmdir := $(addsuffix -rmdir,$(wildcard $(_man8dir)))
_mandir_rmdir := $(addsuffix -rmdir,$(wildcard $(_mandir)))
install_manX := $(foreach x,$(MAN_SECTIONS),install-man$(x))
installdirs_manX := $(foreach x,$(MAN_SECTIONS),installdirs-man$(x))
uninstall_manX := $(foreach x,$(MAN_SECTIONS),uninstall-man$(x))
.SECONDEXPANSION:
$(_manpages): $(DESTDIR)$(mandir)/man%: $(MANDIR)/man% | $$(@D)/.
$(info - INSTALL $@)
$(INSTALL_DATA) -T $< $@
$(_mandirs): %/.: | $$(dir %). $(_mandir)
$(_mandirs_rmdir): $(DESTDIR)$(mandir)/man%/.-rmdir: $$(_man%pages_rm) FORCE
$(_mandir_rmdir): $(uninstall_manX) FORCE
.PHONY: $(install_manX)
$(install_manX): install-man%: $$(_man%pages) | installdirs-man%
@:
.PHONY: install-man
install-man: $(install_manX)
@:
.PHONY: $(installdirs_manX)
$(installdirs_manX): installdirs-man%: $$(_man%dir) $(_mandir)
@:
.PHONY: installdirs-man
installdirs-man: $(installdirs_manX)
@:
.PHONY: $(uninstall_manX)
$(uninstall_manX): uninstall-man%: $$(_man%pages_rm) $$(_man%dir_rmdir)
@:
.PHONY: uninstall-man
uninstall-man: $(_mandir_rmdir) $(uninstall_manX)
@:
########################################################################
# html
# Use with
# make HTDIR=/some/dir HTOPTS=whatever html
# make HTOPTS=whatever html
# The sed removes the lines "Content-type: text/html\n\n"
html:
@if [ x$(HTDIR) = x ]; then echo "You must set HTDIR."; else \
for i in man?; do \
[ -d $(HTDIR)/"$$i" ] || mkdir -p $(HTDIR)/"$$i"; \
find "$$i/" -type f | while read f; do \
(cd "$$i"; man2html $(HTOPTS) `basename $$f`) | \
sed -e '1,2d' > $(HTDIR)/"$$i"/`basename $$f`.html; \
done; \
done; fi
.PHONY: html
html: | builddirs-html
find man?/ -type f \
|while read f; do \
man2html $(HTOPTS) "$$f" \
|sed -e '1,2d' \
>"$(htmlbuilddir)/$${f}$(htmlext)" \
|| exit $$?; \
done;
install:
for i in man?; do \
install -d -m 755 $(DESTDIR)$(MANDIR)/"$$i" || exit $$?; \
install -m 644 "$$i"/* $(DESTDIR)$(MANDIR)/"$$i" || exit $$?; \
done
.PHONY: builddirs-html
builddirs-html:
find man?/ -type d \
|while read d; do \
$(INSTALL_DIR) "$(htmlbuilddir)/$$d" || exit $$?; \
done;
.PHONY: install-html
install-html: | installdirs-html
cd $(htmlbuilddir) && \
find man?/ -type f \
|while read f; do \
$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(htmldir_)/$$f" || exit $$?; \
done;
.PHONY: installdirs-html
installdirs-html:
find man?/ -type d \
|while read d; do \
$(INSTALL_DIR) "$(DESTDIR)$(htmldir_)/$$d" || exit $$?; \
done;
.PHONY: uninstall-html
uninstall-html:
find man?/ -type f \
|while read f; do \
rm -f "$(DESTDIR)$(htmldir_)/$$f".* || exit $$?; \
done;
########################################################################
# tests
# Check if groff reports warnings (may be words of sentences not displayed)
# from http://lintian.debian.org/tags/manpage-has-errors-from-man.html
# from https://lintian.debian.org/tags/groff-message.html
.PHONY: check-groff-warnings
check-groff-warnings:
GROFF_LOG="$$(mktemp --tmpdir manpages-checksXXXX)" || exit $$?; \
for i in man?/*.[1-9]; \
@ -43,3 +268,7 @@ check-groff-warnings:
# someone might also want to look at /var/catman/cat2 or so ...
# a problem is that the location of cat pages varies a lot
########################################################################
FORCE:

41
README
View File

@ -1,37 +1,42 @@
This package contains Linux man pages for sections 1 through 8. Some
more information is given in the 'man-pages-x.y.Announce' file.
Homepage
========
For information about the Linux man-pages project, see
http://www.kernel.org/doc/man-pages/index.html.
Bug reports and contributing
============================
If you have corrections and additions to suggest, see
http://www.kernel.org/doc/man-pages/contributing.html
(Although there is a mirror of this repository on GitHub,
please don't report issues via the GitHub issue tracker!)
For further information on contributing, see the CONTRIBUTING file.
Installing and uninstalling
===========================
"make install" will copy these man pages to /usr/share/man/man[1-8].
"make install" will copy these man pages to /usr/local/share/man/man[1-8].
To install to a path different from /usr, use
To install to a path different from /usr/local, use
"make install prefix=/install/path".
"make remove" or "make uninstall" will remove any man page in this
distribution from its destination. Use with caution, and remember to
use "prefix" if desired, as with the "install" target.
To install only a specific man section (mandir) such as man3, use
"make install-man3". Similar syntax can be used to uninstall a
specific man section, such as man7: "make uninstall-man7".
"make" or "make all" will perform "make uninstall" followed by "make
install".
Man page overlap and duplication
================================
Note that sometimes these pages are duplicates of pages also distributed
in other packages. This has been reported about:
man page also found in
-------------------------------------
resolver.3 bind-utils, bind9utils
resolv.conf.5 "
passwd.5 shadow, passwd
mailaddr.7 ?
Consider using multiple threads (at least 2) when installing
these man pages, as the Makefile is optimized for multiple threads:
"make -j install".
Copyrights
==========
See the 'man-pages-x.y.Announce' file.
Homepage
========
For much more about the Linux man-pages project, see
http://www.kernel.org/doc/man-pages/index.html.

View File

@ -1,7 +1,7 @@
RELEASE
The Linux man page maintainer proudly announces. . .
man-pages-5.01.tar.gz - man pages for Linux
man-pages-5.14.tar.gz - man pages for Linux
Differences from the previous manual pages release are listed in
the file "Changes".

View File

@ -1,14 +1,13 @@
Begin3
Title: Section 2, 3, 4, 5 and 7 man pages for Linux
Version: 5.01
Entered-date: 2019-05-09
Version: 5.14
Entered-date: ????-??-??
Description: Linux manual pages
Keywords: man pages
Author: several
Maintained-by: Michael Kerrisk <mtk.manpages@gmail.com>
Primary-site: ftp://ftp.kernel.org/pub/linux/docs/man-pages
2633k man-pages-5.01.tar.gz
Alternate-site: ftp://ftp.win.tue.nl/pub/linux-local/manpages
Primary-site: http://www.kernel.org/pub/linux/docs/man-pages
????k man-pages-5.14.tar.gz
Copying-policy: several; the pages are all freely distributable as long as
nroff source is provided
End

View File

@ -22,11 +22,13 @@
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH GETENT 1 2019-03-06 "Linux" "User Commands"
.TH GETENT 1 2021-03-22 "Linux" "User Commands"
.SH NAME
getent \- get entries from Name Service Switch libraries
.SH SYNOPSIS
.B getent\ [\fIoption\fP]...\ \fIdatabase\fP\ \fIkey\fP...
.nf
.B getent [\fIoption\fP]... \fIdatabase\fP \fIkey\fP...
.fi
.SH DESCRIPTION
The
.B getent
@ -209,7 +211,7 @@ Alternatively, three
.I keys
may be provided, which are interpreted as the
.IR hostname ,
.I username
.IR username ,
and
.I domainname
to match to a netgroup name via
@ -376,7 +378,7 @@ Print the version number, license, and disclaimer of warranty for
One of the following exit values can be returned by
.BR getent :
.RS 3
.TP 10
.TP
.B 0
Command completed successfully.
.TP

View File

@ -1,5 +1,3 @@
'\" t -*- coding: UTF-8 -*-
.\"
.\" Copyright (C) 2014 Marko Myllynen <myllynen@redhat.com>
.\"
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
@ -23,7 +21,7 @@
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH ICONV 1 2019-03-06 "GNU" "Linux User Manual"
.TH ICONV 1 2021-08-27 "GNU" "Linux User Manual"
.SH NAME
iconv \- convert text from one character encoding to another
.SH SYNOPSIS
@ -176,9 +174,13 @@ Usual system default gconv module configuration file.
.TP
.I /usr/lib/gconv/gconv\-modules.cache
Usual system gconv module configuration cache.
.PP
Depending on the architecture,
the above files may instead be located at directories with the path prefix
.IR /usr/lib64 .
.SH CONFORMING TO
POSIX.1-2001.
.SH EXAMPLE
.SH EXAMPLES
Convert text from the ISO 8859-15 character encoding to UTF-8:
.PP
.in +4n

View File

@ -22,7 +22,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH INTRO 1 2015-07-23 "Linux" "Linux User's Manual"
.TH INTRO 1 2020-08-13 "Linux" "Linux User's Manual"
.SH NAME
intro \- introduction to user commands
.SH DESCRIPTION
@ -220,7 +220,7 @@ and
.I pwd
commands and explore
.I cd
usage: "cd", "cd .", "cd ..", "cd /" and "cd ~".
usage: "cd", "cd .", "cd ..", "cd /", and "cd \(ti".
.SS Directories
The command
.I mkdir
@ -321,5 +321,5 @@ and use a browser if you find HTML files there.
.BR zsh (1),
.BR wait (2),
.BR stdout (3),
.BR man-pages (7),
.BR man\-pages (7),
.BR standards (7)

View File

@ -11,29 +11,32 @@
.\" May be distributed under the GNU General Public License
.\" %%%LICENSE_END
.\"
.TH LDD 1 2019-03-06 "" "Linux Programmer's Manual"
.TH LDD 1 2021-08-27 "" "Linux Programmer's Manual"
.SH NAME
ldd \- print shared object dependencies
.SH SYNOPSIS
.nf
.BR ldd " [\fIoption\fP]... \fIfile\fP..."
.fi
.SH DESCRIPTION
.B 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 is the following:
An example of its use and output
is the following:
.PP
.in +2n
.in +4n
.EX
$ \fBldd /bin/ls\fP
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)
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)
.EE
.in
.PP
@ -53,9 +56,9 @@ For each dependency,
displays the location of the matching object
and the (hexadecimal) address at which it is loaded.
(The
.I linux-vdso
.I linux\-vdso
and
.I ld-linux
.I ld\-linux
shared dependencies are special; see
.BR vdso (7)
and
@ -64,7 +67,7 @@ and
.SS Security
Be aware that in some circumstances
(e.g., where the program specifies an ELF interpreter other than
.IR ld-linux.so ),
.IR ld\-linux.so ),
.\" The circumstances are where the program has an interpreter
.\" other than ld-linux.so. In this case, ldd tries to execute the
.\" program directly with LD_TRACE_LOADED_OBJECTS=1, with the

View File

@ -22,7 +22,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH LOCALE 1 2019-03-06 "Linux" "Linux User Manual"
.TH LOCALE 1 2021-03-22 "Linux" "Linux User Manual"
.SH NAME
locale \- get locale-specific information
.SH SYNOPSIS
@ -58,7 +58,7 @@ the behavior is as follows:
.BR \-a ", " \-\-all\-locales
Display a list of all available locales.
The
.B -v
.B \-v
option causes the
.B LC_IDENTIFICATION
metadata about each locale to be included in the output.
@ -66,14 +66,14 @@ metadata about each locale to be included in the output.
.BR \-m ", " \-\-charmaps
Display the available charmaps (character set description files).
To display the current character set for the locale, use
\fBlocale -c charmap\fR.
\fBlocale \-c charmap\fR.
.PP
The
.B locale
command can also be provided with one or more arguments,
which are the names of locale keywords (for example,
.IR date_fmt ,
.IR ctype-class-names ,
.IR ctype\-class\-names ,
.IR yesexpr ,
or
.IR decimal_point )
@ -129,14 +129,14 @@ Display a short usage message and exit.
Display the program version and exit.
.SH FILES
.TP
.I /usr/lib/locale/locale-archive
.I /usr/lib/locale/locale\-archive
Usual default locale archive location.
.TP
.I /usr/share/i18n/locales
Usual default path for locale definition files.
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008.
.SH EXAMPLE
.SH EXAMPLES
.EX
$ \fBlocale\fP
LANG=en_US.UTF\-8
@ -195,11 +195,11 @@ in the shell profile file so that the custom locale will be used in the
subsequent user sessions:
.PP
.EX
$ \fBmkdir -p $HOME/.locale\fP
$ \fBI18NPATH=./wrk/ localedef -f UTF-8 -i fi_SE $HOME/.locale/fi_SE.UTF-8\fP
$ \fBLOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF-8 date\fP
$ \fBmkdir \-p $HOME/.locale\fP
$ \fBI18NPATH=./wrk/ localedef \-f UTF\-8 \-i fi_SE $HOME/.locale/fi_SE.UTF\-8\fP
$ \fBLOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF\-8 date\fP
$ \fBecho "export LOCPATH=\e$HOME/.locale" >> $HOME/.bashrc\fP
$ \fBecho "export LANG=fi_SE.UTF-8" >> $HOME/.bashrc\fP
$ \fBecho "export LANG=fi_SE.UTF\-8" >> $HOME/.bashrc\fP
.EE
.SH SEE ALSO
.BR localedef (1),

View File

@ -31,7 +31,7 @@
.\" Lars Wirzenius to document new functionality (as of GNU
.\" C library 2.3.5).
.\"
.TH LOCALEDEF 1 2019-03-06 "Linux" "Linux User Manual"
.TH LOCALEDEF 1 2021-03-22 "Linux" "Linux User Manual"
.SH NAME
localedef \- compile locale definition files
.SH SYNOPSIS
@ -41,22 +41,22 @@ localedef \- compile locale definition files
.RI [ options ]
.I outputpath
.br
.B "localedef \-\-list\-archive"
.B "localedef \-\-add\-to\-archive"
.RI [ options ]
.I compiledpath
.br
.B "localedef \-\-delete\-from\-archive"
.RI [ options ]
.IR localename " ..."
.br
.B "localedef \-\-add\-to\-archive"
.B "localedef \-\-list\-archive"
.RI [ options ]
.I compiledpath
.br
.B "localedef \-\-version"
.br
.B "localedef \-\-help"
.br
.B "localedef \-\-usage"
.br
.B "localedef \-\-version"
.ad b
.hy
.SH DESCRIPTION
@ -98,7 +98,7 @@ Otherwise,
.I outputpath
is the name of a locale and the compiled locale data is added to the
archive file
.IR /usr/lib/locale/locale-archive .
.IR /usr/lib/locale/locale\-archive .
A locale archive is a memory-mapped file which contains all the
system-provided locales;
it is used by all localized programs when the environment variable
@ -113,7 +113,7 @@ not already been created.
If no
.I charmapfile
is given, the value
.I ANSI_X3.4-1968
.I ANSI_X3.4\-1968
(for ASCII) is used by default.
If no
.I inputfile
@ -128,12 +128,6 @@ A few options direct
to do something other than compile locale definitions.
Only one of these options should be used at a time.
.TP
.B \-\-delete\-from\-archive
Delete the named locales from the locale archive file.
.TP
.B \-\-list\-archive
List the locales contained in the locale archive file.
.TP
.B \-\-add\-to\-archive
Add the
.I compiledpath
@ -142,6 +136,12 @@ The directories should have been created by previous runs of
.BR localedef ,
using
.BR \-\-no\-archive .
.TP
.B \-\-delete\-from\-archive
Delete the named locales from the locale archive file.
.TP
.B \-\-list\-archive
List the locales contained in the locale archive file.
.SS Other options
Some of the following options are sensible only for certain operations;
generally, it should be self-evident which ones.
@ -187,7 +187,7 @@ are also searched after the current directory.
The default directory for locale definition files is printed by
.BR "localedef \-\-help" .
.TP
.BI \-u " repertoirefile" "\fR, \fP\-\-repertoire-map=" repertoirefile
.BI \-u " repertoirefile" "\fR, \fP\-\-repertoire\-map=" repertoirefile
Read mappings from symbolic names to Unicode code points from
.IR repertoirefile .
If
@ -212,14 +212,6 @@ Use
to look up aliases for locale names.
There is no default aliases file.
.TP
.BI \-\-prefix= pathname
Set the prefix to be prepended to the full archive pathname.
By default, the prefix is empty.
Setting the prefix to
.IR foo ,
the archive would be placed in
.IR foo/usr/lib/locale/locale-archive .
.TP
.BR \-c ", " \-\-force
Write the output files even if warnings were generated about the input
file.
@ -227,21 +219,11 @@ file.
.BR \-v ", " \-\-verbose
Generate extra warnings about errors that are normally ignored.
.TP
.B \-\-quiet
Suppress all notifications and warnings, and report only fatal errors.
.B \-\-big\-endian
Generate big-endian output.
.TP
.B \-\-posix
Conform strictly to POSIX. Implies
.BR \-\-verbose .
This option currently has no other effect.
POSIX conformance is assumed if the environment variable
.B POSIXLY_CORRECT
is set.
.TP
.B \-\-replace
Replace a locale in the locale archive file.
Without this option, if the locale is in the archive file already,
an error occurs.
.B \-\-little\-endian
Generate little-endian output.
.TP
.B \-\-no\-archive
Do not use the locale archive file, instead create
@ -252,6 +234,48 @@ This is helpful to prevent system locale archive updates from overwriting
custom locales created with
.BR localedef .
.TP
.B \-\-no\-hard\-links
Do not create hard links between installed locales.
.TP
.BI \-\-no\-warnings= warnings
Comma-separated list of warnings to disable.
Supported warnings are
.I ascii
and
.IR intcurrsym .
.TP
.B \-\-posix
Conform strictly to POSIX.
Implies
.BR \-\-verbose .
This option currently has no other effect.
POSIX conformance is assumed if the environment variable
.B POSIXLY_CORRECT
is set.
.TP
.BI \-\-prefix= pathname
Set the prefix to be prepended to the full archive pathname.
By default, the prefix is empty.
Setting the prefix to
.IR foo ,
the archive would be placed in
.IR foo/usr/lib/locale/locale\-archive .
.TP
.B \-\-quiet
Suppress all notifications and warnings, and report only fatal errors.
.TP
.B \-\-replace
Replace a locale in the locale archive file.
Without this option, if the locale is in the archive file already,
an error occurs.
.TP
.BI \-\-warnings= warnings
Comma-separated list of warnings to enable.
Supported warnings are
.I ascii
and
.IR intcurrsym .
.TP
.BR \-? ", " \-\-help
Print a usage summary and exit.
Also prints the default paths used by
@ -266,8 +290,7 @@ Print the version number, license, and disclaimer of warranty for
.SH EXIT STATUS
One of the following exit values can be returned by
.BR localedef :
.RS 3
.TP 10
.TP
.B 0
Command completed successfully.
.TP
@ -276,7 +299,6 @@ Warnings or errors occurred, output files were written.
.TP
.B 4
Errors encountered, no output created.
.RE
.SH ENVIRONMENT
.TP
.B POSIXLY_CORRECT
@ -297,7 +319,7 @@ Usual default path for locale definition files.
.I /usr/share/i18n/repertoiremaps
Usual default repertoire map path.
.TP
.I /usr/lib/locale/locale-archive
.I /usr/lib/locale/locale\-archive
Usual default locale archive location.
.TP
.I /usr/lib/locale
@ -350,7 +372,7 @@ An output file that contains information about formatting of data and
time values.
.SH CONFORMING TO
POSIX.1-2008.
.SH EXAMPLE
.SH EXAMPLES
Compile the locale files for Finnish in the UTF\-8 character set
and add it to the default locale archive with the name
.BR fi_FI.UTF\-8 :

View File

@ -21,11 +21,13 @@
.\" License along with this manual; if not, see
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.TH MEMUSAGE 1 2019-03-06 "GNU" "Linux user manual"
.TH MEMUSAGE 1 2021-03-22 "GNU" "Linux user manual"
.SH NAME
memusage \- profile memory usage of a program
.SH SYNOPSIS
.nf
.BR memusage " [\fIoption\fR]... \fIprogram\fR [\fIprogramoption\fR]..."
.fi
.SH DESCRIPTION
.B memusage
is a bash script which profiles memory usage of the program,
@ -55,7 +57,7 @@ can also be intercepted.
can output the collected data in textual form, or it can use
.BR memusagestat (1)
(see the
.B -p
.B \-p
option, below)
to create a PNG file containing graphical representation
of the collected data.
@ -152,7 +154,7 @@ Collect
.I size
entries before writing them out.
.TP
.B \fB\-\-no-timer
.B \-\-no\-timer
Disable timer-based
.RB ( SIGPROF )
sampling of stack pointer value.
@ -196,12 +198,14 @@ Make the graph
.I size
pixels high.
.SH EXIT STATUS
Exit status is equal to the exit status of profiled program.
The exit status of
.BR memusage
is equal to the exit status of the profiled program.
.SH BUGS
To report bugs, see
.UR http://www.gnu.org/software/libc/bugs.html
.UE
.SH EXAMPLE
.SH EXAMPLES
Below is a simple program that reallocates a block of
memory in cycles that rise to a peak before then cyclically
reallocating the memory in smaller blocks that return to zero.
@ -244,30 +248,34 @@ $ \fBmemusagestat memusage.dat memusage.png\fP
int
main(int argc, char *argv[])
{
int i, j;
int *p;
int i, j;
size_t size;
int *p;
printf("malloc: %zd\en", sizeof(int) * 100);
p = malloc(sizeof(int) * 100);
size = sizeof(*p) * 100;
printf("malloc: %zu\en", size);
p = malloc(size);
for (i = 0; i < CYCLES; i++) {
if (i < CYCLES / 2)
j = i;
else
j--;
for (i = 0; i < CYCLES; i++) {
if (i < CYCLES / 2)
j = i;
else
j\-\-;
printf("realloc: %zd\en", sizeof(int) * (j * 50 + 110));
p = realloc(p, sizeof(int) * (j * 50 + 100));
size = sizeof(*p) * (j * 50 + 110);
printf("realloc: %zu\en", size);
p = realloc(p, size);
printf("realloc: %zd\en", sizeof(int) * ((j+1) * 150 + 110));
p = realloc(p, sizeof(int) * ((j + 1) * 150 + 110));
}
size = sizeof(*p) * ((j + 1) * 150 + 110);
printf("realloc: %zu\en", size);
p = realloc(p, size);
}
free(p);
exit(EXIT_SUCCESS);
free(p);
exit(EXIT_SUCCESS);
}
.EE
.SH SEE ALSO
.BR memusagestat (1),
.BR mtrace (1)
.BR mtrace (1),
.BR ld.so (8)

View File

@ -20,20 +20,22 @@
.\" License along with this manual; if not, see
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.TH MEMUSAGESTAT 1 2019-03-06 "GNU" "Linux programmer's manual"
.TH MEMUSAGESTAT 1 2021-03-22 "GNU" "Linux programmer's manual"
.SH NAME
memusagestat \- generate graphic from memory profiling data
.SH SYNOPSIS
.nf
.BR memusagestat " [\fIoption\fR]... \fIdatafile\fR [\fIoutfile\fR]"
.fi
.SH DESCRIPTION
.B memusagestat
creates a PNG file containing a graphical representation of the
memory profiling data in the file
.IR datafile ;
that file is generated via the
.I -d
.I \-d
(or
.IR --data )
.IR \-\-data )
option of
.BR memusage (1).
.PP
@ -41,7 +43,7 @@ The red line in the graph shows the heap usage (allocated memory)
and the green line shows the stack usage.
The x-scale is either the number of memory-handling function calls or
(if the
.I -t
.I \-t
option is specified)
time.
.SH OPTIONS
@ -60,7 +62,7 @@ Use time (rather than number of function calls) as the scale for the X axis.
.B \-T\fR,\ \fB\-\-total
Also draw a graph of total memory consumption.
.TP
.BI \-x\ size \fR,\ \fB\-\-x-size= size
.BI \-x\ size \fR,\ \fB\-\-x\-size= size
Make the output graph
.I size
pixels wide.
@ -82,7 +84,7 @@ Print version information and exit.
To report bugs, see
.UR http://www.gnu.org/software/libc/bugs.html
.UE
.SH EXAMPLE
.SH EXAMPLES
See
.BR memusage (1).
.SH SEE ALSO

View File

@ -20,11 +20,13 @@
.\" License along with this manual; if not, see
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.TH MTRACE 1 2017-09-15 "GNU" "Linux user manual"
.TH MTRACE 1 2021-03-22 "GNU" "Linux user manual"
.SH NAME
mtrace \- interpret the malloc trace log
.SH SYNOPSIS
.nf
.BR mtrace " [\fIoption\fR]... [\fIbinary\fR] \fImtracedata\fR"
.fi
.SH DESCRIPTION
.B mtrace
is a Perl script used to interpret and provide human readable output

View File

@ -22,7 +22,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH PLDD 1 2019-03-06 "GNU" "Linux User Manual"
.TH PLDD 1 2020-11-01 "GNU" "Linux User Manual"
.SH NAME
pldd \- display dynamic shared objects linked into a process
.SH SYNOPSIS
@ -33,20 +33,20 @@ pldd \- display dynamic shared objects linked into a process
.SH DESCRIPTION
The
.B pldd
command displays a list of the dynamic shared objects that are
linked into the process with the specified process ID.
command displays a list of the dynamic shared objects (DSOs) that are
linked into the process with the specified process ID (PID).
The list includes the libraries that have been dynamically loaded using
.BR dlopen (3).
.SH OPTIONS
.TP
.BR \-? ", " \-\-help
Display program help message.
Display a help message and exit.
.TP
.B \-\-usage
Display a short usage message.
Display a short usage message and exit.
.TP
.BR \-V ", " \-\-version
Display the program version.
Display program version information and exit.
.SH EXIT STATUS
On success,
.B pldd
@ -93,21 +93,22 @@ using a command such as the following
.in +4n
.EX
$ \fBgdb \-ex "set confirm off" \-ex "set height 0" \-ex "info shared" \e\fP
\fB-ex "quit" \-p $pid | grep '^0x.*0x'\fP
\fB\-ex "quit" \-p $pid | grep \(aq\(ha0x.*0x\(aq\fP
.EE
.in
.SH BUGS
Since glibc 2.19,
From glibc 2.19 to 2.29,
.B pldd
is broken: it just hangs when executed.
.\" FIXME . https://sourceware.org/bugzilla/show_bug.cgi?id=18035
It is unclear if it will ever be fixed.
.SH EXAMPLE
was broken: it just hung when executed.
.\" glibc commit 1a4c27355e146b6d8cc6487b998462c7fdd1048f
This problem was fixed in glibc 2.30, and the fix has been backported
to earlier glibc versions in some distributions.
.SH EXAMPLES
.EX
$ \fBecho $$\fP # Display PID of shell
1143
$ \fBpldd $$\fP # Display DSOs linked into the shell
1143: /usr/bin/bash
1143: /usr/bin/bash
linux\-vdso.so.1
/lib64/libtinfo.so.5
/lib64/libdl.so.2

View File

@ -22,7 +22,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH SPROF 1 2019-03-06 "Linux" "Linux User Manual"
.TH SPROF 1 2020-11-01 "Linux" "Linux User Manual"
.SH NAME
sprof \- read and display shared object profiling data
.SH SYNOPSIS
@ -76,7 +76,7 @@ Display the program version and exit.
The
.B sprof
command is a GNU extension, not present in POSIX.1.
.SH EXAMPLE
.SH EXAMPLES
The following example demonstrates the use of
.BR sprof .
The example consists of a main program that calls two functions
@ -116,35 +116,27 @@ $ \fBcat libdemo.c\fP
void
consumeCpu1(int lim)
{
int j;
for (j = 0; j < lim; j++)
for (int j = 0; j < lim; j++)
getppid();
}
void
x1(void) {
int j;
for (j = 0; j < 100; j++)
for (int j = 0; j < 100; j++)
consumeCpu1(200000);
}
void
consumeCpu2(int lim)
{
int j;
for (j = 0; j < lim; j++)
for (int j = 0; j < lim; j++)
getppid();
}
void
x2(void)
{
int j;
for (j = 0; j < 1000; j++)
for (int j = 0; j < 1000; j++)
consumeCpu2(10000);
}
.EE

View File

@ -10,7 +10,8 @@
.SH NAME
time \- time a simple command or give resource usage
.SH SYNOPSIS
.BI "time [" options "] " command " [" arguments... "] "
.B time \c
.RI [ options ] " command " [ arguments... ]
.SH DESCRIPTION
The
.B time
@ -87,7 +88,6 @@ are used for the text and formatting of the output.
.B PATH
is used to search for
.IR command .
The remaining ones for the text and formatting of the output.
.SH GNU VERSION
Below a description of the GNU 1.7 version of
.BR time .
@ -124,8 +124,8 @@ sys %S
.\"
.SS The format string
The format is interpreted in the usual printf-like way.
Ordinary characters are directly copied, tab, newline
and backslash are escaped using \et, \en and \e\e,
Ordinary characters are directly copied, tab, newline,
and backslash are escaped using \et, \en, and \e\e,
a percent sign is represented by %%, and otherwise %
indicates a conversion.
The program

View File

@ -26,31 +26,30 @@
.\" Modified Wed Jul 21 23:02:38 1993 by Rik Faith <faith@cs.unc.edu>
.\" Modified 2001-11-17, aeb
.\"
.TH _EXIT 2 2017-05-03 "Linux" "Linux Programmer's Manual"
.TH _EXIT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
_exit, _Exit \- terminate the calling process
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "void _exit(int " status );
.BI "noreturn void _exit(int " status );
.PP
.B #include <stdlib.h>
.PP
.BI "void _Exit(int " status );
.BI "noreturn void _Exit(int " status );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.PP
.ad l
.BR _Exit ():
.RS 4
_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
.RE
.ad
.PP
.BR _Exit ():
.nf
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
.fi
.SH DESCRIPTION
The function
.BR _exit ()
terminates the calling process "immediately".
Any open file descriptors belonging to the process are closed.
@ -65,9 +64,9 @@ The process's parent is sent a
signal.
.PP
The value
.I "status & 0377"
.I "status & 0xFF"
is returned to the parent process as the process's exit status, and
can be collected using one of the
can be collected by the parent using one of the
.BR wait (2)
family of calls.
.PP
@ -113,6 +112,22 @@ canceled upon
.BR _exit (),
is implementation-dependent.
.SS C library/kernel differences
The text above in DESCRIPTION describes the traditional effect of
.BR _exit (),
which is to terminate a process,
and these are the semantics specified by POSIIX.1 and implemented
by the C library wrapper function.
On modern systems, this means termination of all threads in the process.
.PP
By contrast with the C library wrapper function, the raw Linux
.BR _exit ()
system call terminates only the calling thread, and actions such as
reparenting child processes or sending
.B SIGCHLD
to the parent process are performed only if this is
the last thread in the thread group.
.\" _exit() is used by pthread_exit() to terminate the calling thread
.PP
In glibc up to version 2.3, the
.BR _exit ()
wrapper function invoked the kernel system call of the same name.

View File

@ -35,15 +35,17 @@
.\" 2007-10-23 mtk: created as a new page, by taking the content
.\" specific to the _syscall() macros from intro(2).
.\"
.TH _SYSCALL 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH _SYSCALL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
_syscall \- invoking a system call without library support (OBSOLETE)
.SH SYNOPSIS
.nf
.B #include <linux/unistd.h>
.PP
A _syscall macro
.PP
desired system call
.fi
.SH DESCRIPTION
The important thing to know about a system call is its prototype.
You need to know how many arguments, their types,
@ -139,7 +141,7 @@ passed by-value or by-pointer (for aggregates like structs).
.\" header file contains the required SYS_foo definition.
.\" Otherwise, the use of a _syscall macro is required.
.\"
.SH EXAMPLE
.SH EXAMPLES
.EX
#include <stdio.h>
#include <stdlib.h>

View File

@ -38,21 +38,21 @@
.\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" 2008-12-04, mtk, Add documentation of accept4()
.\"
.TH ACCEPT 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH ACCEPT 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
accept, accept4 \- accept a connection on a socket
.SH SYNOPSIS
.nf
.BR "#include <sys/types.h>" " /* See NOTES */"
.B #include <sys/socket.h>
.PP
.BI "int accept(int " sockfd ", struct sockaddr *" addr ", socklen_t *" addrlen );
.BI "int accept(int " sockfd ", struct sockaddr *restrict " addr ,
.BI " socklen_t *restrict " addrlen );
.PP
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <sys/socket.h>
.PP
.BI "int accept4(int " sockfd ", struct sockaddr *" addr ,
.BI " socklen_t *" addrlen ", int " flags );
.BI "int accept4(int " sockfd ", struct sockaddr *restrict " addr ,
.BI " socklen_t *restrict " addrlen ", int " flags );
.fi
.SH DESCRIPTION
The
@ -169,11 +169,11 @@ flag in
for reasons why this may be useful.
.SH RETURN VALUE
On success,
these system calls return a nonnegative integer that is a file descriptor
for the accepted socket.
these system calls return a file descriptor
for the accepted socket (a nonnegative integer).
On error, \-1 is returned,
.I errno
is set appropriately, and
is set to indicate the error, and
.I addrlen
is left unchanged.
.SS Error handling
@ -261,15 +261,11 @@ does not refer to a socket.
The referenced socket is not of type
.BR SOCK_STREAM .
.TP
.B EPROTO
Protocol error.
.PP
In addition, Linux
.BR accept ()
may fail if:
.TP
.B EPERM
Firewall rules forbid connection.
.TP
.B EPROTO
Protocol error.
.PP
In addition, network errors for the new socket and as defined
for the protocol may be returned.
@ -318,12 +314,6 @@ of file status flags and always explicitly set all required flags on
the socket returned from
.BR accept ().
.SH NOTES
POSIX.1-2001 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
.PP
There may not always be a connection waiting after a
.B SIGIO
is delivered or
@ -367,7 +357,7 @@ standard wanted to change it into a \fIsize_t\ *\fPC;
.\" SunOS 5 has 'size_t *'
later POSIX standards and glibc 2.x have
.IR "socklen_t\ * ".
.SH EXAMPLE
.SH EXAMPLES
See
.BR bind (2).
.SH SEE ALSO

View File

@ -40,40 +40,43 @@
.\" Modified 2004-06-23 by Michael Kerrisk
.\" 2007-06-10, mtk, various parts rewritten, and added BUGS section.
.\"
.TH ACCESS 2 2016-03-15 "Linux" "Linux Programmer's Manual"
.TH ACCESS 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
access, faccessat \- check user's permissions for a file
access, faccessat, faccessat2 \- check user's permissions for a file
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int access(const char *" pathname ", int " mode );
.BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
.PP
.BR "#include <fcntl.h>" " /* Definition of " AT_* " constants */"
.B #include <unistd.h>
.PP
.BI "int faccessat(int " dirfd ", const char *" pathname ", int " \
mode ", int " flags );
/* But see C library/kernel differences, below */
.PP
.BR "#include <fcntl.h>" " /* Definition of " AT_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_faccessat2,"
.BI " int " dirfd ", const char *" pathname ", int " mode \
", int " flags );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR faccessat ():
.PD 0
.ad l
.RS 4
.TP 4
Since glibc 2.10:
_POSIX_C_SOURCE\ >=\ 200809L
.TP
Before glibc 2.10:
_ATFILE_SOURCE
.RE
.ad
.PD
.nf
Since glibc 2.10:
_POSIX_C_SOURCE >= 200809L
Before glibc 2.10:
_ATFILE_SOURCE
.fi
.SH DESCRIPTION
.BR access ()
checks whether the calling process can access the file
@ -126,9 +129,8 @@ then an
check is successful for a regular file if execute permission
is enabled for any of the file owner, group, or other.
.SS faccessat()
The
.BR faccessat ()
system call operates in exactly the same way as
operates in exactly the same way as
.BR access (),
except for the differences described here.
.PP
@ -180,6 +182,25 @@ See
.BR openat (2)
for an explanation of the need for
.BR faccessat ().
.\"
.SS faccessat2()
The description of
.BR faccessat ()
given above corresponds to POSIX.1 and
to the implementation provided by glibc.
However, the glibc implementation was an imperfect emulation (see BUGS)
that papered over the fact that the raw Linux
.BR faccessat ()
system call does not have a
.I flags
argument.
To allow for a proper implementation, Linux 5.8 added the
.BR faccessat2 ()
system call, which supports the
.I flags
argument and allows a correct implementation of the
.BR faccessat ()
wrapper function.
.SH RETURN VALUE
On success (all requested permissions granted, or
.I mode
@ -195,12 +216,8 @@ is
and the file does not exist, or some other error occurred),
\-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.BR access ()
and
.BR faccessat ()
shall fail if:
.TP
.B EACCES
The requested access would be denied to the file, or search permission
@ -209,6 +226,32 @@ is denied for one of the directories in the path prefix of
(See also
.BR path_resolution (7).)
.TP
.B EBADF
.RB ( faccessat ())
.I pathname
is relative but
.I dirfd
is neither
.B AT_FDCWD
.RB ( faccessat ())
nor a valid file descriptor.
.TP
.B EFAULT
.I pathname
points outside your accessible address space.
.TP
.B EINVAL
.I mode
was incorrectly specified.
.TP
.B EINVAL
.RB ( faccessat ())
Invalid flag specified in
.IR flags .
.TP
.B EIO
An I/O error occurred.
.TP
.B ELOOP
Too many symbolic links were encountered in resolving
.IR pathname .
@ -222,65 +265,44 @@ A component of
.I pathname
does not exist or is a dangling symbolic link.
.TP
.B ENOMEM
Insufficient kernel memory was available.
.TP
.B ENOTDIR
A component used as a directory in
.I pathname
is not, in fact, a directory.
.TP
.B EROFS
Write permission was requested for a file on a read-only filesystem.
.PP
.BR access ()
and
.BR faccessat ()
may fail if:
.TP
.B EFAULT
.I pathname
points outside your accessible address space.
.TP
.B EINVAL
.I mode
was incorrectly specified.
.TP
.B EIO
An I/O error occurred.
.TP
.B ENOMEM
Insufficient kernel memory was available.
.TP
.B ETXTBSY
Write access was requested to an executable which is being
executed.
.PP
The following additional errors can occur for
.BR faccessat ():
.TP
.B EBADF
.I dirfd
is not a valid file descriptor.
.TP
.B EINVAL
Invalid flag specified in
.IR flags .
.TP
.B ENOTDIR
.RB ( faccessat ())
.I pathname
is relative and
.I dirfd
is a file descriptor referring to a file other than a directory.
.TP
.B EROFS
Write permission was requested for a file on a read-only filesystem.
.TP
.B ETXTBSY
Write access was requested to an executable which is being
executed.
.SH VERSIONS
.BR faccessat ()
was added to Linux in kernel 2.6.16;
library support was added to glibc in version 2.4.
.PP
.BR faccessat2 ()
was added to Linux in version 5.8.
.SH CONFORMING TO
.BR access ():
SVr4, 4.3BSD, POSIX.1-2001, POSIX.1-2008.
.PP
.BR faccessat ():
POSIX.1-2008.
.SH NOTES
.PP
.BR faccessat2 ():
Linux-specific.
.SH NOTES
.BR Warning :
Using these calls to check if a user is authorized to, for example,
open a file before actually doing so using
@ -325,15 +347,15 @@ Only access bits are checked, not the file type or contents.
Therefore, if a directory is found to be writable,
it probably means that files can be created in the directory,
and not that the directory can be written as a file.
Similarly, a DOS file may be found to be "executable," but the
Similarly, a DOS file may be reported as executable, but the
.BR execve (2)
call will still fail.
.PP
These calls
may not work correctly on NFSv2 filesystems with UID mapping enabled,
because UID mapping is done on the server and hidden from the client,
which checks permissions. (NFS versions 3 and higher perform the check on
the server.)
which checks permissions.
(NFS versions 3 and higher perform the check on the server.)
Similar problems can occur to FUSE mounts.
.\"
.\"
@ -349,7 +371,8 @@ flags are actually implemented within the glibc wrapper function for
.BR faccessat ().
If either of these flags is specified, then the wrapper function employs
.BR fstatat (2)
to determine access permissions.
to determine access permissions, but see BUGS.
.\"
.SS Glibc notes
On older kernels where
.BR faccessat ()
@ -369,6 +392,24 @@ that corresponds to the
.IR dirfd
argument.
.SH BUGS
Because the Linux kernel's
.BR faccessat ()
system call does not support a
.I flags
argument, the glibc
.BR faccessat ()
wrapper function provided in glibc 2.32 and earlier
emulates the required functionality using
a combination of the
.BR faccessat ()
system call and
.BR fstatat (2).
However, this emulation does not take ACLs into account.
Starting with glibc 2.33, the wrapper function avoids this bug
by making use of the
.BR faccessat2 ()
system call where it is provided by the underlying kernel.
.PP
In kernel 2.4 (and earlier) there is some strangeness in the handling of
.B X_OK
tests for superuser.

View File

@ -28,7 +28,7 @@
.\" Modified 1998-11-04 by Tigran Aivazian <tigran@sco.com>
.\" Modified 2004-05-27, 2004-06-17, 2004-06-23 by Michael Kerrisk
.\"
.TH ACCT 2 2016-03-15 "Linux" "Linux Programmer's Manual"
.TH ACCT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
acct \- switch process accounting on or off
.SH SYNOPSIS
@ -40,10 +40,10 @@ acct \- switch process accounting on or off
.fi
.ad b
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR acct ():
.nf
@ -51,9 +51,9 @@ Feature Test Macro Requirements for glibc (see
.\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8
_DEFAULT_SOURCE
In glibc 2.19 and 2.20:
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
Up to and including glibc 2.19:
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
.fi
.SH DESCRIPTION
The
@ -69,7 +69,7 @@ An argument of NULL causes accounting to be turned off.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EACCES

View File

@ -9,12 +9,11 @@
.\" 2 of the License, or (at your option) any later version.
.\" %%%LICENSE_END
.\"
.TH ADD_KEY 2 2019-03-06 Linux "Linux Key Management Calls"
.TH ADD_KEY 2 2021-08-27 Linux "Linux Key Management Calls"
.SH NAME
add_key \- add a key to the kernel's key management facility
.SH SYNOPSIS
.nf
.B #include <sys/types.h>
.B #include <keyutils.h>
.PP
.BI "key_serial_t add_key(const char *" type ", const char *" description ,
@ -22,7 +21,8 @@ add_key \- add a key to the kernel's key management facility
.BI " key_serial_t " keyring ");"
.fi
.PP
No glibc wrapper is provided for this system call; see NOTES.
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
.SH DESCRIPTION
.BR add_key ()
creates or updates a key of the given
@ -68,23 +68,23 @@ Alternatively, it may be one of the following special keyring IDs:
.TP
.B KEY_SPEC_THREAD_KEYRING
This specifies the caller's thread-specific keyring
.RB ( thread-keyring (7)).
.RB ( thread\-keyring (7)).
.TP
.B KEY_SPEC_PROCESS_KEYRING
This specifies the caller's process-specific keyring
.RB ( process-keyring (7)).
.RB ( process\-keyring (7)).
.TP
.B KEY_SPEC_SESSION_KEYRING
This specifies the caller's session-specific keyring
.RB ( session-keyring (7)).
.RB ( session\-keyring (7)).
.TP
.B KEY_SPEC_USER_KEYRING
This specifies the caller's UID-specific keyring
.RB ( user-keyring (7)).
.RB ( user\-keyring (7)).
.TP
.B KEY_SPEC_USER_SESSION_KEYRING
This specifies the caller's UID-session keyring
.RB ( user-session-keyring (7)).
.RB ( user\-session\-keyring (7)).
.SS Key types
The key
.I type
@ -146,7 +146,7 @@ On success,
returns the serial number of the key it created or updated.
On error, \-1 is returned and
.I errno
is set to indicate the cause of the error.
is set to indicate the error.
.SH ERRORS
.TP
.B EACCES
@ -215,13 +215,16 @@ This system call first appeared in Linux 2.6.10.
.SH CONFORMING TO
This system call is a nonstandard Linux extension.
.SH NOTES
No wrapper for this system call is provided in glibc.
Glibc does not provide a wrapper for this system call.
A wrapper is provided in the
.IR libkeyutils
package.
library.
(The accompanying package provides the
.I <keyutils.h>
header file.)
When employing the wrapper in that library, link with
.IR \-lkeyutils .
.SH EXAMPLE
.SH EXAMPLES
The program below creates a key with the type, description, and payload
specified in its command-line arguments,
and links that key into the session keyring.
@ -232,7 +235,7 @@ The following shell session demonstrates the use of the program:
$ \fB./a.out user mykey "Some payload"\fP
Key ID is 64a4dca
$ \fBgrep \(aq64a4dca\(aq /proc/keys\fP
064a4dca I--Q--- 1 perm 3f010000 1000 1000 user mykey: 12
064a4dca I\-\-Q\-\-\- 1 perm 3f010000 1000 1000 user mykey: 12
.EE
.in
.SS Program source
@ -240,6 +243,7 @@ $ \fBgrep \(aq64a4dca\(aq /proc/keys\fP
.EX
#include <sys/types.h>
#include <keyutils.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -262,7 +266,7 @@ main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
printf("Key ID is %lx\en", (long) key);
printf("Key ID is %jx\en", (uintmax_t) key);
exit(EXIT_SUCCESS);
}

View File

@ -26,15 +26,17 @@
.\" Modified 1997-07-30 by Paul Slootman <paul@wurtel.demon.nl>
.\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH ADJTIMEX 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH ADJTIMEX 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
adjtimex, ntp_adjtime \- tune kernel clock
adjtimex, clock_adjtime, ntp_adjtime \- tune kernel clock
.SH SYNOPSIS
.nf
.B #include <sys/timex.h>
.PP
.BI "int adjtimex(struct timex *" "buf" );
.PP
.BI "int clock_adjtime(clockid_t " clk_id, " struct timex *" "buf" );
.PP
.BI "int ntp_adjtime(struct timex *" buf );
.fi
.SH DESCRIPTION
@ -59,36 +61,36 @@ struct timex {
long maxerror; /* Maximum error (microseconds) */
long esterror; /* Estimated error (microseconds) */
int status; /* Clock command/status */
long constant; /* PLL (phase-locked loop) time constant */
long constant; /* PLL (phase\-locked loop) time constant */
long precision; /* Clock precision
(microseconds, read-only) */
long tolerance; /* Clock frequency tolerance (read-only);
(microseconds, read\-only) */
long tolerance; /* Clock frequency tolerance (read\-only);
see NOTES for units */
struct timeval time;
/* Current time (read-only, except for
/* Current time (read\-only, except for
ADJ_SETOFFSET); upon return, time.tv_usec
contains nanoseconds, if STA_NANO status
flag is set, otherwise microseconds */
long tick; /* Microseconds between clock ticks */
long ppsfreq; /* PPS (pulse per second) frequency
(read-only); see NOTES for units */
long jitter; /* PPS jitter (read-only); nanoseconds, if
(read\-only); see NOTES for units */
long jitter; /* PPS jitter (read\-only); nanoseconds, if
STA_NANO status flag is set, otherwise
microseconds */
int shift; /* PPS interval duration
(seconds, read-only) */
long stabil; /* PPS stability (read-only);
(seconds, read\-only) */
long stabil; /* PPS stability (read\-only);
see NOTES for units */
long jitcnt; /* PPS count of jitter limit exceeded
events (read-only) */
events (read\-only) */
long calcnt; /* PPS count of calibration intervals
(read-only) */
(read\-only) */
long errcnt; /* PPS count of calibration errors
(read-only) */
(read\-only) */
long stbcnt; /* PPS count of stability limit exceeded
events (read-only) */
events (read\-only) */
int tai; /* TAI offset, as set by previous ADJ_TAI
operation (seconds, read-only,
operation (seconds, read\-only,
since Linux 2.6.26) */
/* Further padding bytes to allow for future expansion */
};
@ -160,6 +162,26 @@ flag, then
.I buf.time.tv_usec
is interpreted as a nanosecond value;
otherwise it is interpreted as microseconds.
.IP
The value of
.I buf.time
is the sum of its two fields, but the
field
.I buf.time.tv_usec
must always be nonnegative.
The following example shows how to
normalize a
.I timeval
with nanosecond resolution.
.IP
.in +4n
.EX
while (buf.time.tv_usec < 0) {
buf.time.tv_sec \-= 1;
buf.time.tv_usec += 1000000000;
}
.EE
.in
.TP
.BR ADJ_MICRO " (since Linux 2.6.26)"
.\" commit eea83d896e318bda54be2d2770d2c5d6668d11db
@ -210,7 +232,7 @@ in which case other bits should not be specified in
.\" In user space, ADJ_OFFSET_SINGLESHOT is 0x8001
.\" In kernel space it is 0x0001, and must be ANDed with ADJ_ADJTIME (0x8000)
Old-fashioned
.BR adjtime ():
.BR adjtime (3):
(gradually) adjust time by value specified in
.IR buf.offset ,
which specifies an adjustment in microseconds.
@ -344,6 +366,14 @@ Attempts to set read-only
.I status
bits are silently ignored.
.\"
.SS clock_adjtime ()
The
.BR clock_adjtime ()
system call (added in Linux 2.6.39) behaves like
.BR adjtimex ()
but takes an additional
.IR clk_id
argument to specify the particular clock on which to act.
.SS ntp_adjtime ()
The
.BR ntp_adjtime ()
@ -352,7 +382,7 @@ library function
is a more portable interface for performing the same task as
.BR adjtimex ().
Other than the following points, it is identical to
.BR adjtime ():
.BR adjtimex ():
.IP * 3
The constants used in
.I modes
@ -445,7 +475,8 @@ the call operates asynchronously and the return value usually will
not reflect a state change caused by the call itself.
.PP
On failure, these calls return \-1 and set
.IR errno .
.IR errno
to indicate the error.
.SH ERRORS
.TP
.B EFAULT
@ -472,6 +503,20 @@ An attempt was made to set
to a value other than those listed above.
.TP
.B EINVAL
The
.I clk_id
given to
.BR clock_adjtime ()
is invalid for one of two reasons.
Either the System-V style hard-coded
positive clock ID value is out of range, or the dynamic
.I clk_id
does not refer to a valid instance of a clock object.
See
.BR clock_gettime (2)
for a discussion of dynamic clocks.
.TP
.B EINVAL
An attempt was made to set
.I buf.tick
to a value outside the range
@ -482,6 +527,20 @@ where
.B HZ
is the system timer interrupt frequency.
.TP
.B ENODEV
The hot-pluggable device (like USB for example) represented by a
dynamic
.I clk_id
has disappeared after its character device was opened.
See
.BR clock_gettime (2)
for a discussion of dynamic clocks.
.TP
.B EOPNOTSUPP
The given
.I clk_id
does not support adjustment.
.TP
.B EPERM
.I buf.modes
is neither 0 nor
@ -493,20 +552,27 @@ capability is required.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lb lb lb
lbx lb lb
l l l.
Interface Attribute Value
T{
.BR ntp_adjtime ()
T} Thread safety MT-Safe
.TE
.hy
.ad
.sp 1
.SH CONFORMING TO
Neither of these interfaces is described in POSIX.1
None of these interfaces is described in POSIX.1
.PP
.BR adjtimex ()
is Linux-specific and should not be used in programs
and
.BR clock_adjtime ()
are Linux-specific and should not be used in programs
intended to be portable.
.PP
The preferred API for the NTP daemon is
@ -533,6 +599,8 @@ is done by the kernel in timer context.
Thus, it will take one tick into the second
for the leap second to be inserted or deleted.
.SH SEE ALSO
.BR clock_gettime (2),
.BR clock_settime (2),
.BR settimeofday (2),
.BR adjtime (3),
.BR ntp_gettime (3),

View File

@ -22,19 +22,24 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH ALLOC_HUGEPAGES 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH ALLOC_HUGEPAGES 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
alloc_hugepages, free_hugepages \- allocate or free huge pages
.SH SYNOPSIS
.nf
.BI "void *alloc_hugepages(int " key ", void *" addr ", size_t " len ,
.BI " int " prot ", int " flag );
.BI "void *syscall(SYS_alloc_hugepages, int " key ", void *" addr \
", size_t " len ,
.BI " int " prot ", int " flag );
.\" asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr,
.\" unsigned long len, int prot, int flag);
.PP
.BI "int free_hugepages(void *" addr );
.BI "int syscall(SYS_free_hugepages, void *" addr );
.\" asmlinkage int sys_free_hugepages(unsigned long addr);
.fi
.PP
.IR Note :
glibc provides no wrappers for these system calls,
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The system calls
.BR alloc_hugepages ()
@ -114,7 +119,7 @@ returns the allocated virtual address, and
returns zero.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B ENOSYS
@ -129,8 +134,7 @@ This can be read and written.
Gives info on the number of configured hugetlb pages and on their size
in the three variables HugePages_Total, HugePages_Free, Hugepagesize.
.SH CONFORMING TO
These calls are specific to Linux on Intel processors, and should not be
used in programs intended to be portable.
These extinct system calls were specific to Linux on Intel processors.
.SH NOTES
These system calls are gone;
they existed only in Linux 2.5.36 through to 2.5.54.
@ -143,8 +147,8 @@ to map files in this virtual filesystem.
The maximal number of huge pages can be specified using the
.B hugepages=
boot parameter.
.PP
.\".PP
.\" requires CONFIG_HUGETLB_PAGE (under "Processor type and features")
.\" and CONFIG_HUGETLBFS (under "Filesystems").
.\" mount -t hugetlbfs hugetlbfs /huge
.\" mount \-t hugetlbfs hugetlbfs /huge
.\" SHM_HUGETLB

View File

@ -22,17 +22,24 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH ARCH_PRCTL 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH ARCH_PRCTL 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
arch_prctl \- set architecture-specific thread state
.SH SYNOPSIS
.nf
.B #include <asm/prctl.h>
.B #include <sys/prctl.h>
.BR "#include <asm/prctl.h>" " /* Definition of " ARCH_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int arch_prctl(int " code ", unsigned long " addr );
.BI "int arch_prctl(int " code ", unsigned long *" addr );
.BI "int syscall(SYS_arch_prctl, int " code ", unsigned long " addr );
.BI "int syscall(SYS_arch_prctl, int " code ", unsigned long *" addr );
.fi
.PP
.IR Note :
glibc provides no wrapper for
.BR arch_prctl (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.BR arch_prctl ()
sets architecture-specific process or thread state.
@ -48,7 +55,47 @@ for the "set" operations, or as an
.IR "unsigned long\ *" ,
for the "get" operations.
.PP
Subfunctions for x86-64 are:
Subfunctions for both x86 and x86-64 are:
.TP
.BR ARCH_SET_CPUID " (since Linux 4.12)"
.\" commit e9ea1e7f53b852147cbd568b0568c7ad97ec21a3
Enable
.RI ( "addr != 0" )
or disable
.RI ( "addr == 0" )
the
.I cpuid
instruction for the calling thread.
The instruction is enabled by default.
If disabled, any execution of a
.I cpuid
instruction will instead generate a
.B SIGSEGV
signal.
This feature can be used to emulate
.I cpuid
results that differ from what the underlying
hardware would have produced (e.g., in a paravirtualization setting).
.IP
The
.BR ARCH_SET_CPUID
setting is preserved across
.BR fork (2)
and
.BR clone (2)
but reset to the default (i.e.,
.I cpuid
enabled) on
.BR execve (2).
.TP
.BR ARCH_GET_CPUID " (since Linux 4.12)"
Return the setting of the flag manipulated by
.B ARCH_SET_CPUID
as the result of the system call (1 for enabled, 0 for disabled).
.I addr
is ignored.
.TP
Subfunctions for x86-64 only are:
.TP
.B ARCH_SET_FS
Set the 64-bit base for the
@ -59,7 +106,7 @@ register to
.B ARCH_GET_FS
Return the 64-bit base value for the
.I FS
register of the current thread in the
register of the calling thread in the
.I unsigned long
pointed to by
.IR addr .
@ -73,7 +120,7 @@ register to
.B ARCH_GET_GS
Return the 64-bit base value for the
.I GS
register of the current thread in the
register of the calling thread in the
.I unsigned long
pointed to by
.IR addr .
@ -93,6 +140,10 @@ points to an unmapped address or is outside the process address space.
.I code
is not a valid subcommand.
.TP
.B ENODEV
.B ARCH_SET_CPUID
was requested, but the underlying hardware does not support CPUID faulting.
.TP
.B EPERM
.I addr
is outside the process address space.
@ -130,11 +181,6 @@ and
in the same thread is dangerous, as they may overwrite each other's
TLS entries.
.PP
As of version 2.7, glibc provides no prototype for
.BR arch_prctl ().
You have to declare it yourself for now.
This may be fixed in future glibc versions.
.PP
.I FS
may be already used by the threading library.
Programs that use

View File

@ -24,7 +24,7 @@
.\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH BDFLUSH 2 2016-10-08 "Linux" "Linux Programmer's Manual"
.TH BDFLUSH 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
bdflush \- start, flush, or tune buffer-dirty-flush daemon
.SH SYNOPSIS
@ -34,10 +34,13 @@ bdflush \- start, flush, or tune buffer-dirty-flush daemon
.BI "int bdflush(int " func ", long *" address );
.BI "int bdflush(int " func ", long " data );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see VERSIONS.
.SH DESCRIPTION
.IR Note :
Since Linux 2.6,
.\" As noted in a changes in the 2.5.12 source
.\" As noted in changes in the 2.5.12 source
this system call is deprecated and does nothing.
It is likely to disappear altogether in a future kernel release.
Nowadays, the task performed by

View File

@ -1,4 +1,5 @@
.\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu)
.\" and Copyright 2005-2007, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Portions extracted from /usr/include/sys/socket.h, which does not have
.\" any authorship information in it. It is probably available under the GPL.
.\"
@ -65,12 +66,11 @@
.\" $Id: bind.2,v 1.3 1999/04/23 19:56:07 freitag Exp $
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH BIND 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH BIND 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
bind \- bind a name to a socket
.SH SYNOPSIS
.nf
.BR "#include <sys/types.h>" " /* See NOTES */"
.B #include <sys/socket.h>
.PP
.BI "int bind(int " sockfd ", const struct sockaddr *" addr ,
@ -148,12 +148,12 @@ The only purpose of this structure is to cast the structure
pointer passed in
.I addr
in order to avoid compiler warnings.
See EXAMPLE below.
See EXAMPLES below.
.SH RETURN VALUE
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EACCES
@ -242,12 +242,6 @@ first appeared in 4.2BSD).
.\" .B EISDIR
.\" UNIX-domain error conditions.
.SH NOTES
POSIX.1 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
.PP
For background on the
.I socklen_t
type, see
@ -255,7 +249,7 @@ type, see
.SH BUGS
The transparent proxy options are not described.
.\" FIXME Document transparent proxy options
.SH EXAMPLE
.SH EXAMPLES
An example of the use of
.BR bind ()
with Internet domain sockets can be found in
@ -292,23 +286,22 @@ main(int argc, char *argv[])
if (sfd == \-1)
handle_error("socket");
memset(&my_addr, 0, sizeof(struct sockaddr_un));
/* Clear structure */
memset(&my_addr, 0, sizeof(my_addr));
my_addr.sun_family = AF_UNIX;
strncpy(my_addr.sun_path, MY_SOCK_PATH,
sizeof(my_addr.sun_path) \- 1);
if (bind(sfd, (struct sockaddr *) &my_addr,
sizeof(struct sockaddr_un)) == \-1)
sizeof(my_addr)) == \-1)
handle_error("bind");
if (listen(sfd, LISTEN_BACKLOG) == \-1)
handle_error("listen");
/* Now we can accept incoming connections one
at a time using accept(2) */
at a time using accept(2). */
peer_addr_size = sizeof(struct sockaddr_un);
peer_addr_size = sizeof(peer_addr);
cfd = accept(sfd, (struct sockaddr *) &peer_addr,
&peer_addr_size);
if (cfd == \-1)
@ -317,7 +310,7 @@ main(int argc, char *argv[])
/* Code to deal with incoming connection(s)... */
/* When no longer required, the socket pathname, MY_SOCK_PATH
should be deleted using unlink(2) or remove(3) */
should be deleted using unlink(2) or remove(3). */
}
.EE
.SH SEE ALSO

View File

@ -23,13 +23,13 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH BPF 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH BPF 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
bpf \- perform a command on an extended BPF map or program
.SH SYNOPSIS
.nf
.B #include <linux/bpf.h>
.PP
.BI "int bpf(int " cmd ", union bpf_attr *" attr ", unsigned int " size );
.fi
.SH DESCRIPTION
@ -84,7 +84,7 @@ below for further details.
Generally, eBPF programs are loaded by the user process and automatically
unloaded when the process exits.
In some cases, for example,
.BR tc-bpf (8),
.BR tc\-bpf (8),
the program will continue to stay alive inside the kernel even after the
process that loaded the program exits.
In that case,
@ -121,13 +121,13 @@ eBPF programs can access the same map:
.EX
tracing tracing tracing packet packet packet
event A event B event C on eth0 on eth1 on eth2
| | | | | ^
| | | | | \(ha
| | | | v |
--> tracing <-- tracing socket tc ingress tc egress
\-\-> tracing <\-\- tracing socket tc ingress tc egress
prog_1 prog_2 prog_3 classifier action
| | | | prog_4 prog_5
|--- -----| |------| map_3 | |
map_1 map_2 --| map_4 |--
|\-\-\- \-\-\-\-\-| |\-\-\-\-\-\-| map_3 | |
map_1 map_2 \-\-| map_4 |\-\-
.EE
.in
.\"
@ -209,11 +209,11 @@ union bpf_attr {
struct { /* Used by BPF_PROG_LOAD */
__u32 prog_type;
__u32 insn_cnt;
__aligned_u64 insns; /* 'const struct bpf_insn *' */
__aligned_u64 license; /* 'const char *' */
__aligned_u64 insns; /* \(aqconst struct bpf_insn *\(aq */
__aligned_u64 license; /* \(aqconst char *\(aq */
__u32 log_level; /* verbosity level of verifier */
__u32 log_size; /* size of user buffer */
__aligned_u64 log_buf; /* user supplied 'char *'
__aligned_u64 log_buf; /* user supplied \(aqchar *\(aq
buffer */
__u32 kern_version;
/* checked when prog_type=kprobe
@ -307,21 +307,23 @@ of 8 and the eBPF program calls
.IP
.in +4n
.EX
bpf_map_lookup_elem(map_fd, fp - 4)
bpf_map_lookup_elem(map_fd, fp \- 4)
.EE
.in
.IP
the program will be rejected,
since the in-kernel helper function
.IP
.in +4n
.EX
bpf_map_lookup_elem(map_fd, void *key)
bpf_map_lookup_elem(map_fd, void *key)
.EE
.in
.IP
expects to read 8 bytes from the location pointed to by
.IR key ,
but the
.I fp\ -\ 4
.I fp\ \-\ 4
(where
.I fp
is the top of the stack)
@ -367,6 +369,14 @@ enum bpf_map_type {
BPF_MAP_TYPE_DEVMAP,
BPF_MAP_TYPE_SOCKMAP,
BPF_MAP_TYPE_CPUMAP,
BPF_MAP_TYPE_XSKMAP,
BPF_MAP_TYPE_SOCKHASH,
BPF_MAP_TYPE_CGROUP_STORAGE,
BPF_MAP_TYPE_REUSEPORT_SOCKARRAY,
BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE,
BPF_MAP_TYPE_QUEUE,
BPF_MAP_TYPE_STACK,
/* See /usr/include/linux/bpf.h for the full list. */
};
.EE
.in
@ -756,6 +766,25 @@ enum bpf_prog_type {
BPF_PROG_TYPE_KPROBE,
BPF_PROG_TYPE_SCHED_CLS,
BPF_PROG_TYPE_SCHED_ACT,
BPF_PROG_TYPE_TRACEPOINT,
BPF_PROG_TYPE_XDP,
BPF_PROG_TYPE_PERF_EVENT,
BPF_PROG_TYPE_CGROUP_SKB,
BPF_PROG_TYPE_CGROUP_SOCK,
BPF_PROG_TYPE_LWT_IN,
BPF_PROG_TYPE_LWT_OUT,
BPF_PROG_TYPE_LWT_XMIT,
BPF_PROG_TYPE_SOCK_OPS,
BPF_PROG_TYPE_SK_SKB,
BPF_PROG_TYPE_CGROUP_DEVICE,
BPF_PROG_TYPE_SK_MSG,
BPF_PROG_TYPE_RAW_TRACEPOINT,
BPF_PROG_TYPE_CGROUP_SOCK_ADDR,
BPF_PROG_TYPE_LWT_SEG6LOCAL,
BPF_PROG_TYPE_LIRC_MODE2,
BPF_PROG_TYPE_SK_REUSEPORT,
BPF_PROG_TYPE_FLOW_DISSECTOR,
/* See /usr/include/linux/bpf.h for the full list. */
};
.EE
.in
@ -942,75 +971,6 @@ ioctl(event_fd, PERF_EVENT_IOC_SET_BPF, prog_fd);
.in
.\"
.\"
.SH EXAMPLES
.EX
/* bpf+sockets example:
* 1. create array map of 256 elements
* 2. load program that counts number of packets received
* r0 = skb->data[ETH_HLEN + offsetof(struct iphdr, protocol)]
* map[r0]++
* 3. attach prog_fd to raw socket via setsockopt()
* 4. print number of received TCP/UDP packets every second
*/
int
main(int argc, char **argv)
{
int sock, map_fd, prog_fd, key;
long long value = 0, tcp_cnt, udp_cnt;
map_fd = bpf_create_map(BPF_MAP_TYPE_ARRAY, sizeof(key),
sizeof(value), 256);
if (map_fd < 0) {
printf("failed to create map '%s'\en", strerror(errno));
/* likely not run as root */
return 1;
}
struct bpf_insn prog[] = {
BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), /* r6 = r1 */
BPF_LD_ABS(BPF_B, ETH_HLEN + offsetof(struct iphdr, protocol)),
/* r0 = ip->proto */
BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, -4),
/* *(u32 *)(fp - 4) = r0 */
BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), /* r2 = fp */
BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -4), /* r2 = r2 - 4 */
BPF_LD_MAP_FD(BPF_REG_1, map_fd), /* r1 = map_fd */
BPF_CALL_FUNC(BPF_FUNC_map_lookup_elem),
/* r0 = map_lookup(r1, r2) */
BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 2),
/* if (r0 == 0) goto pc+2 */
BPF_MOV64_IMM(BPF_REG_1, 1), /* r1 = 1 */
BPF_XADD(BPF_DW, BPF_REG_0, BPF_REG_1, 0, 0),
/* lock *(u64 *) r0 += r1 */
.\" == atomic64_add
BPF_MOV64_IMM(BPF_REG_0, 0), /* r0 = 0 */
BPF_EXIT_INSN(), /* return r0 */
};
prog_fd = bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, prog,
sizeof(prog) / sizeof(prog[0]), "GPL");
sock = open_raw_sock("lo");
assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, &prog_fd,
sizeof(prog_fd)) == 0);
for (;;) {
key = IPPROTO_TCP;
assert(bpf_lookup_elem(map_fd, &key, &tcp_cnt) == 0);
key = IPPROTO_UDP;
assert(bpf_lookup_elem(map_fd, &key, &udp_cnt) == 0);
printf("TCP %lld UDP %lld packets\en", tcp_cnt, udp_cnt);
sleep(1);
}
return 0;
}
.EE
.PP
Some complete working code can be found in the
.I samples/bpf
directory in the kernel source tree.
.SH RETURN VALUE
For a successful call, the return value depends on the operation:
.TP
@ -1025,7 +985,7 @@ Zero.
.PP
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B E2BIG
@ -1120,11 +1080,33 @@ The
.BR bpf ()
system call is Linux-specific.
.SH NOTES
In the current implementation, all
Prior to Linux 4.4, all
.BR bpf ()
commands require the caller to have the
.B CAP_SYS_ADMIN
capability.
From Linux 4.4 onwards,
.\" commit 1be7f75d1668d6296b80bf35dcf6762393530afc
an unprivileged user may create limited programs of type
.BR BPF_PROG_TYPE_SOCKET_FILTER
and associated maps.
However they may not store kernel pointers within
the maps and are presently limited to the following helper functions:
.\" [Linux 5.6] mtk: The list of available functions is, I think, governed
.\" by the check in net/core/filter.c::bpf_base_func_proto().
.IP * 3
get_random
.PD 0
.IP *
get_smp_processor_id
.IP *
tail_call
.IP *
ktime_get_ns
.PD 1
.PP
Unprivileged access may be blocked by writing the value 1 to the file
.IR /proc/sys/kernel/unprivileged_bpf_disabled .
.PP
eBPF objects (maps and programs) can be shared between processes.
For example, after
@ -1196,12 +1178,12 @@ ARM32 (since Linux 3.18; cBPF since Linux 3.4);
SPARC 32 (since Linux 3.18; cBPF since Linux 3.5);
.\" commit 2809a2087cc44b55e4377d7b9be3f7f5d2569091
.IP *
s390 (since Linux 3.18; cBPF since Linux 3.7);
.\" commit c10302efe569bfd646b4c22df29577a4595b4580
.IP *
ARM-64 (since Linux 3.18);
.\" commit e54bcde3d69d40023ae77727213d14f920eb264a
.IP *
s390 (since Linux 4.1; cBPF since Linux 3.7);
.\" commit c10302efe569bfd646b4c22df29577a4595b4580
.IP *
PowerPC 64 (since Linux 4.8; cBPF since Linux 3.1);
.\" commit 0ca87f05ba8bdc6791c14878464efc901ad71e99
.\" commit 156d0e290e969caba25f1851c52417c14d141b24
@ -1219,12 +1201,81 @@ MIPS 64 (since Linux 4.18; cBPF since Linux 3.16);
riscv (since Linux 5.1).
.\" commit 2353ecc6f91fd15b893fa01bf85a1c7a823ee4f2
.PD
.SH EXAMPLES
.EX
/* bpf+sockets example:
* 1. create array map of 256 elements
* 2. load program that counts number of packets received
* r0 = skb\->data[ETH_HLEN + offsetof(struct iphdr, protocol)]
* map[r0]++
* 3. attach prog_fd to raw socket via setsockopt()
* 4. print number of received TCP/UDP packets every second
*/
int
main(int argc, char *argv[])
{
int sock, map_fd, prog_fd, key;
long long value = 0, tcp_cnt, udp_cnt;
map_fd = bpf_create_map(BPF_MAP_TYPE_ARRAY, sizeof(key),
sizeof(value), 256);
if (map_fd < 0) {
printf("failed to create map \(aq%s\(aq\en", strerror(errno));
/* likely not run as root */
return 1;
}
struct bpf_insn prog[] = {
BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), /* r6 = r1 */
BPF_LD_ABS(BPF_B, ETH_HLEN + offsetof(struct iphdr, protocol)),
/* r0 = ip\->proto */
BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, \-4),
/* *(u32 *)(fp \- 4) = r0 */
BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), /* r2 = fp */
BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, \-4), /* r2 = r2 \- 4 */
BPF_LD_MAP_FD(BPF_REG_1, map_fd), /* r1 = map_fd */
BPF_CALL_FUNC(BPF_FUNC_map_lookup_elem),
/* r0 = map_lookup(r1, r2) */
BPF_JMP_IMM(BPF_JEQ, BPF_REG_0, 0, 2),
/* if (r0 == 0) goto pc+2 */
BPF_MOV64_IMM(BPF_REG_1, 1), /* r1 = 1 */
BPF_XADD(BPF_DW, BPF_REG_0, BPF_REG_1, 0, 0),
/* lock *(u64 *) r0 += r1 */
.\" == atomic64_add
BPF_MOV64_IMM(BPF_REG_0, 0), /* r0 = 0 */
BPF_EXIT_INSN(), /* return r0 */
};
prog_fd = bpf_prog_load(BPF_PROG_TYPE_SOCKET_FILTER, prog,
sizeof(prog) / sizeof(prog[0]), "GPL");
sock = open_raw_sock("lo");
assert(setsockopt(sock, SOL_SOCKET, SO_ATTACH_BPF, &prog_fd,
sizeof(prog_fd)) == 0);
for (;;) {
key = IPPROTO_TCP;
assert(bpf_lookup_elem(map_fd, &key, &tcp_cnt) == 0);
key = IPPROTO_UDP;
assert(bpf_lookup_elem(map_fd, &key, &udp_cnt) == 0);
printf("TCP %lld UDP %lld packets\en", tcp_cnt, udp_cnt);
sleep(1);
}
return 0;
}
.EE
.PP
Some complete working code can be found in the
.I samples/bpf
directory in the kernel source tree.
.SH SEE ALSO
.BR seccomp (2),
.BR bpf-helpers (7),
.BR bpf\-helpers (7),
.BR socket (7),
.BR tc (8),
.BR tc-bpf (8)
.BR tc\-bpf (8)
.PP
Both classic and extended BPF are explained in the kernel source file
.IR Documentation/networking/filter.txt .

View File

@ -1,5 +1,5 @@
.\" Copyright (c) 1993 Michael Haardt
.\" (michael@moria.de),
.\" Copyright (c) 1993 Michael Haardt, (michael@moria.de)
.\" and Copyright 2006, 2008, Michael Kerrisk <tmk.manpages@gmail.com>
.\" Fri Apr 2 11:32:09 MET DST 1993
.\"
.\" %%%LICENSE_START(GPLv2+_DOC_FULL)
@ -26,51 +26,41 @@
.\" Modified Wed Jul 21 19:52:58 1993 by Rik Faith <faith@cs.unc.edu>
.\" Modified Sun Aug 21 17:40:38 1994 by Rik Faith <faith@cs.unc.edu>
.\"
.TH BRK 2 2016-03-15 "Linux" "Linux Programmer's Manual"
.TH BRK 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
brk, sbrk \- change data segment size
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int brk(void *" addr );
.PP
.BI "void *sbrk(intptr_t " increment );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR brk (),
.BR sbrk ():
.ad l
.RS 4
.PD 0
.TP 4
Since glibc 2.19:
.nf
_DEFAULT_SOURCE ||
(_XOPEN_SOURCE\ >=\ 500) &&
.\" (_XOPEN_SOURCE\ >=\ 500 ||
.\" _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
! (_POSIX_C_SOURCE\ >=\ 200112L)
Since glibc 2.19:
_DEFAULT_SOURCE
|| ((_XOPEN_SOURCE >= 500) &&
! (_POSIX_C_SOURCE >= 200112L))
.\" (_XOPEN_SOURCE >= 500 ||
.\" _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) &&
From glibc 2.12 to 2.19:
_BSD_SOURCE || _SVID_SOURCE
|| ((_XOPEN_SOURCE >= 500) &&
! (_POSIX_C_SOURCE >= 200112L))
.\" (_XOPEN_SOURCE >= 500 ||
.\" _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) &&
Before glibc 2.12:
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
.fi
.TP 4
From glibc 2.12 to 2.19:
.nf
_BSD_SOURCE || _SVID_SOURCE ||
(_XOPEN_SOURCE\ >=\ 500) &&
.\" (_XOPEN_SOURCE\ >=\ 500 ||
.\" _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
! (_POSIX_C_SOURCE\ >=\ 200112L)
.fi
.TP 4
Before glibc 2.12:
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
.PD
.RE
.ad b
.SH DESCRIPTION
.BR brk ()
and

View File

@ -22,22 +22,26 @@
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH CACHEFLUSH 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH CACHEFLUSH 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
cacheflush \- flush contents of instruction and/or data cache
.SH SYNOPSIS
.nf
.B #include <asm/cachectl.h>
.B #include <sys/cachectl.h>
.PP
.BI "int cacheflush(char *" addr ", int "nbytes ", int "cache );
.BI "int cacheflush(void *" addr ", int "nbytes ", int "cache );
.fi
.PP
.IR Note :
On some architectures,
there is no glibc wrapper for this system call; see NOTES.
.SH DESCRIPTION
.BR cacheflush ()
flushes the contents of the indicated cache(s) for the
user addresses in the range
.I addr
to
.IR (addr+nbytes-1) .
.IR (addr+nbytes\-1) .
.I cache
may be one of:
.TP
@ -52,17 +56,17 @@ Same as
.BR (ICACHE|DCACHE) .
.SH RETURN VALUE
.BR cacheflush ()
returns 0 on success or \-1 on error.
If errors are detected,
returns 0 on success.
On error, it returns \-1 and sets
.I errno
will indicate the error.
to indicate the error.
.SH ERRORS
.TP
.B EFAULT
Some or all of the address range
.I addr
to
.I (addr+nbytes-1)
.I (addr+nbytes\-1)
is not accessible.
.TP
.B EINVAL
@ -86,6 +90,59 @@ On Linux, this call first appeared on the MIPS architecture,
but nowadays, Linux provides a
.BR cacheflush ()
system call on some other architectures, but with different arguments.
.SH NOTES
.SS Architecture-specific variants
Glibc provides a wrapper for this system call,
with the prototype shown in SYNOPSIS,
for the following architectures:
ARC, CSKY, MIPS, and NIOS2.
.PP
On some other architectures,
Linux provides this system call, with different arguments:
.TP
M68K:
.nf
.BI "int cacheflush(unsigned long " addr ", int " scope ", int " cache ,
.BI " unsigned long " len );
.fi
.TP
SH:
.nf
.BI "int cacheflush(unsigned long " addr ", unsigned long " len ", int " op );
.fi
.TP
NDS32:
.nf
.BI "int cacheflush(unsigned int " start ", unsigned int " end ", int " cache );
.fi
.PP
On the above architectures,
glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.SS GCC alternative
Unless you need the finer grained control that this system call provides,
you probably want to use the GCC built-in function
.BR __builtin___clear_cache (),
which provides a portable interface
across platforms supported by GCC and compatible compilers:
.PP
.in +4n
.EX
.BI "void __builtin___clear_cache(void *" begin ", void *" end );
.EE
.in
.PP
On platforms that don't require instruction cache flushes,
.BR __builtin___clear_cache ()
has no effect.
.PP
.IR Note :
On some GCC-compatible compilers,
the prototype for this built-in function uses
.I char *
instead of
.I void *
for the parameters.
.SH BUGS
Linux kernels older than version 2.6.11 ignore the
.I addr

View File

@ -1,4 +1,5 @@
.\" written by Andrew Morgan <morgan@kernel.org>
.\" Copyright: written by Andrew Morgan <morgan@kernel.org>
.\" and Copyright 2006, 2008, Michael Kerrisk <tmk.manpages@gmail.com>
.\"
.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
.\" may be distributed as per GPL
@ -12,15 +13,26 @@
.\" 64-bit capability sets in kernel 2.6.2[45].
.\" Modified 2009-01-26, andi kleen
.\"
.TH CAPGET 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH CAPGET 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
capget, capset \- set/get capabilities of thread(s)
.SH SYNOPSIS
.B #include <sys/capability.h>
.nf
.BR "#include <linux/capability.h>" " /* Definition of " CAP_* " and"
.BR " _LINUX_CAPABILITY_*" " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int capget(cap_user_header_t " hdrp ", cap_user_data_t " datap );
.BI "int syscall(SYS_capget, cap_user_header_t " hdrp ,
.BI " cap_user_data_t " datap );
.BI "int syscall(SYS_capset, cap_user_header_t " hdrp ,
.BI " const cap_user_data_t " datap );
.fi
.PP
.BI "int capset(cap_user_header_t " hdrp ", const cap_user_data_t " datap );
.IR Note :
glibc provides no wrappers for these system calls,
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
These two system calls are the raw kernel interface for getting and
setting thread capabilities.
@ -35,7 +47,7 @@ The portable interfaces are
.BR cap_set_proc (3)
and
.BR cap_get_proc (3);
if possible, you should use those interfaces in applications.
if possible, you should use those interfaces in applications; see NOTES.
.\"
.SS Current details
Now that you have been warned, some current kernel details.
@ -97,11 +109,11 @@ There was, however, an API glitch, and Linux 2.6.26 added
to fix the problem.
.PP
Note that 64-bit capabilities use
.IR datap [0]
.I datap[0]
and
.IR datap [1],
.IR datap[1] ,
whereas 32-bit capabilities use only
.IR datap [0].
.IR datap[0] .
.PP
On kernels that support file capabilities (VFS capabilities support),
these system calls behave slightly differently.
@ -112,7 +124,7 @@ For
.BR capget ()
calls, one can probe the capabilities of any process by specifying its
process ID with the
.I hdrp->pid
.I hdrp\->pid
field value.
.PP
For details on the data, see
@ -127,7 +139,7 @@ asynchronously setting the capabilities of another.
That is, on kernels that have VFS capabilities support, when calling
.BR capset (),
the only permitted values for
.I hdrp->pid
.I hdrp\->pid
are 0 or, equivalently, the value returned by
.BR gettid (2).
.\"
@ -165,7 +177,7 @@ to all members of the process group whose ID is \-\fIpid\fP.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.PP
The calls fail with the error
.BR EINVAL ,
@ -194,9 +206,21 @@ capability version format supported by the kernel.
One of the arguments was invalid.
.TP
.B EPERM
An attempt was made to add a capability to the Permitted set, or to set
a capability in the Effective or Inheritable sets that is not in the
Permitted set.
An attempt was made to add a capability to the permitted set, or to set
a capability in the effective set that is not in the
permitted set.
.TP
.B EPERM
An attempt was made to add a capability to the inheritable set, and either:
.RS
.IP * 3
that capability was not in the caller's bounding set; or
.IP *
the capability was not in the caller's permitted set
and the caller lacked the
.B CAP_SETPCAP
capability in its effective set.
.RE
.TP
.B EPERM
The caller attempted to use

View File

@ -30,32 +30,29 @@
.\" Modified 1997-08-21 by Joseph S. Myers <jsm28@cam.ac.uk>
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH CHDIR 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH CHDIR 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
chdir, fchdir \- change working directory
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int chdir(const char *" path );
.br
.BI "int fchdir(int " fd );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR fchdir ():
.PD 0
.ad l
.RS 4
_XOPEN_SOURCE\ >=\ 500
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
|| /* Glibc up to and including 2.19: */ _BSD_SOURCE
.RE
.ad
.PD
.nf
_XOPEN_SOURCE >= 500
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
|| /* Glibc up to and including 2.19: */ _BSD_SOURCE
.fi
.SH DESCRIPTION
.BR chdir ()
changes the current working directory of the calling process to the
@ -71,7 +68,7 @@ open file descriptor.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
Depending on the filesystem, other errors can be returned.
The more
@ -124,6 +121,10 @@ Search permission was denied on the directory open on
.B EBADF
.I fd
is not a valid file descriptor.
.TP
.B ENOTDIR
.I fd
does not refer to a directory.
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD.
.SH NOTES

View File

@ -29,7 +29,7 @@
.\" <michael@cantor.informatik.rwth-aachen.de>: NFS details
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH CHMOD 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH CHMOD 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
chmod, fchmod, fchmodat \- change permissions of a file
.SH SYNOPSIS
@ -37,9 +37,8 @@ chmod, fchmod, fchmodat \- change permissions of a file
.B #include <sys/stat.h>
.PP
.BI "int chmod(const char *" pathname ", mode_t " mode );
.br
.BI "int fchmod(int " fd ", mode_t " mode );
.PP
.BR "#include <fcntl.h>" " /* Definition of AT_* constants */"
.B #include <sys/stat.h>
.PP
@ -47,55 +46,41 @@ chmod, fchmod, fchmodat \- change permissions of a file
mode ", int " flags );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.PP
.ad l
.PD 0
.BR fchmod ():
.RS 4
Since glibc 2.24:
_POSIX_C_SOURCE\ >=\ 199309L
.\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
.PP
Glibc 2.19 to 2.23
_POSIX_C_SOURCE
.PP
Glibc 2.16 to 2.19:
_BSD_SOURCE || _POSIX_C_SOURCE
.PP
Glibc 2.12 to 2.16:
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
_POSIX_C_SOURCE >= 200809L
.PP
Glibc 2.11 and earlier:
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
.\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
.RE
.PD
.PP
.nf
.BR fchmod ():
Since glibc 2.24:
_POSIX_C_SOURCE >= 199309L
.\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
Glibc 2.19 to 2.23
_POSIX_C_SOURCE
Glibc 2.16 to 2.19:
_BSD_SOURCE || _POSIX_C_SOURCE
Glibc 2.12 to 2.16:
_BSD_SOURCE || _XOPEN_SOURCE >= 500
|| _POSIX_C_SOURCE >= 200809L
Glibc 2.11 and earlier:
_BSD_SOURCE || _XOPEN_SOURCE >= 500
.\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
.fi
.PP
.BR fchmodat ():
.PD 0
.ad l
.RS 4
.TP 4
Since glibc 2.10:
_POSIX_C_SOURCE\ >=\ 200809L
.TP
Before glibc 2.10:
_ATFILE_SOURCE
.RE
.ad
.PD
.ad
.nf
Since glibc 2.10:
_POSIX_C_SOURCE >= 200809L
Before glibc 2.10:
_ATFILE_SOURCE
.fi
.SH DESCRIPTION
The
.BR chmod ()
and
.BR fchmod ()
system calls change a files mode bits.
system calls change a file's mode bits.
(The file mode consists of the file permission bits plus the set-user-ID,
set-group-ID, and sticky bits.)
These system calls differ only in how the file is specified:
@ -246,7 +231,7 @@ for an explanation of the need for
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
Depending on the filesystem,
errors other than those listed below can be returned.
@ -260,10 +245,30 @@ Search permission is denied on a component of the path prefix.
(See also
.BR path_resolution (7).)
.TP
.B EBADF
.RB ( fchmod ())
The file descriptor
.I fd
is not valid.
.TP
.B EBADF
.RB ( fchmodat ())
.I pathname
is relative but
.I dirfd
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EFAULT
.I pathname
points outside your accessible address space.
.TP
.B EINVAL
.RB ( fchmodat ())
Invalid flag specified in
.IR flags .
.TP
.B EIO
An I/O error occurred.
.TP
@ -284,6 +289,20 @@ Insufficient kernel memory was available.
.B ENOTDIR
A component of the path prefix is not a directory.
.TP
.B ENOTDIR
.RB ( fchmodat ())
.I pathname
is relative and
.I dirfd
is a file descriptor referring to a file other than a directory.
.TP
.B ENOTSUP
.RB ( fchmodat ())
.I flags
specified
.BR AT_SYMLINK_NOFOLLOW ,
which is not supported.
.TP
.B EPERM
The effective UID does not match the owner of the file,
and the process is not privileged (Linux: it does not have the
@ -297,51 +316,6 @@ The file is marked immutable or append-only.
.TP
.B EROFS
The named file resides on a read-only filesystem.
.PP
The general errors for
.BR fchmod ()
are listed below:
.TP
.B EBADF
The file descriptor
.I fd
is not valid.
.TP
.B EIO
See above.
.TP
.B EPERM
See above.
.TP
.B EROFS
See above.
.PP
The same errors that occur for
.BR chmod ()
can also occur for
.BR fchmodat ().
The following additional errors can occur for
.BR fchmodat ():
.TP
.B EBADF
.I dirfd
is not a valid file descriptor.
.TP
.B EINVAL
Invalid flag specified in
.IR flags .
.TP
.B ENOTDIR
.I pathname
is relative and
.I dirfd
is a file descriptor referring to a file other than a directory.
.TP
.B ENOTSUP
.I flags
specified
.BR AT_SYMLINK_NOFOLLOW ,
which is not supported.
.SH VERSIONS
.BR fchmodat ()
was added to Linux in kernel 2.6.16;

View File

@ -35,7 +35,7 @@
.\" (bsdgroups versus sysvgroups, and the effect of the parent
.\" directory's set-group-ID mode bit).
.\"
.TH CHOWN 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH CHOWN 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
chown, fchown, lchown, fchownat \- change ownership of a file
.SH SYNOPSIS
@ -45,7 +45,7 @@ chown, fchown, lchown, fchownat \- change ownership of a file
.BI "int chown(const char *" pathname ", uid_t " owner ", gid_t " group );
.BI "int fchown(int " fd ", uid_t " owner ", gid_t " group );
.BI "int lchown(const char *" pathname ", uid_t " owner ", gid_t " group );
.PP
.BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
.B #include <unistd.h>
.PP
@ -53,35 +53,27 @@ chown, fchown, lchown, fchownat \- change ownership of a file
.BI " uid_t " owner ", gid_t " group ", int " flags );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR fchown (),
.BR lchown ():
.PD 0
.ad l
.RS 4
/* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
|| _XOPEN_SOURCE\ >=\ 500
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
|| /* Glibc versions <= 2.19: */ _BSD_SOURCE
.RE
.nf
/* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
|| _XOPEN_SOURCE >= 500
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|| /* Glibc <= 2.19: */ _BSD_SOURCE
.fi
.PP
.BR fchownat ():
.PD 0
.ad l
.RS 4
.TP 4
Since glibc 2.10:
_POSIX_C_SOURCE\ >=\ 200809L
.TP
Before glibc 2.10:
_ATFILE_SOURCE
.RE
.ad
.PD
.nf
Since glibc 2.10:
_POSIX_C_SOURCE >= 200809L
Before glibc 2.10:
_ATFILE_SOURCE
.fi
.SH DESCRIPTION
These system calls change the owner and group of a file.
The
@ -226,7 +218,7 @@ for an explanation of the need for
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
Depending on the filesystem,
errors other than those listed below can be returned.
@ -240,10 +232,33 @@ Search permission is denied on a component of the path prefix.
(See also
.BR path_resolution (7).)
.TP
.B EBADF
.RB ( fchown ())
.I fd
is not a valid open file descriptor.
.TP
.B EBADF
.RB ( fchownat ())
.I pathname
is relative but
.I dirfd
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EFAULT
.I pathname
points outside your accessible address space.
.TP
.B EINVAL
.RB ( fchownat ())
Invalid flag specified in
.IR flags .
.TP
.B EIO
.RB ( fchown ())
A low-level I/O error occurred while modifying the inode.
.TP
.B ELOOP
Too many symbolic links were encountered in resolving
.IR pathname .
@ -261,6 +276,13 @@ Insufficient kernel memory was available.
.B ENOTDIR
A component of the path prefix is not a directory.
.TP
.B ENOTDIR
.RB ( fchownat ())
.I pathname
is relative and
.I dirfd
is a file descriptor referring to a file other than a directory.
.TP
.B EPERM
The calling process did not have the required permissions
(see above) to change owner and/or group.
@ -272,47 +294,6 @@ The file is marked immutable or append-only.
.TP
.B EROFS
The named file resides on a read-only filesystem.
.PP
The general errors for
.BR fchown ()
are listed below:
.TP
.B EBADF
.I fd
is not a valid open file descriptor.
.TP
.B EIO
A low-level I/O error occurred while modifying the inode.
.TP
.B ENOENT
See above.
.TP
.B EPERM
See above.
.TP
.B EROFS
See above.
.PP
The same errors that occur for
.BR chown ()
can also occur for
.BR fchownat ().
The following additional errors can occur for
.BR fchownat ():
.TP
.B EBADF
.I dirfd
is not a valid file descriptor.
.TP
.B EINVAL
Invalid flag specified in
.IR flags .
.TP
.B ENOTDIR
.I pathname
is relative and
.I dirfd
is a file descriptor referring to a file other than a directory.
.SH VERSIONS
.BR fchownat ()
was added to Linux in kernel 2.6.16;
@ -446,8 +427,7 @@ as the old
has got the same syscall number, and
.BR chown ()
got the newly introduced number.
.SH EXAMPLE
.PP
.SH EXAMPLES
The following program changes the ownership of the file named in
its second command-line argument to the value specified in its
first command-line argument.

View File

@ -30,35 +30,30 @@
.\" Modified 1997-08-21 by Joseph S. Myers <jsm28@cam.ac.uk>
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH CHROOT 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH CHROOT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
chroot \- change root directory
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int chroot(const char *" path );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR chroot ():
.ad l
.RS 4
.PD 0
.TP 4
Since glibc 2.2.2:
.nf
_XOPEN_SOURCE && ! (_POSIX_C_SOURCE\ >=\ 200112L)
|| /* Since glibc 2.20: */ _DEFAULT_SOURCE
|| /* Glibc versions <= 2.19: */ _BSD_SOURCE
.TP 4
Since glibc 2.2.2:
_XOPEN_SOURCE && ! (_POSIX_C_SOURCE >= 200112L)
|| /* Since glibc 2.20: */ _DEFAULT_SOURCE
|| /* Glibc <= 2.19: */ _BSD_SOURCE
Before glibc 2.2.2:
none
.fi
Before glibc 2.2.2: none
.PD
.RE
.ad b
.SH DESCRIPTION
.BR chroot ()
changes the root directory of the calling process to that specified in
@ -117,7 +112,7 @@ descriptors may allow access to files outside the chroot tree.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
Depending on the filesystem, other errors can be returned.
The more general errors are listed below:

1
man2/clock_adjtime.2 Normal file
View File

@ -0,0 +1 @@
.so man2/adjtimex.2

View File

@ -1,5 +1,6 @@
.\" Copyright (c) 2003 Nick Clifford (zaf@nrc.co.nz), Jan 25, 2003
.\" Copyright (c) 2003 Andries Brouwer (aeb@cwi.nl), Aug 24, 2003
.\" Copyright (c) 2020 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
@ -27,38 +28,37 @@
.\" 2003-08-24 aeb, large parts rewritten
.\" 2004-08-06 Christoph Lameter <clameter@sgi.com>, SMP note
.\"
.TH CLOCK_GETRES 2 2019-03-06 "" "Linux Programmer's Manual"
.TH CLOCK_GETRES 2 2021-03-22 "" "Linux Programmer's Manual"
.SH NAME
clock_getres, clock_gettime, clock_settime \- clock and time functions
.SH SYNOPSIS
.nf
.B #include <time.h>
.PP
.BI "int clock_getres(clockid_t " clk_id ", struct timespec *" res );
.BI "int clock_getres(clockid_t " clockid ", struct timespec *" res );
.PP
.BI "int clock_gettime(clockid_t " clk_id ", struct timespec *" tp );
.PP
.BI "int clock_settime(clockid_t " clk_id ", const struct timespec *" tp );
.BI "int clock_gettime(clockid_t " clockid ", struct timespec *" tp );
.BI "int clock_settime(clockid_t " clockid ", const struct timespec *" tp );
.fi
.PP
Link with \fI\-lrt\fP (only for glibc versions before 2.17).
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.ad l
.BR clock_getres (),
.BR clock_gettime (),
.BR clock_settime ():
.RS
_POSIX_C_SOURCE\ >=\ 199309L
.RE
.ad b
.nf
_POSIX_C_SOURCE >= 199309L
.fi
.SH DESCRIPTION
The function
.BR clock_getres ()
finds the resolution (precision) of the specified clock
.IR clk_id ,
.IR clockid ,
and, if
.I res
is non-NULL, stores it in the \fIstruct timespec\fP pointed to by
@ -79,7 +79,7 @@ The functions
and
.BR clock_settime ()
retrieve and set the time of the specified clock
.IR clk_id .
.IR clockid .
.PP
The
.I res
@ -100,7 +100,7 @@ struct timespec {
.in
.PP
The
.I clk_id
.I clockid
argument is the identifier of the particular clock on which to act.
A clock may be system-wide and hence visible for all processes, or
per-process if it measures time only within a single process.
@ -120,7 +120,7 @@ Sufficiently recent versions of glibc and the Linux kernel
support the following clocks:
.TP
.B CLOCK_REALTIME
System-wide clock that measures real (i.e., wall-clock) time.
A settable system-wide clock that measures real (i.e., wall-clock) time.
Setting this clock requires appropriate privileges.
This clock is affected by discontinuous jumps in the system time
(e.g., if the system administrator manually changes the clock),
@ -128,17 +128,39 @@ and by the incremental adjustments performed by
.BR adjtime (3)
and NTP.
.TP
.BR CLOCK_REALTIME_ALARM " (since Linux 3.0; Linux-specific)"
Like
.BR CLOCK_REALTIME ,
but not settable.
See
.BR timer_create (2)
for further details.
.TP
.BR CLOCK_REALTIME_COARSE " (since Linux 2.6.32; Linux-specific)"
.\" Added in commit da15cfdae03351c689736f8d142618592e3cebc3
A faster but less precise version of
.BR CLOCK_REALTIME .
This clock is not settable.
Use when you need very fast, but not fine-grained timestamps.
Requires per-architecture support,
and probably also architecture support for this flag in the
.BR vdso (7).
.TP
.BR CLOCK_TAI " (since Linux 3.10; Linux-specific)"
.\" commit 1ff3c9677bff7e468e0c487d0ffefe4e901d33f4
A nonsettable system-wide clock derived from wall-clock time
but ignoring leap seconds.
This clock does
not experience discontinuities and backwards jumps caused by NTP
inserting leap seconds as
.BR CLOCK_REALTIME
does.
.IP
The acronym TAI refers to International Atomic Time.
.TP
.B CLOCK_MONOTONIC
Clock that cannot be set and represents monotonic time since\(emas described
A nonsettable system-wide clock that
represents monotonic time since\(emas described
by POSIX\(em"some unspecified point in the past".
On Linux, that point corresponds to the number of seconds that the system
has been running since it was booted.
@ -151,6 +173,11 @@ but is affected by the incremental adjustments performed by
.BR adjtime (3)
and NTP.
This clock does not count time that the system is suspended.
All
.B CLOCK_MONOTONIC
variants guarantee that the time returned by consecutive calls will not go
backwards, but successive calls may\(emdepending on the architecture\(emreturn
identical (not-increased) time values.
.TP
.BR CLOCK_MONOTONIC_COARSE " (since Linux 2.6.32; Linux-specific)"
.\" Added in commit da15cfdae03351c689736f8d142618592e3cebc3
@ -174,9 +201,9 @@ This clock does not count time that the system is suspended.
.BR CLOCK_BOOTTIME " (since Linux 2.6.39; Linux-specific)"
.\" commit 7fdd7f89006dd5a4c702fa0ce0c272345fa44ae0
.\" commit 70a08cca1227dc31c784ec930099a4417a06e7d0
Identical to
A nonsettable system-wide clock that is identical to
.BR CLOCK_MONOTONIC ,
except it also includes any time that the system is suspended.
except that it also includes any time that the system is suspended.
This allows applications to get a suspend-aware monotonic clock
without having to deal with the complications of
.BR CLOCK_REALTIME ,
@ -184,30 +211,81 @@ which may have discontinuities if the time is changed using
.BR settimeofday (2)
or similar.
.TP
.BR CLOCK_BOOTTIME_ALARM " (since Linux 3.0; Linux-specific)"
Like
.BR CLOCK_BOOTTIME .
See
.BR timer_create (2)
for further details.
.TP
.BR CLOCK_PROCESS_CPUTIME_ID " (since Linux 2.6.12)"
Per-process CPU-time clock
(measures CPU time consumed by all threads in the process).
This is a clock that measures CPU time consumed by this process
(i.e., CPU time consumed by all threads in the process).
On Linux, this clock is not settable.
.TP
.BR CLOCK_THREAD_CPUTIME_ID " (since Linux 2.6.12)"
Thread-specific CPU-time clock.
This is a clock that measures CPU time consumed by this thread.
On Linux, this clock is not settable.
.PP
Linux also implements dynamic clock instances as described below.
.SS Dynamic clocks
In addition to the hard-coded System-V style clock IDs described above,
Linux also supports
POSIX clock operations on certain character devices.
Such devices are
called "dynamic" clocks, and are supported since Linux 2.6.39.
.PP
Using the appropriate macros, open file
descriptors may be converted into clock IDs and passed to
.BR clock_gettime (),
.BR clock_settime (),
and
.BR clock_adjtime (2).
The following example shows how to convert a file descriptor into a
dynamic clock ID.
.PP
.in +4n
.EX
#define CLOCKFD 3
#define FD_TO_CLOCKID(fd) ((\(ti(clockid_t) (fd) << 3) | CLOCKFD)
#define CLOCKID_TO_FD(clk) ((unsigned int) \(ti((clk) >> 3))
struct timespec ts;
clockid_t clkid;
int fd;
fd = open("/dev/ptp0", O_RDWR);
clkid = FD_TO_CLOCKID(fd);
clock_gettime(clkid, &ts);
.EE
.in
.SH RETURN VALUE
.BR clock_gettime (),
.BR clock_settime (),
and
.BR clock_getres ()
return 0 for success, or \-1 for failure (in which case
return 0 for success.
On error, \-1 is returned and
.I errno
is set appropriately).
is set to indicate the error.
.SH ERRORS
.TP
.B EACCES
.BR clock_settime ()
does not have write permission for the dynamic POSIX
clock device indicated.
.TP
.B EFAULT
.I tp
points outside the accessible address space.
.TP
.B EINVAL
The
.I clk_id
specified is not supported on this system.
.I clockid
specified is invalid for one of two reasons.
Either the System-V style
hard coded positive value is out of range, or the dynamic clock ID
does not refer to a valid instance of a clock object.
.\" Linux also gives this error on attempts to set CLOCK_PROCESS_CPUTIME_ID
.\" and CLOCK_THREAD_CPUTIME_ID, when probably the proper error should be
.\" EPERM.
@ -219,12 +297,19 @@ is negative or
.I tp.tv_nsec
is outside the range [0..999,999,999].
.TP
.B EINVAL
The
.I clockid
specified in a call to
.BR clock_settime ()
is not a settable clock.
.TP
.BR EINVAL " (since Linux 4.3)"
.\" commit e1d7ba8735551ed79c7a0463a042353574b96da3
A call to
.BR clock_settime ()
with a
.I clk_id
.I clockid
of
.B CLOCK_REALTIME
attempted to set the time to a value less than
@ -232,6 +317,16 @@ the current value of the
.B CLOCK_MONOTONIC
clock.
.TP
.B ENODEV
The hot-pluggable device (like USB for example) represented by a
dynamic
.I clk_id
has disappeared after its character device was opened.
.TP
.B ENOTSUP
The operation is not supported by the dynamic POSIX clock device
specified.
.TP
.B EPERM
.BR clock_settime ()
does not have permission to set the clock indicated.
@ -240,9 +335,11 @@ These system calls first appeared in Linux 2.6.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lbw32 lb lb
lbx lb lb
l l l.
Interface Attribute Value
T{
@ -251,10 +348,12 @@ T{
.BR clock_settime ()
T} Thread safety MT-Safe
.TE
.hy
.ad
.sp 1
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SUSv2.
.SH AVAILABILITY
.PP
On POSIX systems on which these functions are available, the symbol
.B _POSIX_TIMERS
is defined in \fI<unistd.h>\fP to a value greater than 0.
@ -284,6 +383,16 @@ function; nor on the expiration of relative timers based upon this clock.
Consequently, these time services shall expire when the requested relative
interval elapses, independently of the new or old value of the clock.
.RE
.PP
According to POSIX.1-2001, a process with "appropriate privileges" may set the
.B CLOCK_PROCESS_CPUTIME_ID
and
.B CLOCK_THREAD_CPUTIME_ID
clocks using
.BR clock_settime ().
On Linux, these clocks are not settable
(i.e., no process has "appropriate privileges").
.\" See http://bugzilla.kernel.org/show_bug.cgi?id=11972
.\"
.SS C library/kernel differences
On some architectures, an implementation of
@ -332,16 +441,93 @@ and
.BR CLOCK_THREAD_CPUTIME_ID ,
on systems that provide such an implementation
(i.e., Linux 2.6.12 and later).
.SH BUGS
According to POSIX.1-2001, a process with "appropriate privileges" may set the
.B CLOCK_PROCESS_CPUTIME_ID
.SH EXAMPLES
The program below demonstrates the use of
.BR clock_gettime ()
and
.B CLOCK_THREAD_CPUTIME_ID
clocks using
.BR clock_settime ().
On Linux, these clocks are not settable
(i.e., no process has "appropriate privileges").
.\" See http://bugzilla.kernel.org/show_bug.cgi?id=11972
.BR clock_getres ()
with various clocks.
This is an example of what we might see when running the program:
.PP
.in +4n
.EX
$ \fB./clock_times x\fP
CLOCK_REALTIME : 1585985459.446 (18356 days + 7h 30m 59s)
resolution: 0.000000001
CLOCK_TAI : 1585985496.447 (18356 days + 7h 31m 36s)
resolution: 0.000000001
CLOCK_MONOTONIC: 52395.722 (14h 33m 15s)
resolution: 0.000000001
CLOCK_BOOTTIME : 72691.019 (20h 11m 31s)
resolution: 0.000000001
.EE
.in
.SS Program source
\&
.EX
/* clock_times.c
Licensed under GNU General Public License v2 or later.
*/
#define _XOPEN_SOURCE 600
#include <time.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#define SECS_IN_DAY (24 * 60 * 60)
static void
displayClock(clockid_t clock, const char *name, bool showRes)
{
struct timespec ts;
if (clock_gettime(clock, &ts) == \-1) {
perror("clock_gettime");
exit(EXIT_FAILURE);
}
printf("%\-15s: %10jd.%03ld (", name,
(intmax_t) ts.tv_sec, ts.tv_nsec / 1000000);
long days = ts.tv_sec / SECS_IN_DAY;
if (days > 0)
printf("%ld days + ", days);
printf("%2dh %2dm %2ds",
(int) (ts.tv_sec % SECS_IN_DAY) / 3600,
(int) (ts.tv_sec % 3600) / 60,
(int) ts.tv_sec % 60);
printf(")\en");
if (clock_getres(clock, &ts) == \-1) {
perror("clock_getres");
exit(EXIT_FAILURE);
}
if (showRes)
printf(" resolution: %10jd.%09ld\en",
(intmax_t) ts.tv_sec, ts.tv_nsec);
}
int
main(int argc, char *argv[])
{
bool showRes = argc > 1;
displayClock(CLOCK_REALTIME, "CLOCK_REALTIME", showRes);
#ifdef CLOCK_TAI
displayClock(CLOCK_TAI, "CLOCK_TAI", showRes);
#endif
displayClock(CLOCK_MONOTONIC, "CLOCK_MONOTONIC", showRes);
#ifdef CLOCK_BOOTTIME
displayClock(CLOCK_BOOTTIME, "CLOCK_BOOTTIME", showRes);
#endif
exit(EXIT_SUCCESS);
}
.EE
.SH SEE ALSO
.BR date (1),
.BR gettimeofday (2),
@ -354,5 +540,6 @@ On Linux, these clocks are not settable
.BR pthread_getcpuclockid (3),
.BR sysconf (3),
.BR time (7),
.BR time_namespaces (7),
.BR vdso (7),
.BR hwclock (8)

View File

@ -23,31 +23,29 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH CLOCK_NANOSLEEP 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH CLOCK_NANOSLEEP 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
clock_nanosleep \- high-resolution sleep with specifiable clock
.SH SYNOPSIS
.B #include <time.h>
.nf
.PP
.BI "int clock_nanosleep(clockid_t " clock_id ", int " flags ,
.BI "int clock_nanosleep(clockid_t " clockid ", int " flags ,
.BI " const struct timespec *" request ,
.BI " struct timespec *" remain );
.fi
.PP
Link with \fI\-lrt\fP (only for glibc versions before 2.17).
.PP
.ad l
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR clock_nanosleep ():
.RS 4
_POSIX_C_SOURCE\ >=\ 200112L
.RE
.ad
.nf
_POSIX_C_SOURCE >= 200112L
.fi
.SH DESCRIPTION
Like
.BR nanosleep (2),
@ -73,20 +71,30 @@ struct timespec {
.in
.PP
The
.I clock_id
.I clockid
argument specifies the clock against which the sleep interval
is to be measured.
This argument can have one of the following values:
.TP 17
.\" Look in time/posix-timers.c (kernel 5.6 sources) for the
.\" 'struct k_clock' structures that have an 'nsleep' method
.TP
.BR CLOCK_REALTIME
A settable system-wide real-time clock.
.TP
.BR CLOCK_TAI " (since Linux 3.10)"
A system-wide clock derived from wall-clock time but ignoring leap seconds.
.TP
.BR CLOCK_MONOTONIC
A nonsettable, monotonically increasing clock that measures time
since some unspecified point in the past that does not change after
system startup.
.\" On Linux this clock measures time since boot.
.TP
.BR CLOCK_BOOTIME " (since Linux 2.6.39)"
Identical to
.BR CLOCK_MONOTONIC ,
except that it also includes any time that the system is suspended.
.TP
.BR CLOCK_PROCESS_CPUTIME_ID
A settable per-process clock that measures CPU time consumed
by all threads in the process.
@ -101,7 +109,10 @@ In addition, the CPU clock IDs returned by
and
.BR pthread_getcpuclockid (3)
can also be passed in
.IR clock_id .
.IR clockid .
.\" Sleeping against CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM
.\" is also possible (tested), with CAP_WAKE_ALARM, but I'm not
.\" sure if this is useful or needs to be documented.
.PP
If
.I flags
@ -109,7 +120,7 @@ is 0, then the value specified in
.I request
is interpreted as an interval relative to the current
value of the clock specified by
.IR clock_id .
.IR clockid .
.PP
If
.I flags
@ -118,7 +129,7 @@ is
then
.I request
is interpreted as an absolute time as measured by the clock,
.IR clock_id .
.IR clockid .
If
.I request
is less than or equal to the current value of the clock,
@ -175,11 +186,15 @@ field was not in the range 0 to 999999999 or
was negative.
.TP
.B EINVAL
.I clock_id
.I clockid
was invalid.
.RB ( CLOCK_THREAD_CPUTIME_ID
is not a permitted value for
.IR clock_id .)
.IR clockid .)
.TP
.B ENOTSUP
The kernel does not support sleeping against this
.IR clockid .
.SH VERSIONS
The
.BR clock_nanosleep ()

File diff suppressed because it is too large Load Diff

1
man2/clone3.2 Normal file
View File

@ -0,0 +1 @@
.so man2/clone.2

View File

@ -33,7 +33,7 @@
.\" Modified 2000-07-22 by Nicolás Lichtmaier <nick@debian.org>
.\" added note about close(2) not guaranteeing that data is safe on close.
.\"
.TH CLOSE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH CLOSE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
close \- close a file descriptor
.SH SYNOPSIS
@ -67,7 +67,7 @@ the file is deleted.
returns zero on success.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -92,7 +92,7 @@ subsequent
.BR write (2),
.BR fsync (2),
or
.BR close (2).
.BR close ().
.PP
See NOTES for a discussion of why
.BR close ()
@ -115,7 +115,8 @@ that a file descriptor is automatically closed upon a successful
see
.BR fcntl (2)
for details.
.PP
.\"
.SS Multithreaded processes and close()
It is probably unwise to close file descriptors while
they may be in use by system calls in
other threads in the same process.
@ -130,6 +131,35 @@ that may cause unintended side effects.
.\" call has restarted after ERESTARTSYS, the original system call will
.\" later restart with the reused file descriptor. This is most likely a
.\" serious programming error.
.PP
Furthermore, consider the following scenario where two threads are
performing operations on the same file descriptor:
.IP 1. 3
One thread is blocked in an I/O system call on the file descriptor.
For example, it is trying to
.BR write (2)
to a pipe that is already full, or trying to
.BR read (2)
from a stream socket which currently has no available data.
.IP 2.
Another thread closes the file descriptor.
.PP
The behavior in this situation varies across systems.
On some systems, when the file descriptor is closed,
the blocking system call returns immediately with an error.
.PP
On Linux (and possibly some other systems), the behavior is different:
the blocking I/O system call holds a reference to the underlying
open file description, and this reference keeps the description open
until the I/O system call completes.
.\" 'struct file' in kernel-speak
(See
.BR open (2)
for a discussion of open file descriptions.)
Thus, the blocking system call in the first thread may successfully
complete after the
.BR close ()
in the second thread.
.\"
.SS Dealing with error returns from close()
A careful programmer will check the return value of
@ -194,7 +224,7 @@ The
error is a somewhat special case.
Regarding the
.B EINTR
error, POSIX.1-2013 says:
error, POSIX.1-2008 says:
.PP
.RS
If
@ -242,6 +272,7 @@ the next major release of the POSIX.1 standard.
.\" Review the following glibc bug later
.\" https://sourceware.org/bugzilla/show_bug.cgi?id=14627
.SH SEE ALSO
.BR close_range (2),
.BR fcntl (2),
.BR fsync (2),
.BR open (2),

284
man2/close_range.2 Normal file
View File

@ -0,0 +1,284 @@
.\" Copyright (c) 2020 Stephen Kitt <steve@sk2.org>
.\" and Copyright (c) 2021 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH CLOSE_RANGE 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
close_range \- close all file descriptors in a given range
.SH SYNOPSIS
.nf
.B #include <linux/close_range.h>
.PP
.BI "int close_range(unsigned int " first ", unsigned int " last ,
.BI " unsigned int " flags );
.fi
.SH DESCRIPTION
The
.BR close_range ()
system call closes all open file descriptors from
.I first
to
.I last
(included).
.PP
Errors closing a given file descriptor are currently ignored.
.PP
.I flags
is a bit mask containing 0 or more of the following:
.TP
.BR CLOSE_RANGE_CLOEXEC " (since Linux 5.11)"
Set the close-on-exec flag on the specified file descriptors,
rather than immediately closing them.
.TP
.B CLOSE_RANGE_UNSHARE
Unshare the specified file descriptors from any other processes
before closing them,
avoiding races with other threads sharing the file descriptor table.
.SH RETURN VALUE
On success,
.BR close_range ()
returns 0.
On error, \-1 is returned and
.I errno
is set to indicate the error.
.SH ERRORS
.TP
.B EINVAL
.I flags
is not valid, or
.I first
is greater than
.IR last .
.PP
The following can occur with
.B CLOSE_RANGE_UNSHARE
(when constructing the new descriptor table):
.TP
.B EMFILE
The number of open file descriptors exceeds the limit specified in
.IR /proc/sys/fs/nr_open
(see
.BR proc (5)).
This error can occur in situations where that limit was lowered before
a call to
.BR close_range ()
where the
.B CLOSE_RANGE_UNSHARE
flag is specified.
.TP
.B ENOMEM
Insufficient kernel memory was available.
.SH VERSIONS
.BR close_range ()
first appeared in Linux 5.9.
Library support was added in glibc in version 2.34.
.SH CONFORMING TO
.BR close_range ()
is a nonstandard function that is also present on FreeBSD.
.SH NOTES
.SS Closing all open file descriptors
.\" 278a5fbaed89dacd04e9d052f4594ffd0e0585de
To avoid blindly closing file descriptors
in the range of possible file descriptors,
this is sometimes implemented (on Linux)
by listing open file descriptors in
.I /proc/self/fd/
and calling
.BR close (2)
on each one.
.BR close_range ()
can take care of this without requiring
.I /proc
and within a single system call,
which provides significant performance benefits.
.SS Closing file descriptors before exec
.\" 60997c3d45d9a67daf01c56d805ae4fec37e0bd8
File descriptors can be closed safely using
.PP
.in +4n
.EX
/* we don't want anything past stderr here */
close_range(3, ~0U, CLOSE_RANGE_UNSHARE);
execve(....);
.EE
.in
.PP
.B CLOSE_RANGE_UNSHARE
is conceptually equivalent to
.PP
.in +4n
.EX
unshare(CLONE_FILES);
close_range(first, last, 0);
.EE
.in
.PP
but can be more efficient:
if the unshared range extends past
the current maximum number of file descriptors allocated
in the caller's file descriptor table
(the common case when
.I last
is ~0U),
the kernel will unshare a new file descriptor table for the caller up to
.IR first ,
copying as few file descriptors as possible.
This avoids subsequent
.BR close (2)
calls entirely;
the whole operation is complete once the table is unshared.
.SS Closing files on \fBexec\fP
.\" 582f1fb6b721facf04848d2ca57f34468da1813e
This is particularly useful in cases where multiple
.RB pre- exec
setup steps risk conflicting with each other.
For example, setting up a
.BR seccomp (2)
profile can conflict with a
.BR close_range ()
call:
if the file descriptors are closed before the
.BR seccomp (2)
profile is set up,
the profile setup can't use them itself,
or control their closure;
if the file descriptors are closed afterwards,
the seccomp profile can't block the
.BR close_range ()
call or any fallbacks.
Using
.B CLOSE_RANGE_CLOEXEC
avoids this:
the descriptors can be marked before the
.BR seccomp (2)
profile is set up,
and the profile can control access to
.BR close_range ()
without affecting the calling process.
.SH EXAMPLES
The program shown below opens the files named in its command-line arguments,
displays the list of files that it has opened
(by iterating through the entries in
.IR /proc/PID/fd ),
uses
.BR close_range ()
to close all file descriptors greater than or equal to 3,
and then once more displays the process's list of open files.
The following example demonstrates the use of the program:
.PP
.in +4n
.EX
$ \fBtouch /tmp/a /tmp/b /tmp/c\fP
$ \fB./a.out /tmp/a /tmp/b /tmp/c\fP
/tmp/a opened as FD 3
/tmp/b opened as FD 4
/tmp/c opened as FD 5
/proc/self/fd/0 ==> /dev/pts/1
/proc/self/fd/1 ==> /dev/pts/1
/proc/self/fd/2 ==> /dev/pts/1
/proc/self/fd/3 ==> /tmp/a
/proc/self/fd/4 ==> /tmp/b
/proc/self/fd/5 ==> /tmp/b
/proc/self/fd/6 ==> /proc/9005/fd
========= About to call close_range() =======
/proc/self/fd/0 ==> /dev/pts/1
/proc/self/fd/1 ==> /dev/pts/1
/proc/self/fd/2 ==> /dev/pts/1
/proc/self/fd/3 ==> /proc/9005/fd
.EE
.in
.PP
Note that the lines showing the pathname
.I /proc/9005/fd
result from the calls to
.BR opendir (3).
.SS Program source
\&
.EX
#define _GNU_SOURCE
#include <fcntl.h>
#include <linux/close_range.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/syscall.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
/* Show the contents of the symbolic links in /proc/self/fd */
static void
show_fds(void)
{
DIR *dirp = opendir("/proc/self/fd");
if (dirp == NULL) {
perror("opendir");
exit(EXIT_FAILURE);
}
for (;;) {
struct dirent *dp = readdir(dirp);
if (dp == NULL)
break;
if (dp\->d_type == DT_LNK) {
char path[PATH_MAX], target[PATH_MAX];
snprintf(path, sizeof(path), "/proc/self/fd/%s",
dp\->d_name);
ssize_t len = readlink(path, target, sizeof(target));
printf("%s ==> %.*s\en", path, (int) len, target);
}
}
closedir(dirp);
}
int
main(int argc, char *argv[])
{
for (int j = 1; j < argc; j++) {
int fd = open(argv[j], O_RDONLY);
if (fd == \-1) {
perror(argv[j]);
exit(EXIT_FAILURE);
}
printf("%s opened as FD %d\en", argv[j], fd);
}
show_fds();
printf("========= About to call close_range() =======\en");
if (syscall(__NR_close_range, 3, \(ti0U, 0) == \-1) {
perror("close_range");
exit(EXIT_FAILURE);
}
show_fds();
exit(EXIT_FAILURE);
}
.EE
.SH SEE ALSO
.BR close (2)

View File

@ -64,13 +64,11 @@
.\" Modified 1998, 1999 by Andi Kleen
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH CONNECT 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH CONNECT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
connect \- initiate a connection on a socket
.SH SYNOPSIS
.nf
.BR "#include <sys/types.h>" " /* See NOTES */"
.br
.B #include <sys/socket.h>
.PP
.BI "int connect(int " sockfd ", const struct sockaddr *" addr ,
@ -111,24 +109,34 @@ this call attempts to make a connection to the socket that is bound
to the address specified by
.IR addr .
.PP
Generally, connection-based protocol sockets may successfully
Some protocol sockets (e.g., UNIX domain stream sockets)
may successfully
.BR connect ()
only once; connectionless protocol sockets may use
only once.
.PP
Some protocol sockets
(e.g., datagram sockets in the UNIX and Internet domains)
may use
.BR connect ()
multiple times to change their association.
Connectionless sockets may
dissolve the association by connecting to an address with the
.PP
Some protocol sockets
(e.g., TCP sockets as well as datagram sockets in the UNIX and
Internet domains)
may dissolve the association by connecting to an address with the
.I sa_family
member of
.I sockaddr
set to
.BR AF_UNSPEC
(supported on Linux since kernel 2.2).
.BR AF_UNSPEC ;
thereafter, the socket can be connected to another address.
.RB ( AF_UNSPEC
is supported on Linux since kernel 2.2.)
.SH RETURN VALUE
If the connection or binding succeeds, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
The following are general socket errors only.
There may be other domain-specific error codes.
@ -145,6 +153,13 @@ in the path prefix.
The user tried to connect to a broadcast address without having the socket
broadcast flag enabled or the connection request failed because of a local
firewall rule.
.IP
.B EACCES
can also be returned if an SELinux policy denied a connection (for
example, if there is a policy saying that an HTTP proxy can only
connect to ports associated with HTTP servers, and the proxy tries to
connect to a different port).
dd
.TP
.B EADDRINUSE
Local address is already in use.
@ -260,12 +275,6 @@ first appeared in 4.2BSD).
.\" It also
.\" documents many additional error conditions not described here.
.SH NOTES
POSIX.1 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
.PP
For background on the
.I socklen_t
type, see
@ -276,7 +285,7 @@ If
fails, consider the state of the socket as unspecified.
Portable applications should close the socket and create a new one for
reconnecting.
.SH EXAMPLE
.SH EXAMPLES
An example of the use of
.BR connect ()
is shown in
@ -287,4 +296,5 @@ is shown in
.BR getsockname (2),
.BR listen (2),
.BR socket (2),
.BR path_resolution (7)
.BR path_resolution (7),
.BR selinux (8)

View File

@ -22,7 +22,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH COPY_FILE_RANGE 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH COPY_FILE_RANGE 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
copy_file_range \- Copy a range of data from one file to another
.SH SYNOPSIS
@ -30,8 +30,8 @@ copy_file_range \- Copy a range of data from one file to another
.B #define _GNU_SOURCE
.B #include <unistd.h>
.PP
.BI "ssize_t copy_file_range(int " fd_in ", loff_t *" off_in ,
.BI " int " fd_out ", loff_t *" off_out ,
.BI "ssize_t copy_file_range(int " fd_in ", off64_t *" off_in ,
.BI " int " fd_out ", off64_t *" off_out ,
.BI " size_t " len ", unsigned int " flags );
.fi
.SH DESCRIPTION
@ -42,9 +42,9 @@ without the additional cost of transferring data from the kernel to user space
and then back into the kernel.
It copies up to
.I len
bytes of data from file descriptor
bytes of data from the source file descriptor
.I fd_in
to file descriptor
to the target file descriptor
.IR fd_out ,
overwriting any data that exists within the requested range of the target file.
.PP
@ -74,16 +74,27 @@ is not changed, but
.I off_in
is adjusted appropriately.
.PP
.I fd_in
and
.I fd_out
can refer to the same file.
If they refer to the same file, then the source and target ranges are not
allowed to overlap.
.PP
The
.I flags
argument is provided to allow for future extensions
and currently must be to 0.
and currently must be set to 0.
.SH RETURN VALUE
Upon successful completion,
.BR copy_file_range ()
will return the number of bytes copied between files.
This could be less than the length originally requested.
If the file offset of
.I fd_in
is at or past the end of file, no bytes are copied, and
.BR copy_file_range ()
returns zero.
.PP
On error,
.BR copy_file_range ()
@ -93,12 +104,16 @@ is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
One or more file descriptors are not valid; or
One or more file descriptors are not valid.
.TP
.B EBADF
.I fd_in
is not open for reading; or
.I fd_out
is not open for writing; or
the
is not open for writing.
.TP
.B EBADF
The
.B O_APPEND
flag is set for the open file description (see
.BR open (2))
@ -106,19 +121,43 @@ referred to by the file descriptor
.IR fd_out .
.TP
.B EFBIG
An attempt was made to write a file that exceeds the implementation-defined
maximum file size or the process's file size limit,
or to write at a position past the maximum allowed offset.
An attempt was made to write at a position past the maximum file offset the
kernel supports.
.TP
.B EFBIG
An attempt was made to write a range that exceeds the allowed maximum file size.
The maximum file size differs between filesystem implementations and can be
different from the maximum allowed file offset.
.TP
.B EFBIG
An attempt was made to write beyond the process's file size resource limit.
This may also result in the process receiving a
.B SIGXFSZ
signal.
.TP
.B EINVAL
Requested range extends beyond the end of the source file; or the
The
.I flags
argument is not 0.
.TP
.B EINVAL
.I fd_in
and
.I fd_out
refer to the same file and the source and target ranges overlap.
.TP
.B EINVAL
Either
.I fd_in
or
.I fd_out
is not a regular file.
.TP
.B EIO
A low-level I/O error occurred while copying.
.TP
.B EISDIR
Either
.I fd_in
or
.I fd_out
@ -130,23 +169,46 @@ Out of memory.
.B ENOSPC
There is not enough space on the target filesystem to complete the copy.
.TP
.B EOVERFLOW
The requested source or destination range is too large to represent in the
specified data types.
.TP
.B EPERM
.I fd_out
refers to an immutable file.
.TP
.B ETXTBSY
Either
.I fd_in
or
.I fd_out
refers to an active swap file.
.TP
.B EXDEV
The files referred to by
.IR file_in " and " file_out
are not on the same mounted filesystem.
.IR fd_in " and " fd_out
are not on the same mounted filesystem (pre Linux 5.3).
.SH VERSIONS
The
.BR copy_file_range ()
system call first appeared in Linux 4.5, but glibc 2.27 provides a user-space
emulation when it is not available.
.\" https://sourceware.org/git/?p=glibc.git;a=commit;f=posix/unistd.h;h=bad7a0c81f501fbbcc79af9eaa4b8254441c4a1f
.PP
A major rework of the kernel implementation occurred in 5.3.
Areas of the API that weren't clearly defined were clarified and the API bounds
are much more strictly checked than on earlier kernels.
Applications should target the behaviour and requirements of 5.3 kernels.
.PP
First support for cross-filesystem copies was introduced in Linux 5.3.
Older kernels will return -EXDEV when cross-filesystem copies are attempted.
.SH CONFORMING TO
The
.BR copy_file_range ()
system call is a nonstandard Linux and GNU extension.
.SH NOTES
If
.I file_in
.I fd_in
is a sparse file, then
.BR copy_file_range ()
may expand any holes existing in the requested range.
@ -164,33 +226,21 @@ gives filesystems an opportunity to implement "copy acceleration" techniques,
such as the use of reflinks (i.e., two or more inodes that share
pointers to the same copy-on-write disk blocks)
or server-side-copy (in the case of NFS).
.SH EXAMPLE
.SH EXAMPLES
.EX
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <unistd.h>
/* On versions of glibc before 2.27, we must invoke copy_file_range()
using syscall(2) */
static loff_t
copy_file_range(int fd_in, loff_t *off_in, int fd_out,
loff_t *off_out, size_t len, unsigned int flags)
{
return syscall(__NR_copy_file_range, fd_in, off_in, fd_out,
off_out, len, flags);
}
int
main(int argc, char **argv)
main(int argc, char *argv[])
{
int fd_in, fd_out;
struct stat stat;
loff_t len, ret;
off64_t len, ret;
if (argc != 3) {
fprintf(stderr, "Usage: %s <source> <destination>\en", argv[0]);
@ -224,7 +274,7 @@ main(int argc, char **argv)
}
len \-= ret;
} while (len > 0);
} while (len > 0 && ret > 0);
close(fd_in);
close(fd_out);

View File

@ -7,7 +7,7 @@
.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
.\" reformatting and rewordings by mtk
.\"
.TH CREATE_MODULE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH CREATE_MODULE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
create_module \- create a loadable module entry
.SH SYNOPSIS
@ -31,7 +31,7 @@ This system call requires privilege.
On success, returns the kernel address at which the module will reside.
On error, \-1 is returned and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EEXIST

View File

@ -22,16 +22,23 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH DELETE_MODULE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH DELETE_MODULE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
delete_module \- unload a kernel module
.SH SYNOPSIS
.nf
.BI "int delete_module(const char *" name ", int " flags );
.BR "#include <fcntl.h>" " /* Definition of " O_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.BR "#include <unistd.h>
.PP
.BI "int syscall(SYS_delete_module, const char *" name ", unsigned int " flags );
.fi
.PP
.IR Note :
No declaration of this system call is provided in glibc headers; see NOTES.
glibc provides no wrapper for
.BR delete_module (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR delete_module ()
@ -125,7 +132,7 @@ Using this flag taints the kernel (TAINT_FORCED_RMMOD).
On success, zero is returned.
On error, \-1 is returned and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBUSY

View File

@ -34,7 +34,7 @@
.\" details for dup2().
.\" 2008-10-09, mtk: add description of dup3()
.\"
.TH DUP 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH DUP 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
dup, dup2, dup3 \- duplicate a file descriptor
.SH SYNOPSIS
@ -43,9 +43,9 @@ dup, dup2, dup3 \- duplicate a file descriptor
.PP
.BI "int dup(int " oldfd );
.BI "int dup2(int " oldfd ", int " newfd );
.PP
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.BR "#include <fcntl.h>" " /* Obtain O_* constant definitions */
.BR "#include <fcntl.h>" " /* Definition of " O_* " constants */"
.B #include <unistd.h>
.PP
.BI "int dup3(int " oldfd ", int " newfd ", int " flags );
@ -53,18 +53,22 @@ dup, dup2, dup3 \- duplicate a file descriptor
.SH DESCRIPTION
The
.BR dup ()
system call creates a copy of the file descriptor
.IR oldfd ,
using the lowest-numbered unused file descriptor for the new descriptor.
system call allocates a new file descriptor that refers to the same
open file description as the descriptor
.IR oldfd .
(For an explanation of open file descriptions, see
.BR open (2).)
The new file descriptor number is guaranteed to be the lowest-numbered
file descriptor that was unused in the calling process.
.PP
After a successful return,
the old and new file descriptors may be used interchangeably.
They refer to the same open file description (see
.BR open (2))
and thus share file offset and file status flags;
Since the two file descriptors refer to the same open file description,
they share file offset and file status flags;
for example, if the file offset is modified by using
.BR lseek (2)
on one of the file descriptors, the offset is also changed for the other.
on one of the file descriptors,
the offset is also changed for the other file descriptor.
.PP
The two file descriptors do not share file descriptor flags
(the close-on-exec flag).
@ -82,9 +86,18 @@ system call performs the same task as
but instead of using the lowest-numbered unused file descriptor,
it uses the file descriptor number specified in
.IR newfd .
In other words,
the file descriptor
.I newfd
is adjusted so that it now refers to the same open file description as
.IR oldfd .
.PP
If the file descriptor
.IR newfd
was previously open, it is silently closed before being reused.
was previously open, it is closed before being reused;
the close is performed silently
(i.e., any errors during the close are not reported by
.BR dup2 ()).
.PP
The steps of closing and reusing the file descriptor
.IR newfd
@ -152,7 +165,7 @@ On success, these system calls
return the new file descriptor.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -247,32 +260,35 @@ before calling
because of the race condition described above.
Instead, code something like the following could be used:
.PP
.in +4n
.EX
/* Obtain a duplicate of 'newfd' that can subsequently
be used to check for close() errors; an EBADF error
means that 'newfd' was not open. */
/* Obtain a duplicate of \(aqnewfd\(aq that can subsequently
be used to check for close() errors; an EBADF error
means that \(aqnewfd\(aq was not open. */
tmpfd = dup(newfd);
if (tmpfd == \-1 && errno != EBADF) {
/* Handle unexpected dup() error */
}
/* Atomically duplicate 'oldfd' on 'newfd' */
if (dup2(oldfd, newfd) == \-1) {
/* Handle dup2() error */
}
/* Now check for close() errors on the file originally
referred to by 'newfd' */
if (tmpfd != \-1) {
if (close(tmpfd) == \-1) {
/* Handle errors from close */
}
tmpfd = dup(newfd);
if (tmpfd == \-1 && errno != EBADF) {
/* Handle unexpected dup() error. */
}
/* Atomically duplicate \(aqoldfd\(aq on \(aqnewfd\(aq. */
if (dup2(oldfd, newfd) == \-1) {
/* Handle dup2() error. */
}
/* Now check for close() errors on the file originally
referred to by \(aqnewfd\(aq. */
if (tmpfd != \-1) {
if (close(tmpfd) == \-1) {
/* Handle errors from close. */
}
}
.EE
.in
.SH SEE ALSO
.BR close (2),
.BR fcntl (2),
.BR open (2)
.BR open (2),
.BR pidfd_getfd (2)

View File

@ -1,4 +1,5 @@
.\" Copyright (C) 2003 Davide Libenzi
.\" and Copyright 2008, 2009, 2012 Michael Kerrisk <tk.manpages@gmail.com>
.\" Davide Libenzi <davidel@xmailserver.org>
.\"
.\" %%%LICENSE_START(GPLv2+_SW_3_PARA)
@ -21,7 +22,7 @@
.\" Modified 2005-04-04 by Marko Kohtala <marko.kohtala@gmail.com>
.\" 2008-10-10, mtk: add description of epoll_create1()
.\"
.TH EPOLL_CREATE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH EPOLL_CREATE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
epoll_create, epoll_create1 \- open an epoll file descriptor
.SH SYNOPSIS
@ -38,7 +39,7 @@ creates a new
instance.
Since Linux 2.6.8, the
.I size
argument is ignored, but must be greater than zero; see NOTES below.
argument is ignored, but must be greater than zero; see NOTES.
.PP
.BR epoll_create ()
returns a file descriptor referring to the new epoll instance.
@ -77,7 +78,7 @@ for reasons why this may be useful.
.SH RETURN VALUE
On success,
these system calls
return a nonnegative file descriptor.
return a file descriptor (a nonnegative integer).
On error, \-1 is returned, and
.I errno
is set to indicate the error.
@ -120,7 +121,9 @@ was added to the kernel in version 2.6.27.
Library support is provided in glibc starting with version 2.9.
.SH CONFORMING TO
.BR epoll_create ()
is Linux-specific.
and
.BR epoll_create1 ()
are Linux-specific.
.SH NOTES
In the initial
.BR epoll_create ()

View File

@ -1,5 +1,6 @@
.\" Copyright (C) 2003 Davide Libenzi
.\" Davide Libenzi <davidel@xmailserver.org>
.\" and Copyright 2009, 2014, 2016, 2018, 2019 Michael Kerrisk <tk.manpages@gmail.com>
.\"
.\" %%%LICENSE_START(GPLv2+_SW_3_PARA)
.\" This program is free software; you can redistribute it and/or modify
@ -17,14 +18,16 @@
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH EPOLL_CTL 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH EPOLL_CTL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
epoll_ctl \- control interface for an epoll file descriptor
.SH SYNOPSIS
.nf
.B #include <sys/epoll.h>
.PP
.BI "int epoll_ctl(int " epfd ", int " op ", int " fd \
", struct epoll_event *" event );
.fi
.SH DESCRIPTION
This system call is used to add, modify, or remove
entries in the interest list of the
@ -42,13 +45,16 @@ Valid values for the
argument are:
.TP
.B EPOLL_CTL_ADD
Add
.I fd
to the interest list
and associate the settings specified in
.I event
with the internal file linked to
.IR fd .
Add an entry to the interest list of the epoll file descriptor,
.IR epfd .
The entry includes the file descriptor,
.IR fd ,
a reference to the corresponding open file description (see
.BR epoll (7)
and
.BR open (2)),
and the settings specified in
.IR event .
.TP
.B EPOLL_CTL_MOD
Change the settings associated with
@ -89,8 +95,18 @@ struct epoll_event {
.in
.PP
The
.I data
member of the
.I epoll_event
structure specifies data that the kernel should save and then return (via
.BR epoll_wait (2))
when this file descriptor becomes ready.
.PP
The
.I events
member is a bit mask composed by ORing together zero or more of
member of the
.I epoll_event
structure is a bit mask composed by ORing together zero or more of
the following available event types:
.TP
.B EPOLLIN
@ -107,7 +123,7 @@ operations.
Stream socket peer closed connection,
or shut down writing half of connection.
(This flag is especially useful for writing simple code to detect
peer shutdown when using Edge Triggered monitoring.)
peer shutdown when using edge-triggered monitoring.)
.TP
.B EPOLLPRI
There is an exceptional condition on the file descriptor.
@ -120,15 +136,21 @@ in
Error condition happened on the associated file descriptor.
This event is also reported for the write end of a pipe when the read end
has been closed.
.IP
.BR epoll_wait (2)
will always report for this event; it is not necessary to set it in
.IR events .
.IR events
when calling
.BR epoll_ctl ().
.TP
.B EPOLLHUP
Hang up happened on the associated file descriptor.
.IP
.BR epoll_wait (2)
will always wait for this event; it is not necessary to set it in
.IR events .
.IR events
when calling
.BR epoll_ctl ().
.IP
Note that when reading from a channel such as a pipe or a stream socket,
this event merely indicates that the peer closed its end of the channel.
@ -136,20 +158,27 @@ Subsequent reads from the channel will return 0 (end of file)
only after all outstanding data in the channel has been consumed.
.TP
.B EPOLLET
Sets the Edge Triggered behavior for the associated file descriptor.
Requests edge-triggered notification for the associated file descriptor.
The default behavior for
.B epoll
is Level Triggered.
is level-triggered.
See
.BR epoll (7)
for more detailed information about Edge and Level Triggered event
distribution architectures.
for more detailed information about edge-triggered and
level-triggered notification.
.IP
This flag is an input flag for the
.I event.events
field when calling
.BR epoll_ctl ();
it is never returned by
.BR epoll_wait (2).
.TP
.BR EPOLLONESHOT " (since Linux 2.6.2)"
Sets the one-shot behavior for the associated file descriptor.
This means that after an event is pulled out with
.BR epoll_wait (2)
the associated file descriptor is internally disabled and no other events
Requests one-shot notification for the associated file descriptor.
This means that after an event notified for the file descriptor by
.BR epoll_wait (2),
the file descriptor is disabled in the interest list and no other events
will be reported by the
.B epoll
interface.
@ -158,6 +187,13 @@ The user must call
with
.B EPOLL_CTL_MOD
to rearm the file descriptor with a new event mask.
.IP
This flag is an input flag for the
.I event.events
field when calling
.BR epoll_ctl ();
it is never returned by
.BR epoll_wait (2).
.TP
.BR EPOLLWAKEUP " (since Linux 3.5)"
.\" commit 4d7e30d98939a0340022ccd49325a3d70f7e0238
@ -186,6 +222,13 @@ or the clearing of
for the event file descriptor with
.BR EPOLL_CTL_MOD .
See also BUGS.
.IP
This flag is an input flag for the
.I event.events
field when calling
.BR epoll_ctl ();
it is never returned by
.BR epoll_wait (2).
.TP
.BR EPOLLEXCLUSIVE " (since Linux 4.5)"
Sets an exclusive wakeup mode for the epoll file descriptor that is being
@ -256,6 +299,15 @@ and specifies the target file descriptor
as an epoll instance will likewise fail.
The error in all of these cases is
.BR EINVAL .
.IP
The
.BR EPOLLEXCLUSIVE
flag is an input flag for the
.I event.events
field when calling
.BR epoll_ctl ();
it is never returned by
.BR epoll_wait (2).
.SH RETURN VALUE
When successful,
.BR epoll_ctl ()
@ -264,7 +316,7 @@ When an error occurs,
.BR epoll_ctl ()
returns \-1 and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -332,7 +384,8 @@ refers to an epoll instance.
refers to an epoll instance and this
.B EPOLL_CTL_ADD
operation would result in a circular loop of epoll instances
monitoring one another.
monitoring one another or a nesting depth of epoll instances
greater than 5.
.TP
.B ENOENT
.I op
@ -372,10 +425,10 @@ refers to, for example, a regular file or a directory.
was added to the kernel in version 2.6.
.\" To be precise: kernel 2.5.44.
.\" The interface should be finalized by Linux kernel 2.5.66.
Library support is provided in glibc starting with version 2.3.2.
.SH CONFORMING TO
.BR epoll_ctl ()
is Linux-specific.
Library support is provided in glibc starting with version 2.3.2.
.SH NOTES
The
.B epoll

1
man2/epoll_pwait2.2 Normal file
View File

@ -0,0 +1 @@
.so man2/epoll_wait.2

View File

@ -1,5 +1,6 @@
.\" Copyright (C) 2003 Davide Libenzi
.\" Davide Libenzi <davidel@xmailserver.org>
.\" and Copyright 2007, 2012, 2014, 2018 Michael Kerrisk <tk.manpages@gmail.com>
.\"
.\" %%%LICENSE_START(GPLv2+_SW_3_PARA)
.\" This program is free software; you can redistribute it and/or modify
@ -19,9 +20,9 @@
.\"
.\" 2007-04-30: mtk, Added description of epoll_pwait()
.\"
.TH EPOLL_WAIT 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH EPOLL_WAIT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
epoll_wait, epoll_pwait \- wait for an I/O event on an epoll file descriptor
epoll_wait, epoll_pwait, epoll_pwait2 \- wait for an I/O event on an epoll file descriptor
.SH SYNOPSIS
.nf
.B #include <sys/epoll.h>
@ -31,6 +32,12 @@ epoll_wait, epoll_pwait \- wait for an I/O event on an epoll file descriptor
.BI "int epoll_pwait(int " epfd ", struct epoll_event *" events ,
.BI " int " maxevents ", int " timeout ,
.BI " const sigset_t *" sigmask );
.BI "int epoll_pwait2(int " epfd ", struct epoll_event *" events ,
.BI " int " maxevents ", const struct timespec *" timeout ,
.BI " const sigset_t *" sigmask );
.\" FIXME: Check if glibc has added a wrapper for epoll_pwait2(),
.\" and if so, check the prototype.
.\" https://sourceware.org/bugzilla/show_bug.cgi?id=27359
.fi
.SH DESCRIPTION
The
@ -39,9 +46,11 @@ system call waits for events on the
.BR epoll (7)
instance referred to by the file descriptor
.IR epfd .
The memory area pointed to by
The buffer pointed to by
.I events
will contain the events that will be available for the caller.
is used to return information from the ready list
about file descriptors in the interest list that
have some events available.
Up to
.I maxevents
are returned by
@ -58,12 +67,15 @@ will block.
Time is measured against the
.B CLOCK_MONOTONIC
clock.
The call will block until either:
.IP * 3
.PP
A call to
.BR epoll_wait ()
will block until either:
.IP \(bu 2
a file descriptor delivers an event;
.IP *
.IP \(bu
the call is interrupted by a signal handler; or
.IP *
.IP \(bu
the timeout expires.
.PP
Note that the
@ -103,14 +115,22 @@ struct epoll_event {
.PP
The
.I data
field of each returned structure contains the same data as was specified
field of each returned
.I epoll_event
structure contains the same data as was specified
in the most recent call to
.BR epoll_ctl (2)
.RB ( EPOLL_CTL_ADD ", " EPOLL_CTL_MOD )
for the corresponding open file description.
for the corresponding open file descriptor.
.PP
The
.I events
field contains the returned event bit field.
field is a bit mask that indicates the events that have occurred for the
corresponding open file description.
See
.BR epoll_ctl (2)
for a list of the bits that may appear in this mask.
.\"
.SS epoll_pwait()
The relationship between
.BR epoll_wait ()
@ -156,18 +176,39 @@ argument may be specified as NULL, in which case
.BR epoll_pwait ()
is equivalent to
.BR epoll_wait ().
.\"
.SS epoll_pwait2()
The
.BR epoll_pwait2 ()
system call is equivalent to
.BR epoll_pwait ()
except for the
.I timeout
argument.
It takes an argument of type
.I timespec
to be able to specify nanosecond resolution timeout.
This argument functions the same as in
.BR pselect (2)
and
.BR ppoll (2).
If
.I timeout
is NULL, then
.BR epoll_pwait2 ()
can block indefinitely.
.SH RETURN VALUE
When successful,
On success,
.BR epoll_wait ()
returns the number of file descriptors ready for the requested I/O, or zero
if no file descriptor became ready during the requested
.I timeout
milliseconds.
When an error occurs,
On failure,
.BR epoll_wait ()
returns \-1 and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -203,12 +244,18 @@ Library support is provided in glibc starting with version 2.3.2.
.BR epoll_pwait ()
was added to Linux in kernel 2.6.19.
Library support is provided in glibc starting with version 2.6.
.PP
.BR epoll_pwait2 ()
was added to Linux in kernel 5.11.
.SH CONFORMING TO
.BR epoll_wait ()
is Linux-specific.
.BR epoll_wait (),
.BR epoll_pwait (),
and
.BR epoll_pwait2 ()
are Linux-specific.
.SH NOTES
While one thread is blocked in a call to
.BR epoll_pwait (),
.BR epoll_wait (),
it is possible for another thread to add a file descriptor to the waited-upon
.B epoll
instance.
@ -238,6 +285,21 @@ instance whose interest list is currently empty
or removed from the interest in another thread).
The call will block until some file descriptor is later added to the
interest list (in another thread) and that file descriptor becomes ready.
.SS C library/kernel differences
The raw
.BR epoll_pwait ()
and
.BR epoll_pwait2 ()
system calls have a sixth argument,
.IR "size_t sigsetsize" ,
which specifies the size in bytes of the
.IR sigmask
argument.
The glibc
.BR epoll_pwait ()
wrapper function specifies this argument as a fixed value
(equal to
.IR sizeof(sigset_t) ).
.SH BUGS
In kernels before 2.6.37, a
.I timeout
@ -250,19 +312,6 @@ is 4 and the kernel
.I HZ
value is 1000,
this means that timeouts greater than 35.79 minutes are treated as infinity.
.SS C library/kernel differences
The raw
.BR epoll_pwait ()
system call has a sixth argument,
.IR "size_t sigsetsize" ,
which specifies the size in bytes of the
.IR sigmask
argument.
The glibc
.BR epoll_pwait ()
wrapper function specifies this argument as a fixed value
(equal to
.IR sizeof(sigset_t) ).
.SH SEE ALSO
.BR epoll_create (2),
.BR epoll_ctl (2),

View File

@ -19,13 +19,15 @@
.\"
.\" 2008-10-10, mtk: describe eventfd2(), and EFD_NONBLOCK and EFD_CLOEXEC
.\"
.TH EVENTFD 2 2019-03-06 Linux "Linux Programmer's Manual"
.TH EVENTFD 2 2021-03-22 Linux "Linux Programmer's Manual"
.SH NAME
eventfd \- create a file descriptor for event notification
.SH SYNOPSIS
.nf
.B #include <sys/eventfd.h>
.PP
.BI "int eventfd(unsigned int " initval ", int " flags );
.fi
.SH DESCRIPTION
.BR eventfd ()
creates an "eventfd object" that can be used as
@ -270,15 +272,19 @@ system call, if it is supported by the kernel.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lb lb lb
lbx lb lb
l l l.
Interface Attribute Value
T{
.BR eventfd ()
T} Thread safety MT-Safe
.TE
.hy
.ad
.sp 1
.SH CONFORMING TO
.BR eventfd ()
@ -357,8 +363,7 @@ The functions perform the read and write operations on an
eventfd file descriptor,
returning 0 if the correct number of bytes was transferred,
or \-1 otherwise.
.SH EXAMPLE
.PP
.SH EXAMPLES
The following program creates an eventfd file descriptor
and then forks to create a child process.
While the parent briefly sleeps,
@ -387,6 +392,7 @@ Parent read 28 (0x1c) from efd
.EX
#include <sys/eventfd.h>
#include <unistd.h>
#include <inttypes.h> /* Definition of PRIu64 & PRIx64 */
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h> /* Definition of uint64_t */
@ -397,7 +403,7 @@ Parent read 28 (0x1c) from efd
int
main(int argc, char *argv[])
{
int efd, j;
int efd;
uint64_t u;
ssize_t s;
@ -412,7 +418,7 @@ main(int argc, char *argv[])
switch (fork()) {
case 0:
for (j = 1; j < argc; j++) {
for (int j = 1; j < argc; j++) {
printf("Child writing %s to efd\en", argv[j]);
u = strtoull(argv[j], NULL, 0);
/* strtoull() allows various bases */
@ -431,8 +437,7 @@ main(int argc, char *argv[])
s = read(efd, &u, sizeof(uint64_t));
if (s != sizeof(uint64_t))
handle_error("read");
printf("Parent read %llu (0x%llx) from efd\en",
(unsigned long long) u, (unsigned long long) u);
printf("Parent read %"PRIu64" (%#"PRIx64") from efd\en", u, u);
exit(EXIT_SUCCESS);
case \-1:

View File

@ -34,15 +34,16 @@
.\" 2007-09-14 Ollie Wild <aaw@google.com>, mtk
.\" Add text describing limits on command-line arguments + environment
.\"
.TH EXECVE 2 2019-05-09 "Linux" "Linux Programmer's Manual"
.TH EXECVE 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
execve \- execute program
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int execve(const char *" pathname ", char *const " argv "[], "
.br
.BI "int execve(const char *" pathname ", char *const " argv [],
.BI " char *const " envp []);
.fi
.SH DESCRIPTION
.BR execve ()
executes the program referred to by \fIpathname\fP.
@ -55,23 +56,32 @@ starting with a line of the form:
.PP
.in +4n
.EX
\fB#!\fP \fIinterpreter \fP[optional-arg]
\fB#!\fP\fIinterpreter \fP[optional-arg]
.EE
.in
.PP
For details of the latter case, see "Interpreter scripts" below.
.PP
\fIargv\fP is an array of argument strings passed to the new program.
\fIargv\fP is an array of pointers to strings passed to the new program
as its command-line arguments.
By convention, the first of these strings (i.e.,
.IR argv[0] )
should contain the filename associated with the file being executed.
\fIenvp\fP is an array of strings, conventionally of the form
\fBkey=value\fP, which are passed as environment to the new program.
The \fIargv\fP and \fIenvp\fP arrays must each include a null pointer
at the end of the array.
The
.I argv
array must be terminated by a NULL pointer.
(Thus, in the new program,
.IR argv[argc]
will be NULL.)
.PP
\fIenvp\fP is an array of pointers to strings, conventionally of the form
\fBkey=value\fP, which are passed as the environment of the new program.
The
.I envp
array must be terminated by a NULL pointer.
.PP
The argument vector and environment can be accessed by the
called program's main function, when it is defined as:
new program's main function, when it is defined as:
.PP
.in +4n
.EX
@ -98,8 +108,8 @@ If the set-user-ID bit is set on the program file referred to by
\fIpathname\fP,
then the effective user ID of the calling process is changed
to that of the owner of the program file.
Similarly, when the set-group-ID
bit of the program file is set the effective group ID of the calling
Similarly, if the set-group-ID bit is set on the program file,
then the effective group ID of the calling
process is set to the group of the program file.
.PP
The aforementioned transformations of the effective IDs are
@ -131,7 +141,7 @@ similarly, the effective group ID is copied to the saved set-group-ID.
This copying takes place after any effective ID changes that occur
because of the set-user-ID and set-group-ID mode bits.
.PP
The process's real UID and real GID, as well its supplementary group IDs,
The process's real UID and real GID, as well as its supplementary group IDs,
are unchanged by a call to
.BR execve ().
.PP
@ -147,10 +157,11 @@ If the executable is a dynamically linked ELF executable, the
interpreter named in the PT_INTERP segment is used to load the needed
shared objects.
This interpreter is typically
.I /lib/ld-linux.so.2
.I /lib/ld\-linux.so.2
for binaries linked with glibc (see
.BR ld-linux.so (8)).
.PP
.BR ld\-linux.so (8)).
.\"
.SS Effect on process attributes
All process attributes are preserved during an
.BR execve (),
except the following:
@ -200,12 +211,22 @@ The following Linux-specific process attributes are also
not preserved during an
.BR execve ():
.IP * 3
The
.BR prctl (2)
.B PR_SET_DUMPABLE
flag is set,
unless a set-user-ID or set-group ID program is being executed,
in which case it is cleared.
The process's "dumpable" attribute is set to the value 1,
unless a set-user-ID program, a set-group-ID program,
or a program with capabilities is being executed,
in which case the dumpable flag may instead be reset to the value in
.IR /proc/sys/fs/suid_dumpable ,
in the circumstances described under
.BR PR_SET_DUMPABLE
in
.BR prctl (2).
Note that changes to the "dumpable" attribute may cause ownership
of files in the process's
.IR /proc/[pid]
directory to change to
.IR root:root ,
as described in
.BR proc (5).
.IP *
The
.BR prctl (2)
@ -285,7 +306,7 @@ POSIX.1 says that if file descriptors 0, 1, and 2 would
otherwise be closed after a successful
.BR execve (),
and the process would gain privilege because the set-user-ID or
set-group_ID mode bit was set on the executed file,
set-group-ID mode bit was set on the executed file,
then the system may open an unspecified file for each of these
file descriptors.
As a general principle, no portable program, whether privileged or not,
@ -301,13 +322,14 @@ permission enabled and whose first line is of the form:
.PP
.in +4n
.EX
\fB#!\fP \fIinterpreter \fP[optional-arg]
\fB#!\fP\fIinterpreter \fP[optional-arg]
.EE
.in
.PP
The
.I interpreter
must be a valid pathname for an executable file.
.PP
If the
.I pathname
argument of
@ -323,13 +345,25 @@ will be invoked with the following arguments:
.in
.PP
where
.I pathname
is the pathname of the file specified as the first argument of
.BR execve (),
and
.I arg...
is the series of words pointed to by the
.I argv
argument of
.BR execve (),
starting at
.IR argv [1].
.IR argv[1] .
Note that there is no way to get the
.IR argv[0]
that was passed to the
.BR execve ()
call.
.\" See the P - preserve-argv[0] option.
.\" Documentation/admin-guide/binfmt-misc.rst
.\" https://www.kernel.org/doc/html/latest/admin-guide/binfmt-misc.html
.PP
For portable use,
.I optional-arg
@ -390,14 +424,14 @@ ensures that the new program always has some stack space.)
Additionally, the total size is limited to 3/4 of the value
of the kernel constant
.B _STK_LIM
(8 Mibibytes).
(8 MiB).
Since Linux 2.6.25,
the kernel also places a floor of 32 pages on this size limit,
so that, even when
.BR RLIMIT_STACK
is set very low,
applications are guaranteed to have at least as much argument and
environment space as was provided by Linux 2.6.23 and earlier.
environment space as was provided by Linux 2.6.22 and earlier.
(This guarantee was not provided in Linux 2.6.23 and 2.6.24.)
Additionally, the limit per string is 32 pages (the kernel constant
.BR MAX_ARG_STRLEN ),
@ -407,7 +441,7 @@ On success,
.BR execve ()
does not return, on error \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B E2BIG
@ -491,9 +525,7 @@ The system-wide limit on the total number of open files has been reached.
.B ENOENT
The file
.I pathname
or a script or ELF interpreter does not exist, or a shared library
.\" FIXME but see http://sourceware.org/bugzilla/show_bug.cgi?id=12241
needed for the file or interpreter cannot be found.
or a script or ELF interpreter does not exist.
.TP
.B ENOEXEC
An executable is not in a recognized format, is for the wrong
@ -547,7 +579,7 @@ there is no new process;
many attributes of the calling process remain unchanged
(in particular, its PID).
All that
.BR execve (2)
.BR execve ()
does is arrange for an existing process (the calling process)
to execute a new program.
.PP
@ -609,12 +641,20 @@ failure may occur past the point of no return:
the original executable image has been torn down,
but the new image could not be completely built.
In such cases, the kernel kills the process with a
.BR SIGKILL
.\" commit 19d860a140beac48a1377f179e693abe86a9dac9
.BR SIGSEGV
.RB ( SIGKILL
until Linux 3.17)
signal.
.\"
.SS Interpreter scripts
A maximum line length of 127 characters is allowed for the first line in
an interpreter script.
The kernel imposes a maximum length on the text that follows the
"#!" characters at the start of a script;
characters beyond the limit are ignored.
Before Linux 5.1, the limit is 127 characters.
Since Linux 5.1,
.\" commit 6eb3c3d0a52dca337e327ae8868ca1f44a712e02
the limit is 255 characters.
.PP
The semantics of the
.I optional-arg
@ -635,7 +675,8 @@ and white spaces in
.I optional-arg
are used to delimit the arguments.
.PP
Linux ignores the set-user-ID and set-group-ID bits on scripts.
Linux (like most other modern UNIX systems)
ignores the set-user-ID and set-group-ID bits on scripts.
.\"
.\" .SH BUGS
.\" Some Linux versions have failed to check permissions on ELF
@ -740,7 +781,7 @@ Since UNIX\ V7, both are NULL.
.\" .BR execve ()
.\" that could be exploited for denial of service by a suitably crafted
.\" ELF binary. There are no known problems with 2.0.34 or 2.2.15.
.SH EXAMPLE
.SH EXAMPLES
The following program is designed to be execed by the second program below.
It just echoes its command-line arguments, one per line.
.PP
@ -754,9 +795,7 @@ It just echoes its command-line arguments, one per line.
int
main(int argc, char *argv[])
{
int j;
for (j = 0; j < argc; j++)
for (int j = 0; j < argc; j++)
printf("argv[%d]: %s\en", j, argv[j]);
exit(EXIT_SUCCESS);
@ -817,8 +856,8 @@ program:
.in +4n
.EX
.RB "$" " cat > script"
.B #!./myecho script-arg
.B ^D
.B #!./myecho script\-arg
.B \(haD
.RB "$" " chmod +x script"
.EE
.in
@ -829,7 +868,7 @@ We can then use our program to exec the script:
.EX
.RB "$" " ./execve ./script"
argv[0]: ./myecho
argv[1]: script-arg
argv[1]: script\-arg
argv[2]: ./script
argv[3]: hello
argv[4]: world
@ -843,8 +882,10 @@ argv[4]: world
.BR ptrace (2),
.BR exec (3),
.BR fexecve (3),
.BR getauxval (3),
.BR getopt (3),
.BR system (3),
.BR capabilities (7),
.BR credentials (7),
.BR environ (7),
.BR path_resolution (7),

View File

@ -23,17 +23,18 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH EXECVEAT 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH EXECVEAT 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
execveat \- execute program relative to a directory file descriptor
.SH SYNOPSIS
.nf
.BR "#include <linux/fcntl.h>" " /* Definition of " AT_* " constants */"
.B #include <unistd.h>
.PP
.BI "int execveat(int " dirfd ", const char *" pathname ","
.br
.BI " char *const " argv "[], char *const " envp "[],"
.br
.BI "int execveat(int " dirfd ", const char *" pathname ,
.BI " const char *const " argv "[], const char *const " envp [],
.BI " int " flags );
.fi
.SH DESCRIPTION
.\" commit 51f39a1f0cea1cacf8c787f652f26dfee9611874
The
@ -111,7 +112,7 @@ On success,
does not return.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
The same errors that occur for
.BR execve (2)
@ -120,9 +121,12 @@ can also occur for
The following additional errors can occur for
.BR execveat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EINVAL
Invalid flag specified in
@ -160,8 +164,7 @@ is a file descriptor referring to a file other than a directory.
.SH VERSIONS
.BR execveat ()
was added to Linux in kernel 3.19.
GNU C library support is pending.
.\" FIXME . check for glibc support in a future release
Library support was added to glibc in version 2.34.
.SH CONFORMING TO
The
.BR execveat ()

View File

@ -22,19 +22,24 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH EXIT_GROUP 2 2008-11-27 "Linux" "Linux Programmer's Manual"
.TH EXIT_GROUP 2 2021-06-20 "Linux" "Linux Programmer's Manual"
.SH NAME
exit_group \- exit all threads in a process
.SH SYNOPSIS
.nf
.B #include <linux/unistd.h>
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "void exit_group(int " status );
.BI "noreturn void syscall(SYS_exit_group, int " status );
.fi
.PP
.IR Note :
glibc provides no wrapper for
.BR exit_group (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
This system call is equivalent to
.BR _exit (2)
except that it terminates not only the calling thread, but all threads
This system call terminates all threads
in the calling process's thread group.
.SH RETURN VALUE
This system call does not return.
@ -47,4 +52,4 @@ Since glibc 2.3, this is the system call invoked when the
.BR _exit (2)
wrapper function is called.
.SH SEE ALSO
.BR exit (2)
.BR _exit (2)

1
man2/faccessat2.2 Normal file
View File

@ -0,0 +1 @@
.so man2/access.2

View File

@ -8,7 +8,7 @@
.\" 2011-09-19: Added FALLOC_FL_PUNCH_HOLE
.\" 2011-09-19: Substantial restructuring of the page
.\"
.TH FALLOCATE 2 2018-04-30 "Linux" "Linux Programmer's Manual"
.TH FALLOCATE 2 2019-11-19 "Linux" "Linux Programmer's Manual"
.SH NAME
fallocate \- manipulate file space
.SH SYNOPSIS
@ -17,7 +17,7 @@ fallocate \- manipulate file space
.B #include <fcntl.h>
.PP
.BI "int fallocate(int " fd ", int " mode ", off_t " offset \
", off_t " len ");
", off_t " len ");"
.fi
.SH DESCRIPTION
This is a nonportable, Linux-specific system call.
@ -81,7 +81,7 @@ Preallocating zeroed blocks beyond the end of the file in this manner
is useful for optimizing append workloads.
.PP
If the
.B FALLOC_FL_UNSHARE
.B FALLOC_FL_UNSHARE_RANGE
flag is specified in
.IR mode ,
shared file data extents will be made private to the file to guarantee
@ -133,8 +133,12 @@ ext4 (since Linux 3.0)
Btrfs (since Linux 3.7)
.IP *
.BR tmpfs (5)
(since Linux 3.5)"
(since Linux 3.5)
.\" commit 83e4fa9c16e4af7122e31be3eca5d57881d236fe
.IP *
.BR gfs2 (5)
(since Linux 4.16)
.\" commit 4e56a6411fbce6f859566e17298114c2434391a4
.SS Collapsing file space
.\" commit 00f5e61998dd17f5375d9dfc01331f104b83f841
Specifying the

View File

@ -1,4 +1,4 @@
.\" Copyright (C) 2013, Heinrich Schuchardt <xypron.glpk@gmx.de>
\" Copyright (C) 2013, Heinrich Schuchardt <xypron.glpk@gmx.de>
.\"
.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
@ -21,15 +21,16 @@
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.TH FANOTIFY_INIT 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH FANOTIFY_INIT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
fanotify_init \- create and initialize fanotify group
.SH SYNOPSIS
.B #include <fcntl.h>
.br
.nf
.BR "#include <fcntl.h>" " /* Definition of " O_* " constants */"
.B #include <sys/fanotify.h>
.PP
.BI "int fanotify_init(unsigned int " flags ", unsigned int " event_f_flags );
.fi
.SH DESCRIPTION
For an overview of the fanotify API, see
.BR fanotify (7).
@ -40,8 +41,8 @@ queue associated with the group.
.PP
The file descriptor is used in calls to
.BR fanotify_mark (2)
to specify the files, directories, and mounts for which fanotify events
shall be created.
to specify the files, directories, mounts, or filesystems for which fanotify
events shall be created.
These events are received by reading from the file descriptor.
Some events are only informative, indicating that a file has been accessed.
Other events can be used to determine whether
@ -154,6 +155,138 @@ supplied to
.BR read (2)
(see
.BR fanotify (7)).
.TP
.BR FAN_ENABLE_AUDIT " (since Linux 4.15)"
.\" commit de8cd83e91bc3ee212b3e6ec6e4283af9e4ab269
Enable generation of audit log records about access mediation performed by
permission events.
The permission event response has to be marked with the
.B FAN_AUDIT
flag for an audit log record to be generated.
.TP
.BR FAN_REPORT_FID " (since Linux 5.1)"
.\" commit a8b13aa20afb69161b5123b4f1acc7ea0a03d360
This value allows the receipt of events which contain additional information
about the underlying filesystem object correlated to an event.
An additional record of type
.BR FAN_EVENT_INFO_TYPE_FID
encapsulates the information about the object and is included alongside the
generic event metadata structure.
The file descriptor that is used to represent the object correlated to an
event is instead substituted with a file handle.
It is intended for applications that may find the use of a file handle to
identify an object more suitable than a file descriptor.
Additionally, it may be used for applications monitoring a directory or a
filesystem that are interested in the directory entry modification events
.BR FAN_CREATE ,
.BR FAN_DELETE ,
and
.BR FAN_MOVE ,
or in events such as
.BR FAN_ATTRIB ,
.BR FAN_DELETE_SELF ,
and
.BR FAN_MOVE_SELF .
All the events above require an fanotify group that identifies filesystem
objects by file handles.
Note that for the directory entry modification events the reported file handle
identifies the modified directory and not the created/deleted/moved child
object.
The use of
.BR FAN_CLASS_CONTENT
or
.BR FAN_CLASS_PRE_CONTENT
is not permitted with this flag and will result in the error
.BR EINVAL .
See
.BR fanotify (7)
for additional details.
.TP
.BR FAN_REPORT_DIR_FID " (since Linux 5.9)"
Events for fanotify groups initialized with this flag will contain
(see exceptions below) additional information about a directory object
correlated to an event.
An additional record of type
.BR FAN_EVENT_INFO_TYPE_DFID
encapsulates the information about the directory object and is included
alongside the generic event metadata structure.
For events that occur on a non-directory object, the additional structure
includes a file handle that identifies the parent directory filesystem object.
Note that there is no guarantee that the directory filesystem object will be
found at the location described by the file handle information at the time
the event is received.
When combined with the flag
.BR FAN_REPORT_FID ,
two records may be reported with events that occur on a non-directory object,
one to identify the non-directory object itself and one to identify the parent
directory object.
Note that in some cases, a filesystem object does not have a parent,
for example, when an event occurs on an unlinked but open file.
In that case, with the
.BR FAN_REPORT_FID
flag, the event will be reported with only one record to identify the
non-directory object itself, because there is no directory associated with
the event.
Without the
.BR FAN_REPORT_FID
flag, no event will be reported.
See
.BR fanotify (7)
for additional details.
.TP
.BR FAN_REPORT_NAME " (since Linux 5.9)"
Events for fanotify groups initialized with this flag will contain additional
information about the name of the directory entry correlated to an event.
This flag must be provided in conjunction with the flag
.BR FAN_REPORT_DIR_FID .
Providing this flag value without
.BR FAN_REPORT_DIR_FID
will result in the error
.BR EINVAL .
This flag may be combined with the flag
.BR FAN_REPORT_FID .
An additional record of type
.BR FAN_EVENT_INFO_TYPE_DFID_NAME ,
which encapsulates the information about the directory entry, is included
alongside the generic event metadata structure and substitutes the additional
information record of type
.BR FAN_EVENT_INFO_TYPE_DFID .
The additional record includes a file handle that identifies a directory
filesystem object followed by a name that identifies an entry in that
directory.
For the directory entry modification events
.BR FAN_CREATE ,
.BR FAN_DELETE ,
and
.BR FAN_MOVE ,
the reported name is that of the created/deleted/moved directory entry.
For other events that occur on a directory object, the reported file handle
is that of the directory object itself and the reported name is '.'.
For other events that occur on a non-directory object, the reported file handle
is that of the parent directory object and the reported name is the name of a
directory entry where the object was located at the time of the event.
The rationale behind this logic is that the reported directory file handle can
be passed to
.BR open_by_handle_at (2)
to get an open directory file descriptor and that file descriptor along with
the reported name can be used to call
.BR fstatat (2).
The same rule that applies to record type
.BR FAN_EVENT_INFO_TYPE_DFID
also applies to record type
.BR FAN_EVENT_INFO_TYPE_DFID_NAME :
if a non-directory object has no parent, either the event will not be reported
or it will be reported without the directory entry information.
Note that there is no guarantee that the filesystem object will be found at the
location described by the directory entry information at the time the event is
received.
See
.BR fanotify (7)
for additional details.
.TP
.B FAN_REPORT_DFID_NAME
This is a synonym for
.RB ( FAN_REPORT_DIR_FID | FAN_REPORT_NAME ).
.PP
The
.I event_f_flags
@ -224,6 +357,8 @@ An invalid value was passed in
or
.IR event_f_flags .
.B FAN_ALL_INIT_FLAGS
(deprecated since Linux kernel version 4.20)
.\" commit 23c9deeb3285d34fd243abb3d6b9f07db60c3cf4
defines all allowable bits for
.IR flags .
.TP

View File

@ -21,7 +21,7 @@
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.TH FANOTIFY_MARK 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH FANOTIFY_MARK 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
fanotify_mark \- add, remove, or modify an fanotify mark on a filesystem
object
@ -83,7 +83,7 @@ contains
.BR FAN_MARK_FILESYSTEM ,
all marks for filesystems are removed from the group.
Otherwise, all marks for directories and files are removed.
No flag other than and at most one of the flags
No flag other than, and at most one of, the flags
.B FAN_MARK_MOUNT
or
.B FAN_MARK_FILESYSTEM
@ -117,15 +117,31 @@ If the filesystem object to be marked is not a directory, the error
shall be raised.
.TP
.B FAN_MARK_MOUNT
Mark the mount point specified by
Mark the mount specified by
.IR pathname .
If
.I pathname
is not itself a mount point, the mount point containing
is not itself a mount point, the mount containing
.I pathname
will be marked.
All directories, subdirectories, and the contained files of the mount point
All directories, subdirectories, and the contained files of the mount
will be monitored.
The events which require that filesystem objects are identified by file handles,
such as
.BR FAN_CREATE ,
.BR FAN_ATTRIB ,
.BR FAN_MOVE ,
and
.BR FAN_DELETE_SELF ,
cannot be provided as a
.IR mask
when
.I flags
contains
.BR FAN_MARK_MOUNT .
Attempting to do so will result in the error
.B EINVAL
being returned.
.TP
.BR FAN_MARK_FILESYSTEM " (since Linux 4.20)"
.\" commit d54f4fba889b205e9cd8239182ca5d27d0ac3bc2
@ -167,16 +183,56 @@ Create an event when a read-only file or directory is closed.
.B FAN_OPEN
Create an event when a file or directory is opened.
.TP
.B FAN_OPEN_EXEC " (since Linux 5.0)"
.BR FAN_OPEN_EXEC " (since Linux 5.0)"
.\" commit 9b076f1c0f4869b838a1b7aa0edb5664d47ec8aa
Create an event when a file is opened with the intent to be executed.
See NOTES for additional details.
.TP
.B FAN_Q_OVERFLOW
Create an event when an overflow of the event queue occurs.
The size of the event queue is limited to 16384 entries if
.B FAN_UNLIMITED_QUEUE
is not set in
.BR fanotify_init (2).
.BR FAN_ATTRIB " (since Linux 5.1)"
.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
Create an event when the metadata for a file or directory has changed.
An fanotify group that identifies filesystem objects by file handles
is required.
.TP
.BR FAN_CREATE " (since Linux 5.1)"
.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
Create an event when a file or directory has been created in a marked
parent directory.
An fanotify group that identifies filesystem objects by file handles
is required.
.TP
.BR FAN_DELETE " (since Linux 5.1)"
.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
Create an event when a file or directory has been deleted in a marked
parent directory.
An fanotify group that identifies filesystem objects by file handles
is required.
.TP
.BR FAN_DELETE_SELF " (since Linux 5.1)"
.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
Create an event when a marked file or directory itself is deleted.
An fanotify group that identifies filesystem objects by file handles
is required.
.TP
.BR FAN_MOVED_FROM " (since Linux 5.1)"
.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
Create an event when a file or directory has been moved from a marked
parent directory.
An fanotify group that identifies filesystem objects by file handles
is required.
.TP
.BR FAN_MOVED_TO " (since Linux 5.1)"
.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
Create an event when a file or directory has been moved to a marked parent
directory.
An fanotify group that identifies filesystem objects by file handles
is required.
.TP
.BR FAN_MOVE_SELF " (since Linux 5.1)"
.\" commit 235328d1fa4251c6dcb32351219bb553a58838d2
Create an event when a marked file or directory itself has been moved.
An fanotify group that identifies filesystem objects by file handles
is required.
.TP
.B FAN_OPEN_PERM
Create an event when a permission to open a file or directory is requested.
@ -187,6 +243,7 @@ or
is required.
.TP
.BR FAN_OPEN_EXEC_PERM " (since Linux 5.0)"
.\" commit 66917a3130f218dcef9eeab4fd11a71cd00cd7c9
Create an event when a permission to open a file for execution is
requested.
An fanotify file descriptor created with
@ -211,21 +268,50 @@ Create events for directories\(emfor example, when
(but see BUGS), and
.BR closedir (3)
are called.
Without this flag, only events for files are created.
Without this flag, events are created only for files.
In the context of directory entry events, such as
.BR FAN_CREATE ,
.BR FAN_DELETE ,
.BR FAN_MOVED_FROM ,
and
.BR FAN_MOVED_TO ,
specifying the flag
.BR FAN_ONDIR
is required in order to create events when subdirectory entries are
modified (i.e.,
.BR mkdir (2)/
.BR rmdir (2)).
.TP
.B FAN_EVENT_ON_CHILD
Events for the immediate children of marked directories shall be created.
The flag has no effect when marking mounts and filesystems.
Note that events are not generated for children of the subdirectories
of marked directories.
More specifically, the directory entry modification events
.BR FAN_CREATE ,
.BR FAN_DELETE ,
.BR FAN_MOVED_FROM ,
and
.BR FAN_MOVED_TO
are not generated for any entry modifications performed inside subdirectories
of marked directories.
Note that the events
.BR FAN_DELETE_SELF
and
.BR FAN_MOVE_SELF
are not generated for children of marked directories.
To monitor complete directory trees it is necessary to mark the relevant
mount.
mount or filesystem.
.PP
The following composed value is defined:
The following composed values are defined:
.TP
.B FAN_CLOSE
A file is closed
.RB ( FAN_CLOSE_WRITE | FAN_CLOSE_NOWRITE ).
.TP
.B FAN_MOVE
A file or directory has been moved
.RB ( FAN_MOVED_FROM | FAN_MOVED_TO ).
.PP
The filesystem object to be marked is determined by the file descriptor
.I dirfd
@ -271,7 +357,12 @@ has the value
.BR AT_FDCWD ,
then the filesystem object to be marked is determined by interpreting
.I pathname
relative the current working directory.
relative to the current working directory.
(See
.BR openat (2)
for an explanation of why the
.I dirfd
argument is useful.)
.SH RETURN VALUE
On success,
.BR fanotify_mark ()
@ -285,6 +376,14 @@ is set to indicate the error.
An invalid file descriptor was passed in
.IR fanotify_fd .
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EINVAL
An invalid value was passed in
.IR flags
@ -297,11 +396,22 @@ was not an fanotify file descriptor.
.B EINVAL
The fanotify file descriptor was opened with
.B FAN_CLASS_NOTIF
or the fanotify group identifies filesystem objects by file handles
and mask contains a flag for permission events
.RB ( FAN_OPEN_PERM
or
.BR FAN_ACCESS_PERM ).
.TP
.B ENODEV
The filesystem object indicated by
.I pathname
is not associated with a filesystem that supports
.I fsid
(e.g.,
.BR tmpfs (5)).
This error can be returned only with an fanotify group that identifies
filesystem objects by file handles.
.TP
.B ENOENT
The filesystem object indicated by
.IR dirfd
@ -335,6 +445,25 @@ and
and
.I pathname
do not specify a directory.
.TP
.B EOPNOTSUPP
The object indicated by
.I pathname
is associated with a filesystem that does not support the encoding of file
handles.
This error can be returned only with an fanotify group that identifies
filesystem objects by file handles.
.TP
.B EXDEV
The filesystem object indicated by
.I pathname
resides within a filesystem subvolume (e.g.,
.BR btrfs (5))
which uses a different
.I fsid
than its root superblock.
This error can be returned only with an fanotify group that identifies
filesystem objects by file handles.
.SH VERSIONS
.BR fanotify_mark ()
was introduced in version 2.6.36 of the Linux kernel and enabled in version
@ -358,7 +487,7 @@ for files that are opened using
or
.BR uselib (2).
Events of these types will not be raised in the situation where an
interpreter is passed (or reads) a script file for interpretation.
interpreter is passed (or reads) a file for interpretation.
.PP
Additionally, if a mark has also been placed on the Linux dynamic
linker, a user should also expect to receive an event for it when
@ -384,7 +513,7 @@ events for both the ELF binary and interpreter, respectively:
.in +4n
.EX
/bin/echo
/lib64/ld-linux-x86-64.so.2
/lib64/ld\-linux\-x86\-64.so.2
.EE
.in
.SH BUGS
@ -395,7 +524,7 @@ If
.I flags
contains
.BR FAN_MARK_FLUSH ,
.I dirfd
.IR dirfd ,
and
.I pathname
must specify a valid filesystem object, even though this object is not used.

View File

@ -1,4 +1,3 @@
'\" t
.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
.\" and Copyright (C) 1993 Michael Haardt, Ian Jackson;
.\" and Copyright (C) 1998 Jamie Lokier;
@ -65,12 +64,11 @@
.\" 2017-06-26, Jens Axboe <axboe@kernel.dk>
.\" Document F_{GET,SET}_RW_HINT and F_{GET,SET}_FILE_RW_HINT
.\"
.TH FCNTL 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH FCNTL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
fcntl \- manipulate file descriptor
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.B #include <fcntl.h>
.PP
.BI "int fcntl(int " fd ", int " cmd ", ... /* " arg " */ );"
@ -701,14 +699,14 @@ asynchronous notification of lost locks.
.BR F_SETOWN ,
.BR F_GETOWN_EX ,
.BR F_SETOWN_EX ,
.BR F_GETSIG
.BR F_GETSIG ,
and
.B F_SETSIG
are used to manage I/O availability signals:
.TP
.BR F_GETOWN " (\fIvoid\fP)"
Return (as the function result)
the process ID or process group currently receiving
the process ID or process group ID currently receiving
.B SIGIO
and
.B SIGURG
@ -1157,7 +1155,7 @@ as
.PP
If the lease holder fails to downgrade or remove the lease within
the number of seconds specified in
.IR /proc/sys/fs/lease-break-time ,
.IR /proc/sys/fs/lease\-break\-time ,
then the kernel forcibly removes or downgrades the lease holder's lease.
.PP
Once a lease break has been initiated,
@ -1229,7 +1227,7 @@ the following bits:
.PP
.RS
.PD 0
.TP 12
.TP
.B DN_ACCESS
A file was accessed
.RB ( read (2),
@ -1350,13 +1348,13 @@ to be at least
bytes.
An unprivileged process can adjust the pipe capacity to any value
between the system page size and the limit defined in
.IR /proc/sys/fs/pipe-max-size
.IR /proc/sys/fs/pipe\-max\-size
(see
.BR proc (5)).
Attempts to set the pipe capacity below the page size are silently
rounded up to the page size.
Attempts by an unprivileged process to set the pipe capacity above the limit in
.IR /proc/sys/fs/pipe-max-size
.IR /proc/sys/fs/pipe\-max\-size
yield the error
.BR EPERM ;
a privileged process
@ -1525,6 +1523,24 @@ Furthermore, if there are any asynchronous I/O operations
.RB ( io_submit (2))
pending on the file,
all outstanding writes will be discarded.
.TP
.BR F_SEAL_FUTURE_WRITE " (since Linux 5.1)"
The effect of this seal is similar to
.BR F_SEAL_WRITE ,
but the contents of the file can still be modified via
shared writable mappings that were created prior to the seal being set.
Any attempt to create a new writable mapping on the file via
.BR mmap (2)
will fail with
.BR EPERM .
Likewise, an attempt to write to the file via
.BR write (2)
will fail with
.BR EPERM .
.IP
Using this seal,
one process can create a memory buffer that it can continue to modify
while sharing that buffer on a "read-only" basis with other processes.
.\"
.SS File read/write hints
Write lifetime hints can be used to inform the kernel about the relative
@ -1609,7 +1625,7 @@ All the write-specific hints are relative to each other,
and no individual absolute meaning should be attributed to them.
.SH RETURN VALUE
For a successful call, the return value depends on the operation:
.TP 0.9i
.TP
.B F_DUPFD
The new file descriptor.
.TP
@ -1644,7 +1660,7 @@ Zero.
.PP
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.BR EACCES " or " EAGAIN
@ -2097,7 +2113,7 @@ It is therefore inadvisable to rely on mandatory locking.
.BR lslocks (8)
.PP
.IR locks.txt ,
.IR mandatory-locking.txt ,
.IR mandatory\-locking.txt ,
and
.I dnotify.txt
in the Linux kernel source directory
@ -2105,6 +2121,6 @@ in the Linux kernel source directory
(on older kernels, these files are directly under the
.I Documentation/
directory, and
.I mandatory-locking.txt
.I mandatory\-locking.txt
is called
.IR mandatory.txt )

View File

@ -32,13 +32,15 @@
.\" FIXME Maybe document LOCK_MAND, LOCK_RW, LOCK_READ, LOCK_WRITE
.\" which only have effect for SAMBA.
.\"
.TH FLOCK 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH FLOCK 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
flock \- apply or remove an advisory lock on an open file
.SH SYNOPSIS
.nf
.B #include <sys/file.h>
.PP
.BI "int flock(int " fd ", int " operation );
.fi
.SH DESCRIPTION
Apply or remove an advisory lock on the open file specified by
.IR fd .
@ -113,7 +115,7 @@ mode in which the file was opened.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -237,6 +239,31 @@ see the discussion of the
.I "local_lock"
option in
.BR nfs (5).
.SS CIFS details
In Linux kernels up to 5.4,
.BR flock ()
is not propagated over SMB.
A file with such locks will not appear locked for remote clients.
.PP
Since Linux 5.5,
.BR flock ()
locks are emulated with SMB byte-range locks on the entire file.
Similarly to NFS, this means that
.BR fcntl (2)
and
.BR flock ()
locks interact with one another.
Another important side-effect is that the locks are not advisory anymore:
any IO on a locked file will always fail with
.BR EACCES
when done from a separate file descriptor.
This difference originates from the design of locks in the SMB protocol,
which provides mandatory locking semantics.
.PP
Remote and mandatory locking semantics may vary with SMB protocol, mount options and server type.
See
.BR mount.cifs (8)
for additional information.
.SH SEE ALSO
.BR flock (1),
.BR close (2),

View File

@ -36,15 +36,15 @@
.\" Greatly expanded, to describe all attributes that differ
.\" parent and child.
.\"
.TH FORK 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH FORK 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
fork \- create a child process
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.nf
.B #include <unistd.h>
.PP
.B pid_t fork(void);
.fi
.SH DESCRIPTION
.BR fork ()
creates a new process by duplicating the calling process.
@ -177,7 +177,7 @@ After a
.BR fork ()
in a multithreaded program,
the child can safely call only async-signal-safe functions (see
.BR signal-safety (7))
.BR signal\-safety (7))
until such time as it calls
.BR execve (2).
.IP *
@ -217,7 +217,7 @@ and 0 is returned in the child.
On failure, \-1 is returned in the parent,
no child process is created, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EAGAIN
@ -234,7 +234,7 @@ which limits the number of processes and threads for a real user ID,
was reached;
.IP *
the kernel's system-wide limit on the number of processes and threads,
.IR /proc/sys/kernel/threads-max ,
.IR /proc/sys/kernel/threads\-max ,
was reached (see
.BR proc (5));
.IP *
@ -279,7 +279,6 @@ System call was interrupted by a signal and will be restarted.
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
.SH NOTES
.PP
Under Linux,
.BR fork ()
is implemented using copy-on-write pages, so the only penalty that it incurs
@ -309,7 +308,7 @@ The glibc wrapper invokes any fork handlers that have been
established using
.BR pthread_atfork (3).
.\" and does some magic to ensure that getpid(2) returns the right value.
.SH EXAMPLE
.SH EXAMPLES
See
.BR pipe (2)
and

View File

@ -1 +0,0 @@
.so man3/statvfs.3

View File

@ -35,30 +35,36 @@
.\" 2006-04-28, mtk, substantial rewrite of various parts.
.\" 2012-02-27 Various changes by Christoph Hellwig <hch@lst.de>
.\"
.TH FSYNC 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH FSYNC 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
fsync, fdatasync \- synchronize a file's in-core state with storage device
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int fsync(int " fd );
.PP
.BI "int fdatasync(int " fd );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.nf
.BR fsync ():
Glibc 2.16 and later:
No feature test macros need be defined
Glibc up to and including 2.15:
_BSD_SOURCE || _XOPEN_SOURCE
|| /* since glibc 2.8: */ _POSIX_C_SOURCE\ >=\ 200112L
.br
|| /* Since glibc 2.8: */ _POSIX_C_SOURCE >= 200112L
.fi
.PP
.BR fdatasync ():
_POSIX_C_SOURCE\ >=\ 199309L || _XOPEN_SOURCE\ >=\ 500
.nf
_POSIX_C_SOURCE >= 199309L || _XOPEN_SOURCE >= 500
.fi
.SH DESCRIPTION
.BR fsync ()
transfers ("flushes") all modified in-core data of
@ -113,7 +119,7 @@ require all metadata to be synchronized with the disk.
On success, these system calls return zero.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -151,7 +157,7 @@ system call, and some previous write failed due to insufficient
storage space.
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, 4.3BSD.
.SH AVAILABILITY
.PP
On POSIX systems on which
.BR fdatasync ()
is available,

View File

@ -19,25 +19,29 @@
.\" FIXME Do we need to add some text regarding Torvald Riegel's 2015-01-24 mail
.\" http://thread.gmane.org/gmane.linux.kernel/1703405/focus=1873242
.\"
.TH FUTEX 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH FUTEX 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
futex \- fast user-space locking
.SH SYNOPSIS
.nf
.PP
.B "#include <linux/futex.h>"
.B "#include <sys/time.h>"
.BR "#include <linux/futex.h>" " /* Definition of " FUTEX_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int futex(int *" uaddr ", int " futex_op ", int " val ,
.BI " const struct timespec *" timeout , \
" \fR /* or: \fBuint32_t \fIval2\fP */
.BI " int *" uaddr2 ", int " val3 );
.BI "long syscall(SYS_futex, uint32_t *" uaddr ", int " futex_op \
", uint32_t " val ,
.BI " const struct timespec *" timeout , \
" \fR /* or: \fBuint32_t \fIval2\fP */"
.BI " uint32_t *" uaddr2 ", uint32_t " val3 );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR futex (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.PP
The
.BR futex ()
system call provides a method for waiting until a certain condition becomes
@ -200,7 +204,7 @@ The
.I futex_op
argument consists of two parts:
a command that specifies the operation to be performed,
bit-wise ORed with zero or more options that
bitwise ORed with zero or more options that
modify the behaviour of the operation.
The options that may be included in
.I futex_op
@ -218,9 +222,9 @@ This allows the kernel to make some additional performance optimizations.
.\" taking reference counts on file backing store, and so on.
.IP
As a convenience,
.IR <linux/futex.h>
.I <linux/futex.h>
defines a set of constants with the suffix
.BR _PRIVATE
.B _PRIVATE
that are equivalents of all of the operations listed below,
.\" except the obsolete FUTEX_FD, for which the "private" flag was
.\" meaningless
@ -237,22 +241,25 @@ and so on.
This option bit can be employed only with the
.BR FUTEX_WAIT_BITSET ,
.BR FUTEX_WAIT_REQUEUE_PI ,
and
(since Linux 4.5)
.\" commit 337f13046ff03717a9e99675284a817527440a49
.BR FUTEX_WAIT
.BR FUTEX_WAIT ,
and
(since Linux 5.14)
.\" commit bf22a6976897977b0a3f1aeba6823c959fc4fdae
.B FUTEX_LOCK_PI2
operations.
.IP
If this option is set, the kernel measures the
.I timeout
against the
.BR CLOCK_REALTIME
.B CLOCK_REALTIME
clock.
.IP
If this option is not set, the kernel measures the
.I timeout
against the
.BR CLOCK_MONOTONIC
.B CLOCK_MONOTONIC
clock.
.PP
The operation specified in
@ -417,7 +424,7 @@ the caller will receive the signal number that was passed in
.IP
The arguments
.IR timeout ,
.I uaddr2
.IR uaddr2 ,
and
.I val3
are ignored.
@ -582,8 +589,8 @@ any of the two supplied futex words:
.IP
.in +4n
.EX
int oldval = *(int *) uaddr2;
*(int *) uaddr2 = oldval \fIop\fP \fIoparg\fP;
uint32_t oldval = *(uint32_t *) uaddr2;
*(uint32_t *) uaddr2 = oldval \fIop\fP \fIoparg\fP;
futex(uaddr, FUTEX_WAKE, val, 0, 0, 0);
if (oldval \fIcmp\fP \fIcmparg\fP)
futex(uaddr2, FUTEX_WAKE, val2, 0, 0, 0);
@ -622,7 +629,7 @@ in the bits of the argument
.IR val3 .
Pictorially, the encoding is:
.IP
.in +8n
.in +4n
.EX
+---+---+-----------+-----------+
|op |cmp| oparg | cmparg |
@ -663,12 +670,12 @@ component has one of the following values:
FUTEX_OP_SET 0 /* uaddr2 = oparg; */
FUTEX_OP_ADD 1 /* uaddr2 += oparg; */
FUTEX_OP_OR 2 /* uaddr2 |= oparg; */
FUTEX_OP_ANDN 3 /* uaddr2 &= ~oparg; */
FUTEX_OP_XOR 4 /* uaddr2 ^= oparg; */
FUTEX_OP_ANDN 3 /* uaddr2 &= \(tioparg; */
FUTEX_OP_XOR 4 /* uaddr2 \(ha= oparg; */
.EE
.in
.IP
In addition, bit-wise ORing the following value into
In addition, bitwise ORing the following value into
.I op
causes
.IR "(1\ <<\ oparg)"
@ -726,7 +733,6 @@ If
.I timeout
is NULL, the operation can block indefinitely.
.IP
.IP
The
.I uaddr2
argument is ignored.
@ -743,7 +749,7 @@ except that the
argument is used to provide a 32-bit bit mask to the kernel.
This bit mask, in which at least one bit must be set,
is used to select which waiters should be woken up.
The selection is done by a bit-wise AND of the "wake" bit mask
The selection is done by a bitwise AND of the "wake" bit mask
(i.e., the value in
.IR val3 )
and the bit mask which is stored in the kernel-internal
@ -901,7 +907,9 @@ value to 0 if the previous value was the expected TID.
If a futex is already acquired (i.e., has a nonzero value),
waiters must employ the
.B FUTEX_LOCK_PI
operation to acquire the lock.
or
.B FUTEX_LOCK_PI2
operations to acquire the lock.
If other threads are waiting for the lock, then the
.B FUTEX_WAITERS
bit is set in the futex value;
@ -960,7 +968,8 @@ PI futexes are operated on by specifying one of the values listed below in
Note that the PI futex operations must be used as paired operations
and are subject to some additional requirements:
.IP * 3
.B FUTEX_LOCK_PI
.BR FUTEX_LOCK_PI ,
.BR FUTEX_LOCK_PI2 ,
and
.B FUTEX_TRYLOCK_PI
pair with
@ -1017,9 +1026,9 @@ user space atomically by setting the futex value to 0.
.\"
.\" lock(kernel_lock);
.\" retry:
.\"
.\"
.\" /*
.\" * Owner might have unlocked in userspace before we
.\" * Owner might have unlocked in user space before we
.\" * were able to set the waiter bit.
.\" */
.\" if (atomic_acquire(futex) == SUCCESS) {
@ -1113,12 +1122,34 @@ The
.IR uaddr2 ,
.IR val ,
and
.IR val3
.I val3
arguments are ignored.
.\"
.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.\"
.TP
.BR FUTEX_LOCK_PI2 " (since Linux 5.14)"
.\" commit bf22a6976897977b0a3f1aeba6823c959fc4fdae
This operation is the same as
.BR FUTEX_LOCK_PI ,
except that the clock against which
.I timeout
is measured is selectable.
By default, the (absolute) timeout specified in
.I timeout
is measured againt the
.B CLOCK_MONOTONIC
clock, but if the
.B FUTEX_CLOCK_REALTIME
flag is specified in
.IR futex_op ,
then the timeout is measured against the
.B CLOCK_REALTIME
clock.
.\"
.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.\"
.TP
.BR FUTEX_TRYLOCK_PI " (since Linux 2.6.18)"
.\" commit c87e2837be82df479a6bae9f155c43516d2feebc
This operation tries to acquire the lock at
@ -1148,7 +1179,7 @@ but the kernel can fix this up and acquire the futex.
.\" in user space would fail, so kernel has to clean up.)
.\" Darren Hart (Oct 2015):
.\" The trylock in the kernel has more state, so it can independently
.\" verify the flags that userspace must trust implicitly.
.\" verify the flags that user space must trust implicitly.
.IP
The
.IR uaddr2 ,
@ -1165,6 +1196,8 @@ arguments are ignored.
.\" commit c87e2837be82df479a6bae9f155c43516d2feebc
This operation wakes the top priority waiter that is waiting in
.B FUTEX_LOCK_PI
or
.B FUTEX_LOCK_PI2
on the futex address provided by the
.I uaddr
argument.
@ -1315,14 +1348,13 @@ operation.
.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.\"
.SH RETURN VALUE
.PP
In the event of an error (and assuming that
.BR futex ()
was invoked via
.BR syscall (2)),
all operations return \-1 and set
.I errno
to indicate the cause of the error.
to indicate the error.
.PP
The return value on success depends on the operation,
as described in the following list:
@ -1377,6 +1409,9 @@ Returns the number of waiters that were woken up.
.B FUTEX_LOCK_PI
Returns 0 if the futex was successfully locked.
.TP
.B FUTEX_LOCK_PI2
Returns 0 if the futex was successfully locked.
.TP
.B FUTEX_TRYLOCK_PI
Returns 0 if the futex was successfully locked.
.TP
@ -1431,8 +1466,9 @@ The value pointed to by
is not equal to the expected value
.IR val3 .
.TP
.BR EAGAIN
.B EAGAIN
.RB ( FUTEX_LOCK_PI ,
.BR FUTEX_LOCK_PI2 ,
.BR FUTEX_TRYLOCK_PI ,
.BR FUTEX_CMP_REQUEUE_PI )
The futex owner thread ID of
@ -1444,8 +1480,9 @@ is about to exit,
but has not yet handled the internal state cleanup.
Try again.
.TP
.BR EDEADLK
.B EDEADLK
.RB ( FUTEX_LOCK_PI ,
.BR FUTEX_LOCK_PI2 ,
.BR FUTEX_TRYLOCK_PI ,
.BR FUTEX_CMP_REQUEUE_PI )
The futex word at
@ -1485,18 +1522,18 @@ a spurious wakeup; since Linux 2.6.22, this no longer happens.
.TP
.B EINVAL
The operation in
.IR futex_op
.I futex_op
is one of those that employs a timeout, but the supplied
.I timeout
argument was invalid
.RI ( tv_sec
was less than zero, or
.IR tv_nsec
.I tv_nsec
was not less than 1,000,000,000).
.TP
.B EINVAL
The operation specified in
.IR futex_op
.I futex_op
employs one or both of the pointers
.I uaddr
and
@ -1508,17 +1545,17 @@ the address is not four-byte-aligned.
.RB ( FUTEX_WAIT_BITSET ,
.BR FUTEX_WAKE_BITSET )
The bit mask supplied in
.IR val3
.I val3
is zero.
.TP
.B EINVAL
.RB ( FUTEX_CMP_REQUEUE_PI )
.I uaddr
equals
.IR uaddr2
.I uaddr2
(i.e., an attempt was made to requeue to the same futex).
.TP
.BR EINVAL
.B EINVAL
.RB ( FUTEX_FD )
The signal number supplied in
.I val
@ -1533,12 +1570,15 @@ is invalid.
The kernel detected an inconsistency between the user-space state at
.I uaddr
and the kernel state\(emthat is, it detected a waiter which waits in
.BR FUTEX_LOCK_PI
.B FUTEX_LOCK_PI
or
.B FUTEX_LOCK_PI2
on
.IR uaddr .
.TP
.B EINVAL
.RB ( FUTEX_LOCK_PI ,
.BR FUTEX_LOCK_PI2 ,
.BR FUTEX_TRYLOCK_PI ,
.BR FUTEX_UNLOCK_PI )
The kernel detected an inconsistency between the user-space state at
@ -1548,7 +1588,7 @@ This indicates either state corruption
or that the kernel found a waiter on
.I uaddr
which is waiting via
.BR FUTEX_WAIT
.B FUTEX_WAIT
or
.BR FUTEX_WAIT_BITSET .
.TP
@ -1561,9 +1601,9 @@ and the kernel state;
.\" The kernel sees: I have non PI state for a futex you tried to
.\" tell me was PI
that is, the kernel detected a waiter which waits via
.BR FUTEX_WAIT
.B FUTEX_WAIT
or
.BR FUTEX_WAIT_BITSET
.B FUTEX_WAIT_BITSET
on
.IR uaddr2 .
.TP
@ -1573,9 +1613,9 @@ The kernel detected an inconsistency between the user-space state at
.I uaddr
and the kernel state;
that is, the kernel detected a waiter which waits via
.BR FUTEX_WAIT
.B FUTEX_WAIT
or
.BR FUTEX_WAIT_BITESET
.B FUTEX_WAIT_BITSET
on
.IR uaddr .
.TP
@ -1587,7 +1627,9 @@ and the kernel state;
that is, the kernel detected a waiter which waits on
.I uaddr
via
.BR FUTEX_LOCK_PI
.B FUTEX_LOCK_PI
or
.B FUTEX_LOCK_PI2
(instead of
.BR FUTEX_WAIT_REQUEUE_PI ).
.TP
@ -1614,8 +1656,9 @@ Invalid argument.
.RB ( FUTEX_FD )
The system-wide limit on the total number of open files has been reached.
.TP
.BR ENOMEM
.B ENOMEM
.RB ( FUTEX_LOCK_PI ,
.BR FUTEX_LOCK_PI2 ,
.BR FUTEX_TRYLOCK_PI ,
.BR FUTEX_CMP_REQUEUE_PI )
The kernel could not allocate memory to hold state information.
@ -1626,17 +1669,19 @@ Invalid operation specified in
.TP
.B ENOSYS
The
.BR FUTEX_CLOCK_REALTIME
.B FUTEX_CLOCK_REALTIME
option was specified in
.IR futex_op ,
but the accompanying operation was neither
.BR FUTEX_WAIT ,
.BR FUTEX_WAIT_BITSET ,
.BR FUTEX_WAIT_REQUEUE_PI ,
nor
.BR FUTEX_WAIT_REQUEUE_PI .
.BR FUTEX_LOCK_PI2 .
.TP
.BR ENOSYS
.B ENOSYS
.RB ( FUTEX_LOCK_PI ,
.BR FUTEX_LOCK_PI2 ,
.BR FUTEX_TRYLOCK_PI ,
.BR FUTEX_UNLOCK_PI ,
.BR FUTEX_CMP_REQUEUE_PI ,
@ -1645,8 +1690,9 @@ A run-time check determined that the operation is not available.
The PI-futex operations are not implemented on all architectures and
are not supported on some CPU variants.
.TP
.BR EPERM
.B EPERM
.RB ( FUTEX_LOCK_PI ,
.BR FUTEX_LOCK_PI2 ,
.BR FUTEX_TRYLOCK_PI ,
.BR FUTEX_CMP_REQUEUE_PI )
The caller is not allowed to attach itself to the futex at
@ -1657,19 +1703,20 @@ the futex at
.IR uaddr2 ).
(This may be caused by a state corruption in user space.)
.TP
.BR EPERM
.B EPERM
.RB ( FUTEX_UNLOCK_PI )
The caller does not own the lock represented by the futex word.
.TP
.BR ESRCH
.B ESRCH
.RB ( FUTEX_LOCK_PI ,
.BR FUTEX_LOCK_PI2 ,
.BR FUTEX_TRYLOCK_PI ,
.BR FUTEX_CMP_REQUEUE_PI )
The thread ID in the futex word at
.I uaddr
does not exist.
.TP
.BR ESRCH
.B ESRCH
.RB ( FUTEX_CMP_REQUEUE_PI )
The thread ID in the futex word at
.I uaddr2
@ -1677,7 +1724,7 @@ does not exist.
.TP
.B ETIMEDOUT
The operation in
.IR futex_op
.I futex_op
employed the timeout specified in
.IR timeout ,
and the timeout expired before the operation completed.
@ -1685,7 +1732,6 @@ and the timeout expired before the operation completed.
.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.\"
.SH VERSIONS
.PP
Futexes were first made available in a stable kernel release
with Linux 2.6.0.
.PP
@ -1698,9 +1744,6 @@ and a sixth argument was added in Linux 2.6.7.
.SH CONFORMING TO
This system call is Linux-specific.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.PP
Several higher-level programming abstractions are implemented via futexes,
including POSIX semaphores and
various POSIX threads synchronization mechanisms
@ -1711,7 +1754,7 @@ various POSIX threads synchronization mechanisms
.\"
.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.\"
.SH EXAMPLE
.SH EXAMPLES
The program below demonstrates use of futexes in a program where a parent
process and a child process use a pair of futexes located inside a
shared anonymous mapping to synchronize access to a shared resource:
@ -1757,6 +1800,7 @@ Child (18535) 4
#include <stdio.h>
#include <errno.h>
#include <stdatomic.h>
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
@ -1768,23 +1812,23 @@ Child (18535) 4
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \e
} while (0)
static int *futex1, *futex2, *iaddr;
static uint32_t *futex1, *futex2, *iaddr;
static int
futex(int *uaddr, int futex_op, int val,
const struct timespec *timeout, int *uaddr2, int val3)
futex(uint32_t *uaddr, int futex_op, uint32_t val,
const struct timespec *timeout, uint32_t *uaddr2, uint32_t val3)
{
return syscall(SYS_futex, uaddr, futex_op, val,
timeout, uaddr, val3);
timeout, uaddr2, val3);
}
/* Acquire the futex pointed to by \(aqfutexp\(aq: wait for its value to
become 1, and then set the value to 0. */
static void
fwait(int *futexp)
fwait(uint32_t *futexp)
{
int s;
long s;
/* atomic_compare_exchange_strong(ptr, oldval, newval)
atomically performs the equivalent of:
@ -1797,11 +1841,11 @@ fwait(int *futexp)
while (1) {
/* Is the futex available? */
const int zero = 0;
if (atomic_compare_exchange_strong(futexp, &zero, 1))
const uint32_t one = 1;
if (atomic_compare_exchange_strong(futexp, &one, 0))
break; /* Yes */
/* Futex is not available; wait */
/* Futex is not available; wait. */
s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);
if (s == \-1 && errno != EAGAIN)
@ -1811,17 +1855,18 @@ fwait(int *futexp)
/* Release the futex pointed to by \(aqfutexp\(aq: if the futex currently
has the value 0, set its value to 1 and the wake any futex waiters,
so that if the peer is blocked in fpost(), it can proceed. */
so that if the peer is blocked in fwait(), it can proceed. */
static void
fpost(int *futexp)
fpost(uint32_t *futexp)
{
int s;
long s;
/* atomic_compare_exchange_strong() was described in comments above */
/* atomic_compare_exchange_strong() was described
in comments above. */
const int one = 1;
if (atomic_compare_exchange_strong(futexp, &one, 0)) {
const uint32_t zero = 0;
if (atomic_compare_exchange_strong(futexp, &zero, 1)) {
s = futex(futexp, FUTEX_WAKE, 1, NULL, NULL, 0);
if (s == \-1)
errExit("futex\-FUTEX_WAKE");
@ -1832,7 +1877,7 @@ int
main(int argc, char *argv[])
{
pid_t childPid;
int j, nloops;
int nloops;
setbuf(stdout, NULL);
@ -1841,9 +1886,9 @@ main(int argc, char *argv[])
/* Create a shared anonymous mapping that will hold the futexes.
Since the futexes are being shared between processes, we
subsequently use the "shared" futex operations (i.e., not the
ones suffixed "_PRIVATE") */
ones suffixed "_PRIVATE"). */
iaddr = mmap(NULL, sizeof(int) * 2, PROT_READ | PROT_WRITE,
iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_SHARED, \-1, 0);
if (iaddr == MAP_FAILED)
errExit("mmap");
@ -1855,27 +1900,27 @@ main(int argc, char *argv[])
*futex2 = 1; /* State: available */
/* Create a child process that inherits the shared anonymous
mapping */
mapping. */
childPid = fork();
if (childPid == \-1)
errExit("fork");
if (childPid == 0) { /* Child */
for (j = 0; j < nloops; j++) {
for (int j = 0; j < nloops; j++) {
fwait(futex1);
printf("Child (%ld) %d\en", (long) getpid(), j);
printf("Child (%jd) %d\en", (intmax_t) getpid(), j);
fpost(futex2);
}
exit(EXIT_SUCCESS);
}
/* Parent falls through to here */
/* Parent falls through to here. */
for (j = 0; j < nloops; j++) {
for (int j = 0; j < nloops; j++) {
fwait(futex2);
printf("Parent (%ld) %d\en", (long) getpid(), j);
printf("Parent (%jd) %d\en", (intmax_t) getpid(), j);
fpost(futex1);
}
@ -1894,15 +1939,15 @@ main(int argc, char *argv[])
.PP
The following kernel source files:
.IP * 2
.I Documentation/pi-futex.txt
.I Documentation/pi\-futex.txt
.IP *
.I Documentation/futex-requeue-pi.txt
.I Documentation/futex\-requeue\-pi.txt
.IP *
.I Documentation/locking/rt-mutex.txt
.I Documentation/locking/rt\-mutex.txt
.IP *
.I Documentation/locking/rt-mutex-design.txt
.I Documentation/locking/rt\-mutex\-design.txt
.IP *
.I Documentation/robust-futex-ABI.txt
.I Documentation/robust\-futex\-ABI.txt
.PP
Franke, H., Russell, R., and Kirwood, M., 2002.
\fIFuss, Futexes and Furwocks: Fast Userlevel Locking in Linux\fP

View File

@ -22,26 +22,28 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH FUTIMESAT 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH FUTIMESAT 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
futimesat \- change timestamps of a file relative to a \
directory file descriptor
.SH SYNOPSIS
.nf
.B #include <fcntl.h> /* Definition of AT_* constants */
.BR "#include <fcntl.h>" " /* Definition of " AT_* " constants */"
.B #include <sys/time.h>
.PP
.BI "int futimesat(int " dirfd ", const char *" pathname ,
.BI " const struct timeval " times [2]);
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR futimesat ():
_GNU_SOURCE
.nf
_GNU_SOURCE
.fi
.SH DESCRIPTION
This system call is obsolete.
Use
@ -81,6 +83,11 @@ If
is absolute, then
.I dirfd
is ignored.
(See
.BR openat (2)
for an explanation of why the
.I dirfd
argument is useful.)
.SH RETURN VALUE
On success,
.BR futimesat ()
@ -97,8 +104,12 @@ The following additional errors can occur for
.BR futimesat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B ENOTDIR
.I pathname

View File

@ -7,7 +7,7 @@
.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
.\" reformatting and rewordings by mtk
.\"
.TH GET_KERNEL_SYMS 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GET_KERNEL_SYMS 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
get_kernel_syms \- retrieve exported kernel and module symbols
.SH SYNOPSIS
@ -53,7 +53,7 @@ On success, returns the number of symbols copied to
.IR table .
On error, \-1 is returned and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
There is only one possible error return:
.TP

View File

@ -24,7 +24,7 @@
.\" 2007-08-27, Lee Schermerhorn <Lee.Schermerhorn@hp.com>
.\" more precise specification of behavior.
.\"
.TH GET_MEMPOLICY 2 2017-09-15 Linux "Linux Programmer's Manual"
.TH GET_MEMPOLICY 2 2021-03-22 Linux "Linux Programmer's Manual"
.SH NAME
get_mempolicy \- retrieve NUMA memory policy for a thread
.SH SYNOPSIS
@ -32,11 +32,14 @@ get_mempolicy \- retrieve NUMA memory policy for a thread
.nf
.PP
.BI "long get_mempolicy(int *" mode ", unsigned long *" nodemask ,
.BI " unsigned long " maxnode ", void *" addr ,
.BI " unsigned long " flags );
.BI " unsigned long " maxnode ", void *" addr ,
.BI " unsigned long " flags );
.PP
Link with \fI\-lnuma\fP.
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
.SH DESCRIPTION
.BR get_mempolicy ()
retrieves the NUMA policy of the calling thread or of a memory address,
@ -239,6 +242,7 @@ system call was added to the Linux kernel in version 2.6.7.
.SH CONFORMING TO
This system call is Linux-specific.
.SH NOTES
Glibc does not provide a wrapper for this system call.
For information on library support, see
.BR numa (7).
.SH SEE ALSO

View File

@ -27,22 +27,26 @@
.\" FIXME Something could be added to this page (or exit(2))
.\" about exit_robust_list processing
.\"
.TH GET_ROBUST_LIST 2 2017-09-15 Linux "Linux System Calls"
.TH GET_ROBUST_LIST 2 2021-03-22 Linux "Linux System Calls"
.SH NAME
get_robust_list, set_robust_list \- get/set list of robust futexes
.SH SYNOPSIS
.nf
.B #include <linux/futex.h>
.B #include <sys/types.h>
.B #include <syscall.h>
.BR "#include <linux/futex.h>" \
" /* Definition of " "struct robust_list_head" " */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "long get_robust_list(int " pid ", struct robust_list_head **" head_ptr ,
.BI " size_t *" len_ptr );
.BI "long set_robust_list(struct robust_list_head *" head ", size_t " len );
.BI "long syscall(SYS_get_robust_list, int " pid ,
.BI " struct robust_list_head **" head_ptr ", size_t *" len_ptr );
.BI "long syscall(SYS_set_robust_list,"
.BI " struct robust_list_head *" head ", size_t " len );
.fi
.PP
.IR Note :
There are no glibc wrappers for these system calls; see NOTES.
glibc provides no wrappers for these system calls,
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
These system calls deal with per-thread robust futex lists.
These lists are managed in user space:
@ -119,6 +123,10 @@ The
.BR get_robust_list ()
system call can fail with the following errors:
.TP
.B EFAULT
The head of the robust futex list can't be stored at the location
.IR head .
.TP
.B EPERM
The calling process does not have permission to see the robust futex list of
the thread with the thread ID
@ -131,17 +139,10 @@ capability.
No thread with the thread ID
.I pid
could be found.
.TP
.B EFAULT
The head of the robust futex list can't be stored at the location
.IR head .
.SH VERSIONS
These system calls were added in Linux 2.6.17.
.SH NOTES
These system calls are not needed by normal applications.
No support for them is provided in glibc.
In the unlikely event that you want to call them directly, use
.BR syscall (2).
.PP
A thread can have only one robust futex list;
therefore applications that wish
@ -165,8 +166,8 @@ and
.BR futex (2),
.BR pthread_mutexattr_setrobust (3)
.PP
.IR Documentation/robust-futexes.txt
.IR Documentation/robust\-futexes.txt
and
.IR Documentation/robust-futex-ABI.txt
.IR Documentation/robust\-futex\-ABI.txt
in the Linux kernel source tree
.\" http://lwn.net/Articles/172149/

View File

@ -1 +0,0 @@
.so man3/getcontext.3

View File

@ -9,15 +9,15 @@
.\"
.\" 2008, mtk, various edits
.\"
.TH GETCPU 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETCPU 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getcpu \- determine CPU and NUMA node on which the calling thread is running
.SH SYNOPSIS
.nf
.B #include <linux/getcpu.h>
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <sched.h>
.PP
.BI "int getcpu(unsigned *" cpu ", unsigned *" node \
", struct getcpu_cache *" tcache );
.BI "int getcpu(unsigned int *" cpu ", unsigned int *" node );
.fi
.SH DESCRIPTION
The
@ -37,10 +37,6 @@ or
.I node
is NULL nothing is written to the respective pointer.
.PP
The third argument to this system call is nowadays unused,
and should be specified as NULL
unless portability to Linux 2.6.23 or earlier is required (see NOTES).
.PP
The information placed in
.I cpu
is guaranteed to be current only at the time of the call:
@ -59,7 +55,7 @@ is no longer current by the time the call returns.
On success, 0 is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT
@ -82,16 +78,31 @@ The intention of
.BR getcpu ()
is to allow programs to make optimizations with per-CPU data
or for NUMA optimization.
.\"
.SS C library/kernel differences
The kernel system call has a third argument:
.PP
.in +4n
.nf
.BI "int getcpu(unsigned int *" cpu ", unsigned int *" node ,
.BI " struct getcpu_cache *" tcache );
.fi
.in
.PP
The
.I tcache
argument is unused since Linux 2.6.24.
argument is unused since Linux 2.6.24,
and (when invoking the system call directly)
should be specified as NULL,
unless portability to Linux 2.6.23 or earlier is required.
.PP
.\" commit 4307d1e5ada595c87f9a4d16db16ba5edb70dcb1
.\" Author: Ingo Molnar <mingo@elte.hu>
.\" Date: Wed Nov 7 18:37:48 2007 +0100
.\" x86: ignore the sys_getcpu() tcache parameter
In earlier kernels,
if this argument was non-NULL,
In Linux 2.6.23 and earlier, if the
.I tcache
argument was non-NULL,
then it specified a pointer to a caller-allocated buffer in thread-local
storage that was used to provide a caching mechanism for
.BR getcpu ().

View File

@ -1 +1,2 @@
.so man3/getcwd.3
.\" Because getcwd(3) is layered on a system call of the same name

View File

@ -28,19 +28,34 @@
.\" Derived from 'readdir.2'.
.\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
.\"
.TH GETDENTS 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETDENTS 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getdents, getdents64 \- get directory entries
.SH SYNOPSIS
.nf
.BI "int getdents(unsigned int " fd ", struct linux_dirent *" dirp ,
.BI " unsigned int " count );
.BI "int getdents64(unsigned int " fd ", struct linux_dirent64 *" dirp ,
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "long syscall(SYS_getdents, unsigned int " fd \
", struct linux_dirent *" dirp ,
.BI " unsigned int " count );
.PP
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.BR "#include <dirent.h>"
.PP
.BI "ssize_t getdents64(int " fd ", void *" dirp ", size_t " count );
.fi
.PP
.IR Note :
There are no glibc wrappers for these system calls; see NOTES.
glibc provides no wrapper for
.BR getdents (),
necessitating the use of
.BR syscall (2).
.PP
.IR Note :
There is no definition of
.I struct linux_dirent
in glibc; see NOTES.
.SH DESCRIPTION
These are not the interfaces you are interested in.
Look at
@ -71,7 +86,7 @@ struct linux_dirent {
unsigned long d_ino; /* Inode number */
unsigned long d_off; /* Offset to next \fIlinux_dirent\fP */
unsigned short d_reclen; /* Length of this \fIlinux_dirent\fP */
char d_name[]; /* Filename (null-terminated) */
char d_name[]; /* Filename (null\-terminated) */
/* length is actually (d_reclen \- 2 \-
offsetof(struct linux_dirent, d_name)) */
/*
@ -165,14 +180,14 @@ system call is like
except that its second argument is a pointer to a buffer containing
structures of the following type:
.PP
.EX
.in +4n
.EX
struct linux_dirent64 {
ino64_t d_ino; /* 64-bit inode number */
off64_t d_off; /* 64-bit offset to next structure */
ino64_t d_ino; /* 64\-bit inode number */
off64_t d_off; /* 64\-bit offset to next structure */
unsigned short d_reclen; /* Size of this dirent */
unsigned char d_type; /* File type */
char d_name[]; /* Filename (null-terminated) */
char d_name[]; /* Filename (null\-terminated) */
};
.EE
.in
@ -181,7 +196,7 @@ On success, the number of bytes read is returned.
On end of directory, 0 is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -203,20 +218,30 @@ File descriptor does not refer to a directory.
SVr4.
.\" SVr4 documents additional ENOLINK, EIO error conditions.
.SH NOTES
Glibc does not provide a wrapper for these system calls; call them using
Library support for
.BR getdents64 ()
was added in glibc 2.30;
Glibc does not provide a wrapper for
.BR getdents ();
call
.BR getdents ()
(or
.BR getdents64 ()
on earlier glibc versions) using
.BR syscall (2).
You will need to define the
In that case you will need to define the
.I linux_dirent
or
.I linux_dirent64
structure yourself.
However, you probably want to use
.PP
Probably, you want to use
.BR readdir (3)
instead.
instead of these system calls.
.PP
These calls supersede
.BR readdir (2).
.SH EXAMPLE
.SH EXAMPLES
.\" FIXME The example program needs to be revised, since it uses the older
.\" getdents() system call and the structure with smaller field widths.
The program below demonstrates the use of
@ -227,7 +252,7 @@ program on an ext2 directory:
.in +4n
.EX
.RB "$" " ./a.out /testfs/"
--------------- nread=120 ---------------
-\-\-\-\-\-\-\-\-\-\-\-\-\-\- nread=120 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
inode# file type d_reclen d_off d_name
2 directory 16 12 .
2 directory 16 24 ..
@ -244,6 +269,7 @@ inode# file type d_reclen d_off d_name
#define _GNU_SOURCE
#include <dirent.h> /* Defines DT_* constants */
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
@ -254,7 +280,7 @@ inode# file type d_reclen d_off d_name
do { perror(msg); exit(EXIT_FAILURE); } while (0)
struct linux_dirent {
long d_ino;
unsigned long d_ino;
off_t d_off;
unsigned short d_reclen;
char d_name[];
@ -265,17 +291,17 @@ struct linux_dirent {
int
main(int argc, char *argv[])
{
int fd, nread;
int fd;
long nread;
char buf[BUF_SIZE];
struct linux_dirent *d;
int bpos;
char d_type;
fd = open(argc > 1 ? argv[1] : ".", O_RDONLY | O_DIRECTORY);
if (fd == \-1)
handle_error("open");
for ( ; ; ) {
for (;;) {
nread = syscall(SYS_getdents, fd, buf, BUF_SIZE);
if (nread == \-1)
handle_error("getdents");
@ -285,7 +311,7 @@ main(int argc, char *argv[])
printf("\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- nread=%d \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\en", nread);
printf("inode# file type d_reclen d_off d_name\en");
for (bpos = 0; bpos < nread;) {
for (long bpos = 0; bpos < nread;) {
d = (struct linux_dirent *) (buf + bpos);
printf("%8ld ", d\->d_ino);
d_type = *(buf + bpos + d\->d_reclen \- 1);
@ -296,8 +322,8 @@ main(int argc, char *argv[])
(d_type == DT_LNK) ? "symlink" :
(d_type == DT_BLK) ? "block dev" :
(d_type == DT_CHR) ? "char dev" : "???");
printf("%4d %10lld %s\en", d\->d_reclen,
(long long) d\->d_off, d\->d_name);
printf("%4d %10jd %s\en", d\->d_reclen,
(intmax_t) d\->d_off, d\->d_name);
bpos += d\->d_reclen;
}
}

View File

@ -26,22 +26,22 @@
.\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" Modified 2008-11-27 by mtk
.\"
.TH GETDOMAINNAME 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETDOMAINNAME 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getdomainname, setdomainname \- get/set NIS domain name
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int getdomainname(char *" name ", size_t " len );
.br
.BI "int setdomainname(const char *" name ", size_t " len );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.ad l
.BR getdomainname (),
.BR setdomainname ():
.nf
@ -49,14 +49,15 @@ Feature Test Macro Requirements for glibc (see
.\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8
_DEFAULT_SOURCE
In glibc 2.19 and 2.20:
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
Up to and including glibc 2.19:
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
.fi
.ad
.SH DESCRIPTION
These functions are used to access or to change the NIS domain name of the
host system.
More precisely, they operate on the NIS domain name associated with the calling
process's UTS namespace.
.PP
.BR setdomainname ()
sets the domain name to the value given in the character array
@ -82,7 +83,7 @@ returns the first \fIlen\fP bytes (glibc) or gives an error (libc).
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.BR setdomainname ()
can fail with the following errors:
@ -134,4 +135,5 @@ field returned from a call to
.SH SEE ALSO
.BR gethostname (2),
.BR sethostname (2),
.BR uname (2)
.BR uname (2),
.BR uts_namespaces (7)

View File

@ -1,2 +0,0 @@
.so man3/getdtablesize.3
.\" Created 2013-02-05; will eventually be removed

View File

@ -22,17 +22,16 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETGID 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETGID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getgid, getegid \- get group identity
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.br
.B #include <sys/types.h>
.PP
.B gid_t getgid(void);
.br
.B gid_t getegid(void);
.fi
.SH DESCRIPTION
.BR getgid ()
returns the real group ID of the calling process.
@ -40,7 +39,11 @@ returns the real group ID of the calling process.
.BR getegid ()
returns the effective group ID of the calling process.
.SH ERRORS
These functions are always successful.
These functions are always successful
and never modify
.\" https://www.austingroupbugs.net/view.php?id=511
.\" 0000511: getuid and friends should not modify errno
.IR errno .
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, 4.3BSD.
.SH NOTES

View File

@ -29,32 +29,33 @@
.\" 2008-05-03, mtk, expanded and rewrote parts of DESCRIPTION and RETURN
.\" VALUE, made style of page more consistent with man-pages style.
.\"
.TH GETGROUPS 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETGROUPS 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getgroups, setgroups \- get/set list of supplementary group IDs
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.nf
.B #include <unistd.h>
.PP
.BI "int getgroups(int " size ", gid_t " list []);
.PP
.B #include <grp.h>
.PP
.BI "int setgroups(size_t " size ", const gid_t *" list );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR setgroups ():
.nf
Since glibc 2.19:
_DEFAULT_SOURCE
Glibc 2.19 and earlier:
_BSD_SOURCE
.fi
.SH DESCRIPTION
.PP
.BR getgroups ()
returns the supplementary group IDs of the calling process in
.IR list .
@ -66,6 +67,7 @@ buffer pointed to by
If the calling process is a member of more than
.I size
supplementary groups, then an error results.
.PP
It is unspecified whether the effective group ID of the calling process
is included in the returned list.
(Thus, an application should also call
@ -106,14 +108,14 @@ On success,
returns the number of supplementary group IDs.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.PP
On success,
.BR setgroups ()
returns 0.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT

View File

@ -1 +0,0 @@
.so man3/gethostid.3

View File

@ -29,46 +29,44 @@
.\" Modified 2004-06-17 by mtk
.\" Modified 2008-11-27 by mtk
.\"
.TH GETHOSTNAME 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETHOSTNAME 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
gethostname, sethostname \- get/set hostname
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int gethostname(char *" name ", size_t " len );
.br
.BI "int sethostname(const char *" name ", size_t " len );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.PP
.ad l
.PD 0
.BR gethostname ():
.RS 4
Since glibc 2.12:
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
.br
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200112L
.RE
.br
.PP
.BR gethostname ():
.nf
_XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200112L
|| /* Glibc 2.19 and earlier */ _BSD_SOURCE
.\" The above is something of a simplification
.\" also in glibc before 2.3 there was a bit churn
.fi
.PP
.BR sethostname ():
.nf
Since glibc 2.21:
.\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8
_DEFAULT_SOURCE
In glibc 2.19 and 2.20:
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
Up to and including glibc 2.19:
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
.fi
.PD
.ad
.SH DESCRIPTION
These system calls are used to access or to change the hostname of the
current processor.
These system calls are used to access or to change the system hostname.
More precisely, they operate on the hostname associated with the calling
process's UTS namespace.
.PP
.BR sethostname ()
sets the hostname to the value given in the character array
@ -96,7 +94,7 @@ includes a terminating null byte.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT
@ -184,4 +182,5 @@ set to
.BR hostname (1),
.BR getdomainname (2),
.BR setdomainname (2),
.BR uname (2)
.BR uname (2),
.BR uts_namespaces (7)

View File

@ -10,7 +10,7 @@
.\" 2005-04-06 mtk, Matthias Lang <matthias@corelatus.se>
.\" Noted MAX_SEC_IN_JIFFIES ceiling
.\"
.TH GETITIMER 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETITIMER 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getitimer, setitimer \- get or set value of an interval timer
.SH SYNOPSIS
@ -18,8 +18,8 @@ getitimer, setitimer \- get or set value of an interval timer
.B #include <sys/time.h>
.PP
.BI "int getitimer(int " which ", struct itimerval *" curr_value );
.BI "int setitimer(int " which ", const struct itimerval *" new_value ,
.BI " struct itimerval *" old_value );
.BI "int setitimer(int " which ", const struct itimerval *restrict " new_value ,
.BI " struct itimerval *restrict " old_value );
.fi
.SH DESCRIPTION
These system calls provide access to interval timers, that is,
@ -34,7 +34,7 @@ Three types of timers\(emspecified via the
argument\(emare provided,
each of which counts against a different clock and
generates a different signal on timer expiration:
.TP 1.5i
.TP
.B ITIMER_REAL
This timer counts down in real (i.e., wall clock) time.
At each expiration, a
@ -134,7 +134,7 @@ if both of its subfields are zero, the timer is single-shot.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT

View File

@ -22,40 +22,31 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETPAGESIZE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETPAGESIZE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getpagesize \- get memory page size
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.B int getpagesize(void);
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR getpagesize ():
.ad l
.RS 4
.PD 0
.TP 4
Since glibc 2.19:
.nf
_DEFAULT_SOURCE || ! (_POSIX_C_SOURCE\ >=\ 200112L)
.TP 4
Since glibc 2.20:
_DEFAULT_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
Glibc 2.12 to 2.19:
_BSD_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
Before glibc 2.12:
_BSD_SOURCE || _XOPEN_SOURCE >= 500
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
.fi
From glibc 2.12 to 2.19:
.nf
_BSD_SOURCE || ! (_POSIX_C_SOURCE\ >=\ 200112L)
.TP 4
.fi
Before glibc 2.12:
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
.PD
.RE
.ad b
.SH DESCRIPTION
The function
.BR getpagesize ()

View File

@ -39,14 +39,16 @@
.\" Modified 17 Jul 2002, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Added 'socket' to NAME, so that "man -k socket" will show this page.
.\"
.TH GETPEERNAME 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETPEERNAME 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getpeername \- get name of connected peer socket
.SH SYNOPSIS
.nf
.B #include <sys/socket.h>
.PP
.BI "int getpeername(int " sockfd ", struct sockaddr *" addr \
", socklen_t *" addrlen );
.BI "int getpeername(int " sockfd ", struct sockaddr *restrict " addr ,
.BI " socklen_t *restrict " addrlen );
.fi
.SH DESCRIPTION
.BR getpeername ()
returns the address of the peer connected to the socket
@ -69,7 +71,7 @@ will return a value greater than was supplied to the call.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF

View File

@ -22,17 +22,16 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETPID 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETPID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getpid, getppid \- get process identification
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.nf
.B #include <unistd.h>
.PP
.B pid_t getpid(void);
.br
.B pid_t getppid(void);
.fi
.SH DESCRIPTION
.BR getpid ()
returns the process ID (PID) of the calling process.
@ -97,6 +96,7 @@ in the child would return the wrong value
.\" #define _GNU_SOURCE
.\" #include <sys/syscall.h>
.\" #include <sys/wait.h>
.\" #include <stdint.h>
.\" #include <stdio.h>
.\" #include <stdlib.h>
.\" #include <unistd.h>
@ -106,13 +106,13 @@ in the child would return the wrong value
.\" {
.\" /* The following statement fills the getpid() cache */
.\"
.\" printf("parent PID = %ld\n", (long) getpid());
.\" printf("parent PID = %ld\n", (intmax_t) getpid());
.\"
.\" if (syscall(SYS_fork) == 0) {
.\" if (getpid() != syscall(SYS_getpid))
.\" printf("child getpid() mismatch: getpid()=%ld; "
.\" printf("child getpid() mismatch: getpid()=%jd; "
.\" "syscall(SYS_getpid)=%ld\n",
.\" (long) getpid(), (long) syscall(SYS_getpid));
.\" (intmax_t) getpid(), (long) syscall(SYS_getpid));
.\" exit(EXIT_SUCCESS);
.\" }
.\" wait(NULL);

View File

@ -42,17 +42,16 @@
.\" Clarified meaning of 0 value for 'who' argument
.\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH GETPRIORITY 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETPRIORITY 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
getpriority, setpriority \- get/set program scheduling priority
.SH SYNOPSIS
.B #include <sys/time.h>
.br
.nf
.B #include <sys/resource.h>
.PP
.BI "int getpriority(int " which ", id_t " who );
.br
.BI "int setpriority(int " which ", id_t " who ", int " prio );
.fi
.SH DESCRIPTION
The scheduling priority of the process, process group, or user, as
indicated by
@ -93,7 +92,7 @@ calling process, or the real user ID of the calling process.
.PP
The
.I prio
argument is a value in the range \-20 to 19 (but see NOTES below).
argument is a value in the range \-20 to 19 (but see NOTES below),
with \-20 being the highest priority and 19 being the lowest priority.
Attempts to set a priority outside this range
are silently clamped to the range.
@ -123,23 +122,33 @@ On success,
returns the calling thread's nice value, which may be a negative number.
On error, it returns \-1 and sets
.I errno
to indicate the cause of the error.
to indicate the error.
.PP
Since a successful call to
.BR getpriority ()
can legitimately return the value \-1, it is necessary
to clear the external variable
to clear
.I errno
prior to the
call, then check it afterward to determine
call, then check
.I errno
afterward to determine
if \-1 is an error or a legitimate value.
.PP
.BR setpriority ()
returns 0 on success.
On error, it returns \-1 and sets
On failure, it returns \-1 and sets
.I errno
to indicate the cause of the error.
to indicate the error.
.SH ERRORS
.TP
.B EACCES
The caller attempted to set a lower nice value
(i.e., a higher process priority), but did not
have the required privilege (on Linux: did not have the
.B CAP_SYS_NICE
capability).
.TP
.B EINVAL
.I which
was not one of
@ -148,24 +157,6 @@ was not one of
or
.BR PRIO_USER .
.TP
.B ESRCH
No process was located using the
.I which
and
.I who
values specified.
.PP
In addition to the errors indicated above,
.BR setpriority ()
may fail if:
.TP
.B EACCES
The caller attempted to set a lower nice value
(i.e., a higher process priority), but did not
have the required privilege (on Linux: did not have the
.B CAP_SYS_NICE
capability).
.TP
.B EPERM
A process was located, but its effective user ID did not match
either the effective or the real user ID of the caller,
@ -173,6 +164,13 @@ and was not privileged (on Linux: did not have the
.B CAP_SYS_NICE
capability).
But see NOTES below.
.TP
.B ESRCH
No process was located using the
.I which
and
.I who
values specified.
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008,
SVr4, 4.4BSD (these interfaces first appeared in 4.2BSD).
@ -206,18 +204,6 @@ the real or effective user ID of the process \fIwho\fP.
All BSD-like systems (SunOS 4.1.3, Ultrix 4.2,
4.3BSD, FreeBSD 4.3, OpenBSD-2.5, ...) behave in the same
manner as Linux 2.6.12 and later.
.PP
Including
.I <sys/time.h>
is not required these days, but increases portability.
(Indeed,
.I <sys/resource.h>
defines the
.I rusage
structure with fields of type
.I struct timeval
defined in
.IR <sys/time.h> .)
.\"
.SS C library/kernel differences
Within the kernel, nice values are actually represented
@ -248,5 +234,5 @@ which may be made standards conformant in the future.
.BR capabilities (7),
.BR sched (7)
.PP
.I Documentation/scheduler/sched-nice-design.txt
.I Documentation/scheduler/sched\-nice\-design.txt
in the Linux kernel source tree (since Linux 2.6.23)

View File

@ -24,13 +24,15 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETRANDOM 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETRANDOM 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getrandom \- obtain a series of random bytes
.SH SYNOPSIS
.nf
.B #include <sys/random.h>
.PP
.BI "ssize_t getrandom(void *"buf ", size_t " buflen ", unsigned int " flags );
.fi
.SH DESCRIPTION
The
.BR getrandom ()
@ -136,7 +138,7 @@ source or the system call was interrupted by a signal.
.PP
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EAGAIN

View File

@ -25,17 +25,17 @@
.\"
.\" Modified, 2003-05-26, Michael Kerrisk, <mtk.manpages@gmail.com>
.\"
.TH GETRESUID 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETRESUID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getresuid, getresgid \- get real, effective and saved user/group IDs
getresuid, getresgid \- get real, effective, and saved user/group IDs
.SH SYNOPSIS
.nf
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.br
.B #include <unistd.h>
.PP
.BI "int getresuid(uid_t *" ruid ", uid_t *" euid ", uid_t *" suid );
.br
.BI "int getresgid(gid_t *" rgid ", gid_t *" egid ", gid_t *" sgid );
.fi
.SH DESCRIPTION
.BR getresuid ()
returns the real UID, the effective UID, and the saved set-user-ID
@ -51,7 +51,7 @@ performs the analogous task for the process's group IDs.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT

View File

@ -61,30 +61,29 @@
.\" 2008-05-07, mtk / Peter Zijlstra, Added description of RLIMIT_RTTIME
.\" 2010-11-06, mtk: Added documentation of prlimit()
.\"
.TH GETRLIMIT 2 2018-04-30 "Linux" "Linux Programmer's Manual"
.TH GETRLIMIT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getrlimit, setrlimit, prlimit \- get/set resource limits
.SH SYNOPSIS
.B #include <sys/time.h>
.br
.nf
.B #include <sys/resource.h>
.PP
.BI "int getrlimit(int " resource ", struct rlimit *" rlim );
.br
.BI "int setrlimit(int " resource ", const struct rlimit *" rlim );
.PP
.BI "int prlimit(pid_t " pid ", int " resource \
", const struct rlimit *" new_limit ,
.br
.BI "int prlimit(pid_t " pid ", int " resource ", const struct rlimit *" new_limit ,
.BI " struct rlimit *" old_limit );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR prlimit ():
_GNU_SOURCE
.nf
_GNU_SOURCE
.fi
.SH DESCRIPTION
The
.BR getrlimit ()
@ -207,7 +206,7 @@ catch this signal instead, in which case the relevant system call (e.g.,
fails with the error
.BR EFBIG .
.TP
.BR RLIMIT_LOCKS " (early Linux 2.4 only)"
.BR RLIMIT_LOCKS " (Linux 2.4.0 to 2.4.24)"
.\" to be precise: Linux 2.4.0-test9; no longer in 2.4.25 / 2.5.65
This is a limit on the combined number of
.BR flock (2)
@ -308,7 +307,7 @@ The actual ceiling for the nice value is calculated as
.IR "20\ \-\ rlim_cur" .
The useful range for this limit is thus from 1
(corresponding to a nice value of 19) to 40
(corresponding to a nice value of -20).
(corresponding to a nice value of \-20).
This unusual choice of range was necessary
because negative numbers cannot be specified
as resource limit values, since they typically have special meanings.
@ -508,7 +507,7 @@ must match the real group ID of the caller.
On success, these system calls return 0.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT
@ -557,9 +556,11 @@ Library support is available since glibc 2.13.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lbw35 lb lb
lbx lb lb
l l l.
Interface Attribute Value
T{
@ -568,6 +569,8 @@ T{
.BR prlimit ()
T} Thread safety MT-Safe
.TE
.hy
.ad
.sp 1
.SH CONFORMING TO
.BR getrlimit (),
@ -776,13 +779,14 @@ and
.BR getrlimit ()
as wrapper functions that call
.BR prlimit ().
.SH EXAMPLE
.SH EXAMPLES
The program below demonstrates the use of
.BR prlimit ().
.PP
.EX
#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64
#include <stdint.h>
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
@ -819,15 +823,15 @@ main(int argc, char *argv[])
if (prlimit(pid, RLIMIT_CPU, newp, &old) == \-1)
errExit("prlimit\-1");
printf("Previous limits: soft=%lld; hard=%lld\en",
(long long) old.rlim_cur, (long long) old.rlim_max);
printf("Previous limits: soft=%jd; hard=%jd\en",
(intmax_t) old.rlim_cur, (intmax_t) old.rlim_max);
/* Retrieve and display new CPU time limit */
if (prlimit(pid, RLIMIT_CPU, NULL, &old) == \-1)
errExit("prlimit\-2");
printf("New limits: soft=%lld; hard=%lld\en",
(long long) old.rlim_cur, (long long) old.rlim_max);
printf("New limits: soft=%jd; hard=%jd\en",
(intmax_t) old.rlim_cur, (intmax_t) old.rlim_max);
exit(EXIT_SUCCESS);
}

View File

@ -36,17 +36,16 @@
.\" document ru_maxrss
.\" 2010-05-24, mtk, enhanced description of various fields
.\"
.TH GETRUSAGE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETRUSAGE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getrusage \- get resource usage
.SH SYNOPSIS
.B #include <sys/time.h>
.br
.nf
.B #include <sys/resource.h>
.PP
.BI "int getrusage(int " who ", struct rusage *" usage );
.fi
.SH DESCRIPTION
.PP
.BR getrusage ()
returns resource usage measures for
.IR who ,
@ -184,12 +183,11 @@ completed (usually to await availability of a resource).
The number of times a context switch resulted due to a higher
priority process becoming runnable or because the current process
exceeded its time slice.
.PP
.SH RETURN VALUE
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT
@ -202,15 +200,19 @@ is invalid.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lb lb lb
lbx lb lb
l l l.
Interface Attribute Value
T{
.BR getrusage ()
T} Thread safety MT-Safe
.TE
.hy
.ad
.sp 1
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
@ -227,14 +229,6 @@ is Linux-specific.
Resource usage metrics are preserved across an
.BR execve (2).
.PP
Including
.I <sys/time.h>
is not required these days, but increases portability.
(Indeed,
.I struct timeval
is defined in
.IR <sys/time.h> .)
.PP
In Linux kernel versions before 2.6.9, if the disposition of
.B SIGCHLD
is set to
@ -254,10 +248,13 @@ Ancient systems provided a
.BR vtimes ()
function with a similar purpose to
.BR getrusage ().
For backward compatibility, glibc also provides
For backward compatibility, glibc (up until version 2.32) also provides
.BR vtimes ().
All new applications should be written using
.BR getrusage ().
(Since version 2.33, glibc no longer provides an
.BR vtimes ()
implementation.)
.PP
See also the description of
.IR /proc/[pid]/stat

View File

@ -24,32 +24,27 @@
.\"
.\" Modified Thu Oct 31 14:18:40 1996 by Eric S. Raymond <esr@y\thyrsus.com>
.\" Modified 2001-12-17, aeb
.TH GETSID 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETSID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getsid \- get session ID
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.nf
.B #include <unistd.h>
.PP
.BI "pid_t getsid(pid_t" " pid" );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.PP
.ad l
.PD 0
.BR getsid ():
.RS 4
_XOPEN_SOURCE\ >=\ 500
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
.br
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
.RE
.PD
.ad
.PP
.BR getsid ():
.nf
_XOPEN_SOURCE >= 500
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
.fi
.SH DESCRIPTION
.I getsid(0)
returns the session ID of the calling process.
@ -63,9 +58,9 @@ is 0,
returns the session ID of the calling process.
.SH RETURN VALUE
On success, a session ID is returned.
On error, \fI(pid_t)\ \-1\fP will be returned, and
On error, \fI(pid_t)\ \-1\fP is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EPERM

View File

@ -37,15 +37,15 @@
.\" Modified Tue Oct 22 00:22:35 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified Sun Mar 28 21:26:46 1999 by Andries Brouwer <aeb@cwi.nl>
.\"
.TH GETSOCKNAME 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETSOCKNAME 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getsockname \- get socket name
.SH SYNOPSIS
.nf
.B #include <sys/socket.h>
.PP
.BI "int getsockname(int " sockfd ", struct sockaddr *" addr \
", socklen_t *" addrlen );
.BI "int getsockname(int " sockfd ", struct sockaddr *restrict " addr ,
.BI " socklen_t *restrict " addrlen );
.fi
.SH DESCRIPTION
.BR getsockname ()
@ -68,7 +68,7 @@ will return a value greater than was supplied to the call.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF

View File

@ -41,16 +41,15 @@
.\" Modified 1999 by Andi Kleen <ak@muc.de>.
.\" Removed most stuff because it is in socket.7 now.
.\"
.TH GETSOCKOPT 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETSOCKOPT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getsockopt, setsockopt \- get and set options on sockets
.SH SYNOPSIS
.nf
.BR "#include <sys/types.h>" " /* See NOTES */"
.B #include <sys/socket.h>
.PP
.BI "int getsockopt(int " sockfd ", int " level ", int " optname ,
.BI " void *" optval ", socklen_t *" optlen );
.BI " void *restrict " optval ", socklen_t *restrict " optlen );
.BI "int setsockopt(int " sockfd ", int " level ", int " optname ,
.BI " const void *" optval ", socklen_t " optlen );
.fi
@ -131,13 +130,13 @@ and the appropriate protocol man pages.
On success, zero is returned for the standard options.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.PP
Netfilter allows the programmer
to define custom socket options with associated handlers; for such
options, the return value on success is the value returned by the handler.
.SH ERRORS
.TP 10
.TP
.B EBADF
The argument
.I sockfd
@ -179,12 +178,6 @@ SVr4, 4.4BSD (these system calls first appeared in 4.2BSD).
.\" .BR SO_SNDLOWAT ", " SO_RCVLOWAT ", " SO_SNDTIMEO ", " SO_RCVTIMEO
.\" options
.SH NOTES
POSIX.1 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
.PP
For background on the
.I socklen_t
type, see

View File

@ -23,12 +23,13 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETTID 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETTID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
gettid \- get thread identification
.SH SYNOPSIS
.nf
.B #include <sys/types.h>
.B #define _GNU_SOURCE
.B #include <unistd.h>
.PP
.B pid_t gettid(void);
.fi
@ -54,8 +55,6 @@ The
system call first appeared on Linux in kernel 2.4.11.
Library support was added in glibc 2.30.
(Earlier glibc versions did not provide a wrapper for this system call,
.\" FIXME . See http://sourceware.org/bugzilla/show_bug.cgi?id=6399
.\" "gettid() should have a wrapper"
necessitating the use of
.BR syscall (2).)
.SH CONFORMING TO
@ -83,8 +82,8 @@ is the same as its thread ID (the value returned by
.BR clone (2),
.BR fcntl (2),
.BR fork (2),
.BR getpid (2),
.BR get_robust_list (2),
.BR getpid (2),
.\" .BR kcmp (2),
.BR ioprio_set (2),
.\" .BR move_pages (2),

View File

@ -37,35 +37,38 @@
.\" Modified, 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" Added notes on capability requirement.
.\"
.TH GETTIMEOFDAY 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETTIMEOFDAY 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
gettimeofday, settimeofday \- get / set time
.SH SYNOPSIS
.nf
.B #include <sys/time.h>
.PP
.BI "int gettimeofday(struct timeval *" tv ", struct timezone *" tz );
.PP
.BI "int settimeofday(const struct timeval *" tv \
", const struct timezone *" tz );
.BI "int gettimeofday(struct timeval *restrict " tv ,
.BI " struct timezone *restrict " tz );
.BI "int settimeofday(const struct timeval *" tv ,
.BI " const struct timezone *" tz );
.fi
.PP
.in -4n
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.in
.RE
.PP
.BR settimeofday ():
.nf
Since glibc 2.19:
_DEFAULT_SOURCE
Glibc 2.19 and earlier:
_BSD_SOURCE
.fi
.SH DESCRIPTION
The functions
.BR gettimeofday ()
and
.BR settimeofday ()
can get and set the time as well as a timezone.
.PP
The
.I tv
argument is a
@ -84,6 +87,7 @@ struct timeval {
.PP
and gives the number of seconds and microseconds since the Epoch (see
.BR time (2)).
.PP
The
.I tz
argument is a
@ -142,9 +146,10 @@ No doubt it is a bad idea to use this feature.
.BR gettimeofday ()
and
.BR settimeofday ()
return 0 for success, or \-1 for failure (in which case
return 0 for success.
On error, \-1 is returned and
.I errno
is set appropriately).
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT

View File

@ -23,17 +23,16 @@
.\" %%%LICENSE_END
.\"
.\" Historical remark, aeb, 2004-06-05
.TH GETUID 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETUID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getuid, geteuid \- get user identity
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.br
.B #include <sys/types.h>
.PP
.B uid_t getuid(void);
.br
.B uid_t geteuid(void);
.fi
.SH DESCRIPTION
.BR getuid ()
returns the real user ID of the calling process.
@ -41,7 +40,11 @@ returns the real user ID of the calling process.
.BR geteuid ()
returns the effective user ID of the calling process.
.SH ERRORS
These functions are always successful.
These functions are always successful
and never modify
.\" https://www.austingroupbugs.net/view.php?id=511
.\" 0000511: getuid and friends should not modify errno
.IR errno .
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, 4.3BSD.
.SH NOTES

View File

@ -24,21 +24,25 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETUNWIND 2 2017-09-15 Linux "Linux Programmer's Manual"
.TH GETUNWIND 2 2021-03-22 Linux "Linux Programmer's Manual"
.SH NAME
getunwind \- copy the unwind data to caller's buffer
.SH SYNOPSIS
.nf
.B #include <syscall.h>
.B #include <linux/unwind.h>
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "long getunwind(void " *buf ", size_t " buf_size );
.BI "long syscall(SYS_getunwind, void " *buf ", size_t " buf_size );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR getunwind (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.I Note: this function is obsolete.
.I Note: this system call is obsolete.
.PP
The
IA-64-specific
@ -68,9 +72,9 @@ The unwind table contains entries of the following form:
.PP
.in +4n
.EX
u64 start; (64-bit address of start of function)
u64 end; (64-bit address of end of function)
u64 info; (BUF-relative offset to unwind info)
u64 start; (64\-bit address of start of function)
u64 end; (64\-bit address of end of function)
u64 info; (BUF\-relative offset to unwind info)
.EE
.in
.PP
@ -102,9 +106,5 @@ and is available only on the IA-64 architecture.
This system call has been deprecated.
The modern way to obtain the kernel's unwind data is via the
.BR vdso (7).
.PP
Glibc does not provide a wrapper for this system call;
in the unlikely event that you want to call it, use
.BR syscall (2).
.SH SEE ALSO
.BR getauxval (3)

Some files were not shown because too many files have changed in this diff Show More