Compare commits

...

546 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
269 changed files with 8508 additions and 2769 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/

819
Changes
View File

@ -1,6 +1,6 @@
==================== Changes in man-pages-5.11 ====================
==================== Changes in man-pages-5.14 ====================
Released: 2021-03-21, Munich
Released: ????-??-??, Munich
Contributors
@ -10,48 +10,6 @@ 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:
Alejandro Colomar <alx.manpages@gmail.com>
Alessandro Bono <alessandro.bono369@gmail.com>
Alyssa Ross <hi@alyssa.is>
Bastien Roucariès <rouca@debian.org>
Bruno Haible <bruno@clisp.org>
Christian Brauner <christian.brauner@ubuntu.com>
Ciprian Dorin Craciun <ciprian.craciun@gmail.com>
Dmitry V. Levin <ldv@altlinux.org>
Dmitry Vorobev <dvorobev@cloudflare.com>
edef <edef@edef.eu>
Enke Chen <enkechen2020@gmail.com>
Gabriel Krisman Bertazi <krisman@collabora.com>
Ganimedes Colomar <gacoan.linux@gmail.com>
Jakub Wilk <jwilk@jwilk.net>
Jan Kara <jack@suse.cz>
Jens Axboe <axboe@kernel.dk>
Johannes Pfister <johannes.pfister@josttech.ch>
Johannes Wellhöfer <johannes.wellhofer@gmail.com>
John Morris <john@zultron.com>
Jonathan Wakely <jwakely@redhat.com>
Jonny Grant <jg@jguk.org>
Manfred Spraul <manfred@colorfullife.com>
Michael Kerrisk <mtk.manpages@gmail.com>
Michal Hocko <mhocko@suse.com>
Minchan Kim <minchan@kernel.org>
Pádraig Brady <P@draigBrady.com>
Pali Rohár <pali@kernel.org>
Palmer Dabbelt <palmerdabbelt@google.com>
Paran Lee <p4ranlee@gmail.com>
Peter H. Froehlich <peter.hans.froehlich@gmail.com>
Philipp Schuster <phip1611@gmail.com>
Stephen Kitt <steve@sk2.org>
Steve Grubb <sgrubb@redhat.com>
Suren Baghdasaryan <surenb@google.com>
Szunti <szunti@gmail.com>
Valentin Kettner <vakevk@gmail.com>
Vincent Lefevre <vincent@vinc17.net>
Walter Franzini <walter.franzini@gmail.com>
Walter Harms <wharms@bfs.de>
Willem de Bruijn <willemb@google.com>
Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Zack Weinberg <zackw@panix.com>
Apologies if I missed anyone!
@ -59,792 +17,19 @@ Apologies if I missed anyone!
New and rewritten pages
-----------------------
close_range.2
Stephen Kitt, Michael Kerrisk [Christian Brauner]
New page documenting close_range(2)
process_madvise.2
Suren Baghdasaryan, Minchan Kim [Michal Hocko, Alejandro Colomar,
Michael Kerrisk]
Document process_madvise(2)
fileno.3
Michael Kerrisk
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).
Newly documented interfaces in existing pages
---------------------------------------------
epoll_wait.2
Willem de Bruijn [Dmitry V. Levin]
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.
fanotify_init.2
fanotify.7
Jan Kara [Steve Grubb]
Document FAN_AUDIT flag and FAN_ENABLE_AUDIT
madvise.2
Michael Kerrisk
Add descriptions of MADV_COLD and MADV_PAGEOUT
Taken from process_madvise(2).
openat2.2
Jens Axboe
Add RESOLVE_CACHED
prctl.2
Gabriel Krisman Bertazi
Document Syscall User Dispatch
mallinfo.3
Michael Kerrisk
Document mallinfo2() and note that mallinfo() is deprecated
Document the mallinfo2() function added in glibc 2.33.
Update example program to use mallinfo2()
system_data_types.7
Alejandro Colomar
Add off64_t to system_data_types(7)
ld.so.8
Michael Kerrisk
Document the --argv0 option added in glibc 2.33
New and changed links
---------------------
epoll_pwait2.2
Dmitry V. Levin
New link to epoll_wait(2)
mallinfo2.3
Michael Kerrisk
New link to mallinfo(3)
off64_t.3
Alejandro Colomar
New link to system_data_types(7)
Global changes
--------------
Various pages
Alejandro Colomar
SYNOPSIS: Use 'restrict' in prototypes
This change has been completed for *all* relevant pages
(around 135 pages in total).
Various pages
Alejandro Colomar [Zack Weinberg]
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.]
A few pages
Alejandro Colomar
Add notes about missing glibc wrappers
_exit.2
abort.3
err.3
exit.3
pthread_exit.3
setjmp.3
Alejandro Colomar
SYNOPSIS: Use 'noreturn' in prototypes
Use standard C11 'noreturn' in these manual page for
functions that do not return.
Various pages
Ganimedes Colomar [Alejandro Colomar]
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.
Normalize NOTES about nonexistent glibc wrappers
This commit normalizes texts under sections other than SYNOPSIS
(most of them in NOTES).
Global changes (formatting fixes and minor edits)
-------------------------------------------------
Various pages
Michael Kerrisk
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.
Various pages
Michael Kerrisk
Use periods more consistently inside code comments
In general, complete sentences in free-standing comments
should be terminated by periods.
A few pages
Michael Kerrisk
Better table formatting
In particular, allow for rendering in widths different from
(especially less than) 80 columns.
Various pages
Michael Kerrisk
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.
Various pages
Michael Kerrisk [Alejandro Colomar]
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.
Various pages
Alejandro Colomar
Consistently use 'unsigned int'
Most pages use 'unsigned int' (and the kernel too).
Make them all do so.
Various pages
Michael Kerrisk
Various improvements in wording in RETURN VALUE
Various pages
Michael Kerrisk
s/Glibc versions </Glibc </ in Feature Test Macro discussions
Use a more compact notation that will render less wide
on the terminal.
Various pages
Michael Kerrisk
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".
Various pages
Michael Kerrisk
Add missing .nf/.fi in FTM info
Various pages
Michael Kerrisk
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.
Various pages
Michael Kerrisk
Use real minus signs in pathnames
Various pages
Michael Kerrisk
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".
Various pages
Michael Kerrisk
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.
Various pages
Michael Kerrisk
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.
Various pages
Michael Kerrisk
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".
Various pages
Michael Kerrisk
Use "\-" to generate real minus in circumstances where appropriate
Use \- for math formulas, pathnames, manual page cross references,
etc.
Various pages
Michael Kerrisk
Inside code blocks (.EX/.EE) use \- to get real minus signs
A real minus can be cut and pasted...
Various pages
Alejandro Colomar
Remove explicit blank lines, replacing them with .PP when appropriate
Various pages
Michael Kerrisk
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);
Various pages
Michael Kerrisk
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".
Various System V IPC pages
Michael Kerrisk
Improve wording describing RETURN VALUE and setting of 'errno'
Changes to individual pages
---------------------------
alloc_hugepages.2
Michael Kerrisk
CONFORMING TO: reword to reflect that these system calls are long gone
cacheflush.2
Alejandro Colomar
Update SYNOPSIS for glibc wrapper
Glibc uses 'void *' instead of 'char *'.
And the prototype is declared in <sys/cachectl.h>.
clone.2
Valentin Kettner
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.
close.2
Michael Kerrisk
SEE ALSO: add close_range(2)
copy_file_range.2
Alejandro Colomar
Document glibc wrapper instead of kernel syscall
Glibc uses 'off64_t' instead of 'loff_t'.
delete_module.2
Alejandro Colomar
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.
epoll_create.2
Michael Kerrisk
CONFORMING TO: mention that epoll_create1() is Linux-specific
epoll_wait.2
Michael Kerrisk
CONFORMING TO: mention that epoll_pwait() is Linux-specific
execve.2
Palmer Dabbelt
Correct the versions of Linux that don't have ARG_MAX argv/envp size
execveat.2
Alejandro Colomar
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.
getcpu.2
Michael Kerrisk [Alejandro Colomar]
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.
getgid.2
getuid.2
Michael Kerrisk
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.
gethostname.2
Michael Kerrisk
Update FTM requirements for gethostname()
getpagesize.2
getdtablesize.3
Michael Kerrisk
Update/correct FTM requirements
getrusage.2
Michael Kerrisk
Starting in 2.33, glibc no longer provides vtimes()
ioctl_tty.2
Michael Kerrisk
Reformat argument type information
The current mark-up renders poorly. To resolve this, move
the type information into a separate line.
ipc.2
Alejandro Colomar
Fix prototype parameter types
kcmp.2
Michael Kerrisk
Since Linux 5.12, kcmp() availability is unconditional
kcmp() is no longer dependent on CONFIG_CHECKPOINT_RESTORE.
keyctl.2
Alejandro Colomar
SYNOPSIS: Fix prototype parameter types
The Linux kernel uses 'unsigned long'.
There's no reason to use the typedef '__kernel_ulong_t'.
lookup_dcookie.2
Alejandro Colomar
Use standard types: u64 -> uint64_t
madvise.2
Michael Kerrisk
SEE ALSO: add process_madvise(2)
mlock.2
Alejandro Colomar
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.
Michael Kerrisk
CONFORMING TO: note more explicitly which APIs are in the standards
mmap2.2
Alejandro Colomar
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.
mount.2
Michael Kerrisk
Note that the 'data' argument can be NULL
move_pages.2
Alejandro Colomar
Add notes about missing glibc wrappers
open.2
rename.2
Alyssa Ross
Refer to tmpfs rather than shmem
If I'm understanding correctly, 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.
pciconfig_read.2
Alejandro Colomar
SYNOPSIS: Fix prototype parameter types
Use the glibc prototypes instead of the kernel ones.
Exception: use 'int' instead of 'enum'.
pidfd_open.2
Michael Kerrisk
Note the process_madvise(2) use case for PID file descriptors
readlink.2
Michael Kerrisk [Jonny Grant]
Emphasize that the returned buffer is not null-terminated
s390_pci_mmio_write.2
Alejandro Colomar
SYNOPSIS: Add 'const' qualifier
s390_pci_mmio_write() uses 'const void *' instead of 'void *'.
sched_setattr.2
Alejandro Colomar
Add note about missing glibc wrappers
semctl.2
Yang Xu [Alejandro Colomar, Manfred Spraul]
Correct SEM_STAT_ANY description
socketcall.2
Alejandro Colomar
Add note about missing glibc wrapper
splice.2
Alejandro Colomar
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.
spu_create.2
Alejandro Colomar
SYNOPSIS: Fix prototype parameter type
The 'flags' parameter of spu_create() uses 'unsigned int'.
spu_run.2
Alejandro Colomar
SYNOPSIS: Fix prototype parameter types
The 2nd and 3rd parameters of spu_run() use 'uint32_t *'.
stat.2
Jonathan Wakely [Alejandro Colomar]
Remove <unistd.h> from SYNOPSIS
There seems to be no reason <unistd.h> is shown here, so remove it.
Michael Kerrisk
Move the obsolete _BSD_SOURCE FTM to the end of the FTM info
syscall.2
Peter H. Froehlich
Update superh syscall convention
syscalls.2
Michael Kerrisk
Add epoll_pwait2()
tkill.2
Alejandro Colomar
SYNOPSIS: Fix prototype parameter types
All but the last parameters of t[g]kill() use 'pid_t',
both in the kernel and glibc.
vmsplice.2
Alejandro Colomar
SYNOPSIS: Fix prototype parameter type
The 3rd parameter of vmsplice() uses 'size_t' in glibc.
bstring.3
Michael Kerrisk
SEE ALSO: add string(3)
circleq.3
list.3
slist.3
stailq.3
tailq.3
Alejandro Colomar
Improve readability, especially in SYNOPSIS
circleq.3
Alejandro Colomar
Fix CIRCLEQ_LOOP_*() return type
crypt.3
Michael Kerrisk
Reformat FTM info (in preparation for next patch)
Michael Kerrisk
Update crypt() FTM requirements to note glibc 2.28 changes
ecvt.3
gcvt.3
Michael Kerrisk
Update FTM requirements
error.3
Michael Kerrisk [Alejandro Colomar, Walter Harms]
Clarify the meaning of 'status==0' for error(3)
ferror.3
Michael Kerrisk
Remove fileno(3) content that was migrated to new fileno(3) page
Michael Kerrisk
Add a RETURN VALUE section
Michael Kerrisk
POSIX.1-2008: these functions won't change 'errno' if 'stream' is valid
See https://www.austingroupbugs.net/view.php?id=401.
fread.3
Alessandro Bono
EXAMPLES: swap size and nmemb params
It works both ways, but this one feels more right. We are reading
four elements sizeof(*buffer) bytes each.
fseeko.3
Michael Kerrisk
Move info about obsolete FTM from SYNOPSIS to NOTES
This makes the SYNOPSIS more consistent with other pages.
ftime.3
Michael Kerrisk
glibc 2.33 has removed ftime()
ftw.3
Alejandro Colomar
SYNOPSIS: Remove duplicate header
gethostbyname.3
Michael Kerrisk
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.
gethostid.3
Michael Kerrisk
Update FTM requirements for gethostid()
get_phys_pages.3
Alejandro Colomar [Jakub Wilk]
glibc gets the info from sysinfo(2) since 2.23
grantpt.3
ptsname.3
unlockpt.3
Michael Kerrisk
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.
malloc.3
Alejandro Colomar [Johannes Pfister]
Document that realloc(p, 0) is specific to glibc and nonportable
malloc_hook.3
Alejandro Colomar
SYNOPSIS: Use 'volatile' in prototypes
malloc_trim.3
Dmitry Vorobev
Remove mention of free() call
'malloc_trim' was and is never called from the 'free' function.
pthread_create.3
Michael Kerrisk [Paran Lee]
Fix undeclared variable error in example program
Michael Kerrisk
Fix a signedness error in the example code
puts.3
Michael Kerrisk
Reorder functions more logically (group related functions together)
qecvt.3
Michael Kerrisk
Update feature test macro requirements
setbuf.3
Michael Kerrisk
POSIX doesn't require errno to be unchanged after successful setbuf()
See https://www.austingroupbugs.net/view.php?id=397#c799
setlocale.3
Michael Kerrisk [Alejandro Colomar, Bruno Haible]
Restructure a particularly difficult sentence
simpleq.3
stailq.3
queue.7
SIMPLEQ_*.3
Alejandro Colomar
Document SIMPLEQ_*() as an alias to STAILQ_*() macros
strerror.3
Alejandro Colomar
strerrorname_np() and strerrordesc_np() first appeared on glibc 2.32
string.3
Michael Kerrisk
SEE ALSO: add bstring(3)
system.3
Alejandro Colomar [Ciprian Dorin Craciun]
Document bug and workaround when the command name starts with a hyphen
environ.7
Bastien Roucariès
Reorder the text
Move the the text describing how to set environment variable before
the list(s) of variables in order to improve readability.
Bastien Roucariès
Document convention of string in environ
Document the name=value system and that nul byte is forbidden.
Bastien Roucariès
Document that HOME, LOGNAME, SHELL, USER are set at login time
and point to the su(1) manual page.
Bastien Roucariès
Add see also ld.so(8) for LD_ variables
Michael Kerrisk [Bastien Roucariès]
Improve the description of PATH
Add more details of how PATH is used, and mention the legacy
use of an empty prefix.
Bastien Roucariès [Alejandro Colomar, Bastien Roucaries, Vincent Lefevre]
Document valid values of pathnames for SHELL, PAGER and EDITOR/VISUAL
Michael Kerrisk [Bastien Roucariès]
Note the default if PAGER is not defined
Michael Kerrisk
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!).
Michael Kerrisk [Bastien Roucariès]
Relocate and reword the mention of _GNU_SOURCE
man-pages.7
Michael Kerrisk
Document "acknowledgement" as the preferred spelling
Michael Kerrisk
Add some notes on comments in example code
Michael Kerrisk
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).
Michael Kerrisk
Note some rationale for the use of real minus signs
netdevice.7
Pali Rohár [Alejandro Colomar]
Update documentation for SIOCGIFADDR SIOCSIFADDR SIOCDIFADDR
netlink.7
Pali Rohár [Alejandro Colomar]
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.
Pali Rohár [Alejandro Colomar]
Remove IPv4 from description
rtnetlink is not only used for IPv4
Philipp Schuster
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.
shm_overview.7
Michael Kerrisk
SEE ALSO: add memfd_create(2)
sock_diag.7
Pali Rohár [Alejandro Colomar]
Fix recvmsg() usage in the example
tcp.7
Enke Chen
Documentation revision for TCP_USER_TIMEOUT
uri.7
Michael Kerrisk
Note that 'logical' quoting is the norm in Europe

File diff suppressed because it is too large Load Diff

275
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 \
man2html $(HTOPTS) $$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 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:

12
README
View File

@ -17,18 +17,26 @@ 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".
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.

View File

@ -1,7 +1,7 @@
RELEASE
The Linux man page maintainer proudly announces. . .
man-pages-5.11.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,13 +1,13 @@
Begin3
Title: Section 2, 3, 4, 5 and 7 man pages for Linux
Version: 5.11
Entered-date: 2021-03-21
Version: 5.14
Entered-date: ????-??-??
Description: Linux manual pages
Keywords: man pages
Author: several
Maintained-by: Michael Kerrisk <mtk.manpages@gmail.com>
Primary-site: http://www.kernel.org/pub/linux/docs/man-pages
2778k man-pages-5.11.tar.gz
????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

@ -21,7 +21,7 @@
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH ICONV 1 2020-06-09 "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
@ -174,6 +174,10 @@ 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 EXAMPLES

View File

@ -11,7 +11,7 @@
.\" May be distributed under the GNU General Public License
.\" %%%LICENSE_END
.\"
.TH LDD 1 2021-03-22 "" "Linux Programmer's Manual"
.TH LDD 1 2021-08-27 "" "Linux Programmer's Manual"
.SH NAME
ldd \- print shared object dependencies
.SH SYNOPSIS
@ -23,14 +23,11 @@ ldd \- print shared object dependencies
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
.BR sed (1)
to trim leading white space for readability in this page)
is the following:
.PP
.in +4n
.EX
$ \fBldd /bin/ls | sed \(aqs/^ */ /\(aq\fP
$ \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)

View File

@ -245,7 +245,8 @@ and
.IR intcurrsym .
.TP
.B \-\-posix
Conform strictly to POSIX. Implies
Conform strictly to POSIX.
Implies
.BR \-\-verbose .
This option currently has no other effect.
POSIX conformance is assumed if the environment variable

View File

@ -112,15 +112,28 @@ 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.
Since glibc 2.3, the wrapper function invokes
.BR exit_group (2),
in order to terminate all of the threads in a process.
(The raw
.BR _exit ()
system call terminates only the calling thread.)
.SH SEE ALSO
.BR execve (2),
.BR exit_group (2),

View File

@ -38,7 +38,7 @@
.\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" 2008-12-04, mtk, Add documentation of accept4()
.\"
.TH ACCEPT 2 2021-03-22 "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
@ -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.

View File

@ -40,7 +40,7 @@
.\" Modified 2004-06-23 by Michael Kerrisk
.\" 2007-06-10, mtk, various parts rewritten, and added BUGS section.
.\"
.TH ACCESS 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH ACCESS 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
access, faccessat, faccessat2 \- check user's permissions for a file
.SH SYNOPSIS
@ -49,15 +49,20 @@ access, faccessat, faccessat2 \- check user's permissions for a file
.PP
.BI "int access(const char *" pathname ", int " mode );
.PP
.BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
.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
.BI "int faccessat2(int " dirfd ", const char *" pathname ", int " \
mode ", int " flags );
.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
.RS -4
@ -213,10 +218,6 @@ and the file does not exist, or some other error occurred),
.I errno
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
@ -225,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 .
@ -238,53 +265,27 @@ 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;
@ -353,8 +354,8 @@ call will still fail.
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.
.\"
.\"

View File

@ -9,12 +9,11 @@
.\" 2 of the License, or (at your option) any later version.
.\" %%%LICENSE_END
.\"
.TH ADD_KEY 2 2021-03-22 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 ,
@ -219,7 +218,10 @@ This system call is a nonstandard Linux extension.
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 EXAMPLES

View File

@ -27,13 +27,19 @@
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);
.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 ()

View File

@ -22,20 +22,24 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH ARCH_PRCTL 2 2021-03-22 "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 :
There is no glibc wrapper for this system call; see NOTES.
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.
@ -136,13 +140,13 @@ points to an unmapped address or is outside the process address space.
.I code
is not a valid subcommand.
.TP
.B EPERM
.I addr
is outside the process address space.
.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.
.\" .SH AUTHOR
.\" Man page written by Andi Kleen.
.SH CONFORMING TO
@ -177,9 +181,6 @@ and
in the same thread is dangerous, as they may overwrite each other's
TLS entries.
.PP
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.PP
.I FS
may be already used by the threading library.
Programs that use

View File

@ -40,7 +40,7 @@ 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

@ -23,7 +23,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH BPF 2 2021-03-22 "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
@ -1212,7 +1212,7 @@ riscv (since Linux 5.1).
* 4. print number of received TCP/UDP packets every second
*/
int
main(int argc, char **argv)
main(int argc, char *argv[])
{
int sock, map_fd, prog_fd, key;
long long value = 0, tcp_cnt, udp_cnt;

View File

@ -18,14 +18,21 @@
capget, capset \- set/get capabilities of thread(s)
.SH SYNOPSIS
.nf
.B #include <sys/capability.h>
.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 capset(cap_user_header_t " hdrp ", const 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
.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 two system calls are the raw kernel interface for getting and
setting thread capabilities.
@ -40,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.
@ -239,9 +246,6 @@ No such thread.
.SH CONFORMING TO
These system calls are Linux-specific.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.PP
The portable interface to the capability querying and setting
functions is provided by the
.I libcap

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 2021-03-22 "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
@ -80,7 +80,7 @@ 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:
@ -245,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
@ -269,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
@ -282,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 2021-03-22 "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
@ -232,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 .
@ -253,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.
@ -264,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;

View File

@ -56,13 +56,19 @@ clone, __clone2, clone3 \- create a child process
.PP
/* For the prototype of the raw clone() system call, see NOTES */
.PP
.BI "long clone3(struct clone_args *" cl_args ", size_t " size );
.BR "#include <linux/sched.h>" " /* Definition of " "struct clone_args" " */"
.BR "#include <sched.h>" " /* Definition of " CLONE_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "long syscall(SYS_clone3, struct clone_args *" cl_args ", size_t " size );
.fi
.PP
.IR Note :
There is no glibc wrapper for
.BR clone3 ();
see NOTES.
glibc provides no wrapper for
.BR clone3 (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
These system calls
create a new ("child") process, in a manner similar to
@ -969,7 +975,7 @@ mask must also include
.B CLONE_VM
if
.B CLONE_SIGHAND
is specified
is specified.
.TP
.BR CLONE_STOPPED " (since Linux 2.6.0)"
.\" Precisely: Linux 2.6.0-test2
@ -1418,7 +1424,7 @@ was an invalid.
.TP
.BR EINVAL " (AArch64 only, Linux 4.6 and earlier)"
.I stack
was not aligned to a 126-bit boundary.
was not aligned to a 128-bit boundary.
.TP
.B ENOMEM
Cannot allocate sufficient memory to allocate a task structure for the
@ -1541,11 +1547,6 @@ One use of these systems calls
is to implement threads: multiple flows of control in a program that
run concurrently in a shared address space.
.PP
Glibc does not provide a wrapper for
.BR clone3 ();
call it using
.BR syscall (2).
.PP
Note that the glibc
.BR clone ()
wrapper function makes some changes

View File

@ -23,7 +23,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH CLOSE_RANGE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.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
@ -33,9 +33,6 @@ close_range \- close all file descriptors in a given range
.BI "int close_range(unsigned int " first ", unsigned int " last ,
.BI " unsigned int " flags );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
.SH DESCRIPTION
The
.BR close_range ()
@ -95,12 +92,11 @@ 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
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.SS Closing all open file descriptors
.\" 278a5fbaed89dacd04e9d052f4594ffd0e0585de
To avoid blindly closing file descriptors

View File

@ -22,7 +22,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH COPY_FILE_RANGE 2 2021-03-22 "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
@ -236,7 +236,7 @@ or server-side-copy (in the case of NFS).
#include <unistd.h>
int
main(int argc, char **argv)
main(int argc, char *argv[])
{
int fd_in, fd_out;
struct stat stat;

View File

@ -27,11 +27,18 @@
delete_module \- unload a kernel module
.SH SYNOPSIS
.nf
.BI "int delete_module(const char *" name ", unsigned 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 :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR delete_module (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR delete_module ()

View File

@ -45,7 +45,7 @@ dup, dup2, dup3 \- duplicate a file descriptor
.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

View File

@ -285,18 +285,6 @@ 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.
.SH BUGS
In kernels before 2.6.37, a
.I timeout
value larger than approximately
.I LONG_MAX / HZ
milliseconds is treated as \-1 (i.e., infinity).
Thus, for example, on a system where
.I sizeof(long)
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 ()
@ -312,6 +300,18 @@ The glibc
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
value larger than approximately
.I LONG_MAX / HZ
milliseconds is treated as \-1 (i.e., infinity).
Thus, for example, on a system where
.I sizeof(long)
is 4 and the kernel
.I HZ
value is 1000,
this means that timeouts greater than 35.79 minutes are treated as infinity.
.SH SEE ALSO
.BR epoll_create (2),
.BR epoll_ctl (2),

View File

@ -34,7 +34,7 @@
.\" 2007-09-14 Ollie Wild <aaw@google.com>, mtk
.\" Add text describing limits on command-line arguments + environment
.\"
.TH EXECVE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH EXECVE 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
execve \- execute program
.SH SYNOPSIS
@ -141,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
@ -346,7 +346,7 @@ will be invoked with the following arguments:
.PP
where
.I pathname
is the absolute pathname of the file specified as the first argument of
is the pathname of the file specified as the first argument of
.BR execve (),
and
.I arg...
@ -882,6 +882,7 @@ argv[4]: world
.BR ptrace (2),
.BR exec (3),
.BR fexecve (3),
.BR getauxval (3),
.BR getopt (3),
.BR system (3),
.BR capabilities (7),

View File

@ -23,21 +23,18 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH EXECVEAT 2 2021-03-22 "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 ,
.BI " const char *const " argv "[], const char *const " envp [],
.BI " int " flags );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
.\" FIXME . See https://sourceware.org/bugzilla/show_bug.cgi?id=27364
.SH DESCRIPTION
.\" commit 51f39a1f0cea1cacf8c787f652f26dfee9611874
The
@ -124,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
@ -164,6 +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.
Library support was added to glibc in version 2.34.
.SH CONFORMING TO
The
.BR execveat ()
@ -209,9 +210,6 @@ the natural idiom when using
is to set the close-on-exec flag on
.IR dirfd .
(But see BUGS.)
.PP
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.SH BUGS
The
.B ENOENT

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)

View File

@ -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

View File

@ -26,7 +26,7 @@
fanotify_init \- create and initialize fanotify group
.SH SYNOPSIS
.nf
.B #include <fcntl.h>
.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 );

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 2021-03-22 "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,14 +117,14 @@ 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
@ -357,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 ()
@ -371,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

View File

@ -69,7 +69,6 @@
fcntl \- manipulate file descriptor
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.B #include <fcntl.h>
.PP
.BI "int fcntl(int " fd ", int " cmd ", ... /* " arg " */ );"

View File

@ -239,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

@ -19,24 +19,28 @@
.\" 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 2021-03-22 "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 <stdint.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 "long futex(uint32_t *" uaddr ", int " futex_op ", uint32_t " val ,
.BI " const struct timespec *" timeout , \
.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 );
.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
The
.BR futex ()
@ -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
@ -900,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;
@ -959,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
@ -1112,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
@ -1164,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.
@ -1375,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
@ -1429,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
@ -1442,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
@ -1483,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
@ -1506,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
@ -1531,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
@ -1546,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
@ -1559,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
@ -1571,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_BITSET
.B FUTEX_WAIT_BITSET
on
.IR uaddr .
.TP
@ -1585,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
@ -1612,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.
@ -1624,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 ,
@ -1643,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
@ -1655,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
@ -1675,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.
@ -1695,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

View File

@ -22,13 +22,13 @@
.\" 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 ,
@ -83,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 ()
@ -99,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

@ -32,8 +32,8 @@ 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

View File

@ -32,16 +32,21 @@
get_robust_list, set_robust_list \- get/set list of robust futexes
.SH SYNOPSIS
.nf
.B #include <linux/futex.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:
@ -138,9 +143,6 @@ could be found.
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

View File

@ -33,19 +33,29 @@
getdents, getdents64 \- get directory entries
.SH SYNOPSIS
.nf
.BI "long getdents(unsigned int " fd ", struct linux_dirent *" 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 "#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 is no glibc wrapper for
.BR getdents ();
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

View File

@ -42,12 +42,11 @@
.\" Clarified meaning of 0 value for 'who' argument
.\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH GETPRIORITY 2 2021-03-22 "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
.nf
.B #include <sys/time.h>
.B #include <sys/resource.h>
.PP
.BI "int getpriority(int " which ", id_t " who );
@ -143,6 +142,13 @@ On failure, it returns \-1 and sets
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
@ -151,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,
@ -176,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).
@ -209,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

View File

@ -66,7 +66,6 @@
getrlimit, setrlimit, prlimit \- get/set resource limits
.SH SYNOPSIS
.nf
.B #include <sys/time.h>
.B #include <sys/resource.h>
.PP
.BI "int getrlimit(int " resource ", struct rlimit *" rlim );

View File

@ -41,7 +41,6 @@
getrusage \- get resource usage
.SH SYNOPSIS
.nf
.B #include <sys/time.h>
.B #include <sys/resource.h>
.PP
.BI "int getrusage(int " who ", struct rusage *" usage );
@ -230,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

View File

@ -29,16 +29,20 @@
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
@ -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)

View File

@ -29,14 +29,20 @@
init_module, finit_module \- load a kernel module
.SH SYNOPSIS
.nf
.BI "int init_module(void *" module_image ", unsigned long " len ,
.BI " const char *" param_values );
.BI "int finit_module(int " fd ", const char *" param_values ,
.BI " int " flags );
.BR "#include <linux/module.h>" " /* Definition of " MODULE_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_init_module, void *" module_image ", unsigned long " len ,
.BI " const char *" param_values );
.BI "int syscall(SYS_finit_module, int " fd ", const char *" param_values ,
.BI " int " flags );
.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
.BR init_module ()
loads an ELF image into kernel space,
@ -268,11 +274,6 @@ manually declare the interface in your code;
alternatively, you can invoke the system call using
.BR syscall (2).
.PP
Glibc does not provide a wrapper for
.BR finit_module ();
call it using
.BR syscall (2).
.PP
Information about currently loaded modules can be found in
.IR /proc/modules
and in the file trees under the per-module subdirectories under

View File

@ -26,7 +26,7 @@
.\" new _syscall(2) page, and substantially enhanced and rewrote
.\" the remaining material on this page.
.\"
.TH INTRO 2 2020-11-01 "Linux" "Linux Programmer's Manual"
.TH INTRO 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
intro \- introduction to system calls
.SH DESCRIPTION
@ -129,7 +129,7 @@ Note that these can be different from page to page!
.BR signal (7),
.BR socket (7),
.BR standards (7),
.BR system_data_types (7),
.BR symlink (7),
.BR system_data_types (7),
.BR sysvipc (7),
.BR time (7)

View File

@ -9,14 +9,13 @@
io_cancel \- cancel an outstanding asynchronous I/O operation
.SH SYNOPSIS
.nf
.BR "#include <linux/aio_abi.h>" " /* Defines needed types */"
.BR "#include <linux/aio_abi.h>" " /* Definition of needed types */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int io_cancel(aio_context_t " ctx_id ", struct iocb *" iocb ,
.BI " struct io_event *" result );
.BI "int syscall(SYS_io_cancel, aio_context_t " ctx_id ", struct iocb *" iocb ,
.BI " struct io_event *" result );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
.SH DESCRIPTION
.IR Note :
this page describes the raw Linux system call interface.
@ -68,10 +67,7 @@ The asynchronous I/O system calls first appeared in Linux 2.5.
is Linux-specific and should not be used
in programs that are intended to be portable.
.SH NOTES
Glibc does not provide a wrapper for this system call.
You could invoke it using
.BR syscall (2).
But instead, you probably want to use the
You probably want to use the
.BR io_cancel ()
wrapper function provided by
.\" http://git.fedorahosted.org/git/?p=libaio.git

View File

@ -9,13 +9,18 @@
io_destroy \- destroy an asynchronous I/O context
.SH SYNOPSIS
.nf
.BR "#include <linux/aio_abi.h>" " /* Defines needed types */"
.BR "#include <linux/aio_abi.h>" " /* Definition of " aio_context_t " */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int io_destroy(aio_context_t " ctx_id );
.BI "int syscall(SYS_io_destroy, aio_context_t " ctx_id );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR io_destroy (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.IR Note :
this page describes the raw Linux system call interface.
@ -57,10 +62,7 @@ The asynchronous I/O system calls first appeared in Linux 2.5.
is Linux-specific and should not be used in programs
that are intended to be portable.
.SH NOTES
Glibc does not provide a wrapper for this system call.
You could invoke it using
.BR syscall (2).
But instead, you probably want to use the
You probably want to use the
.BR io_destroy ()
wrapper function provided by
.\" http://git.fedorahosted.org/git/?p=libaio.git

View File

@ -9,16 +9,20 @@
io_getevents \- read asynchronous I/O events from the completion queue
.SH SYNOPSIS
.nf
.BR "#include <linux/aio_abi.h>" " /* Defines needed types */"
.BR "#include <linux/time.h>" " /* Defines 'struct timespec' */"
.BR "#include <linux/aio_abi.h>" " /* Definition of " *io_* " types */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int io_getevents(aio_context_t " ctx_id ", long " min_nr ", long " nr ,
.BI " struct io_event *" events \
", struct timespec *" timeout );
.BI "int syscall(SYS_io_getevents, aio_context_t " ctx_id ,
.BI " long " min_nr ", long " nr ", struct io_event *" events ,
.BI " struct timespec *" timeout );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR io_getevents (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.IR Note :
this page describes the raw Linux system call interface.
@ -94,10 +98,7 @@ The asynchronous I/O system calls first appeared in Linux 2.5.
is Linux-specific and should not be used in
programs that are intended to be portable.
.SH NOTES
Glibc does not provide a wrapper for this system call.
You could invoke it using
.BR syscall (2).
But instead, you probably want to use the
You probably want to use the
.BR io_getevents ()
wrapper function provided by
.\" http://git.fedorahosted.org/git/?p=libaio.git

View File

@ -685,7 +685,8 @@ These are legal only for the superuser or the owner of the current terminal.
.TP
.B "TIOCLINUX, subcode=0"
Dump the screen.
Disappeared in Linux 1.1.92. (With kernel 1.1.92 or later, read from
Disappeared in Linux 1.1.92.
(With kernel 1.1.92 or later, read from
.I /dev/vcsN
or
.I /dev/vcsaN

View File

@ -26,16 +26,17 @@
ioctl_fat \- manipulating the FAT filesystem
.SH SYNOPSIS
.nf
.B #include <linux/msdos_fs.h>
.BR "#include <linux/msdos_fs.h>" " /* Definition of [" V ] FAT_* " and"
.BR " ATTR_* " constants */"
.B #include <sys/ioctl.h>
.PP
.BI "int ioctl(int " fd ", FAT_IOCTL_GET_ATTRIBUTES, uint32_t *" attr );
.BI "int ioctl(int " fd ", FAT_IOCTL_SET_ATTRIBUTES, uint32_t *" attr );
.BI "int ioctl(int " fd ", FAT_IOCTL_GET_VOLUME_ID, uint32_t *" id );
.BI "int ioctl(int " fd ", VFAT_IOCTL_READDIR_BOTH,"
.BI " struct __fat_dirent[2] " entry );
.BI " struct __fat_dirent " entry [2]);
.BI "int ioctl(int " fd ", VFAT_IOCTL_READDIR_SHORT,"
.BI " struct __fat_dirent[2] " entry );
.BI " struct __fat_dirent " entry [2]);
.fi
.SH DESCRIPTION
The

View File

@ -25,8 +25,8 @@
ioctl_ficlonerange, ioctl_ficlone \- share some the data of one file with another file
.SH SYNOPSIS
.nf
.BR "#include <linux/fs.h>" " /* Definition of " FICLONE* " constants */"
.B #include <sys/ioctl.h>
.B #include <linux/fs.h>
.PP
.BI "int ioctl(int " dest_fd ", FICLONERANGE, struct file_clone_range *" arg );
.BI "int ioctl(int " dest_fd ", FICLONE, int " src_fd );

View File

@ -25,8 +25,9 @@
ioctl_fideduperange \- share some the data of one file with another file
.SH SYNOPSIS
.nf
.BR "#include <linux/fs.h>" " /* Definition of " FIDEDUPERANGE " and
.BR " FILE_DEDUPE_* " constants */
.B #include <sys/ioctl.h>
.B #include <linux/fs.h>
.PP
.BI "int ioctl(int " src_fd ", FIDEDUPERANGE, struct file_dedupe_range *" arg );
.fi

View File

@ -25,8 +25,8 @@
ioctl_fslabel \- get or set a filesystem label
.SH SYNOPSIS
.nf
.BR "#include <linux/fs.h>" " /* Definition of " *FSLABEL* " constants */"
.B #include <sys/ioctl.h>
.B #include <linux/fs.h>
.PP
.BI "int ioctl(int " fd ", FS_IOC_GETFSLABEL, char " label [FSLABEL_MAX]);
.BI "int ioctl(int " fd ", FS_IOC_SETFSLABEL, char " label [FSLABEL_MAX]);
@ -36,14 +36,15 @@ If a filesystem supports online label manipulation, these
.BR ioctl (2)
operations can be used to get or set the filesystem label for the filesystem
on which
.B fd
.I fd
resides.
The
.B FS_IOC_SETFSLABEL
operation requires privilege
.RB ( CAP_SYS_ADMIN ).
.SH RETURN VALUE
On success zero is returned. On error, \-1 is returned, and
On success zero is returned.
On error, \-1 is returned, and
.I errno
is set to indicate the error.
.SH ERRORS
@ -77,7 +78,8 @@ The maximum string length for this interface is
.BR FSLABEL_MAX ,
including the terminating null byte (\(aq\\0\(aq).
Filesystems have differing maximum label lengths, which may or
may not include the terminating null. The string provided to
may not include the terminating null.
The string provided to
.B FS_IOC_SETFSLABEL
must always be null-terminated, and the string returned by
.B FS_IOC_GETFSLABEL

View File

@ -25,9 +25,9 @@
ioctl_getfsmap \- retrieve the physical layout of the filesystem
.SH SYNOPSIS
.nf
.BR "#include <linux/fsmap.h> " "/* Definition of " FS_IOC_GETFSMAP ,
.BR " FM?_OF_*" ", and " *FMR_OWN_* " constants */"
.B #include <sys/ioctl.h>
.B #include <linux/fs.h>
.B #include <linux/fsmap.h>
.PP
.BI "int ioctl(int " fd ", FS_IOC_GETFSMAP, struct fsmap_head * " arg );
.fi

View File

@ -5,12 +5,14 @@
.\" Distributed under GPL
.\" %%%LICENSE_END
.\"
.TH IOCTL_TTY 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH IOCTL_TTY 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
ioctl_tty \- ioctls for terminals and serial lines
.SH SYNOPSIS
.nf
.B "#include <termios.h>"
.B #include <sys/ioctl.h>
.BR "#include <termios.h>" " /* Definition of " CLOCAL ", and"
.BR " TC*" { FLUSH , ON , OFF "} constants */"
.PP
.BI "int ioctl(int " fd ", int " cmd ", ...);"
.fi
@ -24,7 +26,7 @@ or
.IR arg .
.PP
Use of
.I ioctl
.BR ioctl ()
makes for nonportable programs.
Use the POSIX interface described in
.BR termios (3)
@ -69,6 +71,38 @@ Equivalent to
Allow the output buffer to drain, discard pending input, and
set the current serial port settings.
.PP
The following four ioctls, added in Linux 2.6.20,
.\" commit 64bb6c5e1ddcd47c951740485026ef08975ee2e6
.\" commit 592ee3a5e5e2a981ef2829a0380093006d045661
are just like
.BR TCGETS ,
.BR TCSETS ,
.BR TCSETSW ,
.BR TCSETSF ,
except that they take a
.I "struct termios2\ *"
instead of a
.IR "struct termios\ *" .
If the structure member
.B c_cflag
contains the flag
.BR BOTHER ,
then the baud rate is stored in the structure members
.B c_ispeed
and
.B c_ospeed
as integer values.
These ioctls are not supported on all architectures.
.RS
.TS
lb l.
TCGETS2 \fBstruct termios2 *\fPargp
TCSETS2 \fBconst struct termios2 *\fPargp
TCSETSW2 \fBconst struct termios2 *\fPargp
TCSETSF2 \fBconst struct termios2 *\fPargp
.TE
.RE
.PP
The following four ioctls are just like
.BR TCGETS ,
.BR TCSETS ,
@ -78,14 +112,15 @@ except that they take a
.I "struct termio\ *"
instead of a
.IR "struct termios\ *" .
.IP
.BI "TCGETA struct termio *" argp
.IP
.BI "TCSETA const struct termio *" argp
.IP
.BI "TCSETAW const struct termio *" argp
.IP
.BI "TCSETAF const struct termio *" argp
.RS
.TS
lb l.
TCGETA \fBstruct termio *\fPargp
TCSETA \fBconst struct termio *\fPargp
TCSETAW \fBconst struct termio *\fPargp
TCSETAF \fBconst struct termio *\fPargp
.TE
.RE
.SS Locking the termios structure
The
.I termios
@ -118,9 +153,6 @@ Window sizes are kept in the kernel, but not used by the kernel
(except in the case of virtual consoles, where the kernel will
update the window size when the size of the virtual console changes,
for example, by loading a new font).
.PP
The following constants and structure are defined in
.IR <sys/ioctl.h> .
.TP
.B TIOCGWINSZ
Argument:
@ -171,7 +203,7 @@ When
.I arg
is nonzero, nobody knows what will happen.
.IP
(SVr4, UnixWare, Solaris, Linux treat
(SVr4, UnixWare, Solaris, and Linux treat
.I "tcsendbreak(fd,arg)"
with nonzero
.I arg
@ -354,6 +386,9 @@ Set the foreground process group ID of this terminal.
Argument:
.BI "pid_t *" argp
.IP
When successful, equivalent to
.IR "*argp = tcgetsid(fd)" .
.IP
Get the session ID of the given terminal.
This fails with the error
.B ENOTTY
@ -530,6 +565,7 @@ The BSD ioctls
.BR TIOCSTOP ,
.BR TIOCSTART ,
.BR TIOCUCNTL ,
and
.B TIOCREMOTE
have not been implemented under Linux.
.SS Modem control
@ -700,7 +736,8 @@ Insufficient permission.
Check the condition of DTR on the serial port.
.PP
.EX
#include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>

View File

@ -31,6 +31,7 @@ ioctl_userfaultfd \- create a file descriptor for handling page faults in user
space
.SH SYNOPSIS
.nf
.BR "#include <linux/userfaultfd.h>" " /* Definition of " UFFD* " constants */"
.B #include <sys/ioctl.h>
.PP
.BI "int ioctl(int " fd ", int " cmd ", ...);"
@ -208,6 +209,11 @@ signal will be sent to the faulting process.
Applications using this
feature will not require the use of a userfaultfd monitor for processing
memory accesses to the regions registered with userfaultfd.
.TP
.BR UFFD_FEATURE_THREAD_ID " (since Linux 4.14)"
If this feature bit is set,
.I uffd_msg.pagefault.feat.ptid
will be set to the faulted thread ID for each page-fault message.
.PP
The returned
.I ioctls
@ -229,6 +235,11 @@ operation is supported.
The
.B UFFDIO_UNREGISTER
operation is supported.
.TP
.B 1 << _UFFDIO_WRITEPROTECT
The
.B UFFDIO_WRITEPROTECT
operation is supported.
.PP
This
.BR ioctl (2)
@ -317,9 +328,6 @@ Track page faults on missing pages.
.B UFFDIO_REGISTER_MODE_WP
Track page faults on write-protected pages.
.PP
Currently, the only supported mode is
.BR UFFDIO_REGISTER_MODE_MISSING .
.PP
If the operation is successful, the kernel modifies the
.I ioctls
bit-mask field to indicate which
@ -438,6 +446,16 @@ operation:
.TP
.B UFFDIO_COPY_MODE_DONTWAKE
Do not wake up the thread that waits for page-fault resolution
.TP
.B UFFDIO_COPY_MODE_WP
Copy the page with read-only permission.
This allows the user to trap the next write to the page,
which will block and generate another write-protect userfault message.
This is used only when both
.B UFFDIO_REGISTER_MODE_MISSING
and
.B UFFDIO_REGISTER_MODE_WP
modes are enabled for the registered range.
.PP
The
.I copy
@ -649,6 +667,74 @@ field of the
structure was not a multiple of the system page size; or
.I len
was zero; or the specified range was otherwise invalid.
.SS UFFDIO_WRITEPROTECT (Since Linux 5.7)
Write-protect or write-unprotect a userfaultfd-registered memory range
registered with mode
.BR UFFDIO_REGISTER_MODE_WP .
.PP
The
.I argp
argument is a pointer to a
.I uffdio_range
structure as shown below:
.PP
.in +4n
.EX
struct uffdio_writeprotect {
struct uffdio_range range; /* Range to change write permission*/
__u64 mode; /* Mode to change write permission */
};
.EE
.in
.PP
There are two mode bits that are supported in this structure:
.TP
.B UFFDIO_WRITEPROTECT_MODE_WP
When this mode bit is set,
the ioctl will be a write-protect operation upon the memory range specified by
.IR range .
Otherwise it will be a write-unprotect operation upon the specified range,
which can be used to resolve a userfaultfd write-protect page fault.
.TP
.B UFFDIO_WRITEPROTECT_MODE_DONTWAKE
When this mode bit is set,
do not wake up any thread that waits for
page-fault resolution after the operation.
This can be specified only if
.B UFFDIO_WRITEPROTECT_MODE_WP
is not specified.
.PP
This
.BR ioctl (2)
operation returns 0 on success.
On error, \-1 is returned and
.I errno
is set to indicate the error.
Possible errors include:
.TP
.B EINVAL
The
.I start
or the
.I len
field of the
.I ufdio_range
structure was not a multiple of the system page size; or
.I len
was zero; or the specified range was otherwise invalid.
.TP
.B EAGAIN
The process was interrupted; retry this call.
.TP
.B ENOENT
The range specified in
.I range
is not valid.
For example, the virtual address does not exist,
or not registered with userfaultfd write-protect mode.
.TP
.B EFAULT
Encountered a generic fault during processing.
.SH RETURN VALUE
See descriptions of the individual operations, above.
.SH ERRORS

View File

@ -36,7 +36,7 @@
ioperm \- set port input/output permissions
.SH SYNOPSIS
.nf
.BR "#include <sys/io.h>" " /* for glibc */"
.B #include <sys/io.h>
.PP
.BI "int ioperm(unsigned long " from ", unsigned long " num ", int " turn_on );
.fi

View File

@ -21,17 +21,23 @@
.\" with various additions by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\"
.TH IOPRIO_SET 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH IOPRIO_SET 2 2021-06-20 "Linux" "Linux Programmer's Manual"
.SH NAME
ioprio_get, ioprio_set \- get/set I/O scheduling class and priority
.SH SYNOPSIS
.nf
.BI "int ioprio_get(int " which ", int " who );
.BI "int ioprio_set(int " which ", int " who ", int " ioprio );
.BR "#include <linux/ioprio.h> " "/* Definition of " IOPRIO_* " constants */"
.BR "#include <sys/syscall.h> " "/* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_ioprio_get, int " which ", int " who );
.BI "int syscall(SYS_ioprio_set, int " which ", int " who ", int " ioprio );
.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
The
.BR ioprio_get ()
@ -199,9 +205,6 @@ kernel 2.6.13.
.SH CONFORMING TO
These system calls are Linux-specific.
.SH NOTES
Glibc does not provide a wrapper for these system calls; call them using
.BR syscall (2).
.PP
Two or more processes or threads can share an I/O context.
This will be the case when
.BR clone (2)

View File

@ -27,12 +27,21 @@
ipc \- System V IPC system calls
.SH SYNOPSIS
.nf
.BI "int ipc(unsigned int " call ", int " first ", unsigned long " second ,
.BI " unsigned long " third ", void *" ptr ", long " fifth );
.BR "#include <linux/ipc.h>" " /* Definition of needed constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_ipc, unsigned int " call ", int " first ,
.BI " unsigned long " second ", unsigned long " third \
", void *" ptr ,
.BI " long " fifth );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR ipc (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.BR ipc ()
is a common kernel entry point for the System\ V IPC calls
@ -56,10 +65,6 @@ system call; instead,
.BR semctl (2),
.BR shmctl (2),
and so on really are implemented as separate system calls.
.PP
Glibc does not provide a wrapper for this system call;
in the unlikely event that you want to call it directly, you can do so using
.BR syscall (2).
.SH SEE ALSO
.BR msgctl (2),
.BR msgget (2),

View File

@ -30,14 +30,19 @@
kcmp \- compare two processes to determine if they share a kernel resource
.SH SYNOPSIS
.nf
.B #include <linux/kcmp.h>
.BR "#include <linux/kcmp.h>" " /* Definition of " KCMP_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int kcmp(pid_t " pid1 ", pid_t " pid2 ", int " type ,
.BI " unsigned long " idx1 ", unsigned long " idx2 );
.BI "int syscall(SYS_kcmp, pid_t " pid1 ", pid_t " pid2 ", int " type ,
.BI " unsigned long " idx1 ", unsigned long " idx2 );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR kcmp (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR kcmp ()
@ -303,13 +308,10 @@ system call first appeared in Linux 3.5.
.BR kcmp ()
is Linux-specific and should not be used in programs intended to be portable.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.PP
Before Linux 5.12,
this system call is available only if the kernel is configured with
.BR CONFIG_CHECKPOINT_RESTORE ,
since the original pupose the system call was for the
since the original purpose of the system call was for the
checkpoint/restore in user space (CRIU) feature.
(The alternative to this system call would have been to expose suitable
process information via the

View File

@ -29,18 +29,23 @@
kexec_load, kexec_file_load \- load a new kernel for later execution
.SH SYNOPSIS
.nf
.B #include <linux/kexec.h>
.BR "#include <linux/kexec.h>" " /* Definition of " KEXEC_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "long kexec_load(unsigned long " entry ", unsigned long " nr_segments ,
.BI " struct kexec_segment *" segments ,
.BI " unsigned long " flags );
.BI "long kexec_file_load(int " kernel_fd ", int " initrd_fd ,
.BI " unsigned long " cmdline_len ", const char *" cmdline ,
.BI " unsigned long " flags );
.BI "long syscall(SYS_kexec_load, unsigned long " entry ,
.BI " unsigned long " nr_segments \
", struct kexec_segment *" segments ,
.BI " unsigned long " flags );
.BI "long syscall(SYS_kexec_file_load, int " kernel_fd ", int " initrd_fd ,
.BI " unsigned long " cmdline_len ", const char *" cmdline ,
.BI " unsigned long " flags );
.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
The
.BR kexec_load ()
@ -332,9 +337,6 @@ The
system call first appeared in Linux 3.17.
.SH CONFORMING TO
These system calls are Linux-specific.
.SH NOTES
Glibc does not provide a wrapper for these system calls; call them using
.BR syscall (2).
.SH SEE ALSO
.BR reboot (2),
.BR syscall (2),

View File

@ -25,27 +25,25 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH KEYCTL 2 2021-03-22 Linux "Linux Key Management Calls"
.TH KEYCTL 2 2021-08-27 Linux "Linux Key Management Calls"
.SH NAME
keyctl \- manipulate the kernel's key management facility
.SH SYNOPSIS
.nf
.B #include <keyutils.h>
.PP
.BI "long keyctl(int " operation ", ...);"
.PP
.B "/* For direct call via syscall(2): */"
.B #include <asm/unistd.h>
.B #include <linux/keyctl.h>
.BR "#include <linux/keyctl.h>" " /* Definition of " KEY* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "long syscall(__NR_keyctl, int " operation ", unsigned long " arg2 ,
.BI "long syscall(SYS_keyctl, int " operation ", unsigned long " arg2 ,
.BI " unsigned long " arg3 ", unsigned long " arg4 ,
.BI " unsigned long " arg5 );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR keyctl (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.BR keyctl ()
allows user-space programs to perform key manipulation.
@ -1954,10 +1952,12 @@ This system call first appeared in Linux 2.6.10.
.SH CONFORMING TO
This system call is a nonstandard Linux extension.
.SH NOTES
Glibc does not provide a wrapper for this system call.
A wrapper is provided in the
.IR libkeyutils
library.
(The accompanying package provides the
.I <keyutils.h>
header file.)
When employing the wrapper in that library, link with
.IR \-lkeyutils .
However, rather than using this system call directly,

View File

@ -29,7 +29,7 @@
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" Modified 2005-04-04, as per suggestion by Michael Hardt for rename.2
.\"
.TH LINK 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH LINK 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
link, linkat \- make a new name for a file
.SH SYNOPSIS
@ -38,7 +38,7 @@ link, linkat \- make a new name for a file
.PP
.BI "int link(const char *" oldpath ", const char *" newpath );
.PP
.BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
.BR "#include <fcntl.h> " "/* Definition of " AT_* " constants */"
.B #include <unistd.h>
.PP
.BI "int linkat(int " olddirfd ", const char *" oldpath ,
@ -275,17 +275,21 @@ The file is on a read-only filesystem.
are not on the same mounted filesystem.
(Linux permits a filesystem to be mounted at multiple points, but
.BR link ()
does not work across different mount points,
does not work across different mounts,
even if the same filesystem is mounted on both.)
.PP
The following additional errors can occur for
.BR linkat ():
.TP
.B EBADF
.I oldpath
.RI ( newpath )
is relative but
.I olddirfd
or
.I newdirfd
is not a valid file descriptor.
.RI ( newdirfd )
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EINVAL
An invalid flag value was specified in

View File

@ -159,7 +159,7 @@ If the
.I backlog
argument is greater than the value in
.IR /proc/sys/net/core/somaxconn ,
then it is silently truncated to that value.
then it is silently capped to that value.
Since Linux 5.4, the default in this file is 4096;
in earlier kernels, the default value is 128.
In kernels before 2.4.25, this limit was a hard coded value,

View File

@ -31,15 +31,19 @@
_llseek \- reposition read/write file offset
.SH SYNOPSIS
.nf
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int _llseek(unsigned int " fd ", unsigned long " offset_high ,
.BI "int syscall(SYS__llseek, unsigned int " fd ", unsigned long " offset_high ,
.BI " unsigned long " offset_low ", loff_t *" result ,
.BI " unsigned int " whence );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR _llseek (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
Note: for information about the
.BR llseek (3)
@ -97,10 +101,7 @@ is invalid.
This function is Linux-specific, and should not be used in programs
intended to be portable.
.SH NOTES
Glibc does not provide a wrapper for this system call.
To invoke it directly, use
.BR syscall (2).
However, you probably want to use the
You probably want to use the
.BR lseek (2)
wrapper function instead.
.SH SEE ALSO

View File

@ -29,11 +29,18 @@
lookup_dcookie \- return a directory entry's path
.SH SYNOPSIS
.nf
.BI "int lookup_dcookie(uint64_t " cookie ", char *" buffer ", size_t " len );
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_lookup_dcookie, uint64_t " cookie ", char *" buffer ,
.BI " size_t " len );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR lookup_dcookie (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
Look up the full path of the directory entry specified by the value
.IR cookie .
@ -92,8 +99,5 @@ It relies on a kernel driver to register cookies for directory entries.
.PP
The path returned may be suffixed by the string " (deleted)" if the directory
entry has been removed.
.PP
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.SH SEE ALSO
.BR oprofile (1)

View File

@ -22,19 +22,26 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH MEMBARRIER 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH MEMBARRIER 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
membarrier \- issue memory barriers on a set of threads
.SH SYNOPSIS
.nf
.PP
.B #include <linux/membarrier.h>
.BR "#include <linux/membarrier.h>" \
" /* Definition of " MEMBARRIER_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int membarrier(int " cmd ", unsigned int " flags ", int " cpu_id );
.BI "int syscall(SYS_membarrier, int " cmd ", unsigned int " flags \
", int " cpu_id );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR membarrier (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR membarrier ()
@ -322,9 +329,6 @@ Examples where
.BR membarrier ()
can be useful include implementations
of Read-Copy-Update libraries and garbage collectors.
.PP
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.SH EXAMPLES
Assuming a multithreaded application where "fast_path()" is executed
very frequently, and where "slow_path()" is executed infrequently, the
@ -354,7 +358,7 @@ slow_path(int *read_a)
}
int
main(int argc, char **argv)
main(int argc, char *argv[])
{
int read_a, read_b;
@ -440,7 +444,7 @@ slow_path(int *read_a)
}
int
main(int argc, char **argv)
main(int argc, char *argv[])
{
int read_a, read_b;

View File

@ -201,6 +201,19 @@ The
.BR memfd_create ()
system call first appeared in Linux 3.17;
glibc support was added in version 2.27.
.TP
.B EPERM
The
.B MFD_HUGETLB
flag was specified, but the caller was not privileged (did not have the
.B CAP_IPC_LOCK
capability)
and is not a member of the
.I sysctl_hugetlb_shm_group
group; see the description of
.I /proc/sys/vm/sysctl_hugetlb_shm_group
in
.BR proc (5).
.SH CONFORMING TO
The
.BR memfd_create ()
@ -546,6 +559,7 @@ main(int argc, char *argv[])
.SH SEE ALSO
.BR fcntl (2),
.BR ftruncate (2),
.BR memfd_secret (2),
.BR mmap (2),
.BR shmget (2),
.BR shm_open (3)

156
man2/memfd_secret.2 Normal file
View File

@ -0,0 +1,156 @@
.\" Copyright (c) 2021, IBM Corporation.
.\" Written by Mike Rapoport <rppt@linux.ibm.com>
.\"
.\" Based on memfd_create(2) man page
.\" Copyright (C) 2014 Michael Kerrisk <mtk.manpages@gmail.com>
.\" and Copyright (C) 2014 David Herrmann <dh.herrmann@gmail.com>
.\"
.\" %%%LICENSE_START(GPLv2+)
.\"
.\" This program is free software; you can redistribute it and/or modify
.\" it under the terms of the GNU General Public License as published by
.\" the Free Software Foundation; either version 2 of the License, or
.\" (at your option) any later version.
.\"
.\" This program is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
.\" GNU General Public License for more details.
.\"
.\" You should have received a copy of the GNU General Public
.\" License along with this manual; if not, see
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH MEMFD_SECRET 2 2020-08-02 Linux "Linux Programmer's Manual"
.SH NAME
memfd_secret \- create an anonymous RAM-based file
to access secret memory regions
.SH SYNOPSIS
.nf
.PP
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_memfd_secret, unsigned int " flags );
.fi
.PP
.IR Note :
glibc provides no wrapper for
.BR memfd_secret (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.BR memfd_secret ()
creates an anonymous RAM-based file and returns a file descriptor
that refers to it.
The file provides a way to create and access memory regions
with stronger protection than usual RAM-based files and
anonymous memory mappings.
Once all open references to the file are closed,
it is automatically released.
The initial size of the file is set to 0.
Following the call, the file size should be set using
.BR ftruncate (2).
.PP
The memory areas backing the file created with
.BR memfd_secret (2)
are visible only to the processes that have access to the file descriptor.
The memory region is removed from the kernel page tables
and only the page tables of the processes holding the file descriptor
map the corresponding physical memory.
(Thus, the pages in the region can't be accessed by the kernel itself,
so that, for example, pointers to the region can't be passed to
system calls.)
.PP
The following values may be bitwise ORed in
.I flags
to control the behavior of
.BR memfd_secret ():
.TP
.B FD_CLOEXEC
Set the close-on-exec flag on the new file descriptor,
which causes the region to be removed from the process on
.BR execve (2).
See the description of the
.B O_CLOEXEC
flag in
.BR open (2)
.PP
As its return value,
.BR memfd_secret ()
returns a new file descriptor that refers to an anonymous file.
This file descriptor is opened for both reading and writing
.RB ( O_RDWR )
and
.B O_LARGEFILE
is set for the file descriptor.
.PP
With respect to
.BR fork (2)
and
.BR execve (2),
the usual semantics apply for the file descriptor created by
.BR memfd_secret ().
A copy of the file descriptor is inherited by the child produced by
.BR fork (2)
and refers to the same file.
The file descriptor is preserved across
.BR execve (2),
unless the close-on-exec flag has been set.
.PP
The memory region is locked into memory in the same way as with
.BR mlock (2),
so that it will never be written into swap.
However the implementation of
.BR memfd_secret ()
will not try to populate the whole range during the
.BR mmap (2)
call that attaches the region into the process's address space;
instead, the pages are only actually allocated
as they are faulted in.
The amount of memory allowed for memory mappings
of the file descriptor obeys the same rules as
.BR mlock (2)
and cannot exceed
.BR RLIMIT_MEMLOCK .
.SH RETURN VALUE
On success,
.BR memfd_secret ()
returns a new file descriptor.
On error, \-1 is returned and
.I errno
is set to indicate the error.
.SH ERRORS
.TP
.B EINVAL
.I flags
included unknown bits.
.TP
.B EMFILE
The per-process limit on the number of open file descriptors has been reached.
.TP
.B EMFILE
The system-wide limit on the total number of open files has been reached.
.TP
.B ENOMEM
There was insufficient memory to create a new anonymous file.
.TP
.B ENOSYS
.BR memfd_secret ()
is not implemented on this architecture.
.SH VERSIONS
The
.BR memfd_secret ()
system call first appeared in Linux 5.14.
.SH CONFORMING TO
The
.BR memfd_secret ()
system call is Linux-specific.
.SH SEE ALSO
.BR fcntl (2),
.BR ftruncate (2),
.BR mlock (2),
.BR memfd_create (2),
.BR mmap (2),
.BR setrlimit (2)

View File

@ -36,7 +36,6 @@
mincore \- determine whether pages are resident in memory
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.B #include <sys/mman.h>
.PP
.BI "int mincore(void *" addr ", size_t " length ", unsigned char *" vec );

View File

@ -8,7 +8,7 @@
.\" Public License. It comes with NO WARRANTY.
.\" %%%LICENSE_END
.\"
.TH MKDIR 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH MKDIR 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
mkdir, mkdirat \- create a directory
.SH SYNOPSIS
@ -126,6 +126,15 @@ did not allow search permission.
(See also
.BR path_resolution (7).)
.TP
.B EBADF
.RB ( mkdirat ())
.I pathname
is relative but
.I dirfd
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EDQUOT
The user's quota of disk blocks or inodes on the filesystem has been
exhausted.
@ -179,6 +188,13 @@ A component used as a directory in
.I pathname
is not, in fact, a directory.
.TP
.B ENOTDIR
.RB ( mkdirat ())
.I pathname
is relative and
.I dirfd
is a file descriptor referring to a file other than a directory.
.TP
.B EPERM
The filesystem containing
.I pathname
@ -187,19 +203,6 @@ does not support the creation of directories.
.B EROFS
.I pathname
refers to a file on a read-only filesystem.
.PP
The following additional errors can occur for
.BR mkdirat ():
.TP
.B EBADF
.I dirfd
is not a valid file descriptor.
.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 mkdirat ()
was added to Linux in kernel 2.6.16;

View File

@ -12,14 +12,12 @@
.\" Modified 2003-04-23 by Michael Kerrisk
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH MKNOD 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH MKNOD 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
mknod, mknodat \- create a special or ordinary file
.SH SYNOPSIS
.nf
.B #include <sys/stat.h>
.B #include <fcntl.h>
.B #include <unistd.h>
.PP
.BI "int mknod(const char *" pathname ", mode_t " mode ", dev_t " dev );
.PP
@ -165,6 +163,15 @@ did not allow search permission.
(See also
.BR path_resolution (7).)
.TP
.B EBADF
.BR ( mknodat ())
.I pathname
is relative but
.I dirfd
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EDQUOT
The user's quota of disk blocks or inodes on the filesystem has been
exhausted.
@ -209,6 +216,13 @@ A component used as a directory in
.I pathname
is not, in fact, a directory.
.TP
.B ENOTDIR
.BR ( mknodat ())
.I pathname
is relative and
.I dirfd
is a file descriptor referring to a file other than a directory.
.TP
.B EPERM
.I mode
requested creation of something other than a regular file,
@ -226,19 +240,6 @@ does not support the type of node requested.
.B EROFS
.I pathname
refers to a file on a read-only filesystem.
.PP
The following additional errors can occur for
.BR mknodat ():
.TP
.B EBADF
.I dirfd
is not a valid file descriptor.
.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 mknodat ()
was added to Linux in kernel 2.6.16;

View File

@ -23,7 +23,7 @@
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH MLOCK 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH MLOCK 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
mlock, mlock2, munlock, mlockall, munlockall \- lock and unlock memory
.SH SYNOPSIS
@ -182,6 +182,64 @@ is set to indicate the error,
and no changes are made to any locks in the
address space of the process.
.SH ERRORS
.\"SVr4 documents an additional EAGAIN error code.
.TP
.B EAGAIN
.RB ( mlock (),
.BR mlock2 (),
and
.BR munlock ())
Some or all of the specified address range could not be locked.
.TP
.B EINVAL
.RB ( mlock (),
.BR mlock2 (),
and
.BR munlock ())
The result of the addition
.IR addr + len
was less than
.IR addr
(e.g., the addition may have resulted in an overflow).
.TP
.B EINVAL
.RB ( mlock2 ())
Unknown \fIflags\fP were specified.
.TP
.B EINVAL
.RB ( mlockall ())
Unknown \fIflags\fP were specified or
.B MCL_ONFAULT
was specified without either
.B MCL_FUTURE
or
.BR MCL_CURRENT .
.TP
.B EINVAL
(Not on Linux)
.I addr
was not a multiple of the page size.
.TP
.B ENOMEM
.RB ( mlock (),
.BR mlock2 (),
and
.BR munlock ())
Some of the specified address range does not correspond to mapped
pages in the address space of the process.
.TP
.B ENOMEM
.RB ( mlock (),
.BR mlock2 (),
and
.BR munlock ())
Locking or unlocking a region would result in the total number of
mappings with distinct attributes (e.g., locked versus unlocked)
exceeding the allowed maximum.
.\" I.e., the number of VMAs would exceed the 64kB maximum
(For example, unlocking a range in the middle of a currently locked
mapping would result in three mappings:
two locked mappings at each end and an unlocked mapping in the middle.)
.TP
.B ENOMEM
(Linux 2.6.9 and later) the caller had a nonzero
@ -207,63 +265,9 @@ half of RAM.
The caller is not privileged, but needs privilege
.RB ( CAP_IPC_LOCK )
to perform the requested operation.
.\"SVr4 documents an additional EAGAIN error code.
.PP
For
.BR mlock (),
.BR mlock2 (),
and
.BR munlock ():
.TP
.B EAGAIN
Some or all of the specified address range could not be locked.
.TP
.B EINVAL
The result of the addition
.IR addr + len
was less than
.IR addr
(e.g., the addition may have resulted in an overflow).
.TP
.B EINVAL
(Not on Linux)
.I addr
was not a multiple of the page size.
.TP
.B ENOMEM
Some of the specified address range does not correspond to mapped
pages in the address space of the process.
.TP
.B ENOMEM
Locking or unlocking a region would result in the total number of
mappings with distinct attributes (e.g., locked versus unlocked)
exceeding the allowed maximum.
.\" I.e., the number of VMAs would exceed the 64kB maximum
(For example, unlocking a range in the middle of a currently locked
mapping would result in three mappings:
two locked mappings at each end and an unlocked mapping in the middle.)
.PP
For
.BR mlock2 ():
.TP
.B EINVAL
Unknown \fIflags\fP were specified.
.PP
For
.BR mlockall ():
.TP
.B EINVAL
Unknown \fIflags\fP were specified or
.B MCL_ONFAULT
was specified without either
.B MCL_FUTURE
or
.BR MCL_CURRENT .
.PP
For
.BR munlockall ():
.TP
.B EPERM
.RB ( munlockall ())
(Linux 2.6.8 and earlier) The caller was not privileged
.RB ( CAP_IPC_LOCK ).
.SH VERSIONS

View File

@ -254,7 +254,7 @@ restrictions.
If the memory region specified by
.I addr
and
.I len
.I length
overlaps pages of any existing mapping(s), then the overlapped
part of the existing mapping(s) will be discarded.
If the specified address cannot be used,
@ -400,6 +400,11 @@ private writable mappings.
Populate (prefault) page tables for a mapping.
For a file mapping, this causes read-ahead on the file.
This will help to reduce blocking on page faults later.
The
.BR mmap ()
call doesn't fail if the mapping cannot be populated (for example, due
to limitations on the number of mapped huge pages when using
.BR MAP_HUGETLB ).
.BR MAP_POPULATE
is supported for private mappings only since Linux 2.6.23.
.TP
@ -623,6 +628,18 @@ was mounted no-exec.
The operation was prevented by a file seal; see
.BR fcntl (2).
.TP
.B EPERM
The
.B MAP_HUGETLB
flag was specified, but the caller was not privileged (did not have the
.B CAP_IPC_LOCK
capability)
and is not a member of the
.I sysctl_hugetlb_shm_group
group; see the description of
.I /proc/sys/vm/sysctl_hugetlb_shm_group
in
.TP
.B ETXTBSY
.B MAP_DENYWRITE
was set but the object specified by

View File

@ -31,11 +31,13 @@
mmap2 \- map files or devices into memory
.SH SYNOPSIS
.nf
.B #include <sys/mman.h>
.BR "#include <sys/mman.h>" " /* Definition of " MAP_* " and " PROT_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.BR "#include <unistd.h>
.PP
.BI "void *mmap2(unsigned long " addr ", unsigned long " length ,
.BI " unsigned long " prot ", unsigned long " flags ,
.BI " unsigned long " fd ", unsigned long " pgoffset );
.BI "void *syscall(SYS_mmap2, unsigned long " addr ", unsigned long " length ,
.BI " unsigned long " prot ", unsigned long " flags ,
.BI " unsigned long " fd ", unsigned long " pgoffset );
.fi
.SH DESCRIPTION
This is probably not the system call that you are interested in; instead, see

View File

@ -27,11 +27,19 @@
modify_ldt \- get or set a per-process LDT entry
.SH SYNOPSIS
.nf
.BI "int modify_ldt(int " func ", void *" ptr ", unsigned long " bytecount );
.BR "#include <asm/ldt.h>" " /* Definition of " "struct user_desc" " */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_modify_ldt, int " func ", void *" ptr ,
.BI " unsigned long " bytecount );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR modify_ldt (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.BR modify_ldt ()
reads or writes the local descriptor table (LDT) for a process.
@ -168,9 +176,6 @@ is neither 0, 1, 2, nor 0x11.
This call is Linux-specific and should not be used in programs intended
to be portable.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.PP
.BR modify_ldt ()
should not be used for thread-local storage, as it slows down context
switches and only supports a limited number of threads.

View File

@ -37,7 +37,7 @@
.\" 2008-10-06, mtk: move umount*() material into separate umount.2 page.
.\" 2008-10-06, mtk: Add discussion of namespaces.
.\"
.TH MOUNT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH MOUNT 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
mount \- mount filesystem
.SH SYNOPSIS
@ -151,7 +151,7 @@ Reduce on-disk updates of inode timestamps (atime, mtime, ctime)
by maintaining these changes only in memory.
The on-disk timestamps are updated only when:
.RS
.IP (a) 5
.IP (a) 4
the inode needs to be updated for some change unrelated to file timestamps;
.IP (b)
the application employs
@ -221,6 +221,12 @@ Do not allow programs to be executed from this filesystem.
.B MS_NOSUID
Do not honor set-user-ID and set-group-ID bits or file capabilities
when executing programs from this filesystem.
In addition, SELinux domain
transitions require the permission
.IR nosuid_transition ,
which in turn needs
also the policy capability
.IR nnp_nosuid_transition .
.\" (This is a security feature to prevent users executing set-user-ID and
.\" set-group-ID programs from removable disk devices.)
.TP
@ -327,7 +333,7 @@ mount of the filesystem, and will be shared by all subsequent mounts
of the same filesystem.
Subsequently, the settings of the flags can be changed
via a remount operation (see below).
Such changes will be visible via all mount points associated
Such changes will be visible via all mounts associated
with the filesystem.
.PP
Since Linux 2.6.16,
@ -405,8 +411,8 @@ and
.BR MS_SILENT
flags during a remount are silently ignored.
Note that changes to per-superblock flags are visible via
all mount points of the associated filesystem
(because the per-superblock flags are shared by all mount points).
all mounts of the associated filesystem
(because the per-superblock flags are shared by all mounts).
.PP
Since Linux 3.17,
.\" commit ffbc6f0ead47fa5a1dc9642b0331cb75c20a640e
@ -429,7 +435,7 @@ flag can be used with
to modify only the per-mount-point flags.
.\" See https://lwn.net/Articles/281157/
This is particularly useful for setting or clearing the "read-only"
flag on a mount point without changing the underlying filesystem.
flag on a mount without changing the underlying filesystem.
Specifying
.IR mountflags
as:
@ -441,7 +447,7 @@ MS_REMOUNT | MS_BIND | MS_RDONLY
.in
.PP
will make access through this mountpoint read-only, without affecting
other mount points.
other mounts.
.\"
.SS Creating a bind mount
If
@ -469,7 +475,7 @@ described below) in the
.I mountflags
argument are also ignored.
(The bind mount has the same mount options as
the underlying mount point.)
the underlying mount.)
However, see the discussion of remounting above,
for a method of making an existing bind mount read-only.
.PP
@ -517,31 +523,31 @@ arguments are ignored.
The meanings of the propagation type flags are as follows:
.TP
.BR MS_SHARED
Make this mount point shared.
Mount and unmount events immediately under this mount point will propagate
to the other mount points that are members of this mount's peer group.
Make this mount shared.
Mount and unmount events immediately under this mount will propagate
to the other mounts that are members of this mount's peer group.
Propagation here means that the same mount or unmount will automatically
occur under all of the other mount points in the peer group.
occur under all of the other mounts in the peer group.
Conversely, mount and unmount events that take place under
peer mount points will propagate to this mount point.
peer mounts will propagate to this mount.
.TP
.BR MS_PRIVATE
Make this mount point private.
Mount and unmount events do not propagate into or out of this mount point.
Make this mount private.
Mount and unmount events do not propagate into or out of this mount.
.TP
.BR MS_SLAVE
If this is a shared mount point that is a member of a peer group
If this is a shared mount that is a member of a peer group
that contains other members, convert it to a slave mount.
If this is a shared mount point that is a member of a peer group
If this is a shared mount that is a member of a peer group
that contains no other members, convert it to a private mount.
Otherwise, the propagation type of the mount point is left unchanged.
Otherwise, the propagation type of the mount is left unchanged.
.IP
When a mount point is a slave,
mount and unmount events propagate into this mount point from
When a mount is a slave,
mount and unmount events propagate into this mount from
the (master) shared peer group of which it was formerly a member.
Mount and unmount events under this mount point do not propagate to any peer.
Mount and unmount events under this mount do not propagate to any peer.
.IP
A mount point can be the slave of another peer group
A mount can be the slave of another peer group
while at the same time sharing mount and unmount events
with a peer group of which it is a member.
.TP
@ -562,12 +568,12 @@ when replicating that subtree to produce the target subtree.
.PP
By default, changing the propagation type affects only the
.I target
mount point.
mount.
If the
.B MS_REC
flag is also specified in
.IR mountflags ,
then the propagation type of all mount points under
then the propagation type of all mounts under
.IR target
is also changed.
.PP
@ -583,9 +589,9 @@ contains the flag
(available since Linux 2.4.18),
then move a subtree:
.I source
specifies an existing mount point and
specifies an existing mount and
.I target
specifies the new location to which that mount point is to be relocated.
specifies the new location to which that mount is to be relocated.
The move is atomic: at no point is the subtree unmounted.
.PP
The remaining bits in the
@ -596,7 +602,7 @@ and
.IR data
arguments.
.\"
.SS Creating a new mount point
.SS Creating a new mount
If none of
.BR MS_REMOUNT ,
.BR MS_BIND ,
@ -610,9 +616,9 @@ is specified in
.IR mountflags ,
then
.BR mount ()
performs its default action: creating a new mount point.
performs its default action: creating a new mount.
.IR source
specifies the source for the new mount point, and
specifies the source for the new mount, and
.IR target
specifies the directory at which to create the mount point.
.PP
@ -703,7 +709,7 @@ was attempted, but the mount tree under
.I source
includes unbindable mounts and
.I target
is a mount point that has propagation type
is a mount that has propagation type
.BR MS_SHARED .
.TP
.B EINVAL
@ -719,7 +725,7 @@ A move operation
.RB ( MS_MOVE )
was attempted, but
.I source
was not a mount point, or was \(aq/\(aq.
was not a mount, or was \(aq/\(aq.
.TP
.B EINVAL
A bind operation
@ -818,6 +824,21 @@ is out of range.
.B EPERM
The caller does not have the required privileges.
.TP
.B EPERM
An attempt was made to modify
.RB ( MS_REMOUNT )
the
.BR MS_RDONLY ,
.BR MS_NOSUID ,
or
.BR MS_NOEXEC
flag, or one of the "atime" flags
.RB ( MS_NOATIME ,
.BR MS_NODIRATIME ,
.BR MS_RELATIME )
of an existing mount, but the mount is locked; see
.BR mount_namespaces (7).
.TP
.B EROFS
Mounting a read-only filesystem was attempted without giving the
.B MS_RDONLY
@ -918,33 +939,33 @@ subsequently creates) and vice versa.
For further details on mount namespaces, see
.BR mount_namespaces (7).
.\"
.SS Parental relationship between mount points
Each mount point has a parent mount point.
The overall parental relationship of all mount points defines
.SS Parental relationship between mounts
Each mount has a parent mount.
The overall parental relationship of all mounts defines
the single directory hierarchy seen by the processes within a mount namespace.
.PP
The parent of a new mount point is defined when the mount point is created.
The parent of a new mount is defined when the mount is created.
In the usual case,
the parent of a new mount is the mount point of the filesystem
the parent of a new mount is the mount of the filesystem
containing the directory or file at which the new mount is attached.
In the case where a new mount is stacked on top of an existing mount,
the parent of the new mount is the previous mount that was stacked
at that location.
.PP
The parental relationship between mount points can be discovered via the
The parental relationship between mounts can be discovered via the
.I /proc/[pid]/mountinfo
file (see below).
.\"
.SS /proc/[pid]/mounts and /proc/[pid]/mountinfo
The Linux-specific
.I /proc/[pid]/mounts
file exposes the list of mount points in the mount
file exposes the list of mounts in the mount
namespace of the process with the specified ID.
The
.I /proc/[pid]/mountinfo
file exposes even more information about mount points,
file exposes even more information about mounts,
including the propagation type and mount ID information that makes it
possible to discover the parental relationship between mount points.
possible to discover the parental relationship between mounts.
See
.BR proc (5)
and
@ -954,6 +975,7 @@ for details of this file.
.BR mountpoint (1),
.BR chroot (2),
.BR ioctl_iflags (2),
.BR mount_settatr (2),
.BR pivot_root (2),
.BR umount (2),
.BR mount_namespaces (7),

1039
man2/mount_setattr.2 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -24,7 +24,7 @@ move_pages \- move individual pages of a process to another node
.nf
.B #include <numaif.h>
.PP
.BI "long move_pages(int " pid ", unsigned long count, void **" pages ,
.BI "long move_pages(int " pid ", unsigned long " count ", void **" pages ,
.BI " const int *" nodes ", int *" status ", int " flags );
.fi
.PP
@ -180,6 +180,7 @@ The number of nonmigrated pages if they were the result of nonfatal
reasons (since
.\" commit a49bd4d7163707de377aee062f17befef6da891b
Linux 4.17).
.TP
.B E2BIG
Too many pages to move.
Since Linux 2.6.29,

View File

@ -27,14 +27,13 @@
mq_getsetattr \- get/set message queue attributes
.SH SYNOPSIS
.nf
.B #include <mqueue.h>
.BR "#include <mqueue.h>" " /* Definition of " "struct mq_attr" " */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int mq_getsetattr(mqd_t " mqdes ", const struct mq_attr *" newattr ,
.BI " struct mq_attr *" oldattr );
.BI "int syscall(SYS_mq_getsetattr, mqd_t " mqdes ,
.BI " const struct mq_attr *" newattr ", struct mq_attr *" oldattr );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
.SH DESCRIPTION
Do not use this system call.
.PP
@ -48,9 +47,7 @@ see the description of
.SH CONFORMING TO
This interface is nonstandard; avoid its use.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
(Actually, never call it unless you are writing a C library!)
Never call it unless you are writing a C library!
.SH SEE ALSO
.BR mq_getattr (3),
.BR mq_overview (7)

View File

@ -40,7 +40,6 @@
msgctl \- System V message control operations
.SH SYNOPSIS
.nf
.B #include <sys/ipc.h>
.B #include <sys/msg.h>
.PP
.BI "int msgctl(int " msqid ", int " cmd ", struct msqid_ds *" buf );
@ -405,17 +404,6 @@ capability).
POSIX.1-2001, POSIX.1-2008, SVr4.
.\" SVID does not document the EIDRM error condition.
.SH NOTES
The inclusion of
.I <sys/ipc.h>
isn't required on Linux or by any version of POSIX.
However,
some old implementations required the inclusion of this header file,
and the SVID also documented its inclusion.
Applications intended to be portable to such old systems may need
to include this header file.
.\" Like Linux, the FreeBSD man pages still document
.\" the inclusion of this header file.
.PP
The
.BR IPC_INFO ,
.BR MSG_STAT ,

View File

@ -37,7 +37,6 @@
msgget \- get a System V message queue identifier
.SH SYNOPSIS
.nf
.B #include <sys/ipc.h>
.B #include <sys/msg.h>
.PP
.BI "int msgget(key_t " key ", int " msgflg );
@ -188,17 +187,6 @@ would be exceeded.
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4.
.SH NOTES
The inclusion of
.I <sys/ipc.h>
isn't required on Linux or by any version of POSIX.
However,
some old implementations required the inclusion of this header file,
and the SVID also documented its inclusion.
Applications intended to be portable to such old systems may need
to include this header file.
.\" Like Linux, the FreeBSD man pages still document
.\" the inclusion of this header file.
.PP
.B IPC_PRIVATE
isn't a flag field but a
.I key_t

View File

@ -42,7 +42,6 @@
msgrcv, msgsnd \- System V message queue operations
.SH SYNOPSIS
.nf
.B #include <sys/ipc.h>
.B #include <sys/msg.h>
.PP
.BI "int msgsnd(int " msqid ", const void *" msgp ", size_t " msgsz \
@ -480,17 +479,6 @@ their definitions can be obtained by defining the
.\" MSG_COPY since glibc 2.18
feature test macro.
.SH NOTES
The inclusion of
.I <sys/ipc.h>
isn't required on Linux or by any version of POSIX.
However,
some old implementations required the inclusion of this header file,
and the SVID also documented its inclusion.
Applications intended to be portable to such old systems may need
to include this header file.
.\" Like Linux, the FreeBSD man pages still document
.\" the inclusion of this header file.
.PP
The
.I msgp
argument is declared as \fIstruct msgbuf\ *\fP in

View File

@ -48,12 +48,11 @@
.\" FIXME . Apr 08: The next POSIX revision has O_EXEC, O_SEARCH, and
.\" O_TTYINIT. Eventually these may need to be documented. --mtk
.\"
.TH OPEN 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH OPEN 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
open, openat, creat \- open and possibly create a file
.SH SYNOPSIS
.nf
.B #include <sys/stat.h>
.B #include <fcntl.h>
.PP
.BI "int open(const char *" pathname ", int " flags );
@ -97,7 +96,9 @@ be created by
.PP
The return value of
.BR open ()
is a file descriptor, a small, nonnegative integer that is used
is a file descriptor, a small, nonnegative integer that is an index
to an entry in the process's table of open file descriptors.
The file descriptor is used
in subsequent system calls
.RB ( read "(2), " write "(2), " lseek "(2), " fcntl (2),
etc.) to refer to the open file.
@ -822,7 +823,7 @@ fd = open("/path/to/dir", O_TMPFILE | O_RDWR,
/* File I/O on \(aqfd\(aq... */
linkat(fd, NULL, AT_FDCWD, "/path/for/file", AT_EMPTY_PATH);
linkat(fd, "", AT_FDCWD, "/path/for/file", AT_EMPTY_PATH);
/* If the caller doesn\(aqt have the CAP_DAC_READ_SEARCH
capability (needed to use AT_EMPTY_PATH with linkat(2)),
@ -925,17 +926,19 @@ system call operates in exactly the same way as
.BR open (),
except for the differences described here.
.PP
The
.I dirfd
argument is used in conjunction with the
.I pathname
argument as follows:
.IP * 3
If the pathname given in
.I pathname
is relative, then it is interpreted relative to the directory
referred to by the file descriptor
is absolute, then
.I dirfd
(rather than relative to the current working directory of
the calling process, as is done by
.BR open ()
for a relative pathname).
.PP
If
is ignored.
.IP *
If the pathname given in
.I pathname
is relative and
.I dirfd
@ -946,12 +949,36 @@ then
is interpreted relative to the current working
directory of the calling process (like
.BR open ()).
.PP
If
.IP *
If the pathname given in
.I pathname
is absolute, then
is relative, then it is interpreted relative to the directory
referred to by the file descriptor
.I dirfd
is ignored.
(rather than relative to the current working directory of
the calling process, as is done by
.BR open ()
for a relative pathname).
In this case,
.I dirfd
must be a directory that was opened for reading
.RB ( O_RDONLY )
or using the
.B O_PATH
flag.
.PP
If the pathname given in
.I pathname
is relative, and
.I dirfd
is not a valid file descriptor, an error
.RB ( EBADF )
results.
(Specifying an invalid file descriptor number in
.I dirfd
can be used as a means to ensure that
.I pathname
is absolute.)
.\"
.SS openat2(2)
The
@ -1007,6 +1034,15 @@ and
in
.BR proc (5).
.TP
.B EBADF
.RB ( openat ())
.I pathname
is relative but
.I dirfd
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EBUSY
.B O_EXCL
was specified in
@ -1183,6 +1219,13 @@ is not, in fact, a directory, or \fBO_DIRECTORY\fP was specified and
.I pathname
was not a directory.
.TP
.B ENOTDIR
.RB ( openat ())
.I pathname
is a relative pathname and
.I dirfd
is a file descriptor referring to a file other than a directory.
.TP
.B ENXIO
.BR O_NONBLOCK " | " O_WRONLY
is set, the named file is a FIFO, and
@ -1258,19 +1301,6 @@ The
flag was specified, and an incompatible lease was held on the file
(see
.BR fcntl (2)).
.PP
The following additional errors can occur for
.BR openat ():
.TP
.B EBADF
.I dirfd
is not a valid file descriptor.
.TP
.B ENOTDIR
.I pathname
is a relative pathname and
.I dirfd
is a file descriptor referring to a file other than a directory.
.SH VERSIONS
.BR openat ()
was added to Linux in kernel 2.6.16;
@ -1610,13 +1640,15 @@ a directory file descriptor argument
.BR futimesat (2),
.BR linkat (2),
.BR mkdirat (2),
.BR move_mount (2),
.BR mknodat (2),
.BR mount_setattr (2),
.BR move_mount (2),
.BR name_to_handle_at (2),
.BR open_tree (2),
.BR openat2 (2),
.BR readlinkat (2),
.BR renameat (2),
.BR renameat2 (2),
.BR statx (2),
.BR symlinkat (2),
.BR unlinkat (2),

View File

@ -22,14 +22,13 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH OPEN_BY_HANDLE_AT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH OPEN_BY_HANDLE_AT 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
name_to_handle_at, open_by_handle_at \- obtain handle
for a pathname and open file via a handle
.SH SYNOPSIS
.nf
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <sys/stat.h>
.B #include <fcntl.h>
.PP
.BI "int name_to_handle_at(int " dirfd ", const char *" pathname ,
@ -348,6 +347,14 @@ can fail with the following errors:
.IR mount_fd
is not an open file descriptor.
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EFAULT
.IR handle
points outside your accessible address space.

View File

@ -26,16 +26,21 @@
openat2 \- open and possibly create a file (extended)
.SH SYNOPSIS
.nf
.B #include <sys/stat.h>
.B #include <fcntl.h>
.B #include <linux/openat2.h>
.BR "#include <fcntl.h>" \
" /* Definition of " O_* " and " S_* " constants */"
.BR "#include <linux/openat2.h>" " /* Definition of " RESOLVE_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "long openat2(int " dirfd ", const char *" pathname ,
.BI " struct open_how *" how ", size_t " size );
.BI "long syscall(SYS_openat2, int " dirfd ", const char *" pathname ,
.BI " struct open_how *" how ", size_t " size );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR openat2 (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR openat2 ()
@ -434,7 +439,8 @@ call.
.B EAGAIN
.BR RESOLVE_CACHED
was set, and the open operation cannot be performed using only cached
information. The caller should retry without
information.
The caller should retry without
.B RESOLVE_CACHED
set in
.I how.resolve .
@ -494,9 +500,6 @@ The semantics of
were modeled after FreeBSD's
.BR O_BENEATH .
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.\"
.SS Extensibility
In order to allow for future extensibility,
.BR openat2 ()

View File

@ -24,21 +24,26 @@
.\" This document is based on the perf_event.h header file, the
.\" tools/perf/design.txt file, and a lot of bitter experience.
.\"
.TH PERF_EVENT_OPEN 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH PERF_EVENT_OPEN 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
perf_event_open \- set up performance monitoring
.SH SYNOPSIS
.nf
.B #include <linux/perf_event.h>
.B #include <linux/hw_breakpoint.h>
.BR "#include <linux/perf_event.h>" " /* Definition of " PERF_* " constants */"
.BR "#include <linux/hw_breakpoint.h>" " /* Definition of " HW_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int perf_event_open(struct perf_event_attr *" attr ,
.BI " pid_t " pid ", int " cpu ", int " group_fd ,
.BI " unsigned long " flags );
.BI "int syscall(SYS_perf_event_open, struct perf_event_attr *" attr ,
.BI " pid_t " pid ", int " cpu ", int " group_fd \
", unsigned long " flags );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR perf_event_open (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
Given a list of parameters,
.BR perf_event_open ()
@ -1265,7 +1270,7 @@ records when a new cgroup is created (and activated).
.\" commit e17d43b93e544f5016c0251d2074c15568d5d963
This enables the generation of
.B PERF_RECORD_TEXT_POKE
records when there's a changes to the kernel text
records when there's a change to the kernel text
(i.e., self-modifying code).
.TP
.IR wakeup_events ", " wakeup_watermark
@ -3529,6 +3534,10 @@ Returned if the
.I attr
pointer points at an invalid memory address.
.TP
.B EINTR
Returned when trying to mix perf and ftrace handling
for a uprobe.
.TP
.B EINVAL
Returned if the specified event is invalid.
There are many possible reasons for this.
@ -3555,10 +3564,6 @@ values are out of range or set reserved bits;
the generic event selected is not supported; or
there is not enough room to add the selected event.
.TP
.B EINTR
Returned when trying to mix perf and ftrace handling
for a uprobe.
.TP
.B EMFILE
Each opened event uses one file descriptor.
If a large number of events are opened,
@ -3641,10 +3646,6 @@ This
system call Linux-specific
and should not be used in programs intended to be portable.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
See the example below.
.PP
The official way of knowing if
.BR perf_event_open ()
support is enabled is checking
@ -3761,7 +3762,7 @@ perf_event_open(struct perf_event_attr *hw_event, pid_t pid,
}
int
main(int argc, char **argv)
main(int argc, char *argv[])
{
struct perf_event_attr pe;
long long count;

View File

@ -196,12 +196,18 @@ On error, \-1 is returned and
is set to indicate the error.
.SH VERSIONS
.BR perfmonctl ()
is available since Linux 2.4.
was added in Linux 2.4;
.\" commit ecf5b72d5f66af843f189dfe9ce31598c3e48ad7
it was removed in Linux 5.10.
.SH CONFORMING TO
.BR perfmonctl ()
is Linux-specific and is available only on the IA-64 architecture.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
This system call was broken for many years,
and ultimately removed in Linux 5.10.
.PP
Glibc does not provide a wrapper for this system call;
on kernels where it exists, call it using
.BR syscall (2).
.SH SEE ALSO
.BR gprof (1)

View File

@ -27,11 +27,18 @@
pidfd_getfd \- obtain a duplicate of another process's file descriptor
.SH SYNOPSIS
.nf
.BI "int pidfd_getfd(int " pidfd ", int " targetfd ", unsigned int " flags );
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_pidfd_getfd, int " pidfd ", int " targetfd ,
.BI " unsigned int " flags );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR pidfd_getfd (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR pidfd_getfd ()
@ -121,9 +128,6 @@ first appeared in Linux 5.6.
.BR pidfd_getfd ()
is Linux specific.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.PP
For a description of PID file descriptors, see
.BR pidfd_open (2).
.PP

View File

@ -22,16 +22,22 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH PIDFD_OPEN 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.TH PIDFD_OPEN 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
pidfd_open \- obtain a file descriptor that refers to a process
.SH SYNOPSIS
.nf
.BI "int pidfd_open(pid_t " pid ", unsigned int " flags );
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_pidfd_open, pid_t " pid ", unsigned int " flags );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR pidfd_open (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR pidfd_open ()
@ -43,8 +49,17 @@ the close-on-exec flag is set on the file descriptor.
.PP
The
.I flags
argument is reserved for future use;
currently, this argument must be specified as 0.
argument either has the value 0, or contains the following flag:
.TP
.BR PIDFD_NONBLOCK " (since Linux 5.10)"
.\" commit 4da9af0014b51c8b015ed8c622440ef28912efe6
Return a nonblocking file descriptor.
If the process referred to by the file descriptor has not yet terminated,
then an attempt to wait on the file descriptor using
.BR waitid (2)
will immediately return the error
.BR EAGAIN
rather than blocking.
.SH RETURN VALUE
On success,
.BR pidfd_open ()
@ -56,7 +71,7 @@ is set to indicate the error.
.TP
.B EINVAL
.I flags
is not 0.
is not valid.
.TP
.B EINVAL
.I pid
@ -89,9 +104,6 @@ first appeared in Linux 5.3.
.BR pidfd_open ()
is Linux specific.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.PP
The following code sequence can be used to obtain a file descriptor
for the child of
.BR fork (2):

View File

@ -27,14 +27,21 @@
pidfd_send_signal \- send a signal to a process specified by a file descriptor
.SH SYNOPSIS
.nf
.B "#include <signal.h>"
.BR "#include <linux/signal.h>" " /* Definition of " SIG* " constants */"
.BR "#include <signal.h>" " /* Definition of " SI_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int pidfd_send_signal(int " pidfd ", int " sig ", siginfo_t *" info ,
.BI "int syscall(SYS_pidfd_send_signal, int " pidfd ", int " sig \
", siginfo_t *" info ,
.BI " unsigned int " flags );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR pidfd_send_signal (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR pidfd_send_signal ()
@ -136,9 +143,6 @@ first appeared in Linux 5.1.
.BR pidfd_send_signal ()
is Linux specific.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.\"
.SS PID file descriptors
The
.I pidfd

View File

@ -40,20 +40,23 @@ pipe, pipe2 \- create pipe
.nf
.B #include <unistd.h>
.PP
/* On Alpha, IA-64, MIPS, SuperH, and SPARC/SPARC64; see NOTES */
.B struct fd_pair {
.B " long fd[2];"
.B "};"
.B struct fd_pair pipe();
.PP
/* On all other architectures */
.BI "int pipe(int " pipefd "[2]);"
.BI "int pipe(int " pipefd [2]);
.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 pipe2(int " pipefd "[2], int " flags );
.PP
/* On Alpha, IA-64, MIPS, SuperH, and SPARC/SPARC64, pipe() has the
following prototype; see NOTES */
.PP
.B #include <unistd.h>
.PP
.B struct fd_pair {
.B " long fd[2];"
.B "};"
.B struct fd_pair pipe(void);
.fi
.SH DESCRIPTION
.BR pipe ()

View File

@ -29,11 +29,18 @@
pivot_root \- change the root mount
.SH SYNOPSIS
.nf
.BI "int pivot_root(const char *" new_root ", const char *" put_old );
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_pivot_root, const char *" new_root \
", const char *" put_old );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR pivot_root (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.BR pivot_root ()
changes the root mount in the mount namespace of the calling process.
@ -168,9 +175,6 @@ was introduced in Linux 2.3.41.
.BR pivot_root ()
is Linux-specific and hence is not portable.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.PP
A command-line interface for this system call is provided by
.BR pivot_root (8).
.PP

View File

@ -37,11 +37,10 @@ poll, ppoll \- wait for some event on a file descriptor
.BI "int poll(struct pollfd *" fds ", nfds_t " nfds ", int " timeout );
.PP
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <signal.h>
.B #include <poll.h>
.PP
.BI "int ppoll(struct pollfd *" fds ", nfds_t " nfds ,
.BI " const struct timespec *" tmo_p ", const sigset_t *" sigmask );
.BI " const struct timespec *" tmo_p ", const sigset_t *" sigmask );
.fi
.SH DESCRIPTION
.BR poll ()

View File

@ -1135,72 +1135,48 @@ the available system calls.
The more recent
.BR seccomp (2)
system call provides a superset of the functionality of
.BR PR_SET_SECCOMP .
.BR PR_SET_SECCOMP ,
and is the preferred interface for new applications.
.IP
The seccomp mode is selected via
.IR arg2 .
(The seccomp constants are defined in
.IR <linux/seccomp.h> .)
The following values can be specified:
.RS
.TP
.BR SECCOMP_MODE_STRICT " (since Linux 2.6.23)"
See the description of
.B SECCOMP_SET_MODE_STRICT
in
.BR seccomp (2).
.IP
With
.IR arg2
set to
.BR SECCOMP_MODE_STRICT ,
the only system calls that the thread is permitted to make are
.BR read (2),
.BR write (2),
.BR _exit (2)
(but not
.BR exit_group (2)),
and
.BR sigreturn (2).
Other system calls result in the delivery of a
.BR SIGKILL
signal.
Strict secure computing mode is useful for number-crunching applications
that may need to execute untrusted byte code,
perhaps obtained by reading from a pipe or socket.
This operation is available only
if the kernel is configured with
.B CONFIG_SECCOMP
enabled.
.IP
With
.IR arg2
set to
.BR SECCOMP_MODE_FILTER " (since Linux 3.5),"
the system calls allowed are defined by a pointer
.TP
.BR SECCOMP_MODE_FILTER " (since Linux 3.5)"
The allowed system calls are defined by a pointer
to a Berkeley Packet Filter passed in
.IR arg3 .
This argument is a pointer to
.IR "struct sock_fprog" ;
it can be designed to filter
arbitrary system calls and system call arguments.
This mode is available only if the kernel is configured with
See the description of
.B SECCOMP_SET_MODE_FILTER
in
.BR seccomp (2).
.IP
This operation is available only
if the kernel is configured with
.B CONFIG_SECCOMP_FILTER
enabled.
.RE
.IP
If
.BR SECCOMP_MODE_FILTER
filters permit
.BR fork (2),
then the seccomp mode is inherited by children created by
.BR fork (2);
if
.BR execve (2)
is permitted, then the seccomp mode is preserved across
.BR execve (2).
If the filters permit
.BR prctl ()
calls, then additional filters can be added;
they are run in order until the first non-allow result is seen.
.IP
For further information, see the kernel source file
.IR Documentation/userspace\-api/seccomp_filter.rst
.\" commit c061f33f35be0ccc80f4b8e0aea5dfd2ed7e01a3
(or
.IR Documentation/prctl/seccomp_filter.txt
before Linux 4.13).
For further details on seccomp filtering, see
.BR seccomp (2).
.\" prctl PR_GET_SECCOMP
.TP
.BR PR_GET_SECCOMP " (since Linux 2.6.23)"
@ -1216,6 +1192,7 @@ If the caller is in filter mode, and this system call is allowed by the
seccomp filters, it returns 2; otherwise, the process is killed with a
.BR SIGKILL
signal.
.IP
This operation is available only
if the kernel is configured with
.B CONFIG_SECCOMP
@ -1471,7 +1448,7 @@ was included in
.IR arg2 ,
then the configuration described by the return value
will take effect at the next
.BR execve ().
.BR execve (2).
Otherwise, the configuration is already in effect when the
.B PR_SVE_SET_VL
call returns.

View File

@ -25,20 +25,27 @@
.\"
.\" Commit ecb8ac8b1f146915aa6b96449b66dd48984caacc
.\"
.TH PROCESS_MADVISE 2 2021-01-12 "Linux" "Linux Programmer's Manual"
.TH PROCESS_MADVISE 2 2021-06-20 "Linux" "Linux Programmer's Manual"
.SH NAME
process_madvise \- give advice about use of memory to a process
.SH SYNOPSIS
.nf
.B #include <sys/uio.h>
.BR "#include <sys/mman.h>" " /* Definition of " MADV_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.BR "#include <sys/uio.h>" " /* Definition of " "struct iovec" " type */"
.B #include <unistd.h>
.PP
.BI "ssize_t process_madvise(int " pidfd ", const struct iovec *" iovec ,
.BI " size_t " vlen ", int " advice ,
.BI " unsigned int " flags ");"
.BI "ssize_t syscall(SYS_process_madvise, int " pidfd ,
.BI " const struct iovec *" iovec ", size_t " vlen \
", int " advice ,
.BI " unsigned int " flags ");"
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR process_madvise (),
necessitating the use of
.BR syscall (2).
.\" FIXME: See <https://sourceware.org/bugzilla/show_bug.cgi?id=27380>
.SH DESCRIPTION
The
@ -205,9 +212,6 @@ configuration option.
The
.BR process_madvise ()
system call is Linux-specific.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.SH SEE ALSO
.BR madvise (2),
.BR pidfd_open (2),

View File

@ -2327,8 +2327,11 @@ On success, the
requests return the requested data (but see NOTES),
the
.B PTRACE_SECCOMP_GET_FILTER
request returns the number of instructions in the BPF program, and
other requests return zero.
request returns the number of instructions in the BPF program,
the
.B PTRACE_GET_SYSCALL_INFO
request returns the number of bytes available to be written by the kernel,
and other requests return zero.
.PP
On error, all requests return \-1, and
.I errno

View File

@ -30,7 +30,9 @@ quotactl \- manipulate disk quotas
.SH SYNOPSIS
.nf
.B #include <sys/quota.h>
.B #include <xfs/xqm.h> /* for XFS quotas */
.BR "#include <xfs/xqm.h>" " /* Definition of " Q_X* " and " XFS_QUOTA_* \
" constants"
.RB " (or " <linux/dqblk_xfs.h> "; see NOTES) */"
.PP
.BI "int quotactl(int " cmd ", const char *" special ", int " id \
", caddr_t " addr );

View File

@ -32,13 +32,17 @@
readdir \- read directory entry
.SH SYNOPSIS
.nf
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int readdir(unsigned int " fd ", struct old_linux_dirent *" dirp ","
.BI " unsigned int " count );
.BI "int syscall(SYS_readdir, unsigned int " fd ,
.BI " struct old_linux_dirent *" dirp ", unsigned int " count );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
There is no definition of
.BR "struct old_linux_dirent" ;
see NOTES.
.SH DESCRIPTION
This is not the function you are interested in.
Look at
@ -116,8 +120,6 @@ File descriptor does not refer to a directory.
.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).
You will need to define the
.I old_linux_dirent
structure yourself.

Some files were not shown because too many files have changed in this diff Show More