Compare commits

...

1026 Commits

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Sounds good.

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

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

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

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

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

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

I've made the text:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Hello Alexis,

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

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

     rc = pthread_getname_np(thread, thread_name, NAMELEN);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

           .BR fcntl ()

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

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

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

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

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

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

- Break complex declaration lines into a line for each variable

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

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

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

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

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

Document the FUTEX_LOCK_PI2 command.

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

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

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

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

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

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

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

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

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

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

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

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

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

Those, on my system, are:

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

And they all seem to also be part of glibc.

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

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

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

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

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

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

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

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

Cheers.
 emanuele6

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

///////

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

Reported-by: EmanueleTorre <torreemanuele6@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Michael Kerrisk 5e833e276d localedef.1, access.2, ioctl_console.2, ioctl_fslabel.2, openat2.2, write.2, dlsym.3, getopt.3, nl_langinfo.3, termios.3, xcrypt.3, hosts.equiv.5, nsswitch.conf.5, cgroups.7, man-pages.7, netlink.7, system_data_types.7: srcfix: semantic newlines
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Michael Kerrisk e6b7a7b823 nl_langinfo.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Alejandro Colomar c6d8334b58 getopt.3: Minor tweak to James's patch
Cc: James O. D. Hunt <jamesodhunt@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
James O. D. Hunt 87ce949275 getopt.3: Further clarification of optstring
Explain that `optstring` cannot contain a semi-colon (`;`)
character.
[mtk: verified with a small test program; see also posix/getopt.c
in the glibc sources:

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

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

Test program below. Example runs:

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

Signed-off-by: James O. D. Hunt <jamesodhunt@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>

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

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

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

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

    xfnd = 0;
    pstr = NULL;

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

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

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

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

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

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Alejandro Colomar a53fba5e42 termios.3: ffix
Format variable parts of words referring to a group of identifiers
in italics, following groff_man(7) recommendations.

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

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Pali Rohár 4e972a7c84 termios.3: Add information how to set baud rate to any other value
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Pali Rohár 69452aadaf termios.3: Use bold style for Bnn and EXTn macro constants
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
Pali Rohár b9a8ee5a97 termios.3: Document missing baud-rate constants
These baud-rate macro constants are defined in bits/termios.h and are
already supported.

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

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:37 +02:00
G. Branden Robinson c99dbb2776 man-pages.7: wfix
Saw this while preparing the "switch to \~" change Alex invited.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

It avoids negating INT_MIN by returning early with ESRCH.

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

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

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

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

This patch fix this typo.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

====

From the email discussion with Jann Horn

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

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

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

====

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

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

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

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

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

====

Scenario A

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

/* Modified version of code from Jann Horn */

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

struct {
    int seccomp_fd;
} *shared;

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

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

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

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

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

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

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

    /* CHILD */

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

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

        /* Install seccomp filter */

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

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

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

        /* Wake the parent */

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

        /* Establish SA_RESTART handler for SIGUSR1 */

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

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

        /* Make a blocking system call */

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

        exit(0);
    }

    /* PARENT */

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

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

    /* Get notification FD from the child */

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

    sleep(1);

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

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

    exit(0);
}

====

Scenario B

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

/* Modified version of code from Jann Horn */

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

struct {
    int seccomp_fd;
} *shared;

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

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

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

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

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

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

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

    /* CHILD */

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

        /* Install seccomp filter */

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

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

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

        /* Wake the parent */

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

        /* Establish SA_RESTART handler for SIGUSR1 */

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

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

        /* Make a blocking system call */

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

        exit(0);
    }

    /* PARENT */

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

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

    /* Get notification FD from the child */

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

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

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

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

    exit(0);
}

====

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

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

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

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

I added the following to the code:

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

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

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

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

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

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

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

Quoting Jann Horn:

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

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

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

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

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

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

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

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

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

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

Add some comments to the structure definition.

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

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

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

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

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

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

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

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

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

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

This allows for much faster installation times.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Add copyright.

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

For a long history of this problem, see:

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

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

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

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

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

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

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

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

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

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

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

...

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

......

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

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

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

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

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

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

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

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

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

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

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

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

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

The relevant kernel code is the following:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

- Use .PHONY

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

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

- Specify SHELL = /bin/bash

- Specify shebang

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

......

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

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

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

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

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

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

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

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

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

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

Signed-off-by: James O. D. Hunt <jamesodhunt@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-05-10 09:09:11 +12:00
Alejandro Colomar f729c4f36e sigwaitinfo.2: tfix
Fix wording issue introduced in commit
bf1298c9e5.

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

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

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

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

Here is the rendered text:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Also sort the includes alphabetically.

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

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

Also sort the includes alphabetically.

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

Also sort the includes alphabetically.

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

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

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

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

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

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

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

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

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

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

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

Related kernel commits:
bda420b985054a3badafef23807c4b4fa38a3dff

[mtk: Minor fixes to commit message]

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

ffix: Align common parameters.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Let's use it here too.

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

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

Let's use it here too.

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

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

Fix the prototypes to add these qualifiers.

......

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

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

......

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

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

......

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

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

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

......

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

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

......

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

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

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

......

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

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

......

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

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

......

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

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

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

Let's use it here too.

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

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

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

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

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

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

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

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

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

......

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

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

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

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

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

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

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

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

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

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

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

......

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

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

......

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

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

......

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

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

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

......

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

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

......

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

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

......

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

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

......

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

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

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

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

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

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

......

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

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

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

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

......

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

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

......

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

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

......

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

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

......

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

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

......

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

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

......

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

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

......

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

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

......

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

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

......

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

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

......

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

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

......

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

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

......

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

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

......

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

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

......

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

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

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

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

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

......

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

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

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

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

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

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

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

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

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

......

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

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

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

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

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:39:47 +01:00
Alejandro Colomar 5ae403a2d4 mlock.2: mlock2(): Fix prototype parameter types
The documented prototype for mlock2() was a mix of the
glibc wrapper prototype and the kernel syscall prototype.
Let's document the glibc wrapper prototype, which is shown below.

......

.../glibc$ grep_glibc_prototype mlock2
sysdeps/unix/sysv/linux/bits/mman-shared.h:55:
int mlock2 (const void *__addr, size_t __length, unsigned int __flags) __THROW;
.../glibc$

function grep_glibc_prototype()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <func>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "(?s)^[^\s#][\w\s]+\s+\**${1}\s*\([\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:37:28 +01:00
Michael Kerrisk 4791875270 execveat.2: srcfix: add a link to glibc bug requesting wrapper
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:35:53 +01:00
Alejandro Colomar 71a25d4c79 execveat.2: Fix prototype
It's been 6 years since execveat(2) was added to the kernel,
and there's still no glibc wrapper.  Let's document the kernel
syscall prototype.

I reported a bug against glibc requesting a wrapper;
when glibc adds the wrapper, this commit should probably be
reverted.

......

.../linux$ grep_syscall execveat
fs/exec.c:2062:
SYSCALL_DEFINE5(execveat,
		int, fd, const char __user *, filename,
		const char __user *const __user *, argv,
		const char __user *const __user *, envp,
		int, flags)
fs/exec.c:2083:
COMPAT_SYSCALL_DEFINE5(execveat, int, fd,
		       const char __user *, filename,
		       const compat_uptr_t __user *, argv,
		       const compat_uptr_t __user *, envp,
		       int,  flags)
include/linux/compat.h:815:
asmlinkage long compat_sys_execveat(int dfd, const char __user *filename,
		     const compat_uptr_t __user *argv,
		     const compat_uptr_t __user *envp, int flags);
include/linux/syscalls.h:980:
asmlinkage long sys_execveat(int dfd, const char __user *filename,
			const char __user *const __user *argv,
			const char __user *const __user *envp, int flags);
.../linux$

function grep_syscall()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.c$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';

	find * -type f \
	|grep '\.[ch]$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^asmlinkage\s+[\w\s]+\**sys_${1}\s*\(.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Glibc bug: <https://sourceware.org/bugzilla/show_bug.cgi?id=27364>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:33:47 +01:00
Alejandro Colomar 56d1311b87 ipc.2: Fix prototype parameter types
The types for some of the parameters are incorrect
(different than the kernel).  Fix them.
Below are shown the types that the kernel uses.

......

.../linux$ grep_syscall ipc
ipc/syscall.c:110:
SYSCALL_DEFINE6(ipc, unsigned int, call, int, first, unsigned long, second,
		unsigned long, third, void __user *, ptr, long, fifth)
ipc/syscall.c:205:
COMPAT_SYSCALL_DEFINE6(ipc, u32, call, int, first, int, second,
	u32, third, compat_uptr_t, ptr, u32, fifth)
include/linux/compat.h:874:
asmlinkage long compat_sys_ipc(u32, int, int, u32, compat_uptr_t, u32);
include/linux/syscalls.h:1221:
asmlinkage long sys_ipc(unsigned int call, int first, unsigned long second,
		unsigned long third, void __user *ptr, long fifth);
.../linux$

function grep_syscall()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.c$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^\w*SYSCALL_DEFINE.\(${1},.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';

	find * -type f \
	|grep '\.[ch]$' \
	|sort -V \
	|xargs pcregrep -Mn "(?s)^asmlinkage\s+[\w\s]+\**sys_${1}\s*\(.*?\)" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:26:49 +01:00
Michael Kerrisk d5ff9ffcdc rpc.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 19:16:43 +01:00
Jonathan Wakely 055811a99e stat.2: Remove <unistd.h> from synopsis
There seems to be no reason <unistd.h> is shown here, so remove it.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-09 13:27:59 +01:00
Michael Kerrisk ba50f49c69 getpriority.2, recv.2, fts.3: wfix
These pages have the odd wording 'the external variable errno',
which does not occur in other pages. Make these pages conform with
the norm.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 12:01:36 +01:00
Michael Kerrisk a23bf7259c ferror.3: POSIX.1-2008: these functions won't change 'errno' if 'stream' is valid
See https://www.austingroupbugs.net/view.php?id=401.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 12:01:36 +01:00
Michael Kerrisk 5b921fc469 ferror.3: Add a RETURN VALUE section
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 11:01:14 +01:00
Michael Kerrisk 15267cb8a1 ferror.3: Remove fileno(3) content that was migrated to new fileno(3) page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 11:01:14 +01:00
Michael Kerrisk acd8a0e37e fileno.3: Split fileno(3) content out of ferror(3) into new page
fileno(3) differs from the other functions in various ways.
For example, it is governed by different standards,
and can set 'errno'. Conversely, the other functions
are about examining the status of a stream, while
fileno(3) simply obtains the underlying file descriptor.
Furthermore, splitting this function out allows
for some cleaner upcoming changes in ferror(3).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-07 11:01:14 +01:00
Michael Kerrisk c9b9a599fc ipc.2: Minor tweak to Alex's patch regarding use of syscall()
Calling ipc() directly would be a rather unusual thing to do,
so add some text to emphasize that point.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:46:48 +01:00
Alejandro Colomar fa646e185f bdflush.2, capget.2, get_mempolicy.2, ipc.2, lookup_dcookie.2, mbind.2, migrate_pages.2: Add notes about missing glibc wrappers
.../glibc$ grep_syscall_wrapper bdflush
.../glibc$ grep_syscall_wrapper capget
.../glibc$ grep_syscall_wrapper capset
.../glibc$ grep_syscall_wrapper get_mempolicy
.../glibc$ grep_syscall_wrapper ipc
.../glibc$ grep_syscall_wrapper lookup_dcookie
.../glibc$ grep_syscall_wrapper mbind
.../glibc$ grep_syscall_wrapper migrate_pages
.../glibc$

function grep_syscall_wrapper()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "(?s)^[^\s#][\w\s]+\s+\**${1}\s*\([\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:45:41 +01:00
Alejandro Colomar 3d18bee298 getsockname.2: Use restrict in prototypes
POSIX specifies that the 2nd and 3rd parameters to getsockname()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_syscall_wrapper getsockname
socket/sys/socket.h:116:
extern int getsockname (int __fd, __SOCKADDR_ARG __addr,
			socklen_t *__restrict __len) __THROW;
.../glibc$ grep -rn '# *define __SOCKADDR_ARG'
socket/sys/socket.h:58:
 # define __SOCKADDR_ARG		struct sockaddr *__restrict
.../glibc$

function grep_syscall_wrapper()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "(?s)^[^\s#][\w\s]+\s+\**${1}\s*\([\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:39:59 +01:00
Alejandro Colomar 1b213b4fa4 gettimeofday.2: Use restrict in prototypes
POSIX specifies that the parameters of gettimeofday() shall be
'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_syscall_wrapper gettimeofday
time/sys/time.h:66:
extern int gettimeofday (struct timeval *__restrict __tv,
			 void *__restrict __tz) __THROW __nonnull ((1));
.../glibc$

function grep_syscall_wrapper()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "(?s)^[^\s#][\w\s]+\s+\**${1}\s*\([\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:38:53 +01:00
Alejandro Colomar eaaa85c17c getitimer.2: Use restrict in prototypes
POSIX specifies that the 2nd and 3rd parameters to setitimer()
shall be 'restrict'.  Glibc uses 'restrict' too.
Let's use it here too.

......

.../glibc$ grep_syscall_wrapper setitimer
time/sys/time.h:129:
extern int setitimer (__itimer_which_t __which,
		      const struct itimerval *__restrict __new,
		      struct itimerval *__restrict __old) __THROW;
.../glibc$

function grep_syscall_wrapper()
{
	if ! [ -v 1 ]; then
		>&2 echo "Usage: ${FUNCNAME[0]} <syscall>";
		return ${EX_USAGE};
	fi

	find * -type f \
	|grep '\.h$' \
	|sort -V \
	|xargs pcregrep -Mn \
	  "^[^\s][\w\s]+\s+\**${1}\s*\((?s)[\w\s()[\]*,]*?(...)?\)[\w\s()]*;" \
	|sed -E 's/^[^:]+:[0-9]+:/&\n/';
}

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:37:34 +01:00
Alejandro Colomar cb4baea939 epoll_wait.2: srcfix: glibc doesn't provide epoll_pwait2() yet
I filed a bug against glibc
requesting the wrapper for the new syscall.

Glibc bug: <https://sourceware.org/bugzilla/show_bug.cgi?id=27359>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 21:34:45 +01:00
Michael Kerrisk b926779b33 getgid.2, getuid.2: Note that these interfaces never modify 'errno'
See https://www.austingroupbugs.net/view.php?id=511
and the POSIX.1-2008 specifications of the interfaces.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 10:38:57 +01:00
Michael Kerrisk bdd65639ba setbuf.3: POSIX doesn't require to errno to be unchanged after successful setbuf()
See https://www.austingroupbugs.net/view.php?id=397#c799

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 10:26:43 +01:00
Michael Kerrisk c7c869e66d setbuf.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-06 10:19:25 +01:00
Alejandro Colomar 2a8c925ba8 s390_guarded_storage.2: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-04 22:36:46 +01:00
Michael Kerrisk 3aac0708a9 process_madvise.2: Restructure the text in DESCRIPTION a little
The 'advice' subsection fell in the middle of other text in the
DESCRIPTION, which is a little confusing. Instead, move that
subsection to the end of the DESCRIPTION, and make some other
minor text reorganization so that related details are placed in
the same paragraphs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-02 11:43:15 +01:00
Michael Kerrisk e3ce016472 process_madvise.2: Minor edits to Suren Baghdasaryan's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-02 11:43:15 +01:00
Michael Kerrisk 81ec67d804 madvise.2: SEE ALSO: add process_madvise(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-02 11:43:15 +01:00
Michael Kerrisk 790593b4ae pidfd_open.2: Note the process_madvise(2) use case for PID file descriptors
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-02 11:43:15 +01:00
Suren Baghdasaryan a144f458ba process_madvise.2: Document process_madvise(2)
Initial version of process_madvise(2) manual page. Initial text
was extracted from [1], amended after fix [2] and more details
added using man pages of madvise(2) and process_vm_readv(2) as
examples. It also includes the changes to required permission
proposed in [3].

[1] https://lore.kernel.org/patchwork/patch/1297933/
[2] https://lkml.org/lkml/2020/12/8/1282
[3] https://patchwork.kernel.org/project/selinux/patch/20210111170622.2613577-1-surenb@google.com/#23888311

Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Reviewed-by: Michal Hocko <mhocko@suse.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-02 11:43:00 +01:00
Dmitry Vorobev 04f20d64e0 malloc_trim.3: Remove mention of free() call
'malloc_trim' was and is never called from the 'free' function.
see related bug in glibc tracker:
https://sourceware.org/bugzilla/show_bug.cgi?id=2531. or
'__int_free' function. Only the top part of the heap is trimmed
after some calls to 'free', which is different from 'malloc_trim'
which also releases memory in between chunks from all the
arenas/heaps.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-02-01 13:05:30 +01:00
Michael Kerrisk fecb03bc50 environ.7: Minor tweaks to Bastien's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 14:34:54 +01:00
Bastien Roucariès 26dc4876ef environ.7: Reorder the text
Move the the text describing how to set environment variable before
the list(s) of variables in order to improve readability.

[mtk: rewrote commit message]

Signed-off-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 14:30:10 +01:00
Michael Kerrisk 7ec45f6276 environ.7: Note the default if PAGER is not defined
Reported-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 13:25:25 +01:00
Michael Kerrisk bd70fd2e6d environ.7: ffix + tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 13:21:49 +01:00
Michael Kerrisk 241b015a62 environ.7: Various edits to Bastien Roucariès's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:55:14 +01:00
Bastien Roucariès 37147e18b6 environ.7: Document that HOME, LOGNAME, SHELL, USER are set at login time
Clearly document that HOME, LOGNAME, SHELL and USER are set at
login time by a program like such as login(1).

Document also that using su could result in a mixed environment,
and point to the su(1) manual page.

[mtk: edited commit message]

Signed-off-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:55:07 +01:00
Michael Kerrisk b6cb76fb6a environ.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:44:13 +01:00
Michael Kerrisk 5cf53bcf1a environ.7: Improve the description of PATH
Add more details of how PATH is used, and mention the legacy
use of an empty prefix.

Changed after a suggested patch by Bastien Roucariès.

Reported-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:36:08 +01:00
Michael Kerrisk 95d690a249 environ.7: wfix in description of PATH
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:21:34 +01:00
Michael Kerrisk d0281fa3d0 time.1: wfix: remove crufty sentence
Remove a sentence that should have been removed in
commit f0e173d681.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-30 08:10:56 +01:00
Michael Kerrisk f2a4cb6592 tmpfile.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-29 13:34:09 +01:00
Michael Kerrisk db6bce7c06 netdevice.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 21:14:17 +01:00
Pali Rohár 1af219093e netdevice.7: Update documentation for SIOCGIFADDR SIOCSIFADDR SIOCDIFADDR
Unlike SIOCGIFADDR and SIOCSIFADDR which are supported by many
protocol families, SIOCDIFADDR is supported by AF_INET6 and
AF_APPLETALK only.

Unlike other protocols, AF_INET6 uses struct in6_ifreq.

Cc: Dmitry V. Levin <ldv@altlinux.org>
Cc: <netdev@vger.kernel.org>
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 21:12:42 +01:00
Alejandro Colomar ff822ed193 man-pages.7: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 21:11:00 +01:00
Michael Kerrisk c75cdeb4ce uri.7: tfix (logical quoting style)
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:59:34 +01:00
Michael Kerrisk 2775c77783 man.7: tfix (logical quoting style)
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:59:30 +01:00
Michael Kerrisk a9b03562b0 rcmd.3: tfix (logical quoting style)
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:56:01 +01:00
Michael Kerrisk 1543da430a shmget.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:10:42 +01:00
Michael Kerrisk 09c6d6ca72 access.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:10:10 +01:00
Michael Kerrisk 02576fcb1c mmap.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 14:08:52 +01:00
Jakub Wilk 384a1bb256 man-pages.7: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:50:30 +01:00
Michael Kerrisk d810c8199e environ.7: Minor tweaks to Bastien's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:11:06 +01:00
Bastien Roucariès 2768c48107 environ.7: Document convention of string in environ
Document the name=value system and that nul byte is forbidden.

Signed-off-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:11:06 +01:00
Michael Kerrisk 7939275a0a environ.7: Minor fixes to Bastien's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:11:06 +01:00
Bastien Roucariès 5b4da4c3fd environ.7: Add see also ld.so(8) for LD_ variables
Signed-off-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:11:06 +01:00
Michael Kerrisk a079bfc955 environ.7: Be a little more precise when discussing 'exec'
Say "execve(2)" instead of "exec(3)", and note that this step
starts a new program (not a new process!).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:11:06 +01:00
Michael Kerrisk fc0bcf3cfe environ.7: Relocate and reword the mention of _GNU_SOURCE
Using _GNU_SOURCE to obtain the declaration of 'environ' is
nonstandard. Therefore, move the mention of this detail to NOTES.
At the same time, add a few words proposed by Bastien.

Cowritten-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-28 12:10:52 +01:00
Michael Kerrisk 0efacbdd86 man-pages.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-25 16:37:30 +01:00
Michael Kerrisk fa28110cc9 man-pages.7: Add a FORMATTING AND WORDING CONVENTIONS section
In man-pages-5.11, a large number of pages were edited to achieve
greater consistency in the SYNOPIS, RETURN VALUE and ATTRIBUTES
sections. To avoid future inconsistencies, try to capture some of
the preferred conventions in text in man-pages(7).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-25 16:31:58 +01:00
Pali Rohár bc766f2c0c sock_diag.7: Fix recvmsg() usage in the example
The msg_name field for recvmsg() call points to a caller-allocated buffer
nladdr that is used to return the source address of the (netlink) socket.

As recvmsg() does not read this buffer and fills it for a caller, do not
initialize it and instead check its value in the example.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-25 08:01:56 +01:00
Jakub Wilk 29dee4ce10 semget.2, shm_open.3: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 23:33:35 +01:00
Alejandro Colomar 27fce38a2a random.3: srcfix: Don't break proper names into different lines
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 23:32:44 +01:00
Alejandro Colomar 48c3ffa776 kexec_load.2: srcfix: Don't break a line that doesn't get past the right margin
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 23:31:41 +01:00
Jakub Wilk 69a0ed3a21 MAINTAINER_NOTES: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 23:30:51 +01:00
Alejandro Colomar 8b55111d74 fopencookie.3: wsfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-24 15:51:58 +01:00
Michael Kerrisk fb0d03d11c uri.7: Note that 'logical' quoting is the norm in Europe
Drop the reference to the Hacker Writing Guide (and the broken URL)
and simply note that the logical quoting style is the norm in
European languages also.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-23 10:04:55 +01:00
Michael Kerrisk fe1ab0bcc9 man-pages.7: Note some rationale for the use of real minus signs
See:
https://lore.kernel.org/linux-man/20210121061158.5ul7226fgbrmodbt@localhost.localdomain/
    From: "G. Branden Robinson" <g.branden.robinson@gmail.com>
    Cc: linux-man <linux-man@vger.kernel.org>, groff@gnu.org
    Subject: Re: Escaping hyphens ("real" minus signs in groff)
    Date: Thu, 21 Jan 2021 17:12:00 +1100

and also groff_char(7).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 12:10:36 +01:00
Michael Kerrisk cd415e7364 Various pages: use "\-" to generate real minus in circumstances where appropriate
Use \- for math formulas, pathnames, manual page cross references,
etc.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:53:59 +01:00
Michael Kerrisk 57c230fdfe inotify.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:46:28 +01:00
Michael Kerrisk 3fa9299861 mq_overview.7: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:29:14 +01:00
Michael Kerrisk b49c2acb42 Various pages: use real minus signs in pathnames
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:29:14 +01:00
Michael Kerrisk 694d07544e confstr.3: ffix: Use real minus sign inside a string
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:29:14 +01:00
Michael Kerrisk d064d41a4b Various pages: Inside code blocks (.EX/.EE) use \- to get real minus signs
A real minus can be cut and pasted...

THere are a few exceptions that gave been excluded in the this
change.  For example, where there' is a string such as "<p1-name>",
where p1-name is soome sort of pseudo-identifier.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-21 10:29:14 +01:00
Alessandro Bono d5de9d1dc5 fread.3: Swap size and nmemb params
It works both way, but this one feels more right. We are reading
four elements sizeof(*buffer) bytes each.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 21:30:43 +01:00
Michael Kerrisk c43f976fd8 mount.2: Note that the 'data' argument can be NULL
Verified from reading the kernel source and looking at the source
of mount(8). Surprisingly, this has not documented after so many
years.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 13:12:33 +01:00
Enke Chen 1942e41202 tcp.7: Documentation revision for TCP_USER_TIMEOUT
mtk: Enke later noted that this patch provides better documentation
of longstanding behavior (rather documenting a change in behavior).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 13:12:19 +01:00
Alejandro Colomar a3377dcec6 circleq.3: Fix CIRCLEQ_LOOP_*() return type
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 09:52:57 +01:00
Bastien Roucariès 67d876899e environ.7: Document valid values of pathnames for SHELL, PAGER and EDITOR/VISUAL
The environ(7) man page says:

       SHELL  The pathname of the user's login shell.

       PAGER  The user's preferred utility to display text files.

       EDITOR/VISUAL
              The user's preferred utility to edit text files.

but doesn't say whether the pathnames must be absolute or they can
be resolved using $PATH, or whether they can have options.

Note that at least for SHELL, this is not specified by POSIX.
This issue was raised in the Austin Group mailing-list, and the
answer is that "what constitutes a valid value for a platform
should be documented" [1].

Since OpenSSH assumes that $SHELL is an absolute pathname (when
set), it is supposed that the documentation should be:

       SHELL  The absolute pathname of the user's login shell.

For PAGER, POSIX says: "Any string acceptable as a command_string
operand to the sh -c command shall be valid."

For EDITOR, it does not need to be an absolute pathname since
POSIX gives the example:

  EDITOR=vi fc

and since it is specified as "the name of a utility", It assumes
that arguments (options) must not be provided. Page 3013 about
"more", it is said: "If the last pathname component in EDITOR is
either vi or ex, [...]", thus again, it is assumed to be a
pathname.

For VISUAL, POSIX says: "Determine a pathname of a utility to
invoke when the visual command [...]", thus it is also a pathname.
It is not clear whether the pathname must be absolute, but for
consistency with EDITOR, it will be resolved using $PATH.

[1] https://www.mail-archive.com/austin-group-l@opengroup.org/msg01399.html

Reported-by: Vincent Lefevre <vincent@vinc17.net>
Signed-off-by: Bastien Roucaries <rouca@debian.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-20 09:45:37 +01:00
Michael Kerrisk cb7cb64877 man-pages.7: Document "acknowledgement" as the preferred spelling
When I inherited man-pages in 2004, it was a hodge-podge mix of
American vs British spelling. My native spelling is the latter,
but I value consistency and felt that things needed to be
standardized on one or other, and in computing, American is the
norm so that is what I settled on.

Among the changes was the substitution of various instances
of "acknowledgement" for "acknowledgment". The latter spelling is
not one I care for, but I believed it to be the American norm.

Alex Colomar proposed a patch to change the spelling back
to "acknowledgement", and some discussion and investigation
ensued, whereby I learned the following:

* The situation is not clear cut.

* Historically, "acknowledgment" was the norm in British English,
  but was eclipsed by "acknowledgement" some decades ago.

* Even in American English, "acknowledgment" is not universal,
  and "acknowledgement" has become more common in recent decades
  (although it still remains minority usage) [2].

* The BSD license uses "acknowledgement" even though it was
  (presumably) written in California.

* The POSIX standard uses "acknowledgement".

* The Debian BTS uses "acknowledgement".

* Looking at a corpus of manual pages from various systems
  that I have assembled over the years, "acknowledgement" seems
  a little more common than "acknowledgment".

Summary: the situation is not clear cut, but let's follow BSD,
POSIX, and the personal preference of the man-pages maintainers.

[1] https://books.google.com/ngrams/graph?content=acknowledgment%2Cacknowledgement&year_start=1800&year_end=2019&corpus=29&smoothing=3#

[2] https://books.google.com/ngrams/graph?content=acknowledgment%2Cacknowledgement&year_start=1800&year_end=2000&corpus=5&smoothing=3&

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-19 10:24:06 +01:00
Alejandro Colomar daff5a6686 netlink.7, tcp.7: Spelling fix: s/acknowledgment/acknowledgement/
Signed-off-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-19 10:17:16 +01:00
Johannes Wellhöfer 2a1b1111ca clone.2: tfix
For the alternate signal stack to be cleared, CLONE_VM should and
CLONE_VFORK should not be specified.

[mtk: fixes my commit 52e5819c41]

Signed-off-by: Johannes Wellhöfer <johannes.wellhofer@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-19 08:54:41 +01:00
Jakub Wilk cf14bdbde1 cacheflush.2: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-18 16:58:48 +01:00
Jakub Wilk 22206f7dac pipe.7: tfix
Escape hyphens in pathnames, as per man-pages(7)

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-18 16:41:42 +01:00
Michael Kerrisk 91c6bf1ce9 system.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-18 16:34:52 +01:00
Alejandro Colomar 4797383171 system.3: Document bug and workaround when the command name starts with a hypen
man-pages bug: 211029
 https://bugzilla.kernel.org/show_bug.cgi?id=211029

Complete workaround example
(it was too long for the page, but it may be useful here):

......

$ sudo ln -s -T /usr/bin/echo /usr/bin/-echo;
$ cc -o system_hyphen -x c - ;
#include <stdlib.h>

int
main(void)
{
    system(" -echo Hello world!");
    exit(EXIT_SUCCESS);
}

$ ./system_hyphen;
Hello world!

Reported-by: Ciprian Dorin Craciun <ciprian.craciun@gmail.com>
Cc: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-18 16:33:34 +01:00
Pali Rohár 169db9487b netlink.7: Fix minimal Linux version for NETLINK_CAP_ACK
NETLINK_CAP_ACK option was introduced in commit 0a6a3a23ea6e which first
appeared in Linux version 4.3 and not 4.2.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-17 21:55:12 +01:00
Pali Rohár 7c978d1801 rtnetlink.7: Remove IPv4 from description
rtnetlink is not only used for IPv4

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-17 21:55:12 +01:00
Alyssa Ross 0218166754 ulimit.3: tfix
The parentheses here make it look like a function rather than a
command.

This was a typo introduced by a script-assisted global edit.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-17 21:55:12 +01:00
Alejandro Colomar d51b60ac01 execveat.2: Normalize notes about missing wrappers
It's been a long time sine kernel 3.19.
There's still no glibc wrapper.

......

$ grep -rn 'execveat *(' glibc/
$

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-17 21:55:12 +01:00
Alejandro Colomar d75c2ffe21 cacheflush.2: Update SYNOPSIS for glibc wrapper
Glibc uses 'void *' instead of 'char *'.
And the prototype is declared in <sys/cachectl.h>.

......

$ syscall='cacheflush';
$ ret='int';
$ find glibc/ -type f -name '*.h' \
  |xargs pcregrep -Mn "(?s)^[\w\s]*${ret}\s*${syscall}\s*\(.*?;";
glibc/sysdeps/unix/sysv/linux/nios2/sys/cachectl.h:27:
extern int cacheflush (void *__addr, const int __nbytes, const int __op) __THROW;
glibc/sysdeps/unix/sysv/linux/mips/sys/cachectl.h:35:
extern int cacheflush (void *__addr, const int __nbytes, const int __op) __THROW;
glibc/sysdeps/unix/sysv/linux/arc/sys/cachectl.h:30:
extern int cacheflush (void *__addr, int __nbytes, int __op) __THROW;
glibc/sysdeps/unix/sysv/linux/csky/sys/cachectl.h:30:
extern int cacheflush (void *__addr, const int __nbytes,
		       const int __op) __THROW;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-17 21:55:12 +01:00
Michael Kerrisk f199762139 crypt.3: Update crypt() FTM requirements to note glibc 2.28 changes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-15 23:38:14 +01:00
Michael Kerrisk d7200ac321 crypt.3: Reformat FTM info (in preparation for next patch)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-15 23:33:07 +01:00
Michael Kerrisk 5efa68d57d epoll_wait.2: Minor tweaks to Willem de Bruijn's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-12 08:19:51 +01:00
Willem de Bruijn ba47eb5e3c epoll_wait.2: Add documentation of epoll_pwait2()
Expand the epoll_wait() page with epoll_pwait2(), an epoll_wait()
variant that takes a struct timespec to enable nanosecond
resolution timeout.

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-12 08:07:56 +01:00
Valentin Kettner e71d103b2c clone.2: Fix types in clone_args
A file descriptor is an int so it should be stored through an int
pointer while parent_tid should have the same type as child_tid
which is pid_t pointer.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-11 09:17:47 +01:00
Alejandro Colomar da116d481b malloc.3: Document that realloc(p, 0) is specific to glibc and nonportable
A more detailed notice is on realloc(3p).

......

$ man 3p realloc \
  |sed -n \
     -e '/APPLICATION USAGE/,/^$/p' \
     -e '/FUTURE DIRECTIONS/,/^$/p';
APPLICATION USAGE
       The description of realloc() has been modified from  pre‐
       vious  versions  of  this  standard  to  align  with  the
       ISO/IEC 9899:1999 standard. Previous versions  explicitly
       permitted  a  call  to  realloc(p,  0)  to free the space
       pointed to by p and return a null pointer. While this be‐
       havior  could be interpreted as permitted by this version
       of the standard, the C language committee have  indicated
       that   this  interpretation  is  incorrect.  Applications
       should assume that if realloc() returns a  null  pointer,
       the  space pointed to by p has not been freed. Since this
       could lead to double-frees, implementations  should  also
       set errno if a null pointer actually indicates a failure,
       and applications should only free the space if errno  was
       changed.

FUTURE DIRECTIONS
       This  standard  defers  to the ISO C standard. While that
       standard currently has language that might  permit  real‐
       loc(p, 0), where p is not a null pointer, to free p while
       still returning a null pointer, the committee responsible
       for  that standard is considering clarifying the language
       to explicitly prohibit that alternative.

Bug: 211039 <https://bugzilla.kernel.org/show_bug.cgi?id=211039>
Reported-by: Johannes Pfister <johannes.pfister@josttech.ch>
Cc: libc-alpha@sourceware.org
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 09:18:22 +01:00
Alejandro Colomar ccca30c230 Various pages: srcfix: Remove redundant .PP
.PP are redundant just after .SH or .SS.
Remove them.

$ find man? -type f \
  |xargs sed -i '/^\.S[HS]/{n;/\.PP/d}';

Plus a couple manual edits.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 09:15:48 +01:00
Michael Kerrisk dc9cadc1c2 Revert "stailq.3, utmp.5, time_namespaces.7: srcfix: remove redundant .PP"
Do this in order to apply a better patch from Alex Colomar.

This reverts commit f7fc28f97a.
2021-01-10 09:15:12 +01:00
Michael Kerrisk a60e8c598e xcrypt.3: srcfix: use .PP rather than .LP
.LP is equivalent .PP, but the latter is what is used
throughout man-pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 08:59:28 +01:00
Michael Kerrisk 7c2838715f shm_open.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 08:59:28 +01:00
Michael Kerrisk f7fc28f97a stailq.3, utmp.5, time_namespaces.7: srcfix: remove redundant .PP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-10 08:59:28 +01:00
Michael Kerrisk feaef5f266 getfsent.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 22:43:31 +01:00
Michael Kerrisk 0a23e9aac0 mprotect.2, readv.2, sigaltstack.2, sigreturn.2, ctime.3, scandir.3, random.4, pkeys.7: ffix: s/-1/\-1/
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 22:08:50 +01:00
Michael Kerrisk 9fd0c2f252 mlock.2: CONFORMING TO: note more explicitly which APIs are in the standards
The current wording is a little unclear...

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 20:57:09 +01:00
Michael Kerrisk 45e399e7f8 alloc_hugepages.2: CONFORMING TO: reword to reflect that these system calls are long gone
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 20:52:49 +01:00
Michael Kerrisk e4c07f6482 epoll_create.2: CONFORMING TO: mention also that epoll_create1() is Linux-specific
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 20:49:43 +01:00
Michael Kerrisk f7f02d0f8d epoll_wait.2: CONFORMING TO: mention also that epoll_pwait() is Linux-specific
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 20:47:47 +01:00
Michael Kerrisk 3d81c05a79 time.1, ioctl_console.2, daemon.3, updwtmp.3, mouse.4, smartpqi.4: tfix (Oxford comma)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 12:53:15 +01:00
Michael Kerrisk 5473bd6687 smartpqi.4: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 12:46:55 +01:00
Michael Kerrisk 36dce68747 open.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 12:30:48 +01:00
Michael Kerrisk 031115a52c inode.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:55:03 +01:00
Michael Kerrisk 3ded684c1a Various pages: tfix (Oxford comma)
Found using:

    git grep -lE '^[^.].*,.*,.*[^,] (and|or)\>'

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:15:26 +01:00
Michael Kerrisk 12325c3856 suffixes.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:15:26 +01:00
Michael Kerrisk 6b67fcc064 tailq.3: srcfix: remove redundant .PP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:15:22 +01:00
Michael Kerrisk 735334d454 Various pages: tfix (Oxford comma)
Discovered using:

    git grep -lE '^[^.].*, [^ ]*[^,] (or|and)\>'

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 11:02:33 +01:00
Michael Kerrisk 61eaa18945 round.3: wsfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:45:38 +01:00
Michael Kerrisk 2ddebe1a77 circleq.3, list.3, slist.3, stailq.3, queue.7: tfix (Oxford comma)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:41:55 +01:00
Michael Kerrisk 31e9088393 encrypt.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:35:56 +01:00
Michael Kerrisk e8d28f7cc9 ioctl_fslabel.2, ioctl_fideduperange.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:34:46 +01:00
Michael Kerrisk f2fa055834 ioctl_console.2, msgctl.2, msgget.2, msgop.2, semctl.2, semget.2, semop.2, shm_open.3, shmget.2, shmop.2: ERRORS: remove redundant statement that 'errno' is set
This is implied in every other manual page. There is no need to
state it explicitly in these pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:21:57 +01:00
Michael Kerrisk d9b17b7371 semget.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 10:14:48 +01:00
Michael Kerrisk 73b81e53fe write.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 09:59:10 +01:00
Michael Kerrisk 2df7ea6cd8 getsid.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 09:57:41 +01:00
Michael Kerrisk 95887a0039 clone.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 09:51:59 +01:00
Michael Kerrisk 402f955e66 setlocale.3: Restructure a particularly difficult sentence
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Reported-by: Bruno Haible <bruno@clisp.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 09:44:09 +01:00
Michael Kerrisk 2c916a1d3c Various pages: Remove redundant "\\ " to escape spaces
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 13:42:27 +01:00
Michael Kerrisk 51ebfb92a9 keyctl.2: wfix
Fix a glitch in commit ff91beca5b.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 10:06:35 +01:00
Alejandro Colomar b47ee0ab7b msr.4, veth.4, packet.7, sched.7, unicode.7: Remove redundant .PP
.PP and .IP are redundant just before .SH or .SS.
Remove them.

$ find man? -type f \
  |xargs sed -i '/^\.[IP]P$/{N;s/.*\n\(\.S[HS]\)/\1/}';

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 09:58:28 +01:00
Alejandro Colomar aa0da2b9b1 Various pages: tfix: Use Oxford comma
Found using:
$ pcregrep -rnM "^\.[B|I]R .*,\n\.[B|I].*[^,]\nor" man? \
  |grep ^man \
  |sort;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 09:57:24 +01:00
Alejandro Colomar 03659d7d46 close.2, getpriority.2, ioctl_userfaultfd.2, expm1.3, lio_listio.3, rcmd.3, lirc.4, mount_namespaces.7: tfix: Fix punctuation
Found using:
$ pcregrep -rnM '^..[^"].*[^.]\.\n[a-z]' man?

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-08 09:55:25 +01:00
Yang Xu 43ebbd1925 semctl.2: Correct SEM_STAT_ANY description
Since kernel commit a280d6dc77eb
("ipc/sem: introduce semctl(SEM_STAT_ANY)"),
it only skips read access check when using SEM_STAT_ANY command.
And it should use the semid_ds struct instead of seminfo struct.
Fix this.

Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Acked-by: Manfred Spraul <manfred@colorfullife.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk 8c7307e8c6 rcmd.3: wfix (errno)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk e46baa4443 wait.2: Minor wording fixes in RETURN VALUE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk a8a93e8a5a sched_setaffinity.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk 2ae5c63aed epoll_wait.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk a084d8168c cacheflush.2: wfix (errno)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk 89fc988bd5 adjtimex.2: wfix (errno)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:14 +01:00
Michael Kerrisk 7a6227d368 Various pages: Various improvements in wording in RETURN VALUE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:29:00 +01:00
Michael Kerrisk 9862ec0c5c Various System V IPC pages: Improve wording describing RETURN VALUE and setting of 'errno'
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:28:40 +01:00
Michael Kerrisk cb6a894ee7 Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, miscellaneous descriptions of the setting
of 'errno' are reworded to the norm of "is set to indicate
the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:51 +01:00
Michael Kerrisk c112329ffe Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, reword various cases saying that 'errno' is set
"appropriately" to "is set to indicate the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:51 +01:00
Michael Kerrisk f6a4078be5 Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, fix some instances stating that 'errno' is set
"appropriately" to instead say "to indicate the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:35 +01:00
Michael Kerrisk 855d489a7f Various pages: Standardize wording around setting of 'errno' on error
In the RETURN VALUE sections, a number of different wordings
are used in to describe the fact that 'errno' is set on error.
There's no reason for the difference in wordings, since the same
thing is being described in each case. Switch to a standard
wording that is the same as FreeBSD and similar to the wording
used in POSIX.1.

In this change, "to indicate the cause of the error"
is changed to "to indicate the error".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:27 +01:00
Michael Kerrisk 3cf2958737 wordexp.3: Minor wording fixes in RETURN VALUE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:02 +01:00
Michael Kerrisk 30b0d8d97e memusage.1: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:02 +01:00
Michael Kerrisk a077147b0a chroot.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:02 +01:00
Michael Kerrisk 2aec4ef8f5 ioctl_tty.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 14:27:02 +01:00
Michael Kerrisk 2858b5b5ef ioctl_tty.2: Reformat argument type information
The current mark-up renders poorly. To resolve this, move
the type information into a separate line.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 00:05:48 +01:00
Michael Kerrisk 6d1a711b69 netlink.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 00:05:48 +01:00
Michael Kerrisk 0b174fe008 clone.2, ioctl_tty.2, syslog.2, setlocale.3, stdio.3, console_codes.4, inode.7, namespaces.7, netlink.7, signal-safety.7, socket.7: Better table formatting
In particular, allow for rendering in widths different from
(especially less than) 80 columns.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-07 00:05:48 +01:00
Michael Kerrisk 30e3e116bb syscalls.2: ffix: Improve table formatting
Allow more text wrapping in the Notes column

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 15:28:02 +01:00
Michael Kerrisk 0ab815e900 man-pages.7: ffix: don't fill text in tables
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 15:06:06 +01:00
Michael Kerrisk 29b18c3946 slist.3: tfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:53:34 +01:00
Michael Kerrisk 9d281e06da Various pages: add missing .nf/.fi in FTM info
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk 422d5327a8 rcmd.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk 5c10d2c5e2 Various pages: Remove redundant escaping of space characters in FTM info
Since we are using .nf/.fi to bracket FTM info, escaping
space characters serves no space and clutters the source.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk 2bafc702d0 fsync.2: srcfix: add missing ./f/.fi in FTMs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk 5979710fc5 wait4.2: ffix (Make FTM text narrower)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Alejandro Colomar 554afbe862 circleq.3, list.3, slist.3, stailq.3, tailq.3: Improve readability, especially in SYNOPSIS
- Group macros by kinds.
- Align so that it's easiest to distinguish differences
  between related macros.
  (Align all continuations for consistency on PDF.)
- Fix minor typos.
- Remove redundant text:
    'The macro xxx() ...':
        The first paragraph already says that these are macros.
    'circular|tail|... queue':
        Don't need to repeat every time.
        Generic text makes it easier to spot the differences.
- Fit lines into 78 columns.
- Reorder descriptions to match SYNOPSIS,
  and add subsections to DESCRIPTION.
- srcfix: fix a few semantic newlines.

I noticed a bug which should be fixed next:
CIRCLEQ_LOOP_*() return a 'struct TYPE *'.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
John Morris 076fbe0613 resolv.conf.5: tfix
Change `RES_USE_EDNSO` to `RES_USE_EDNS0`, defined in
`resolv.h`.  (This is written correctly in `man3/resolver.3` in this
same repo.)  Helps with grepping and internet searches!

Signed-off-by: John Morris <john@zultron.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk b32feea59e Various pages: Formatting tweaks after "Improve formatting in ATTRIBUTES"
Various ATTRIBUTES table improvements following the previous
commit. In particular, make use of T{...T} to allow wrapping
in table cells that have a lot of text.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:44 +01:00
Michael Kerrisk c466875ecd Various pages: Improve formatting in ATTRIBUTES
Make the formatting more consistent inside the tables in the
ATTRIBUTES sections. Make the source code more uniform; in
particular, eliminate the use of custom tweaks using
'lbwNN'/'lwNN' and .br macros.  In addition, ensure that
hyphenation and text justification do not occur inside the tables.

This is a script-driven edit:

[[
PAGE_LIST=$(git grep -l 'SH ATTRIBUTES' man[23])

# Strip out any preexisting .sp/.br/.ad macros

sed -i '/SH ATTR/,/^\.SH/{/^\.sp/d; /^\.br/d; /\.ad/d}' $PAGE_LIST

# Eliminate any use of 'wNN' in tables; default first column
# to fill unused space

sed -i '/SH ATTR/,/^\.SH/s/lbw[0-9]*/lb/g' $PAGE_LIST
sed -i '/SH ATTR/,/^\.SH/s/lw[0-9]*/l/g' $PAGE_LIST
sed -i '/SH ATTR/,/^\.SH/s/^lb /lbx /' $PAGE_LIST

# Nest the tables inside ".ad l"+".nh" and ".hy"+".ad"+".sp 1"
# ".ad l" ==> no right justification of text in table cells
# ".nh" ==> No hyphenation in table cells
# ".sp 1" ==> ensure a blank line before the next section heading

sed -i '/SH ATTR/,/^\.SH/{/\.TS/i.ad l\n.nh
}'  $PAGE_LIST
sed -i '/SH ATTR/,/^\.SH/{/\.TE/a.hy\n.ad\n.sp 1
}'  $PAGE_LIST

# In a few of the tables, the third column has a lot of text, so
# make that column wide (rather than the first column)

sed -i '/^lbx/{s/lbx/lb/;s/lb$/lbx/}' \
        man3/bindresvport.3 \
        man3/fmtmsg.3 man3/gethostbyname.3 man3/getlogin.3 \
        man3/getnetent.3 man3/getprotoent.3 man3/getpwent.3 \
        man3/getservent.3 man3/getspnam.3 man3/getutent.3 man3/glob.3 \
        man3/login.3 \
        man3/setnetgrent.3 \
        man3/wordexp.3
]]

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 13:46:39 +01:00
Michael Kerrisk daaf6d327b getlogin.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 10:32:26 +01:00
Michael Kerrisk 365a3f2919 man-pages.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-06 10:20:50 +01:00
Michael Kerrisk f2667a7212 Various pages: Use internally consistent continuation indents in SYNOPSIS
In the SYNOPSIS, a long function prototype may need to be
continued over to the next line. The continuation line is
indented according to the following rules:

1. If there is a single such prototype that needs to be continued,
   then align the continuation line so that when the page is
   rendered on a fixed-width font device (e.g., on an xterm) the
   continuation line starts just below the start of the argument
   list in the line above.  (Exception: the indentation may be
   adjusted if necessary to prevent a very long continuation line
   or a further continuation line where the function prototype is
   very long.)

   Thus:

       int tcsetattr(int fd, int optional_actions,
                     const struct termios *termios_p);

2. But, where multiple functions in the SYNOPSIS require
   continuation lines, and the function names have different
   lengths, then align all continuation lines to start in the
   same column.  This provides a nicer rendering in PDF output
   (because the SYNOPSIS uses a variable width font where
   spaces render narrower than most characters).

   Thus:

       int getopt(int argc, char * const argv[],
                  const char *optstring);
       int getopt_long(int argc, char * const argv[],
                  const char *optstring,
                  const struct option *longopts, int *longindex);

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 20:27:11 +01:00
Michael Kerrisk 96b6532808 stat.2: Move the obsolete _BSD_SOURCE FTM to the end of the FTM info
Since _BSD_SOURCE is obsolete for quite some time now,
it should not be listed as the first FTM for lstat().

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 14:35:55 +01:00
Michael Kerrisk 1dd0d7b4e4 Various pages: ffix: More layout consistency fixes for FTMs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 13:22:01 +01:00
Alejandro Colomar ba2c475246 futex.2, syscalls.2, vmsplice.2, bpf-helpers.7: wfix: Write consistently 'user space' instead of 'userspace'
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 12:48:33 +01:00
Michael Kerrisk 72af9e8351 fseeko.3: Move info about obsolete FTM from SYNOPSIS to NOTES
This makes the SYNOPSIS more consistent with other pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk cc4423f732 j0.3, strerror.3, y0.3: wspfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk 58a6844d20 brk.2, chmod.2, gethostname.2, setpgid.2, wait4.2, atoi.3, fwide.3, getlogin.3, printf.3, strtoul.3, wprintf.3: Consistency fix-up in FTMs
Generally, place '||' at start of a line, rather than the end of
the previous line.

Rationale: this placement clearly indicates that that each piece
is an alternative.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk 16fe373c85 qecvt.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk b15b92a585 fsync.2, gethostname.2, stat.2, getutent.3: Minor consistency clean-ups in FTMs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:22 +01:00
Michael Kerrisk 9d2adbae20 Various pages: Simplify mark-up for Feature Test Macro requirements
Different source styles are used in different pages to achieve the
same formatted output, and in some cases the source mark-up is a
rather convoluted combination of .RS/.RE/.TP/.PD macros. Simplify
this greatly, and unify all of the pages to use more or less the
same source code style. This makes the source code rather easier
to read, and may simplify future scripted global changes.

The feature test macro info is currently bracketed by .nf/.fi
pairs. This is not strictly necessary (i.e., it makes no
difference to the rendered output), but for the moment we keep
these "brackets" in case they may be replaced with something else.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-05 11:01:01 +01:00
Michael Kerrisk 1a412fc5cb gethostid.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 16:27:45 +01:00
Michael Kerrisk e36f10f91d Various pages: replace '.ad b' macro with '.ad'
Verified no change in rendered output

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 16:25:50 +01:00
Michael Kerrisk 3d614fb849 clock_getres.2, atan2.3, ctime.3, getcwd.3, isgreater.3, iswblank.3, scalbln.3: ffix
Consistently use 4-space indents for FTMs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:55:20 +01:00
Michael Kerrisk 255d42333e chroot.2, rename.2, getgrent.3, nextafter.3, ttyslot.3, wprintf.3: ffix
Bring a bit more consistency to the layout of FTMs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:47:04 +01:00
Michael Kerrisk c418bc9d16 grantpt.3, ptsname.3, unlockpt.3: Remove mention of _XOPEN_SOURCE_EXTENDED FTM
This rather ancient FTM is not mentioned in other pages for
reasons discussed in feature_test_macros(7).  Remove this FTM
from the three pages where it does appear.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:47:04 +01:00
Michael Kerrisk db198f06a8 nice.2, putenv.3, strtok.3, toascii.3, tzset.3: ffix
Where FTM requirements span multiple lines, start the FTMs on
a new line.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:19:02 +01:00
Michael Kerrisk 3754620f0e getpagesize.2, getdtablesize.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 15:10:10 +01:00
Michael Kerrisk d187835fe7 fanotify_init.2, fanotify.7: Minor edits to Jan Kara's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:29:59 +01:00
Jan Kara f040d28675 fanotify_init.2, fanotify.7: Document FAN_AUDIT flag and FAN_ENABLE_AUDIT
Acked-by: Steve Grubb <sgrubb@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:29:59 +01:00
Michael Kerrisk 028350ffb8 exec.3: tfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:29:59 +01:00
Michael Kerrisk 10afe9f58d malloc_hook.3: tfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:29:56 +01:00
Michael Kerrisk 2bb103326f ecvt.3, gcvt.3: Update FTM requirements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 14:10:59 +01:00
Michael Kerrisk 9e8a25d700 getpagesize.2, getdtablesize.3: Update/correct FTM requirements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 12:13:37 +01:00
Michael Kerrisk 49b843f53a gethostid.3: Update FTM requirements for gethostid()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 11:55:58 +01:00
Michael Kerrisk 6e5cd0d9c1 gethostname.2: Update FTM requirements for gethostname()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 11:50:30 +01:00
Michael Kerrisk f1663f029c feature_test_macros.7: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 11:02:32 +01:00
Michael Kerrisk bd8e32e0b2 feature_test_macros.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 10:47:12 +01:00
Michael Kerrisk 51a6f93d71 wait.2, getaddrinfo.3, getnameinfo.3: ffix: Bring greater consistency to FTM layout
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 10:10:05 +01:00
Michael Kerrisk b1a4a24634 qecvt.3: Update feature test macro requirements
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 09:34:08 +01:00
Michael Kerrisk 4653ec6ef2 Various pages: Use .nf/.fi in SYNOPSIS
Fix various pages missed in commit
c7db92b96a.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 09:34:08 +01:00
Michael Kerrisk e3528453c0 getutent.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 08:54:44 +01:00
Michael Kerrisk fe05d0458e bsd_signal.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 08:53:50 +01:00
Michael Kerrisk 464ba16d1e scandir.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-04 08:48:01 +01:00
Michael Kerrisk 5b72a11386 string.3: tfix
Reported-by: Pádraig Brady <P@draigBrady.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 20:50:04 +01:00
Michael Kerrisk 05d13bfb42 string.3: SEE ALSO: add bstring(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:10:04 +01:00
Michael Kerrisk 28f288d395 bstring.3: SEE ALSO: add string(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:10:04 +01:00
Michael Kerrisk c7db92b96a Various pages: Use .nf/.fi in SYNOPSIS
The majority of pages use .nf/.fi in SYNOPSIS, but there are
still many that don't and use .br to achieve newlines. Fix many
of those. This brings greater consistency to the pages, which
eases editing and may ease future scripted edits to the pages.

Many of these changes were script-assisted, with some additional
manual edits.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:09:47 +01:00
Michael Kerrisk 511bb71b0c Various pages: Further clean-ups after "bring more whitespace consistency in SYNOPSIS"
Yet more clean-ups after commit
15d6565317.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-03 13:09:36 +01:00
Michael Kerrisk ff21c173ea wordexp.3: ffix
Reported-by: "Alejandro Colomar" <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-02 20:57:59 +01:00
Michael Kerrisk c9eec92c18 getcpu.2: Rewrite page to describe glibc wrapper function
Since glibc 2.29, there is a wrapper for getcpu(2).
The wrapper has only 2 arguments, omitting the unused
third system call argument. Rework the manual page
to reflect this.

Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-02 09:37:11 +01:00
Alejandro Colomar 771aecbeff Various pages: Consistently use 'unsigned int'
Most pages use 'unsigned int' (and the kernel too).
Make them all do so.

$ find man? -type f \
  | xargs sed -i \
	-e 's/unsigned \*/unsigned int */g'
	-e 's/unsigned "/unsigned int "/g';

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-02 08:31:43 +01:00
Michael Kerrisk e878a2de3e get_phys_pages.3: Minor relocation of text
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 23:38:00 +01:00
Alejandro Colomar 984126f454 off64_t.3: New link to system_data_types(7)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 23:31:50 +01:00
Alejandro Colomar d6ab4c76a1 system_data_types.7: Add off64_t to system_data_types(7)
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 23:30:49 +01:00
Michael Kerrisk 7b5d39f48f Various pages: clean-ups after "bring more whitespace consistency in SYNOPSIS"
Cleann-ups after commit 15d6565317.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 23:28:14 +01:00
Michael Kerrisk 15d6565317 Various pages: bring more whitespace consistency in SYNOPSIS
The use of vertical white space in the SYNOPSIS sections
is rather inconsistent. Make it more consistent, subject to the
following heuristics:

* Prefer no blank lines between function signatures by default.
* Where many functions are defined in the SYNOPSIS, add blank
  lines where needed to improve readability, possibly by using
  blank lines to separate logical groups of functions.

Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 12:40:22 +01:00
Michael Kerrisk 742694e926 gethostbyname.3: Move mention of <sys/socket.h> from SYNOPSIS to DESCRIPTION
The functions are all declared in <netdb.h>. <sys/socket.h> is only
needed for the AF_* constants.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-01 12:26:47 +01:00
Michael Kerrisk 460aeeb46d puts.3: Reorder functions more logically (group related fuinctions together)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 23:38:02 +01:00
Michael Kerrisk cbd813e73c getdirentries.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 22:50:57 +01:00
Michael Kerrisk d4f9c56ac5 drand48.3: tfix (Oxford comma)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 21:19:28 +01:00
Michael Kerrisk 1210ac324b dl_iterate_phdr.3: wsppfix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 21:16:41 +01:00
Michael Kerrisk fb30841679 perfmonctl.2, pidfd_send_signal.2: ffix: Ensure statement about no wrapper function is a new paragraph
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 15:13:41 +01:00
Alejandro Colomar 76c5631fb4 copy_file_range.2: Document glibc wrapper instead of kernel syscall
Glibc uses 'off64_t' instead of 'loff_t'.

......

Glibc prototype:

$ syscall='copy_file_range';
$ ret='ssize_t';
$ find glibc/ -type f -name '*.h' \
  |xargs pcregrep -Mn "(?s)^[\w\s]*${ret}\s*${syscall}\s*\(.*?;";
glibc/posix/unistd.h:1121:
ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
			 int __outfd, __off64_t *__poutoff,
			 size_t __length, unsigned int __flags);

......

Testing example:

$ man ./man2/copy_file_range.2 \
  |sed -n '/^EXAMPLES/,/^SEE ALSO/p' \
  |head -n -1 \
  |tail -n +2 \
  >copy_file_range.c
$ gcc -Wall -Wextra -Werror -pedantic
copy_file_range.c -o copy_file_range
$ ./copy_file_range
Usage: ./copy_file_range <source> <destination>
$ tee a >/dev/null
asdf
$ tee b >/dev/null
qwerty
zxcvbn
$ ./copy_file_range a b
$ cat a
asdf
$ cat b
asdf

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 15:01:18 +01:00
Michael Kerrisk 9834f61da2 wait4.2, endian.3, isalpha.3, unlocked_stdio.3: Minor consistency fix for Feature Test Macro info
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 11:05:26 +01:00
Michael Kerrisk ea40ab1199 strsignal.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 11:05:26 +01:00
Michael Kerrisk 7d8d2f0941 Various pages: s/Glibc versions </Glibc </ in Feature Test Macro discussions
Use a more compact notation that will render less wide
on the terminal.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 11:05:22 +01:00
Michael Kerrisk 38c1dbe910 pread.2, rename.2, syscall.2, utimensat.2, gethostid.3, rcmd.3, seekdir.3, setnetgrent.3, strerror.3, strsignal.3: ffix: Various tweaks for greater consistency in Feature Test Macros
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 10:48:51 +01:00
Michael Kerrisk 0129eef26c chown.2, ffs.3, fpclassify.3, gamma.3, getgrent.3, ilogb.3, strdup.3: ffix
Bring a bit more consistency to Feature Test Macro information
(mainly .PP between differnt FTM lists).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 10:27:24 +01:00
Michael Kerrisk 58e93595b9 Changes.old: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 10:07:18 +01:00
Michael Kerrisk 98c9347c15 Various pages: Formatting fix
Use .PP (which gives a bit of vertical white space) rather than
.br to separate functions in Feature Test Macro requirement lists.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:55:48 +01:00
Michael Kerrisk 1faebd253c Various pages: srcfix: remove redundant .br
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:55:48 +01:00
Michael Kerrisk e111e485ed recv.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:24:56 +01:00
Alejandro Colomar a6f73f75e6 get_phys_pages.3: glibc gets the info from sysinfo(2) since 2.23
See glibc's commit: 0ce657c576bf1b24
https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=0ce657c576bf1b24

Reported-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:18:04 +01:00
Alejandro Colomar 00d3eabb53 keyctl.2: SYNOPSIS: Fix prototype parameter types
The Linux kernel uses 'unsigned long'.
There's no reason to use the typedef '__kernel_ulong_t'.

......

$ syscall='keyctl';
$ find linux/ -type f -name '*.c' \
  |xargs pcregrep -Mn "(?s)^[\w_]*SYSCALL_DEFINE.\(${syscall},.*?\)";
linux/security/keys/keyctl.c:1869:
SYSCALL_DEFINE5(keyctl, int, option, unsigned long, arg2, unsigned long, arg3,
		unsigned long, arg4, unsigned long, arg5)
linux/security/keys/compat.c:17:
COMPAT_SYSCALL_DEFINE5(keyctl, u32, option,
		       u32, arg2, u32, arg3, u32, arg4, u32, arg5)

Cc: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 23:37:05 +01:00
Alejandro Colomar 7eee650211 delete_module.2: SYNOPSIS: Fix prototype parameter types
The Linux kernel uses 'unsigned int' instead of 'int' for the
'flags' parameter.  As glibc provides no wrapper, use the same
type the kernel uses.

......

$ syscall='delete_module';
$ find linux/ -type f -name '*.c' \
  |xargs pcregrep -Mn "(?s)^[\w_]*SYSCALL_DEFINE.\(${syscall},.*?\)";
linux/kernel/module.c:977:
SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
		unsigned int, flags)

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 23:35:35 +01:00
Michael Kerrisk 40c502d623 kexec_load.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 17:02:42 +01:00
Ganimedes Colomar 16cc03ca92 Various pages: Normalize NOTES about nonexistent glibc wrappers
See previous commit.

This commit normalizes texts under sections other than SYNOPSIS
(most of them in NOTES).

Signed-off-by: Ganimedes Colomar <gacoan.linux@gmail.com>
Cowritten-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 16:56:38 +01:00
Ganimedes Colomar 632d115294 Various pages: Normalize SYNOPSIS notes about nonexistent glibc wrappers
To easily distinguish documentation about glibc wrappers from
documentation about kernel syscalls, let's have a normalized
'Note' in the SYNOPSIS, and a further explanation in the page body
(NOTES in most of them), as already happened in many (but not all)
of the manual pages for syscalls without a wrapper.  Furthermore,
let's normalize the messages, following membarrier.2 (because it's
already quite extended), so that it's easy to use grep to find
those pages.

To find these pages, we used:
$ grep -rn wrapper man? | sort -V
and
$ grep -rni support.*glibc | sort -V

delete_module.2, init_module.2:  glibc 2.23 is no longer
  maintained, so we changed the notes about wrappers, to say that
  there are no glibc wrappers for these system calls; see NOTES.

We didn't fix some obsolete pages such as create_module.2.

Signed-off-by: Ganimedes Colomar <gacoan.linux@gmail.com>
Cowritten-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 16:55:39 +01:00
Michael Kerrisk 3c8813156d syscalls.2: Add epoll_pwait2()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 15:18:54 +01:00
Michael Kerrisk ab4001e286 readlink.2: Emphasize that the returned buffer is not null-terminated
Reported-by: Jonny Grant <jg@jguk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 14:55:38 +01:00
Jakub Wilk 5bd94cbd31 filesystems.5: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 09:30:34 +01:00
Jakub Wilk 704b5ab54c ftime.3: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 09:30:17 +01:00
Jakub Wilk 6a0aa2ecb1 cgroups.7: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 09:30:10 +01:00
Jakub Wilk 0580884cc7 signal.7: tfix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-30 09:29:46 +01:00
Michael Kerrisk c55f66855e pkeys.7: srcfix: remove redundant .PP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk c65f02bae3 user_namespaces.7: srcfix: remove redundant .PP after .SS
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk 312b0eb182 userfaultfd.2, posix_spawn.3: srcfix: remove redundant .PP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk 0421538981 pthread_mutexattr_setrobust.3: wfix: remove redundant comments
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk ae12e0e0f9 bind.2: wfix: remove redundant comment
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk d5d83905a1 spu_run.2: Minor fix-ups for comments
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:30 +01:00
Michael Kerrisk a8114045ab fanotify.7, inotify.7: wfix: Tweak location of tag comments
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:40:25 +01:00
Michael Kerrisk 46b20ca1bb ioctl_ns.2, keyctl.2, memfd_create.2, pidfd_send_signal.2, poll.2, seccomp.2, signalfd.2, timerfd_create.2, unshare.2, dlinfo.3, duplocale.3, fopencookie.3, getgrouplist.3, getifaddrs.3, getprotoent_r.3, getservent_r.3, insque.3, printf.3, pthread_attr_init.3, pthread_cancel.3, pthread_create.3, pthread_mutexattr_setrobust.3, pthread_setaffinity_np.3, qsort.3, sem_wait.3, core.5, elf.5, aio.7, epoll.7, pkeys.7, system_data_types.7, unix.7: Use periods more consistently inside code comments
In general, complete sentences in free-standing comments
should be terminated by periods.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:32:44 +01:00
Michael Kerrisk c6beb8a167 bind.2, clone.2, dup.2, futex.2, mprotect.2, open_by_handle_at.2, pivot_root.2, select_tut.2, shmop.2, timer_create.2, userfaultfd.2, getaddrinfo.3, getaddrinfo_a.3, inet_net_pton.3, malloc_info.3, mbstowcs.3, newlocale.3, posix_spawn.3, pthread_sigmask.3, shm_open.3, strtol.3, inotify.7, user_namespaces.7: Add periods at end of sentences in comments
Try to bring a little more consistency on the use of periods
in comments in example code.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:32:44 +01:00
Michael Kerrisk f18f9c4095 man-pages.7: Add some notes on comments in example code
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-27 12:32:44 +01:00
Michael Kerrisk 1297239d41 slist.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 14:24:43 +01:00
Michael Kerrisk c5127de6ff stailq.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 14:23:39 +01:00
Michael Kerrisk f52cb55283 list.3, slist.3, stailq.3, tailq.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 14:20:50 +01:00
Michael Kerrisk c2e81ff964 seccomp.2, circleq.3, list.3, malloc_hook.3, slist.3, stailq.3, tailq.3, ip.7, unix.7: tfix
Remove "." at the end of sentence fragments/short single sentences
in comments.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 14:17:30 +01:00
Michael Kerrisk d526b40d5b system_data_types.7: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 14:10:05 +01:00
Alejandro Colomar eaa18d3c44 Various pages: Remove explicit blank lines, replacing them with .PP when appropriate
Rationale:
$ man 7 man-pages 2>/dev/null | sed -n /Paragraphs/,/^$/p
       Paragraphs should be separated by suitable markers (usually
       either .PP or .IP).  Do not separate paragraphs using blank
       lines,  as  this  results  in poor rendering in some output
       formats (such as PostScript and PDF).

Fix:
$ sed -i -e '1,/^\.EX/s/^$/.PP/' -e '/^\.EE/,/^\.EX/s/^$/.PP/' man?/*

And then some manual adjustments.

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-23 13:19:10 +01:00
Peter H. Froehlich 4fce5f5bc8 syscall.2: Update superh syscall convention
I noticed this while working on some silly "hello, world"
programs, see https://git.sr.ht/~phf/hello-again if you're
curious.  Disassembling sh4 code showed trap #31 all over the
place but the syscall(2) man page talked about trap #0x17 and
friends. Checking the kernel sources I got lucky in
arch/sh/kernel/entry-common.S where in commit 3623d138213ae Rich
Felker clarifies the situation.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 18:14:37 +01:00
Michael Kerrisk fbe926ebdf mallinfo2.3: New link to mallinfo(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk e9e534537d mallinfo.3: Update example program to use mallinfo2()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk 5bf7268349 mallinfo.3: Document mallinfo2() and note that mallinfo() is deprecated
Document the mallinfo2() function added in glibc 2.33.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk 766f0fd68a ld.so.8: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk 4fd41d7544 ld.so.8: Document the --argv0 option added in glibc 2.33
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk 37fac7c6b2 ftime.3: glibc 2.33 has removed ftime()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:08:09 +01:00
Michael Kerrisk c751bb1e0f getrusage.2: Starting in 2.33, glibc no longer provides vtimes()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:01:31 +01:00
Michael Kerrisk 5ebc9e0a0a pthread_attr_setsigmask_np.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk 0c9ab4fcb7 nl_langinfo.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk 15974546a2 isfdtype.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk 46ab01a33a aio_suspend.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk 88a3ec7921 setns.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk ee2379ef31 perf_event_open.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk ff9469c09c statfs.2: tfix (Section number)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 12:00:09 +01:00
Michael Kerrisk 3ff7c9e360 Changes.old: Minor fixes to 5.10 changelog
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-22 11:05:58 +01:00
Michael Kerrisk 5e207fcf11 Start of man-pages-5.11: updating Changes and Changes.old 2020-12-22 09:30:12 +01:00
Michael Kerrisk 9811bdcbdf Start of man-pages-5.11: updating .Announce and .lsm files 2020-12-22 09:30:12 +01:00
Michael Kerrisk 339818643f Start of man-pages-5.11: renaming .Announce and .lsm files 2020-12-22 09:30:12 +01:00
989 changed files with 20227 additions and 9840 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/

327
Changes
View File

@ -1,6 +1,6 @@
==================== Changes in man-pages-5.10 ====================
==================== Changes in man-pages-5.14 ====================
Released: 2020-12-21, Munich
Released: ????-??-??, Munich
Contributors
@ -10,341 +10,26 @@ The following people contributed patches/fixes or (noted in brackets
in the changelog below) reports, notes, and ideas that have been
incorporated in changes in this release:
Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Alejandro Colomar <alx.manpages@gmail.com>
Amir Goldstein <amir73il@gmail.com>
Arusekk <arek_koz@o2.pl>
Baruch Siach <baruch@tkos.co.il>
Bill Allombert <ballombe@debian.org>
Colin Ian King <colin.king@canonical.com>
Dave Martin <Dave.Martin@arm.com>
Davide Giorgio <davide@giorgiodavide.it>
Heinrich Schuchardt <xypron.glpk@gmx.de>
Jan Kara <jack@suse.cz>
Jing Peng <pj.hades@gmail.com>
John A. Leuenhagen <john@zlima12.com>
Mathias Rav <m@git.strova.dk>
Michael Kerrisk <mtk.manpages@gmail.com>
Mike Crowe <mac@mcrowe.com>
Namhyung Kim <namhyung@gmail.com>
Peter Oskolkov <posk@google.com>
Philip Rowlands <linux-kernel@dimebar.com>
Rob Landley <rob@landley.net>
Ross Zwisler <zwisler@chromium.org>
Sebastian Kirmayer <sebastian@kirmayer.de>
наб <nabijaczleweli@nabijaczleweli.xyz>
Apologies if I missed anyone!
New and rewritten pages
-----------------------
Newly documented interfaces in existing pages
---------------------------------------------
access.2
Michael Kerrisk
Document faccessat2()
faccessat2() was added in Linux 5.8 and enables a fix to
longstanding bugs in the faccessat() wrapper function.
membarrier.2
Peter Oskolkov [Alejandro Colomar]
Update for Linux 5.10
Linux kernel commit 2a36ab717e8fe678d98f81c14a0b124712719840
(part of 5.10 release) changed sys_membarrier prototype/parameters
and added two new commands [MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ
and MEMBARRIER_CMD_REGISTER_PRIVATE_EXPEDITED_RSEQ].
New and changed links
---------------------
faccessat2.2
Michael Kerrisk
New link to access.2
CIRCLEQ_EMPTY.3
CIRCLEQ_FIRST.3
CIRCLEQ_FOREACH.3
CIRCLEQ_FOREACH_REVERSE.3
CIRCLEQ_HEAD_INITIALIZER.3
CIRCLEQ_LAST.3
CIRCLEQ_LOOP_NEXT.3
CIRCLEQ_LOOP_PREV.3
CIRCLEQ_NEXT.3
CIRCLEQ_PREV.3
Michael Kerrisk
Add missing links to circleq.3
pthread_attr_getsigmask_np.3
Michael Kerrisk
New link to pthread_attr_setsigmask_np.3
Global changes
--------------
Various pages
Alejandro Colomar
Use Oxford comma
Changes to individual pages
---------------------------
access.2
Michael Kerrisk
BUGS: note that faccessat() wrapper function emulation ignores ACLs
bpf.2
Michael Kerrisk
Place EXAMPLES section in correct location
cacheflush.2
Alejandro Colomar
Document Architecture-specific variants
Alejandro Colomar [Heinrich Schuchardt]
Document __builtin___clear_cache() as a more portable alternative
chroot.2
memfd_create.2
tailq.3
Michael Kerrisk [Alejandro Colomar]
Fix unbalanced .nf/.fi
clock_getres.2
Michael Kerrisk
Place ERRORS in alphabetical order
clone.2
sigaltstack.2
Michael Kerrisk
clone(CLONE_VM) disables the alternate signal stack
getrlimit.2
Michael Kerrisk
State more precisely the range of kernel versions that had RLIMIT_LOCKS
getrusage.2
Michael Kerrisk
Note that the 'vtimes' symbol exists only up to glibc 2.32
io_cancel.2
io_destroy.2
io_getevents.2
io_setup.2
io_submit.2
Alejandro Colomar
SYNOPSIS: s/io_context_t/aio_context_t/
Linux uses aio_context_t for these syscalls,
and it's the type provided by <linux/aio_abi.h>.
Use it in the SYNOPSIS.
libaio uses 'io_context_t', but that difference is already noted
in NOTES.
io_setup.2
Alejandro Colomar
SYNOPSIS: return long
link.2
Mathias Rav
ERRORS: add ENOENT when target is deleted
Linux kernel commit aae8a97d3ec30788790d1720b71d76fd8eb44b73 (part
of kernel release v2.6.39) added a check to disallow creating a
hard link to an unlinked file.
llseek.2
Michael Kerrisk
Note size of 'loff_t' type
Michael Kerrisk
Point the reader to lseek64(3) for info about llseek(3)
Michael Kerrisk
Some mild rewriting to ease reading of the info in this page
mmap.2
Michael Kerrisk
Clarify SIGBUS text and treatment of partial page at end of a mapping
mount.2
statfs.2
Ross Zwisler
Add NOSYMFOLLOW flags to mount(2) and statfs(2)
msgctl.2
Michael Kerrisk
Make comments in 'msqid_ds' definition more compact
Michael Kerrisk
Place list of field descriptions in same order as structure definition
Michael Kerrisk
Use field name "msg_cbytes" rather than "__msg_cbytes"
Michael Kerrisk
Add description of 'msg_cbytes' field
openat.2
Colin Ian King
Fix include path, should be linux/openat2.h
perf_event_open.2
Namhyung Kim [Alejandro Colomar]
Update man page with recent kernel changes
Alejandro Colomar
Assign calculated value explicitly to 'config'
restart_syscall.2
Alejandro Colomar
SYNOPSIS: Fix restart_syscall() return type
set_tid_address.2
Alejandro Colomar
SYNOPSIS: Fix set_tid_address() return type
shmctl.2
Michael Kerrisk
Place list of field descriptions in same order as structure definition
sigaction.2
Michael Kerrisk
Clarify description of SA_NODEFER
Clarify description of SA_NODEFER, and note interaction with
act.sa_mask.
Michael Kerrisk
Add a cross-reference to signal(7) for further info on 'ucontext_t'
sigaltstack.2
Michael Kerrisk
Clarify that the alternate signal stack is per-thread
Clarify that the alternate signal stack is per-thread (rather
than process-wide).
spu_create.2
Michael Kerrisk
Add kernel version numbers for SPU_CREATE_AFFINITY_SPU/_MEM
Michael Kerrisk
Relocate paragraph on 'mode' argument
Michael Kerrisk [Alejandro Colomar]
Clarify that spu_create() now has 4 arguments but once had only 3
subpage_prot.2
Alejandro Colomar
SYNOPSIS: Fix return type: s/long/int/
syscalls.2
Michael Kerrisk
Add process_madvise()
Michael Kerrisk
Note that sysctl() was removed in Linux 5.5
timer_getoverrun.2
Michael Kerrisk
timer_getoverrun() now clamps the overrun count to DELAYTIMER_MAX
See https://bugzilla.kernel.org/show_bug.cgi?id=12665.
uselib.2
posix_memalign.3
profil.3
rtime.3
Michael Kerrisk
Remove some text about libc/libc5
With this change, there remain almost no vestiges of information
about the long defunct Linux libc.
errno.3
Michael Kerrisk
Note another possible cause of the EMFILE error
getcontext.3
Michael Kerrisk
Mention SA_SIGINFO flag when talking about 3-argument signal handler
Michael Kerrisk
SEE ALSO: add signal(7)
list.3
Michael Kerrisk
NAME: remove LIST_PREV, which is not documented in this page
lseek64.3
Michael Kerrisk
Remove section numbers from interface list
Michael Kerrisk
Remove sentence saying lseek64() is an alias for llseek()
Michael Kerrisk
NOTES: describe the origin of lseek64() in LFS
nextafter.3
Michael Kerrisk
Remove duplicate "BUGS" section heading
pthread_tryjoin_np.3
Michael Kerrisk [Mike Crowe]
Note that pthread_timedjoin_np() uses CLOCK_REALTIME, but there's a bug
rcmd.3
Michael Kerrisk
SEE ALSO: remove intro(2)
strnlen.3
Michael Kerrisk [Heinrich Schuchardt]
Fix a small inconsistency in the text
elf.5
Michael Kerrisk
SEE ALSO: add objcopy(1)
filesystems.5
Ahelenia Ziemiańska [Alejandro Colomar]
Fix link to user space tooling for ncpfs
Ahelenia Ziemiańska [Alejandro Colomar]
Note ncpfs removal from kernel
attributes.7
Michael Kerrisk
SEE ALSO: add signal-safety(7)
fanotify.7
Amir Goldstein [Jan Kara]
fix outdated description
kernel_lockdown.7
Michael Kerrisk
Remove unneeded quotes
packet.7
Baruch Siach [Alejandro Colomar]
Update references to kernel documentation
pthreads.7
Michael Kerrisk
Rephrase function list in terms of POSIX rather than SUS
The list was using an inconsistent mixture of "POSIX" and "SUS".
signal.7
Michael Kerrisk [Heinrich Schuchardt, Dave Martin]
Add some details on the execution of signal handlers
Add a "big picture" of what happens when a signal handler
is invoked.
Michael Kerrisk
Add pidfd_send_signal() to list of APIs for sending signals
Michael Kerrisk
Mention 'ucontext_t' in the discussion of signal handler execution
Michael Kerrisk
SEE ALSO: add swapcontext(3)
signal-safety.7
Michael Kerrisk
Note async-signal-safety details for errno
standards.7
Michael Kerrisk
Add URL for POSIX.1-2008/SUSv4
Michael Kerrisk
Add LFS (Large File Summit)
Michael Kerrisk [Rob Landley]
Fix some URLs for locations of the standards
Michael Kerrisk
Relocate the discussion on POSIX manual pages
tcp.7
Alejandro Colomar [Philip Rowlands]
tcp_syncookies: It is now an integer [0, 2]
Since Linux kernel 3.12, tcp_syncookies can have the value 2,
which sends out cookies unconditionally.

File diff suppressed because it is too large Load Diff

View File

@ -8,5 +8,5 @@ tzfile(5), zdump(8), and zic(8) come from the tz project
(https://www.iana.org/time-zones).
bpf-helpers(7) is autogenerated from the kernel sources using scripts.
See man-pagfes commit 53666f6c30451cde022f65d35a8d448f5a7132ba dir
See man-pages commit 53666f6c30451cde022f65d35a8d448f5a7132ba for
details.

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 \
(cd "$$i"; man2html $(HTOPTS) `basename $$f`) | \
sed -e '1,2d' > $(HTDIR)/"$$i"/`basename $$f`.html; \
done; \
done; fi
.PHONY: html
html: | builddirs-html
find man?/ -type f \
|while read f; do \
man2html $(HTOPTS) "$$f" \
|sed -e '1,2d' \
>"$(htmlbuilddir)/$${f}$(htmlext)" \
|| exit $$?; \
done;
install:
for i in man?; do \
install -d -m 755 $(DESTDIR)$(MANDIR)/"$$i" || exit $$?; \
install -m 644 "$$i"/* $(DESTDIR)$(MANDIR)/"$$i" || exit $$?; \
done
.PHONY: builddirs-html
builddirs-html:
find man?/ -type d \
|while read d; do \
$(INSTALL_DIR) "$(htmlbuilddir)/$$d" || exit $$?; \
done;
.PHONY: install-html
install-html: | installdirs-html
cd $(htmlbuilddir) && \
find man?/ -type f \
|while read f; do \
$(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(htmldir_)/$$f" || exit $$?; \
done;
.PHONY: installdirs-html
installdirs-html:
find man?/ -type d \
|while read d; do \
$(INSTALL_DIR) "$(DESTDIR)$(htmldir_)/$$d" || exit $$?; \
done;
.PHONY: uninstall-html
uninstall-html:
find man?/ -type f \
|while read f; do \
rm -f "$(DESTDIR)$(htmldir_)/$$f".* || exit $$?; \
done;
########################################################################
# tests
# Check if groff reports warnings (may be words of sentences not displayed)
# from 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.10.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.10
Entered-date: 2020-12-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
2764k man-pages-5.10.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

@ -22,11 +22,13 @@
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH GETENT 1 2020-12-21 "Linux" "User Commands"
.TH GETENT 1 2021-03-22 "Linux" "User Commands"
.SH NAME
getent \- get entries from Name Service Switch libraries
.SH SYNOPSIS
.B getent\ [\fIoption\fP]...\ \fIdatabase\fP\ \fIkey\fP...
.nf
.B getent [\fIoption\fP]... \fIdatabase\fP \fIkey\fP...
.fi
.SH DESCRIPTION
The
.B getent

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

@ -220,7 +220,7 @@ and
.I pwd
commands and explore
.I cd
usage: "cd", "cd .", "cd ..", "cd /" and "cd \(ti".
usage: "cd", "cd .", "cd ..", "cd /", and "cd \(ti".
.SS Directories
The command
.I mkdir

View File

@ -11,31 +11,30 @@
.\" May be distributed under the GNU General Public License
.\" %%%LICENSE_END
.\"
.TH LDD 1 2019-03-06 "" "Linux Programmer's Manual"
.TH LDD 1 2021-08-27 "" "Linux Programmer's Manual"
.SH NAME
ldd \- print shared object dependencies
.SH SYNOPSIS
.nf
.BR ldd " [\fIoption\fP]... \fIfile\fP..."
.fi
.SH DESCRIPTION
.B ldd
prints the shared objects (shared libraries) required by each program or
shared object specified on the command line.
An example of its use and output
(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
linux-vdso.so.1 (0x00007ffcc3563000)
$ \fBldd /bin/ls\fP
linux\-vdso.so.1 (0x00007ffcc3563000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f87e5459000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007f87e5254000)
libc.so.6 => /lib64/libc.so.6 (0x00007f87e4e92000)
libpcre.so.1 => /lib64/libpcre.so.1 (0x00007f87e4c22000)
libdl.so.2 => /lib64/libdl.so.2 (0x00007f87e4a1e000)
/lib64/ld-linux-x86-64.so.2 (0x00005574bf12e000)
/lib64/ld\-linux\-x86\-64.so.2 (0x00005574bf12e000)
libattr.so.1 => /lib64/libattr.so.1 (0x00007f87e4817000)
libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f87e45fa000)
.EE
@ -57,9 +56,9 @@ For each dependency,
displays the location of the matching object
and the (hexadecimal) address at which it is loaded.
(The
.I linux-vdso
.I linux\-vdso
and
.I ld-linux
.I ld\-linux
shared dependencies are special; see
.BR vdso (7)
and
@ -68,7 +67,7 @@ and
.SS Security
Be aware that in some circumstances
(e.g., where the program specifies an ELF interpreter other than
.IR ld-linux.so ),
.IR ld\-linux.so ),
.\" The circumstances are where the program has an interpreter
.\" other than ld-linux.so. In this case, ldd tries to execute the
.\" program directly with LD_TRACE_LOADED_OBJECTS=1, with the

View File

@ -22,7 +22,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH LOCALE 1 2020-06-09 "Linux" "Linux User Manual"
.TH LOCALE 1 2021-03-22 "Linux" "Linux User Manual"
.SH NAME
locale \- get locale-specific information
.SH SYNOPSIS
@ -73,7 +73,7 @@ The
command can also be provided with one or more arguments,
which are the names of locale keywords (for example,
.IR date_fmt ,
.IR ctype-class-names ,
.IR ctype\-class\-names ,
.IR yesexpr ,
or
.IR decimal_point )
@ -129,7 +129,7 @@ Display a short usage message and exit.
Display the program version and exit.
.SH FILES
.TP
.I /usr/lib/locale/locale-archive
.I /usr/lib/locale/locale\-archive
Usual default locale archive location.
.TP
.I /usr/share/i18n/locales
@ -196,10 +196,10 @@ subsequent user sessions:
.PP
.EX
$ \fBmkdir \-p $HOME/.locale\fP
$ \fBI18NPATH=./wrk/ localedef \-f UTF-8 \-i fi_SE $HOME/.locale/fi_SE.UTF-8\fP
$ \fBLOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF-8 date\fP
$ \fBI18NPATH=./wrk/ localedef \-f UTF\-8 \-i fi_SE $HOME/.locale/fi_SE.UTF\-8\fP
$ \fBLOCPATH=$HOME/.locale LC_ALL=fi_SE.UTF\-8 date\fP
$ \fBecho "export LOCPATH=\e$HOME/.locale" >> $HOME/.bashrc\fP
$ \fBecho "export LANG=fi_SE.UTF-8" >> $HOME/.bashrc\fP
$ \fBecho "export LANG=fi_SE.UTF\-8" >> $HOME/.bashrc\fP
.EE
.SH SEE ALSO
.BR localedef (1),

View File

@ -31,7 +31,7 @@
.\" Lars Wirzenius to document new functionality (as of GNU
.\" C library 2.3.5).
.\"
.TH LOCALEDEF 1 2020-04-11 "Linux" "Linux User Manual"
.TH LOCALEDEF 1 2021-03-22 "Linux" "Linux User Manual"
.SH NAME
localedef \- compile locale definition files
.SH SYNOPSIS
@ -98,7 +98,7 @@ Otherwise,
.I outputpath
is the name of a locale and the compiled locale data is added to the
archive file
.IR /usr/lib/locale/locale-archive .
.IR /usr/lib/locale/locale\-archive .
A locale archive is a memory-mapped file which contains all the
system-provided locales;
it is used by all localized programs when the environment variable
@ -113,7 +113,7 @@ not already been created.
If no
.I charmapfile
is given, the value
.I ANSI_X3.4-1968
.I ANSI_X3.4\-1968
(for ASCII) is used by default.
If no
.I inputfile
@ -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
@ -258,7 +259,7 @@ By default, the prefix is empty.
Setting the prefix to
.IR foo ,
the archive would be placed in
.IR foo/usr/lib/locale/locale-archive .
.IR foo/usr/lib/locale/locale\-archive .
.TP
.B \-\-quiet
Suppress all notifications and warnings, and report only fatal errors.
@ -318,7 +319,7 @@ Usual default path for locale definition files.
.I /usr/share/i18n/repertoiremaps
Usual default repertoire map path.
.TP
.I /usr/lib/locale/locale-archive
.I /usr/lib/locale/locale\-archive
Usual default locale archive location.
.TP
.I /usr/lib/locale

View File

@ -21,11 +21,13 @@
.\" License along with this manual; if not, see
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.TH MEMUSAGE 1 2020-11-01 "GNU" "Linux user manual"
.TH MEMUSAGE 1 2021-03-22 "GNU" "Linux user manual"
.SH NAME
memusage \- profile memory usage of a program
.SH SYNOPSIS
.nf
.BR memusage " [\fIoption\fR]... \fIprogram\fR [\fIprogramoption\fR]..."
.fi
.SH DESCRIPTION
.B memusage
is a bash script which profiles memory usage of the program,
@ -196,7 +198,9 @@ Make the graph
.I size
pixels high.
.SH EXIT STATUS
Exit status is equal to the exit status of profiled program.
The exit status of
.BR memusage
is equal to the exit status of the profiled program.
.SH BUGS
To report bugs, see
.UR http://www.gnu.org/software/libc/bugs.html
@ -256,7 +260,7 @@ main(int argc, char *argv[])
if (i < CYCLES / 2)
j = i;
else
j--;
j\-\-;
size = sizeof(*p) * (j * 50 + 110);
printf("realloc: %zu\en", size);

View File

@ -20,11 +20,13 @@
.\" License along with this manual; if not, see
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.TH MEMUSAGESTAT 1 2020-06-09 "GNU" "Linux programmer's manual"
.TH MEMUSAGESTAT 1 2021-03-22 "GNU" "Linux programmer's manual"
.SH NAME
memusagestat \- generate graphic from memory profiling data
.SH SYNOPSIS
.nf
.BR memusagestat " [\fIoption\fR]... \fIdatafile\fR [\fIoutfile\fR]"
.fi
.SH DESCRIPTION
.B memusagestat
creates a PNG file containing a graphical representation of the

View File

@ -20,11 +20,13 @@
.\" License along with this manual; if not, see
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.TH MTRACE 1 2017-09-15 "GNU" "Linux user manual"
.TH MTRACE 1 2021-03-22 "GNU" "Linux user manual"
.SH NAME
mtrace \- interpret the malloc trace log
.SH SYNOPSIS
.nf
.BR mtrace " [\fIoption\fR]... [\fIbinary\fR] \fImtracedata\fR"
.fi
.SH DESCRIPTION
.B mtrace
is a Perl script used to interpret and provide human readable output

View File

@ -88,7 +88,6 @@ are used for the text and formatting of the output.
.B PATH
is used to search for
.IR command .
The remaining ones for the text and formatting of the output.
.SH GNU VERSION
Below a description of the GNU 1.7 version of
.BR time .
@ -125,8 +124,8 @@ sys %S
.\"
.SS The format string
The format is interpreted in the usual printf-like way.
Ordinary characters are directly copied, tab, newline
and backslash are escaped using \et, \en and \e\e,
Ordinary characters are directly copied, tab, newline,
and backslash are escaped using \et, \en, and \e\e,
a percent sign is represented by %%, and otherwise %
indicates a conversion.
The program

View File

@ -26,29 +26,29 @@
.\" Modified Wed Jul 21 23:02:38 1993 by Rik Faith <faith@cs.unc.edu>
.\" Modified 2001-11-17, aeb
.\"
.TH _EXIT 2 2020-02-09 "Linux" "Linux Programmer's Manual"
.TH _EXIT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
_exit, _Exit \- terminate the calling process
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "void _exit(int " status );
.BI "noreturn void _exit(int " status );
.PP
.B #include <stdlib.h>
.PP
.BI "void _Exit(int " status );
.BI "noreturn void _Exit(int " status );
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.PP
.ad l
.BR _Exit ():
.RS 4
_ISOC99_SOURCE || _POSIX_C_SOURCE\ >=\ 200112L
.RE
.ad
.nf
_ISOC99_SOURCE || _POSIX_C_SOURCE >= 200112L
.fi
.SH DESCRIPTION
.BR _exit ()
terminates the calling process "immediately".
@ -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

@ -35,15 +35,17 @@
.\" 2007-10-23 mtk: created as a new page, by taking the content
.\" specific to the _syscall() macros from intro(2).
.\"
.TH _SYSCALL 2 2020-06-09 "Linux" "Linux Programmer's Manual"
.TH _SYSCALL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
_syscall \- invoking a system call without library support (OBSOLETE)
.SH SYNOPSIS
.nf
.B #include <linux/unistd.h>
.PP
A _syscall macro
.PP
desired system call
.fi
.SH DESCRIPTION
The important thing to know about a system call is its prototype.
You need to know how many arguments, their types,

View File

@ -38,21 +38,21 @@
.\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" 2008-12-04, mtk, Add documentation of accept4()
.\"
.TH ACCEPT 2 2020-04-11 "Linux" "Linux Programmer's Manual"
.TH ACCEPT 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
accept, accept4 \- accept a connection on a socket
.SH SYNOPSIS
.nf
.BR "#include <sys/types.h>" " /* See NOTES */"
.B #include <sys/socket.h>
.PP
.BI "int accept(int " sockfd ", struct sockaddr *" addr ", socklen_t *" addrlen );
.BI "int accept(int " sockfd ", struct sockaddr *restrict " addr ,
.BI " socklen_t *restrict " addrlen );
.PP
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <sys/socket.h>
.PP
.BI "int accept4(int " sockfd ", struct sockaddr *" addr ,
.BI " socklen_t *" addrlen ", int " flags );
.BI "int accept4(int " sockfd ", struct sockaddr *restrict " addr ,
.BI " socklen_t *restrict " addrlen ", int " flags );
.fi
.SH DESCRIPTION
The
@ -173,7 +173,7 @@ these system calls return a file descriptor
for the accepted socket (a nonnegative integer).
On error, \-1 is returned,
.I errno
is set appropriately, and
is set to indicate the error, and
.I addrlen
is left unchanged.
.SS Error handling
@ -261,15 +261,11 @@ does not refer to a socket.
The referenced socket is not of type
.BR SOCK_STREAM .
.TP
.B EPROTO
Protocol error.
.PP
In addition, Linux
.BR accept ()
may fail if:
.TP
.B EPERM
Firewall rules forbid connection.
.TP
.B EPROTO
Protocol error.
.PP
In addition, network errors for the new socket and as defined
for the protocol may be returned.
@ -318,12 +314,6 @@ of file status flags and always explicitly set all required flags on
the socket returned from
.BR accept ().
.SH NOTES
POSIX.1-2001 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
.PP
There may not always be a connection waiting after a
.B SIGIO
is delivered or

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 2020-12-21 "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
@ -48,16 +48,21 @@ access, faccessat, faccessat2 \- check user's permissions for a file
.B #include <unistd.h>
.PP
.BI "int access(const char *" pathname ", int " mode );
.BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
.PP
.BR "#include <fcntl.h>" " /* Definition of " AT_* " constants */"
.B #include <unistd.h>
.PP
.BI "int faccessat(int " dirfd ", const char *" pathname ", int " \
mode ", int " flags );
/* But see C library/kernel differences, below */
.BI "int faccessat2(int " dirfd ", const char *" pathname ", int " \
mode ", int " flags );
.PP
.BR "#include <fcntl.h>" " /* Definition of " AT_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int syscall(SYS_faccessat2,"
.BI " int " dirfd ", const char *" pathname ", int " mode \
", int " flags );
.fi
.PP
.RS -4
@ -66,18 +71,12 @@ Feature Test Macro Requirements for glibc (see
.RE
.PP
.BR faccessat ():
.PD 0
.ad l
.RS 4
.TP 4
Since glibc 2.10:
_POSIX_C_SOURCE\ >=\ 200809L
.TP
Before glibc 2.10:
_ATFILE_SOURCE
.RE
.ad
.PD
.nf
Since glibc 2.10:
_POSIX_C_SOURCE >= 200809L
Before glibc 2.10:
_ATFILE_SOURCE
.fi
.SH DESCRIPTION
.BR access ()
checks whether the calling process can access the file
@ -217,12 +216,8 @@ is
and the file does not exist, or some other error occurred),
\-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.BR access ()
and
.BR faccessat ()
shall fail if:
.TP
.B EACCES
The requested access would be denied to the file, or search permission
@ -231,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 .
@ -244,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;
@ -352,15 +347,15 @@ Only access bits are checked, not the file type or contents.
Therefore, if a directory is found to be writable,
it probably means that files can be created in the directory,
and not that the directory can be written as a file.
Similarly, a DOS file may be found to be "executable," but the
Similarly, a DOS file may be reported as executable, but the
.BR execve (2)
call will still fail.
.PP
These calls
may not work correctly on NFSv2 filesystems with UID mapping enabled,
because UID mapping is done on the server and hidden from the client,
which checks permissions. (NFS versions 3 and higher perform the check on
the server.)
which checks permissions.
(NFS versions 3 and higher perform the check on the server.)
Similar problems can occur to FUSE mounts.
.\"
.\"

View File

@ -28,7 +28,7 @@
.\" Modified 1998-11-04 by Tigran Aivazian <tigran@sco.com>
.\" Modified 2004-05-27, 2004-06-17, 2004-06-23 by Michael Kerrisk
.\"
.TH ACCT 2 2016-03-15 "Linux" "Linux Programmer's Manual"
.TH ACCT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
acct \- switch process accounting on or off
.SH SYNOPSIS
@ -51,9 +51,9 @@ Feature Test Macro Requirements for glibc (see
.\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8
_DEFAULT_SOURCE
In glibc 2.19 and 2.20:
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
Up to and including glibc 2.19:
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
.fi
.SH DESCRIPTION
The
@ -69,7 +69,7 @@ An argument of NULL causes accounting to be turned off.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EACCES

View File

@ -9,12 +9,11 @@
.\" 2 of the License, or (at your option) any later version.
.\" %%%LICENSE_END
.\"
.TH ADD_KEY 2 2020-11-01 Linux "Linux Key Management Calls"
.TH ADD_KEY 2 2021-08-27 Linux "Linux Key Management Calls"
.SH NAME
add_key \- add a key to the kernel's key management facility
.SH SYNOPSIS
.nf
.B #include <sys/types.h>
.B #include <keyutils.h>
.PP
.BI "key_serial_t add_key(const char *" type ", const char *" description ,
@ -22,7 +21,8 @@ add_key \- add a key to the kernel's key management facility
.BI " key_serial_t " keyring ");"
.fi
.PP
No glibc wrapper is provided for this system call; see NOTES.
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
.SH DESCRIPTION
.BR add_key ()
creates or updates a key of the given
@ -68,23 +68,23 @@ Alternatively, it may be one of the following special keyring IDs:
.TP
.B KEY_SPEC_THREAD_KEYRING
This specifies the caller's thread-specific keyring
.RB ( thread-keyring (7)).
.RB ( thread\-keyring (7)).
.TP
.B KEY_SPEC_PROCESS_KEYRING
This specifies the caller's process-specific keyring
.RB ( process-keyring (7)).
.RB ( process\-keyring (7)).
.TP
.B KEY_SPEC_SESSION_KEYRING
This specifies the caller's session-specific keyring
.RB ( session-keyring (7)).
.RB ( session\-keyring (7)).
.TP
.B KEY_SPEC_USER_KEYRING
This specifies the caller's UID-specific keyring
.RB ( user-keyring (7)).
.RB ( user\-keyring (7)).
.TP
.B KEY_SPEC_USER_SESSION_KEYRING
This specifies the caller's UID-session keyring
.RB ( user-session-keyring (7)).
.RB ( user\-session\-keyring (7)).
.SS Key types
The key
.I type
@ -146,7 +146,7 @@ On success,
returns the serial number of the key it created or updated.
On error, \-1 is returned and
.I errno
is set to indicate the cause of the error.
is set to indicate the error.
.SH ERRORS
.TP
.B EACCES
@ -215,10 +215,13 @@ This system call first appeared in Linux 2.6.10.
.SH CONFORMING TO
This system call is a nonstandard Linux extension.
.SH NOTES
No wrapper for this system call is provided in glibc.
Glibc does not provide a wrapper for this system call.
A wrapper is provided in the
.IR libkeyutils
package.
library.
(The accompanying package provides the
.I <keyutils.h>
header file.)
When employing the wrapper in that library, link with
.IR \-lkeyutils .
.SH EXAMPLES
@ -232,7 +235,7 @@ The following shell session demonstrates the use of the program:
$ \fB./a.out user mykey "Some payload"\fP
Key ID is 64a4dca
$ \fBgrep \(aq64a4dca\(aq /proc/keys\fP
064a4dca I--Q--- 1 perm 3f010000 1000 1000 user mykey: 12
064a4dca I\-\-Q\-\-\- 1 perm 3f010000 1000 1000 user mykey: 12
.EE
.in
.SS Program source

View File

@ -26,7 +26,7 @@
.\" Modified 1997-07-30 by Paul Slootman <paul@wurtel.demon.nl>
.\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH ADJTIMEX 2 2020-06-09 "Linux" "Linux Programmer's Manual"
.TH ADJTIMEX 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
adjtimex, clock_adjtime, ntp_adjtime \- tune kernel clock
.SH SYNOPSIS
@ -61,36 +61,36 @@ struct timex {
long maxerror; /* Maximum error (microseconds) */
long esterror; /* Estimated error (microseconds) */
int status; /* Clock command/status */
long constant; /* PLL (phase-locked loop) time constant */
long constant; /* PLL (phase\-locked loop) time constant */
long precision; /* Clock precision
(microseconds, read-only) */
long tolerance; /* Clock frequency tolerance (read-only);
(microseconds, read\-only) */
long tolerance; /* Clock frequency tolerance (read\-only);
see NOTES for units */
struct timeval time;
/* Current time (read-only, except for
/* Current time (read\-only, except for
ADJ_SETOFFSET); upon return, time.tv_usec
contains nanoseconds, if STA_NANO status
flag is set, otherwise microseconds */
long tick; /* Microseconds between clock ticks */
long ppsfreq; /* PPS (pulse per second) frequency
(read-only); see NOTES for units */
long jitter; /* PPS jitter (read-only); nanoseconds, if
(read\-only); see NOTES for units */
long jitter; /* PPS jitter (read\-only); nanoseconds, if
STA_NANO status flag is set, otherwise
microseconds */
int shift; /* PPS interval duration
(seconds, read-only) */
long stabil; /* PPS stability (read-only);
(seconds, read\-only) */
long stabil; /* PPS stability (read\-only);
see NOTES for units */
long jitcnt; /* PPS count of jitter limit exceeded
events (read-only) */
events (read\-only) */
long calcnt; /* PPS count of calibration intervals
(read-only) */
(read\-only) */
long errcnt; /* PPS count of calibration errors
(read-only) */
(read\-only) */
long stbcnt; /* PPS count of stability limit exceeded
events (read-only) */
events (read\-only) */
int tai; /* TAI offset, as set by previous ADJ_TAI
operation (seconds, read-only,
operation (seconds, read\-only,
since Linux 2.6.26) */
/* Further padding bytes to allow for future expansion */
};
@ -177,7 +177,7 @@ with nanosecond resolution.
.in +4n
.EX
while (buf.time.tv_usec < 0) {
buf.time.tv_sec -= 1;
buf.time.tv_sec \-= 1;
buf.time.tv_usec += 1000000000;
}
.EE
@ -475,7 +475,8 @@ the call operates asynchronously and the return value usually will
not reflect a state change caused by the call itself.
.PP
On failure, these calls return \-1 and set
.IR errno .
.IR errno
to indicate the error.
.SH ERRORS
.TP
.B EFAULT
@ -551,15 +552,20 @@ capability is required.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lb lb lb
lbx lb lb
l l l.
Interface Attribute Value
T{
.BR ntp_adjtime ()
T} Thread safety MT-Safe
.TE
.hy
.ad
.sp 1
.SH CONFORMING TO
None of these interfaces is described in POSIX.1
.PP

View File

@ -22,19 +22,24 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH ALLOC_HUGEPAGES 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH ALLOC_HUGEPAGES 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
alloc_hugepages, free_hugepages \- allocate or free huge pages
.SH SYNOPSIS
.nf
.BI "void *alloc_hugepages(int " key ", void *" addr ", size_t " len ,
.BI " int " prot ", int " flag );
.BI "void *syscall(SYS_alloc_hugepages, int " key ", void *" addr \
", size_t " len ,
.BI " int " prot ", int " flag );
.\" asmlinkage unsigned long sys_alloc_hugepages(int key, unsigned long addr,
.\" unsigned long len, int prot, int flag);
.PP
.BI "int free_hugepages(void *" addr );
.BI "int syscall(SYS_free_hugepages, void *" addr );
.\" asmlinkage int sys_free_hugepages(unsigned long addr);
.fi
.PP
.IR Note :
glibc provides no wrappers for these system calls,
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The system calls
.BR alloc_hugepages ()
@ -114,7 +119,7 @@ returns the allocated virtual address, and
returns zero.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B ENOSYS
@ -129,8 +134,7 @@ This can be read and written.
Gives info on the number of configured hugetlb pages and on their size
in the three variables HugePages_Total, HugePages_Free, Hugepagesize.
.SH CONFORMING TO
These calls are specific to Linux on Intel processors, and should not be
used in programs intended to be portable.
These extinct system calls were specific to Linux on Intel processors.
.SH NOTES
These system calls are gone;
they existed only in Linux 2.5.36 through to 2.5.54.

View File

@ -22,17 +22,24 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH ARCH_PRCTL 2 2020-04-11 "Linux" "Linux Programmer's Manual"
.TH ARCH_PRCTL 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
arch_prctl \- set architecture-specific thread state
.SH SYNOPSIS
.nf
.B #include <asm/prctl.h>
.B #include <sys/prctl.h>
.BR "#include <asm/prctl.h>" " /* Definition of " ARCH_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int arch_prctl(int " code ", unsigned long " addr );
.BI "int arch_prctl(int " code ", unsigned long *" addr );
.BI "int syscall(SYS_arch_prctl, int " code ", unsigned long " addr );
.BI "int syscall(SYS_arch_prctl, int " code ", unsigned long *" addr );
.fi
.PP
.IR Note :
glibc provides no wrapper for
.BR arch_prctl (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.BR arch_prctl ()
sets architecture-specific process or thread state.
@ -133,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
@ -174,11 +181,6 @@ and
in the same thread is dangerous, as they may overwrite each other's
TLS entries.
.PP
As of version 2.7, glibc provides no prototype for
.BR arch_prctl ().
You have to declare it yourself for now.
This may be fixed in future glibc versions.
.PP
.I FS
may be already used by the threading library.
Programs that use

View File

@ -24,7 +24,7 @@
.\" Modified 1997-01-31 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH BDFLUSH 2 2016-10-08 "Linux" "Linux Programmer's Manual"
.TH BDFLUSH 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
bdflush \- start, flush, or tune buffer-dirty-flush daemon
.SH SYNOPSIS
@ -34,10 +34,13 @@ bdflush \- start, flush, or tune buffer-dirty-flush daemon
.BI "int bdflush(int " func ", long *" address );
.BI "int bdflush(int " func ", long " data );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see VERSIONS.
.SH DESCRIPTION
.IR Note :
Since Linux 2.6,
.\" As noted in a changes in the 2.5.12 source
.\" As noted in changes in the 2.5.12 source
this system call is deprecated and does nothing.
It is likely to disappear altogether in a future kernel release.
Nowadays, the task performed by

View File

@ -66,12 +66,11 @@
.\" $Id: bind.2,v 1.3 1999/04/23 19:56:07 freitag Exp $
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH BIND 2 2020-11-01 "Linux" "Linux Programmer's Manual"
.TH BIND 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
bind \- bind a name to a socket
.SH SYNOPSIS
.nf
.BR "#include <sys/types.h>" " /* See NOTES */"
.B #include <sys/socket.h>
.PP
.BI "int bind(int " sockfd ", const struct sockaddr *" addr ,
@ -154,7 +153,7 @@ See EXAMPLES below.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EACCES
@ -243,12 +242,6 @@ first appeared in 4.2BSD).
.\" .B EISDIR
.\" UNIX-domain error conditions.
.SH NOTES
POSIX.1 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
.PP
For background on the
.I socklen_t
type, see
@ -294,7 +287,6 @@ main(int argc, char *argv[])
handle_error("socket");
memset(&my_addr, 0, sizeof(my_addr));
/* Clear structure */
my_addr.sun_family = AF_UNIX;
strncpy(my_addr.sun_path, MY_SOCK_PATH,
sizeof(my_addr.sun_path) \- 1);
@ -307,7 +299,7 @@ main(int argc, char *argv[])
handle_error("listen");
/* Now we can accept incoming connections one
at a time using accept(2) */
at a time using accept(2). */
peer_addr_size = sizeof(peer_addr);
cfd = accept(sfd, (struct sockaddr *) &peer_addr,
@ -318,7 +310,7 @@ main(int argc, char *argv[])
/* Code to deal with incoming connection(s)... */
/* When no longer required, the socket pathname, MY_SOCK_PATH
should be deleted using unlink(2) or remove(3) */
should be deleted using unlink(2) or remove(3). */
}
.EE
.SH SEE ALSO

View File

@ -23,13 +23,13 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH BPF 2 2020-11-01 "Linux" "Linux Programmer's Manual"
.TH BPF 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
bpf \- perform a command on an extended BPF map or program
.SH SYNOPSIS
.nf
.B #include <linux/bpf.h>
.PP
.BI "int bpf(int " cmd ", union bpf_attr *" attr ", unsigned int " size );
.fi
.SH DESCRIPTION
@ -123,11 +123,11 @@ tracing tracing tracing packet packet packet
event A event B event C on eth0 on eth1 on eth2
| | | | | \(ha
| | | | v |
--> tracing <-- tracing socket tc ingress tc egress
\-\-> tracing <\-\- tracing socket tc ingress tc egress
prog_1 prog_2 prog_3 classifier action
| | | | prog_4 prog_5
|--- -----| |------| map_3 | |
map_1 map_2 --| map_4 |--
|\-\-\- \-\-\-\-\-| |\-\-\-\-\-\-| map_3 | |
map_1 map_2 \-\-| map_4 |\-\-
.EE
.in
.\"
@ -307,7 +307,7 @@ of 8 and the eBPF program calls
.IP
.in +4n
.EX
bpf_map_lookup_elem(map_fd, fp - 4)
bpf_map_lookup_elem(map_fd, fp \- 4)
.EE
.in
.IP
@ -323,7 +323,7 @@ bpf_map_lookup_elem(map_fd, void *key)
expects to read 8 bytes from the location pointed to by
.IR key ,
but the
.I fp\ -\ 4
.I fp\ \-\ 4
(where
.I fp
is the top of the stack)
@ -985,7 +985,7 @@ Zero.
.PP
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B E2BIG
@ -1206,13 +1206,13 @@ riscv (since Linux 5.1).
/* bpf+sockets example:
* 1. create array map of 256 elements
* 2. load program that counts number of packets received
* r0 = skb->data[ETH_HLEN + offsetof(struct iphdr, protocol)]
* r0 = skb\->data[ETH_HLEN + offsetof(struct iphdr, protocol)]
* map[r0]++
* 3. attach prog_fd to raw socket via setsockopt()
* 4. print number of received TCP/UDP packets every second
*/
int
main(int argc, char **argv)
main(int argc, char *argv[])
{
int sock, map_fd, prog_fd, key;
long long value = 0, tcp_cnt, udp_cnt;
@ -1228,11 +1228,11 @@ main(int argc, char **argv)
struct bpf_insn prog[] = {
BPF_MOV64_REG(BPF_REG_6, BPF_REG_1), /* r6 = r1 */
BPF_LD_ABS(BPF_B, ETH_HLEN + offsetof(struct iphdr, protocol)),
/* r0 = ip->proto */
BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, -4),
/* *(u32 *)(fp - 4) = r0 */
/* r0 = ip\->proto */
BPF_STX_MEM(BPF_W, BPF_REG_10, BPF_REG_0, \-4),
/* *(u32 *)(fp \- 4) = r0 */
BPF_MOV64_REG(BPF_REG_2, BPF_REG_10), /* r2 = fp */
BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, -4), /* r2 = r2 - 4 */
BPF_ALU64_IMM(BPF_ADD, BPF_REG_2, \-4), /* r2 = r2 \- 4 */
BPF_LD_MAP_FD(BPF_REG_1, map_fd), /* r1 = map_fd */
BPF_CALL_FUNC(BPF_FUNC_map_lookup_elem),
/* r0 = map_lookup(r1, r2) */

View File

@ -26,15 +26,16 @@
.\" Modified Wed Jul 21 19:52:58 1993 by Rik Faith <faith@cs.unc.edu>
.\" Modified Sun Aug 21 17:40:38 1994 by Rik Faith <faith@cs.unc.edu>
.\"
.TH BRK 2 2016-03-15 "Linux" "Linux Programmer's Manual"
.TH BRK 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
brk, sbrk \- change data segment size
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int brk(void *" addr );
.PP
.BI "void *sbrk(intptr_t " increment );
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
@ -43,34 +44,23 @@ Feature Test Macro Requirements for glibc (see
.PP
.BR brk (),
.BR sbrk ():
.ad l
.RS 4
.PD 0
.TP 4
Since glibc 2.19:
.nf
_DEFAULT_SOURCE ||
(_XOPEN_SOURCE\ >=\ 500) &&
.\" (_XOPEN_SOURCE\ >=\ 500 ||
.\" _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
! (_POSIX_C_SOURCE\ >=\ 200112L)
Since glibc 2.19:
_DEFAULT_SOURCE
|| ((_XOPEN_SOURCE >= 500) &&
! (_POSIX_C_SOURCE >= 200112L))
.\" (_XOPEN_SOURCE >= 500 ||
.\" _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) &&
From glibc 2.12 to 2.19:
_BSD_SOURCE || _SVID_SOURCE
|| ((_XOPEN_SOURCE >= 500) &&
! (_POSIX_C_SOURCE >= 200112L))
.\" (_XOPEN_SOURCE >= 500 ||
.\" _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) &&
Before glibc 2.12:
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
.fi
.TP 4
From glibc 2.12 to 2.19:
.nf
_BSD_SOURCE || _SVID_SOURCE ||
(_XOPEN_SOURCE\ >=\ 500) &&
.\" (_XOPEN_SOURCE\ >=\ 500 ||
.\" _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED) &&
! (_POSIX_C_SOURCE\ >=\ 200112L)
.fi
.TP 4
Before glibc 2.12:
_BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE\ >=\ 500
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
.PD
.RE
.ad b
.SH DESCRIPTION
.BR brk ()
and

View File

@ -22,14 +22,14 @@
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH CACHEFLUSH 2 2020-12-21 "Linux" "Linux Programmer's Manual"
.TH CACHEFLUSH 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
cacheflush \- flush contents of instruction and/or data cache
.SH SYNOPSIS
.nf
.B #include <asm/cachectl.h>
.B #include <sys/cachectl.h>
.PP
.BI "int cacheflush(char *" addr ", int "nbytes ", int "cache );
.BI "int cacheflush(void *" addr ", int "nbytes ", int "cache );
.fi
.PP
.IR Note :
@ -41,7 +41,7 @@ flushes the contents of the indicated cache(s) for the
user addresses in the range
.I addr
to
.IR (addr+nbytes-1) .
.IR (addr+nbytes\-1) .
.I cache
may be one of:
.TP
@ -56,17 +56,17 @@ Same as
.BR (ICACHE|DCACHE) .
.SH RETURN VALUE
.BR cacheflush ()
returns 0 on success or \-1 on error.
If errors are detected,
returns 0 on success.
On error, it returns \-1 and sets
.I errno
will indicate the error.
to indicate the error.
.SH ERRORS
.TP
.B EFAULT
Some or all of the address range
.I addr
to
.I (addr+nbytes-1)
.I (addr+nbytes\-1)
is not accessible.
.TP
.B EINVAL

View File

@ -13,15 +13,26 @@
.\" 64-bit capability sets in kernel 2.6.2[45].
.\" Modified 2009-01-26, andi kleen
.\"
.TH CAPGET 2 2020-02-09 "Linux" "Linux Programmer's Manual"
.TH CAPGET 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
capget, capset \- set/get capabilities of thread(s)
.SH SYNOPSIS
.B #include <sys/capability.h>
.nf
.BR "#include <linux/capability.h>" " /* Definition of " CAP_* " and"
.BR " _LINUX_CAPABILITY_*" " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "int capget(cap_user_header_t " hdrp ", cap_user_data_t " datap );
.BI "int syscall(SYS_capget, cap_user_header_t " hdrp ,
.BI " cap_user_data_t " datap );
.BI "int syscall(SYS_capset, cap_user_header_t " hdrp ,
.BI " const cap_user_data_t " datap );
.fi
.PP
.BI "int capset(cap_user_header_t " hdrp ", const cap_user_data_t " datap );
.IR Note :
glibc provides no wrappers for these system calls,
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
These two system calls are the raw kernel interface for getting and
setting thread capabilities.
@ -36,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.
@ -113,7 +124,7 @@ For
.BR capget ()
calls, one can probe the capabilities of any process by specifying its
process ID with the
.I hdrp->pid
.I hdrp\->pid
field value.
.PP
For details on the data, see
@ -128,7 +139,7 @@ asynchronously setting the capabilities of another.
That is, on kernels that have VFS capabilities support, when calling
.BR capset (),
the only permitted values for
.I hdrp->pid
.I hdrp\->pid
are 0 or, equivalently, the value returned by
.BR gettid (2).
.\"
@ -166,7 +177,7 @@ to all members of the process group whose ID is \-\fIpid\fP.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.PP
The calls fail with the error
.BR EINVAL ,

View File

@ -30,15 +30,16 @@
.\" Modified 1997-08-21 by Joseph S. Myers <jsm28@cam.ac.uk>
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH CHDIR 2 2019-08-02 "Linux" "Linux Programmer's Manual"
.TH CHDIR 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
chdir, fchdir \- change working directory
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int chdir(const char *" path );
.br
.BI "int fchdir(int " fd );
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
@ -46,16 +47,12 @@ Feature Test Macro Requirements for glibc (see
.RE
.PP
.BR fchdir ():
.PD 0
.ad l
.RS 4
_XOPEN_SOURCE\ >=\ 500
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
|| /* Glibc up to and including 2.19: */ _BSD_SOURCE
.RE
.ad
.PD
.nf
_XOPEN_SOURCE >= 500
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
|| /* Glibc up to and including 2.19: */ _BSD_SOURCE
.fi
.SH DESCRIPTION
.BR chdir ()
changes the current working directory of the calling process to the
@ -71,7 +68,7 @@ open file descriptor.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
Depending on the filesystem, other errors can be returned.
The more

View File

@ -29,7 +29,7 @@
.\" <michael@cantor.informatik.rwth-aachen.de>: NFS details
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH CHMOD 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH CHMOD 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
chmod, fchmod, fchmodat \- change permissions of a file
.SH SYNOPSIS
@ -38,7 +38,7 @@ chmod, fchmod, fchmodat \- change permissions of a file
.PP
.BI "int chmod(const char *" pathname ", mode_t " mode );
.BI "int fchmod(int " fd ", mode_t " mode );
.PP
.BR "#include <fcntl.h>" " /* Definition of AT_* constants */"
.B #include <sys/stat.h>
.PP
@ -51,50 +51,36 @@ Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.PP
.ad l
.PD 0
.nf
.BR fchmod ():
.RS 4
Since glibc 2.24:
_POSIX_C_SOURCE\ >=\ 199309L
Since glibc 2.24:
_POSIX_C_SOURCE >= 199309L
.\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
.PP
Glibc 2.19 to 2.23
_POSIX_C_SOURCE
.PP
Glibc 2.16 to 2.19:
_BSD_SOURCE || _POSIX_C_SOURCE
.PP
Glibc 2.12 to 2.16:
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500 ||
_POSIX_C_SOURCE >= 200809L
.PP
Glibc 2.11 and earlier:
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
Glibc 2.19 to 2.23
_POSIX_C_SOURCE
Glibc 2.16 to 2.19:
_BSD_SOURCE || _POSIX_C_SOURCE
Glibc 2.12 to 2.16:
_BSD_SOURCE || _XOPEN_SOURCE >= 500
|| _POSIX_C_SOURCE >= 200809L
Glibc 2.11 and earlier:
_BSD_SOURCE || _XOPEN_SOURCE >= 500
.\" || (_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED)
.RE
.PD
.fi
.PP
.BR fchmodat ():
.PD 0
.ad l
.RS 4
.TP 4
Since glibc 2.10:
_POSIX_C_SOURCE\ >=\ 200809L
.TP
Before glibc 2.10:
_ATFILE_SOURCE
.RE
.ad
.PD
.ad
.nf
Since glibc 2.10:
_POSIX_C_SOURCE >= 200809L
Before glibc 2.10:
_ATFILE_SOURCE
.fi
.SH DESCRIPTION
The
.BR chmod ()
and
.BR fchmod ()
system calls change a files mode bits.
system calls change a file's mode bits.
(The file mode consists of the file permission bits plus the set-user-ID,
set-group-ID, and sticky bits.)
These system calls differ only in how the file is specified:
@ -245,7 +231,7 @@ for an explanation of the need for
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
Depending on the filesystem,
errors other than those listed below can be returned.
@ -259,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
@ -283,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
@ -296,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 2020-06-09 "Linux" "Linux Programmer's Manual"
.TH CHOWN 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
chown, fchown, lchown, fchownat \- change ownership of a file
.SH SYNOPSIS
@ -45,7 +45,7 @@ chown, fchown, lchown, fchownat \- change ownership of a file
.BI "int chown(const char *" pathname ", uid_t " owner ", gid_t " group );
.BI "int fchown(int " fd ", uid_t " owner ", gid_t " group );
.BI "int lchown(const char *" pathname ", uid_t " owner ", gid_t " group );
.PP
.BR "#include <fcntl.h> " "/* Definition of AT_* constants */"
.B #include <unistd.h>
.PP
@ -60,28 +60,20 @@ Feature Test Macro Requirements for glibc (see
.PP
.BR fchown (),
.BR lchown ():
.PD 0
.ad l
.RS 4
/* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
|| _XOPEN_SOURCE\ >=\ 500
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
|| /* Glibc versions <= 2.19: */ _BSD_SOURCE
.RE
.nf
/* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
|| _XOPEN_SOURCE >= 500
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|| /* Glibc <= 2.19: */ _BSD_SOURCE
.fi
.PP
.BR fchownat ():
.PD 0
.ad l
.RS 4
.TP 4
Since glibc 2.10:
_POSIX_C_SOURCE\ >=\ 200809L
.TP
Before glibc 2.10:
_ATFILE_SOURCE
.RE
.ad
.PD
.nf
Since glibc 2.10:
_POSIX_C_SOURCE >= 200809L
Before glibc 2.10:
_ATFILE_SOURCE
.fi
.SH DESCRIPTION
These system calls change the owner and group of a file.
The
@ -226,7 +218,7 @@ for an explanation of the need for
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
Depending on the filesystem,
errors other than those listed below can be returned.
@ -240,10 +232,33 @@ Search permission is denied on a component of the path prefix.
(See also
.BR path_resolution (7).)
.TP
.B EBADF
.RB ( fchown ())
.I fd
is not a valid open file descriptor.
.TP
.B EBADF
.RB ( fchownat ())
.I pathname
is relative but
.I dirfd
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EFAULT
.I pathname
points outside your accessible address space.
.TP
.B EINVAL
.RB ( fchownat ())
Invalid flag specified in
.IR flags .
.TP
.B EIO
.RB ( fchown ())
A low-level I/O error occurred while modifying the inode.
.TP
.B ELOOP
Too many symbolic links were encountered in resolving
.IR pathname .
@ -261,6 +276,13 @@ Insufficient kernel memory was available.
.B ENOTDIR
A component of the path prefix is not a directory.
.TP
.B ENOTDIR
.RB ( fchownat ())
.I pathname
is relative and
.I dirfd
is a file descriptor referring to a file other than a directory.
.TP
.B EPERM
The calling process did not have the required permissions
(see above) to change owner and/or group.
@ -272,47 +294,6 @@ The file is marked immutable or append-only.
.TP
.B EROFS
The named file resides on a read-only filesystem.
.PP
The general errors for
.BR fchown ()
are listed below:
.TP
.B EBADF
.I fd
is not a valid open file descriptor.
.TP
.B EIO
A low-level I/O error occurred while modifying the inode.
.TP
.B ENOENT
See above.
.TP
.B EPERM
See above.
.TP
.B EROFS
See above.
.PP
The same errors that occur for
.BR chown ()
can also occur for
.BR fchownat ().
The following additional errors can occur for
.BR fchownat ():
.TP
.B EBADF
.I dirfd
is not a valid file descriptor.
.TP
.B EINVAL
Invalid flag specified in
.IR flags .
.TP
.B ENOTDIR
.I pathname
is relative and
.I dirfd
is a file descriptor referring to a file other than a directory.
.SH VERSIONS
.BR fchownat ()
was added to Linux in kernel 2.6.16;

View File

@ -30,13 +30,15 @@
.\" Modified 1997-08-21 by Joseph S. Myers <jsm28@cam.ac.uk>
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH CHROOT 2 2020-12-21 "Linux" "Linux Programmer's Manual"
.TH CHROOT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
chroot \- change root directory
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int chroot(const char *" path );
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
@ -44,21 +46,14 @@ Feature Test Macro Requirements for glibc (see
.RE
.PP
.BR chroot ():
.ad l
.RS 4
.PD 0
.TP 4
Since glibc 2.2.2:
.nf
_XOPEN_SOURCE && ! (_POSIX_C_SOURCE\ >=\ 200112L)
|| /* Since glibc 2.20: */ _DEFAULT_SOURCE
|| /* Glibc versions <= 2.19: */ _BSD_SOURCE
Since glibc 2.2.2:
_XOPEN_SOURCE && ! (_POSIX_C_SOURCE >= 200112L)
|| /* Since glibc 2.20: */ _DEFAULT_SOURCE
|| /* Glibc <= 2.19: */ _BSD_SOURCE
Before glibc 2.2.2:
none
.fi
.TP 4
Before glibc 2.2.2: none
.PD
.RE
.ad b
.SH DESCRIPTION
.BR chroot ()
changes the root directory of the calling process to that specified in
@ -117,7 +112,7 @@ descriptors may allow access to files outside the chroot tree.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
Depending on the filesystem, other errors can be returned.
The more general errors are listed below:

View File

@ -28,17 +28,18 @@
.\" 2003-08-24 aeb, large parts rewritten
.\" 2004-08-06 Christoph Lameter <clameter@sgi.com>, SMP note
.\"
.TH CLOCK_GETRES 2 2020-12-21 "" "Linux Programmer's Manual"
.TH CLOCK_GETRES 2 2021-03-22 "" "Linux Programmer's Manual"
.SH NAME
clock_getres, clock_gettime, clock_settime \- clock and time functions
.SH SYNOPSIS
.nf
.B #include <time.h>
.PP
.BI "int clock_getres(clockid_t " clockid ", struct timespec *" res );
.PP
.BI "int clock_gettime(clockid_t " clockid ", struct timespec *" tp );
.PP
.BI "int clock_settime(clockid_t " clockid ", const struct timespec *" tp );
.fi
.PP
Link with \fI\-lrt\fP (only for glibc versions before 2.17).
.PP
@ -47,14 +48,12 @@ Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.PP
.ad l
.BR clock_getres (),
.BR clock_gettime (),
.BR clock_settime ():
.RS
_POSIX_C_SOURCE\ >=\ 199309L
.RE
.ad b
.nf
_POSIX_C_SOURCE >= 199309L
.fi
.SH DESCRIPTION
The function
.BR clock_getres ()
@ -265,9 +264,10 @@ clock_gettime(clkid, &ts);
.BR clock_settime (),
and
.BR clock_getres ()
return 0 for success, or \-1 for failure (in which case
return 0 for success.
On error, \-1 is returned and
.I errno
is set appropriately).
is set to indicate the error.
.SH ERRORS
.TP
.B EACCES
@ -335,9 +335,11 @@ These system calls first appeared in Linux 2.6.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lbw32 lb lb
lbx lb lb
l l l.
Interface Attribute Value
T{
@ -346,6 +348,8 @@ T{
.BR clock_settime ()
T} Thread safety MT-Safe
.TE
.hy
.ad
.sp 1
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SUSv2.

View File

@ -23,7 +23,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH CLOCK_NANOSLEEP 2 2020-04-11 "Linux" "Linux Programmer's Manual"
.TH CLOCK_NANOSLEEP 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
clock_nanosleep \- high-resolution sleep with specifiable clock
.SH SYNOPSIS
@ -37,17 +37,15 @@ clock_nanosleep \- high-resolution sleep with specifiable clock
.PP
Link with \fI\-lrt\fP (only for glibc versions before 2.17).
.PP
.ad l
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.PP
.BR clock_nanosleep ():
.RS 4
_POSIX_C_SOURCE\ >=\ 200112L
.RE
.ad
.nf
_POSIX_C_SOURCE >= 200112L
.fi
.SH DESCRIPTION
Like
.BR nanosleep (2),

View File

@ -39,7 +39,7 @@
.\" 2008-11-19, mtk, document CLONE_NEWIPC
.\" 2008-11-19, Jens Axboe, mtk, document CLONE_IO
.\"
.TH CLONE 2 2020-11-01 "Linux" "Linux Programmer's Manual"
.TH CLONE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
clone, __clone2, clone3 \- create a child process
.SH SYNOPSIS
@ -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 not yet a 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
@ -183,11 +189,11 @@ is a structure of the following form:
struct clone_args {
u64 flags; /* Flags bit mask */
u64 pidfd; /* Where to store PID file descriptor
(\fIpid_t *\fP) */
(\fIint *\fP) */
u64 child_tid; /* Where to store child TID,
in child\(aqs memory (\fIpid_t *\fP) */
u64 parent_tid; /* Where to store child TID,
in parent\(aqs memory (\fIint *\fP) */
in parent\(aqs memory (\fIpid_t *\fP) */
u64 exit_signal; /* Signal to deliver to parent on
child termination */
u64 stack; /* Pointer to lowest byte of stack */
@ -250,14 +256,16 @@ and the fields in the
.I clone_args
argument supplied to
.BR clone3 ():
.RS
.RS 4
.TS
lb lb lb
l l l
li li l.
clone() clone3() Notes
\fIcl_args\fP field
flags & \(ti0xff flags For most flags; details below
flags & \(ti0xff flags T{
For most flags; details below
T}
parent_tid pidfd See CLONE_PIDFD
child_tid child_tid See CLONE_CHILD_SETTID
parent_tid parent_tid See CLONE_PARENT_SETTID
@ -325,7 +333,7 @@ should be set is defined by
which cannot be larger than the number of currently nested PID namespaces.
.PP
To create a process with the following PIDs in a PID namespace hierarchy:
.RS
.RS 4
.TS
lb lb lb
l l l.
@ -359,7 +367,7 @@ set_tid_size = 2;
.in
.PP
The PID in the PID namespaces outside the two innermost PID namespaces
will be selected the same way as any other PID is selected.
is selected the same way as any other PID is selected.
.PP
The
.I set_tid
@ -434,7 +442,7 @@ in the child's memory.
The store operation completes before the clone call
returns control to user space in the child process.
(Note that the store operation may not have completed before the clone call
returns in the parent process, which will be relevant if the
returns in the parent process, which is relevant if the
.BR CLONE_VM
flag is also employed.)
.TP
@ -813,7 +821,7 @@ which is signaled when the child terminates, so that
if
.B CLONE_PARENT
is set, then the parent of the calling process, rather than the
calling process itself, will be signaled.
calling process itself, is signaled.
.IP
The
.B CLONE_PARENT
@ -967,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
@ -1129,7 +1137,7 @@ signals and the signals that are pending for the calling thread.
.IP
If a process-directed signal is delivered to a thread group,
and the thread group has installed a handler for the signal, then
the handler will be invoked in exactly one, arbitrarily selected
the handler is invoked in exactly one, arbitrarily selected
member of the thread group that has not blocked the signal.
If multiple threads in a group are waiting to accept the same signal using
.BR sigwaitinfo (2),
@ -1185,7 +1193,7 @@ processes do not affect the other, as with
If the
.BR CLONE_VM
flag is specified and the
.BR CLONE_VM
.BR CLONE_VFORK
flag is not specified,
then any alternate signal stack that was established by
.BR sigaltstack (2)
@ -1196,9 +1204,9 @@ is cleared in the child process.
On success, the thread ID of the child process is returned
in the caller's thread of execution.
On failure, \-1 is returned
in the caller's context, no child process will be created, and
in the caller's context, no child process is created, and
.I errno
will be set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EAGAIN
@ -1416,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
@ -1539,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
@ -1830,12 +1833,12 @@ childFunc(void *arg)
{
struct utsname uts;
/* Change hostname in UTS namespace of child */
/* Change hostname in UTS namespace of child. */
if (sethostname(arg, strlen(arg)) == \-1)
errExit("sethostname");
/* Retrieve and display hostname */
/* Retrieve and display hostname. */
if (uname(&uts) == \-1)
errExit("uname");
@ -1865,7 +1868,7 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
/* Allocate memory to be used for the stack of the child */
/* Allocate memory to be used for the stack of the child. */
stack = mmap(NULL, STACK_SIZE, PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, \-1, 0);
@ -1875,7 +1878,7 @@ main(int argc, char *argv[])
stackTop = stack + STACK_SIZE; /* Assume stack grows downward */
/* Create child that has its own UTS namespace;
child commences execution in childFunc() */
child commences execution in childFunc(). */
pid = clone(childFunc, stackTop, CLONE_NEWUTS | SIGCHLD, argv[1]);
if (pid == \-1)

View File

@ -33,7 +33,7 @@
.\" Modified 2000-07-22 by Nicolás Lichtmaier <nick@debian.org>
.\" added note about close(2) not guaranteeing that data is safe on close.
.\"
.TH CLOSE 2 2020-06-09 "Linux" "Linux Programmer's Manual"
.TH CLOSE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
close \- close a file descriptor
.SH SYNOPSIS
@ -67,7 +67,7 @@ the file is deleted.
returns zero on success.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -148,7 +148,7 @@ The behavior in this situation varies across systems.
On some systems, when the file descriptor is closed,
the blocking system call returns immediately with an error.
.PP
On Linux (and possibly some other systems), the behavior is different.
On Linux (and possibly some other systems), the behavior is different:
the blocking I/O system call holds a reference to the underlying
open file description, and this reference keeps the description open
until the I/O system call completes.
@ -272,6 +272,7 @@ the next major release of the POSIX.1 standard.
.\" Review the following glibc bug later
.\" https://sourceware.org/bugzilla/show_bug.cgi?id=14627
.SH SEE ALSO
.BR close_range (2),
.BR fcntl (2),
.BR fsync (2),
.BR open (2),

284
man2/close_range.2 Normal file
View File

@ -0,0 +1,284 @@
.\" Copyright (c) 2020 Stephen Kitt <steve@sk2.org>
.\" and Copyright (c) 2021 Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.\" Since the Linux kernel and libraries are constantly changing, this
.\" manual page may be incorrect or out-of-date. The author(s) assume no
.\" responsibility for errors or omissions, or for damages resulting from
.\" the use of the information contained herein. The author(s) may not
.\" have taken the same level of care in the production of this manual,
.\" which is licensed free of charge, as they might when working
.\" professionally.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH CLOSE_RANGE 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
close_range \- close all file descriptors in a given range
.SH SYNOPSIS
.nf
.B #include <linux/close_range.h>
.PP
.BI "int close_range(unsigned int " first ", unsigned int " last ,
.BI " unsigned int " flags );
.fi
.SH DESCRIPTION
The
.BR close_range ()
system call closes all open file descriptors from
.I first
to
.I last
(included).
.PP
Errors closing a given file descriptor are currently ignored.
.PP
.I flags
is a bit mask containing 0 or more of the following:
.TP
.BR CLOSE_RANGE_CLOEXEC " (since Linux 5.11)"
Set the close-on-exec flag on the specified file descriptors,
rather than immediately closing them.
.TP
.B CLOSE_RANGE_UNSHARE
Unshare the specified file descriptors from any other processes
before closing them,
avoiding races with other threads sharing the file descriptor table.
.SH RETURN VALUE
On success,
.BR close_range ()
returns 0.
On error, \-1 is returned and
.I errno
is set to indicate the error.
.SH ERRORS
.TP
.B EINVAL
.I flags
is not valid, or
.I first
is greater than
.IR last .
.PP
The following can occur with
.B CLOSE_RANGE_UNSHARE
(when constructing the new descriptor table):
.TP
.B EMFILE
The number of open file descriptors exceeds the limit specified in
.IR /proc/sys/fs/nr_open
(see
.BR proc (5)).
This error can occur in situations where that limit was lowered before
a call to
.BR close_range ()
where the
.B CLOSE_RANGE_UNSHARE
flag is specified.
.TP
.B ENOMEM
Insufficient kernel memory was available.
.SH VERSIONS
.BR close_range ()
first appeared in Linux 5.9.
Library support was added in glibc in version 2.34.
.SH CONFORMING TO
.BR close_range ()
is a nonstandard function that is also present on FreeBSD.
.SH NOTES
.SS Closing all open file descriptors
.\" 278a5fbaed89dacd04e9d052f4594ffd0e0585de
To avoid blindly closing file descriptors
in the range of possible file descriptors,
this is sometimes implemented (on Linux)
by listing open file descriptors in
.I /proc/self/fd/
and calling
.BR close (2)
on each one.
.BR close_range ()
can take care of this without requiring
.I /proc
and within a single system call,
which provides significant performance benefits.
.SS Closing file descriptors before exec
.\" 60997c3d45d9a67daf01c56d805ae4fec37e0bd8
File descriptors can be closed safely using
.PP
.in +4n
.EX
/* we don't want anything past stderr here */
close_range(3, ~0U, CLOSE_RANGE_UNSHARE);
execve(....);
.EE
.in
.PP
.B CLOSE_RANGE_UNSHARE
is conceptually equivalent to
.PP
.in +4n
.EX
unshare(CLONE_FILES);
close_range(first, last, 0);
.EE
.in
.PP
but can be more efficient:
if the unshared range extends past
the current maximum number of file descriptors allocated
in the caller's file descriptor table
(the common case when
.I last
is ~0U),
the kernel will unshare a new file descriptor table for the caller up to
.IR first ,
copying as few file descriptors as possible.
This avoids subsequent
.BR close (2)
calls entirely;
the whole operation is complete once the table is unshared.
.SS Closing files on \fBexec\fP
.\" 582f1fb6b721facf04848d2ca57f34468da1813e
This is particularly useful in cases where multiple
.RB pre- exec
setup steps risk conflicting with each other.
For example, setting up a
.BR seccomp (2)
profile can conflict with a
.BR close_range ()
call:
if the file descriptors are closed before the
.BR seccomp (2)
profile is set up,
the profile setup can't use them itself,
or control their closure;
if the file descriptors are closed afterwards,
the seccomp profile can't block the
.BR close_range ()
call or any fallbacks.
Using
.B CLOSE_RANGE_CLOEXEC
avoids this:
the descriptors can be marked before the
.BR seccomp (2)
profile is set up,
and the profile can control access to
.BR close_range ()
without affecting the calling process.
.SH EXAMPLES
The program shown below opens the files named in its command-line arguments,
displays the list of files that it has opened
(by iterating through the entries in
.IR /proc/PID/fd ),
uses
.BR close_range ()
to close all file descriptors greater than or equal to 3,
and then once more displays the process's list of open files.
The following example demonstrates the use of the program:
.PP
.in +4n
.EX
$ \fBtouch /tmp/a /tmp/b /tmp/c\fP
$ \fB./a.out /tmp/a /tmp/b /tmp/c\fP
/tmp/a opened as FD 3
/tmp/b opened as FD 4
/tmp/c opened as FD 5
/proc/self/fd/0 ==> /dev/pts/1
/proc/self/fd/1 ==> /dev/pts/1
/proc/self/fd/2 ==> /dev/pts/1
/proc/self/fd/3 ==> /tmp/a
/proc/self/fd/4 ==> /tmp/b
/proc/self/fd/5 ==> /tmp/b
/proc/self/fd/6 ==> /proc/9005/fd
========= About to call close_range() =======
/proc/self/fd/0 ==> /dev/pts/1
/proc/self/fd/1 ==> /dev/pts/1
/proc/self/fd/2 ==> /dev/pts/1
/proc/self/fd/3 ==> /proc/9005/fd
.EE
.in
.PP
Note that the lines showing the pathname
.I /proc/9005/fd
result from the calls to
.BR opendir (3).
.SS Program source
\&
.EX
#define _GNU_SOURCE
#include <fcntl.h>
#include <linux/close_range.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/syscall.h>
#include <string.h>
#include <unistd.h>
#include <dirent.h>
/* Show the contents of the symbolic links in /proc/self/fd */
static void
show_fds(void)
{
DIR *dirp = opendir("/proc/self/fd");
if (dirp == NULL) {
perror("opendir");
exit(EXIT_FAILURE);
}
for (;;) {
struct dirent *dp = readdir(dirp);
if (dp == NULL)
break;
if (dp\->d_type == DT_LNK) {
char path[PATH_MAX], target[PATH_MAX];
snprintf(path, sizeof(path), "/proc/self/fd/%s",
dp\->d_name);
ssize_t len = readlink(path, target, sizeof(target));
printf("%s ==> %.*s\en", path, (int) len, target);
}
}
closedir(dirp);
}
int
main(int argc, char *argv[])
{
for (int j = 1; j < argc; j++) {
int fd = open(argv[j], O_RDONLY);
if (fd == \-1) {
perror(argv[j]);
exit(EXIT_FAILURE);
}
printf("%s opened as FD %d\en", argv[j], fd);
}
show_fds();
printf("========= About to call close_range() =======\en");
if (syscall(__NR_close_range, 3, \(ti0U, 0) == \-1) {
perror("close_range");
exit(EXIT_FAILURE);
}
show_fds();
exit(EXIT_FAILURE);
}
.EE
.SH SEE ALSO
.BR close (2)

View File

@ -64,12 +64,11 @@
.\" Modified 1998, 1999 by Andi Kleen
.\" Modified 2004-06-23 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH CONNECT 2 2020-04-11 "Linux" "Linux Programmer's Manual"
.TH CONNECT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
connect \- initiate a connection on a socket
.SH SYNOPSIS
.nf
.BR "#include <sys/types.h>" " /* See NOTES */"
.B #include <sys/socket.h>
.PP
.BI "int connect(int " sockfd ", const struct sockaddr *" addr ,
@ -137,7 +136,7 @@ is supported on Linux since kernel 2.2.)
If the connection or binding succeeds, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
The following are general socket errors only.
There may be other domain-specific error codes.
@ -276,12 +275,6 @@ first appeared in 4.2BSD).
.\" It also
.\" documents many additional error conditions not described here.
.SH NOTES
POSIX.1 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
.PP
For background on the
.I socklen_t
type, see

View File

@ -22,7 +22,7 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH COPY_FILE_RANGE 2 2020-06-09 "Linux" "Linux Programmer's Manual"
.TH COPY_FILE_RANGE 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
copy_file_range \- Copy a range of data from one file to another
.SH SYNOPSIS
@ -30,8 +30,8 @@ copy_file_range \- Copy a range of data from one file to another
.B #define _GNU_SOURCE
.B #include <unistd.h>
.PP
.BI "ssize_t copy_file_range(int " fd_in ", loff_t *" off_in ,
.BI " int " fd_out ", loff_t *" off_out ,
.BI "ssize_t copy_file_range(int " fd_in ", off64_t *" off_in ,
.BI " int " fd_out ", off64_t *" off_out ,
.BI " size_t " len ", unsigned int " flags );
.fi
.SH DESCRIPTION
@ -233,26 +233,14 @@ or server-side-copy (in the case of NFS).
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <unistd.h>
/* On versions of glibc before 2.27, we must invoke copy_file_range()
using syscall(2) */
static loff_t
copy_file_range(int fd_in, loff_t *off_in, int fd_out,
loff_t *off_out, size_t len, unsigned int flags)
{
return syscall(__NR_copy_file_range, fd_in, off_in, fd_out,
off_out, len, flags);
}
int
main(int argc, char **argv)
main(int argc, char *argv[])
{
int fd_in, fd_out;
struct stat stat;
loff_t len, ret;
off64_t len, ret;
if (argc != 3) {
fprintf(stderr, "Usage: %s <source> <destination>\en", argv[0]);

View File

@ -7,7 +7,7 @@
.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
.\" reformatting and rewordings by mtk
.\"
.TH CREATE_MODULE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH CREATE_MODULE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
create_module \- create a loadable module entry
.SH SYNOPSIS
@ -31,7 +31,7 @@ This system call requires privilege.
On success, returns the kernel address at which the module will reside.
On error, \-1 is returned and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EEXIST

View File

@ -22,16 +22,23 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH DELETE_MODULE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH DELETE_MODULE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
delete_module \- unload a kernel module
.SH SYNOPSIS
.nf
.BI "int delete_module(const char *" name ", int " flags );
.BR "#include <fcntl.h>" " /* Definition of " O_* " constants */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.BR "#include <unistd.h>
.PP
.BI "int syscall(SYS_delete_module, const char *" name ", unsigned int " flags );
.fi
.PP
.IR Note :
No declaration of this system call is provided in glibc headers; see NOTES.
glibc provides no wrapper for
.BR delete_module (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
The
.BR delete_module ()
@ -125,7 +132,7 @@ Using this flag taints the kernel (TAINT_FORCED_RMMOD).
On success, zero is returned.
On error, \-1 is returned and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBUSY

View File

@ -34,7 +34,7 @@
.\" details for dup2().
.\" 2008-10-09, mtk: add description of dup3()
.\"
.TH DUP 2 2020-11-01 "Linux" "Linux Programmer's Manual"
.TH DUP 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
dup, dup2, dup3 \- duplicate a file descriptor
.SH SYNOPSIS
@ -43,9 +43,9 @@ dup, dup2, dup3 \- duplicate a file descriptor
.PP
.BI "int dup(int " oldfd );
.BI "int dup2(int " oldfd ", int " newfd );
.PP
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.BR "#include <fcntl.h>" " /* Obtain O_* constant definitions */"
.BR "#include <fcntl.h>" " /* Definition of " O_* " constants */"
.B #include <unistd.h>
.PP
.BI "int dup3(int " oldfd ", int " newfd ", int " flags );
@ -53,18 +53,22 @@ dup, dup2, dup3 \- duplicate a file descriptor
.SH DESCRIPTION
The
.BR dup ()
system call creates a copy of the file descriptor
.IR oldfd ,
using the lowest-numbered unused file descriptor for the new descriptor.
system call allocates a new file descriptor that refers to the same
open file description as the descriptor
.IR oldfd .
(For an explanation of open file descriptions, see
.BR open (2).)
The new file descriptor number is guaranteed to be the lowest-numbered
file descriptor that was unused in the calling process.
.PP
After a successful return,
the old and new file descriptors may be used interchangeably.
They refer to the same open file description (see
.BR open (2))
and thus share file offset and file status flags;
Since the two file descriptors refer to the same open file description,
they share file offset and file status flags;
for example, if the file offset is modified by using
.BR lseek (2)
on one of the file descriptors, the offset is also changed for the other.
on one of the file descriptors,
the offset is also changed for the other file descriptor.
.PP
The two file descriptors do not share file descriptor flags
(the close-on-exec flag).
@ -82,9 +86,18 @@ system call performs the same task as
but instead of using the lowest-numbered unused file descriptor,
it uses the file descriptor number specified in
.IR newfd .
In other words,
the file descriptor
.I newfd
is adjusted so that it now refers to the same open file description as
.IR oldfd .
.PP
If the file descriptor
.IR newfd
was previously open, it is silently closed before being reused.
was previously open, it is closed before being reused;
the close is performed silently
(i.e., any errors during the close are not reported by
.BR dup2 ()).
.PP
The steps of closing and reusing the file descriptor
.IR newfd
@ -152,7 +165,7 @@ On success, these system calls
return the new file descriptor.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -255,21 +268,21 @@ Instead, code something like the following could be used:
tmpfd = dup(newfd);
if (tmpfd == \-1 && errno != EBADF) {
/* Handle unexpected dup() error */
/* Handle unexpected dup() error. */
}
/* Atomically duplicate \(aqoldfd\(aq on \(aqnewfd\(aq */
/* Atomically duplicate \(aqoldfd\(aq on \(aqnewfd\(aq. */
if (dup2(oldfd, newfd) == \-1) {
/* Handle dup2() error */
/* Handle dup2() error. */
}
/* Now check for close() errors on the file originally
referred to by \(aqnewfd\(aq */
referred to by \(aqnewfd\(aq. */
if (tmpfd != \-1) {
if (close(tmpfd) == \-1) {
/* Handle errors from close */
/* Handle errors from close. */
}
}
.EE

View File

@ -22,7 +22,7 @@
.\" Modified 2005-04-04 by Marko Kohtala <marko.kohtala@gmail.com>
.\" 2008-10-10, mtk: add description of epoll_create1()
.\"
.TH EPOLL_CREATE 2 2020-04-11 "Linux" "Linux Programmer's Manual"
.TH EPOLL_CREATE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
epoll_create, epoll_create1 \- open an epoll file descriptor
.SH SYNOPSIS
@ -121,7 +121,9 @@ was added to the kernel in version 2.6.27.
Library support is provided in glibc starting with version 2.9.
.SH CONFORMING TO
.BR epoll_create ()
is Linux-specific.
and
.BR epoll_create1 ()
are Linux-specific.
.SH NOTES
In the initial
.BR epoll_create ()

View File

@ -18,14 +18,16 @@
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH EPOLL_CTL 2 2020-11-01 "Linux" "Linux Programmer's Manual"
.TH EPOLL_CTL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
epoll_ctl \- control interface for an epoll file descriptor
.SH SYNOPSIS
.nf
.B #include <sys/epoll.h>
.PP
.BI "int epoll_ctl(int " epfd ", int " op ", int " fd \
", struct epoll_event *" event );
.fi
.SH DESCRIPTION
This system call is used to add, modify, or remove
entries in the interest list of the
@ -314,7 +316,7 @@ When an error occurs,
.BR epoll_ctl ()
returns \-1 and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF

1
man2/epoll_pwait2.2 Normal file
View File

@ -0,0 +1 @@
.so man2/epoll_wait.2

View File

@ -20,9 +20,9 @@
.\"
.\" 2007-04-30: mtk, Added description of epoll_pwait()
.\"
.TH EPOLL_WAIT 2 2020-04-11 "Linux" "Linux Programmer's Manual"
.TH EPOLL_WAIT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
epoll_wait, epoll_pwait \- wait for an I/O event on an epoll file descriptor
epoll_wait, epoll_pwait, epoll_pwait2 \- wait for an I/O event on an epoll file descriptor
.SH SYNOPSIS
.nf
.B #include <sys/epoll.h>
@ -32,6 +32,12 @@ epoll_wait, epoll_pwait \- wait for an I/O event on an epoll file descriptor
.BI "int epoll_pwait(int " epfd ", struct epoll_event *" events ,
.BI " int " maxevents ", int " timeout ,
.BI " const sigset_t *" sigmask );
.BI "int epoll_pwait2(int " epfd ", struct epoll_event *" events ,
.BI " int " maxevents ", const struct timespec *" timeout ,
.BI " const sigset_t *" sigmask );
.\" FIXME: Check if glibc has added a wrapper for epoll_pwait2(),
.\" and if so, check the prototype.
.\" https://sourceware.org/bugzilla/show_bug.cgi?id=27359
.fi
.SH DESCRIPTION
The
@ -170,18 +176,39 @@ argument may be specified as NULL, in which case
.BR epoll_pwait ()
is equivalent to
.BR epoll_wait ().
.\"
.SS epoll_pwait2()
The
.BR epoll_pwait2 ()
system call is equivalent to
.BR epoll_pwait ()
except for the
.I timeout
argument.
It takes an argument of type
.I timespec
to be able to specify nanosecond resolution timeout.
This argument functions the same as in
.BR pselect (2)
and
.BR ppoll (2).
If
.I timeout
is NULL, then
.BR epoll_pwait2 ()
can block indefinitely.
.SH RETURN VALUE
When successful,
On success,
.BR epoll_wait ()
returns the number of file descriptors ready for the requested I/O, or zero
if no file descriptor became ready during the requested
.I timeout
milliseconds.
When an error occurs,
On failure,
.BR epoll_wait ()
returns \-1 and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -217,9 +244,15 @@ Library support is provided in glibc starting with version 2.3.2.
.BR epoll_pwait ()
was added to Linux in kernel 2.6.19.
Library support is provided in glibc starting with version 2.6.
.PP
.BR epoll_pwait2 ()
was added to Linux in kernel 5.11.
.SH CONFORMING TO
.BR epoll_wait ()
is Linux-specific.
.BR epoll_wait (),
.BR epoll_pwait (),
and
.BR epoll_pwait2 ()
are Linux-specific.
.SH NOTES
While one thread is blocked in a call to
.BR epoll_wait (),
@ -252,6 +285,21 @@ instance whose interest list is currently empty
or removed from the interest in another thread).
The call will block until some file descriptor is later added to the
interest list (in another thread) and that file descriptor becomes ready.
.SS C library/kernel differences
The raw
.BR epoll_pwait ()
and
.BR epoll_pwait2 ()
system calls have a sixth argument,
.IR "size_t sigsetsize" ,
which specifies the size in bytes of the
.IR sigmask
argument.
The glibc
.BR epoll_pwait ()
wrapper function specifies this argument as a fixed value
(equal to
.IR sizeof(sigset_t) ).
.SH BUGS
In kernels before 2.6.37, a
.I timeout
@ -264,19 +312,6 @@ is 4 and the kernel
.I HZ
value is 1000,
this means that timeouts greater than 35.79 minutes are treated as infinity.
.SS C library/kernel differences
The raw
.BR epoll_pwait ()
system call has a sixth argument,
.IR "size_t sigsetsize" ,
which specifies the size in bytes of the
.IR sigmask
argument.
The glibc
.BR epoll_pwait ()
wrapper function specifies this argument as a fixed value
(equal to
.IR sizeof(sigset_t) ).
.SH SEE ALSO
.BR epoll_create (2),
.BR epoll_ctl (2),

View File

@ -19,13 +19,15 @@
.\"
.\" 2008-10-10, mtk: describe eventfd2(), and EFD_NONBLOCK and EFD_CLOEXEC
.\"
.TH EVENTFD 2 2020-11-01 Linux "Linux Programmer's Manual"
.TH EVENTFD 2 2021-03-22 Linux "Linux Programmer's Manual"
.SH NAME
eventfd \- create a file descriptor for event notification
.SH SYNOPSIS
.nf
.B #include <sys/eventfd.h>
.PP
.BI "int eventfd(unsigned int " initval ", int " flags );
.fi
.SH DESCRIPTION
.BR eventfd ()
creates an "eventfd object" that can be used as
@ -270,15 +272,19 @@ system call, if it is supported by the kernel.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lb lb lb
lbx lb lb
l l l.
Interface Attribute Value
T{
.BR eventfd ()
T} Thread safety MT-Safe
.TE
.hy
.ad
.sp 1
.SH CONFORMING TO
.BR eventfd ()

View File

@ -34,15 +34,16 @@
.\" 2007-09-14 Ollie Wild <aaw@google.com>, mtk
.\" Add text describing limits on command-line arguments + environment
.\"
.TH EXECVE 2 2020-08-13 "Linux" "Linux Programmer's Manual"
.TH EXECVE 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
execve \- execute program
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int execve(const char *" pathname ", char *const " argv [],
.br
.BI " char *const " envp []);
.fi
.SH DESCRIPTION
.BR execve ()
executes the program referred to by \fIpathname\fP.
@ -140,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
@ -156,7 +157,7 @@ If the executable is a dynamically linked ELF executable, the
interpreter named in the PT_INTERP segment is used to load the needed
shared objects.
This interpreter is typically
.I /lib/ld-linux.so.2
.I /lib/ld\-linux.so.2
for binaries linked with glibc (see
.BR ld\-linux.so (8)).
.\"
@ -345,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...
@ -423,14 +424,14 @@ ensures that the new program always has some stack space.)
Additionally, the total size is limited to 3/4 of the value
of the kernel constant
.B _STK_LIM
(8 Mibibytes).
(8 MiB).
Since Linux 2.6.25,
the kernel also places a floor of 32 pages on this size limit,
so that, even when
.BR RLIMIT_STACK
is set very low,
applications are guaranteed to have at least as much argument and
environment space as was provided by Linux 2.6.23 and earlier.
environment space as was provided by Linux 2.6.22 and earlier.
(This guarantee was not provided in Linux 2.6.23 and 2.6.24.)
Additionally, the limit per string is 32 pages (the kernel constant
.BR MAX_ARG_STRLEN ),
@ -440,7 +441,7 @@ On success,
.BR execve ()
does not return, on error \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B E2BIG
@ -881,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,17 +23,18 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH EXECVEAT 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH EXECVEAT 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
execveat \- execute program relative to a directory file descriptor
.SH SYNOPSIS
.nf
.BR "#include <linux/fcntl.h>" " /* Definition of " AT_* " constants */"
.B #include <unistd.h>
.PP
.BI "int execveat(int " dirfd ", const char *" pathname ","
.br
.BI " char *const " argv "[], char *const " envp "[],"
.br
.BI "int execveat(int " dirfd ", const char *" pathname ,
.BI " const char *const " argv "[], const char *const " envp [],
.BI " int " flags );
.fi
.SH DESCRIPTION
.\" commit 51f39a1f0cea1cacf8c787f652f26dfee9611874
The
@ -111,7 +112,7 @@ On success,
does not return.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
The same errors that occur for
.BR execve (2)
@ -120,9 +121,12 @@ can also occur for
The following additional errors can occur for
.BR execveat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B EINVAL
Invalid flag specified in
@ -160,8 +164,7 @@ is a file descriptor referring to a file other than a directory.
.SH VERSIONS
.BR execveat ()
was added to Linux in kernel 3.19.
GNU C library support is pending.
.\" FIXME . check for glibc support in a future release
Library support was added to glibc in version 2.34.
.SH CONFORMING TO
The
.BR execveat ()

View File

@ -22,19 +22,24 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH EXIT_GROUP 2 2008-11-27 "Linux" "Linux Programmer's Manual"
.TH EXIT_GROUP 2 2021-06-20 "Linux" "Linux Programmer's Manual"
.SH NAME
exit_group \- exit all threads in a process
.SH SYNOPSIS
.nf
.B #include <linux/unistd.h>
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "void exit_group(int " status );
.BI "noreturn void syscall(SYS_exit_group, int " status );
.fi
.PP
.IR Note :
glibc provides no wrapper for
.BR exit_group (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
This system call is equivalent to
.BR _exit (2)
except that it terminates not only the calling thread, but all threads
This system call terminates all threads
in the calling process's thread group.
.SH RETURN VALUE
This system call does not return.
@ -47,4 +52,4 @@ Since glibc 2.3, this is the system call invoked when the
.BR _exit (2)
wrapper function is called.
.SH SEE ALSO
.BR exit (2)
.BR _exit (2)

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

@ -21,15 +21,16 @@
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.TH FANOTIFY_INIT 2 2020-11-01 "Linux" "Linux Programmer's Manual"
.TH FANOTIFY_INIT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
fanotify_init \- create and initialize fanotify group
.SH SYNOPSIS
.B #include <fcntl.h>
.br
.nf
.BR "#include <fcntl.h>" " /* Definition of " O_* " constants */"
.B #include <sys/fanotify.h>
.PP
.BI "int fanotify_init(unsigned int " flags ", unsigned int " event_f_flags );
.fi
.SH DESCRIPTION
For an overview of the fanotify API, see
.BR fanotify (7).
@ -40,7 +41,7 @@ queue associated with the group.
.PP
The file descriptor is used in calls to
.BR fanotify_mark (2)
to specify the files, directories, mounts or filesystems for which fanotify
to specify the files, directories, mounts, or filesystems for which fanotify
events shall be created.
These events are received by reading from the file descriptor.
Some events are only informative, indicating that a file has been accessed.
@ -155,6 +156,14 @@ supplied to
(see
.BR fanotify (7)).
.TP
.BR FAN_ENABLE_AUDIT " (since Linux 4.15)"
.\" commit de8cd83e91bc3ee212b3e6ec6e4283af9e4ab269
Enable generation of audit log records about access mediation performed by
permission events.
The permission event response has to be marked with the
.B FAN_AUDIT
flag for an audit log record to be generated.
.TP
.BR FAN_REPORT_FID " (since Linux 5.1)"
.\" commit a8b13aa20afb69161b5123b4f1acc7ea0a03d360
This value allows the receipt of events which contain additional information

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 2020-11-01 "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
@ -500,7 +513,7 @@ events for both the ELF binary and interpreter, respectively:
.in +4n
.EX
/bin/echo
/lib64/ld-linux-x86-64.so.2
/lib64/ld\-linux\-x86\-64.so.2
.EE
.in
.SH BUGS

View File

@ -64,12 +64,11 @@
.\" 2017-06-26, Jens Axboe <axboe@kernel.dk>
.\" Document F_{GET,SET}_RW_HINT and F_{GET,SET}_FILE_RW_HINT
.\"
.TH FCNTL 2 2020-12-21 "Linux" "Linux Programmer's Manual"
.TH FCNTL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
fcntl \- manipulate file descriptor
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.B #include <fcntl.h>
.PP
.BI "int fcntl(int " fd ", int " cmd ", ... /* " arg " */ );"
@ -1156,7 +1155,7 @@ as
.PP
If the lease holder fails to downgrade or remove the lease within
the number of seconds specified in
.IR /proc/sys/fs/lease-break-time ,
.IR /proc/sys/fs/lease\-break\-time ,
then the kernel forcibly removes or downgrades the lease holder's lease.
.PP
Once a lease break has been initiated,
@ -1349,13 +1348,13 @@ to be at least
bytes.
An unprivileged process can adjust the pipe capacity to any value
between the system page size and the limit defined in
.IR /proc/sys/fs/pipe-max-size
.IR /proc/sys/fs/pipe\-max\-size
(see
.BR proc (5)).
Attempts to set the pipe capacity below the page size are silently
rounded up to the page size.
Attempts by an unprivileged process to set the pipe capacity above the limit in
.IR /proc/sys/fs/pipe-max-size
.IR /proc/sys/fs/pipe\-max\-size
yield the error
.BR EPERM ;
a privileged process
@ -1661,7 +1660,7 @@ Zero.
.PP
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.BR EACCES " or " EAGAIN
@ -2114,7 +2113,7 @@ It is therefore inadvisable to rely on mandatory locking.
.BR lslocks (8)
.PP
.IR locks.txt ,
.IR mandatory-locking.txt ,
.IR mandatory\-locking.txt ,
and
.I dnotify.txt
in the Linux kernel source directory
@ -2122,6 +2121,6 @@ in the Linux kernel source directory
(on older kernels, these files are directly under the
.I Documentation/
directory, and
.I mandatory-locking.txt
.I mandatory\-locking.txt
is called
.IR mandatory.txt )

View File

@ -32,13 +32,15 @@
.\" FIXME Maybe document LOCK_MAND, LOCK_RW, LOCK_READ, LOCK_WRITE
.\" which only have effect for SAMBA.
.\"
.TH FLOCK 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH FLOCK 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
flock \- apply or remove an advisory lock on an open file
.SH SYNOPSIS
.nf
.B #include <sys/file.h>
.PP
.BI "int flock(int " fd ", int " operation );
.fi
.SH DESCRIPTION
Apply or remove an advisory lock on the open file specified by
.IR fd .
@ -113,7 +115,7 @@ mode in which the file was opened.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -237,6 +239,31 @@ see the discussion of the
.I "local_lock"
option in
.BR nfs (5).
.SS CIFS details
In Linux kernels up to 5.4,
.BR flock ()
is not propagated over SMB.
A file with such locks will not appear locked for remote clients.
.PP
Since Linux 5.5,
.BR flock ()
locks are emulated with SMB byte-range locks on the entire file.
Similarly to NFS, this means that
.BR fcntl (2)
and
.BR flock ()
locks interact with one another.
Another important side-effect is that the locks are not advisory anymore:
any IO on a locked file will always fail with
.BR EACCES
when done from a separate file descriptor.
This difference originates from the design of locks in the SMB protocol,
which provides mandatory locking semantics.
.PP
Remote and mandatory locking semantics may vary with SMB protocol, mount options and server type.
See
.BR mount.cifs (8)
for additional information.
.SH SEE ALSO
.BR flock (1),
.BR close (2),

View File

@ -36,15 +36,15 @@
.\" Greatly expanded, to describe all attributes that differ
.\" parent and child.
.\"
.TH FORK 2 2020-06-09 "Linux" "Linux Programmer's Manual"
.TH FORK 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
fork \- create a child process
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.nf
.B #include <unistd.h>
.PP
.B pid_t fork(void);
.fi
.SH DESCRIPTION
.BR fork ()
creates a new process by duplicating the calling process.
@ -217,7 +217,7 @@ and 0 is returned in the child.
On failure, \-1 is returned in the parent,
no child process is created, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EAGAIN
@ -234,7 +234,7 @@ which limits the number of processes and threads for a real user ID,
was reached;
.IP *
the kernel's system-wide limit on the number of processes and threads,
.IR /proc/sys/kernel/threads-max ,
.IR /proc/sys/kernel/threads\-max ,
was reached (see
.BR proc (5));
.IP *

View File

@ -35,30 +35,36 @@
.\" 2006-04-28, mtk, substantial rewrite of various parts.
.\" 2012-02-27 Various changes by Christoph Hellwig <hch@lst.de>
.\"
.TH FSYNC 2 2020-06-09 "Linux" "Linux Programmer's Manual"
.TH FSYNC 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
fsync, fdatasync \- synchronize a file's in-core state with storage device
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int fsync(int " fd );
.PP
.BI "int fdatasync(int " fd );
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.PP
.nf
.BR fsync ():
Glibc 2.16 and later:
No feature test macros need be defined
Glibc up to and including 2.15:
_BSD_SOURCE || _XOPEN_SOURCE
|| /* since glibc 2.8: */ _POSIX_C_SOURCE\ >=\ 200112L
.br
|| /* Since glibc 2.8: */ _POSIX_C_SOURCE >= 200112L
.fi
.PP
.BR fdatasync ():
_POSIX_C_SOURCE\ >=\ 199309L || _XOPEN_SOURCE\ >=\ 500
.nf
_POSIX_C_SOURCE >= 199309L || _XOPEN_SOURCE >= 500
.fi
.SH DESCRIPTION
.BR fsync ()
transfers ("flushes") all modified in-core data of
@ -113,7 +119,7 @@ require all metadata to be synchronized with the disk.
On success, these system calls return zero.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF

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 2020-11-01 "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
@ -1018,7 +1028,7 @@ user space atomically by setting the futex value to 0.
.\" retry:
.\"
.\" /*
.\" * Owner might have unlocked in userspace before we
.\" * Owner might have unlocked in user space before we
.\" * were able to set the waiter bit.
.\" */
.\" if (atomic_acquire(futex) == SUCCESS) {
@ -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
@ -1147,7 +1179,7 @@ but the kernel can fix this up and acquire the futex.
.\" in user space would fail, so kernel has to clean up.)
.\" Darren Hart (Oct 2015):
.\" The trylock in the kernel has more state, so it can independently
.\" verify the flags that userspace must trust implicitly.
.\" verify the flags that user space must trust implicitly.
.IP
The
.IR uaddr2 ,
@ -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.
@ -1320,7 +1354,7 @@ was invoked via
.BR syscall (2)),
all operations return \-1 and set
.I errno
to indicate the cause of the error.
to indicate the error.
.PP
The return value on success depends on the operation,
as described in the following list:
@ -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_BITESET
.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
@ -1799,7 +1845,7 @@ fwait(uint32_t *futexp)
if (atomic_compare_exchange_strong(futexp, &one, 0))
break; /* Yes */
/* Futex is not available; wait */
/* Futex is not available; wait. */
s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);
if (s == \-1 && errno != EAGAIN)
@ -1817,7 +1863,7 @@ fpost(uint32_t *futexp)
long s;
/* atomic_compare_exchange_strong() was described
in comments above */
in comments above. */
const uint32_t zero = 0;
if (atomic_compare_exchange_strong(futexp, &zero, 1)) {
@ -1840,7 +1886,7 @@ main(int argc, char *argv[])
/* Create a shared anonymous mapping that will hold the futexes.
Since the futexes are being shared between processes, we
subsequently use the "shared" futex operations (i.e., not the
ones suffixed "_PRIVATE") */
ones suffixed "_PRIVATE"). */
iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,
MAP_ANONYMOUS | MAP_SHARED, \-1, 0);
@ -1854,7 +1900,7 @@ main(int argc, char *argv[])
*futex2 = 1; /* State: available */
/* Create a child process that inherits the shared anonymous
mapping */
mapping. */
childPid = fork();
if (childPid == \-1)
@ -1870,7 +1916,7 @@ main(int argc, char *argv[])
exit(EXIT_SUCCESS);
}
/* Parent falls through to here */
/* Parent falls through to here. */
for (int j = 0; j < nloops; j++) {
fwait(futex2);
@ -1893,15 +1939,15 @@ main(int argc, char *argv[])
.PP
The following kernel source files:
.IP * 2
.I Documentation/pi-futex.txt
.I Documentation/pi\-futex.txt
.IP *
.I Documentation/futex-requeue-pi.txt
.I Documentation/futex\-requeue\-pi.txt
.IP *
.I Documentation/locking/rt-mutex.txt
.I Documentation/locking/rt\-mutex.txt
.IP *
.I Documentation/locking/rt-mutex-design.txt
.I Documentation/locking/rt\-mutex\-design.txt
.IP *
.I Documentation/robust-futex-ABI.txt
.I Documentation/robust\-futex\-ABI.txt
.PP
Franke, H., Russell, R., and Kirwood, M., 2002.
\fIFuss, Futexes and Furwocks: Fast Userlevel Locking in Linux\fP

View File

@ -22,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 ,
@ -41,7 +41,9 @@ Feature Test Macro Requirements for glibc (see
.RE
.PP
.BR futimesat ():
_GNU_SOURCE
.nf
_GNU_SOURCE
.fi
.SH DESCRIPTION
This system call is obsolete.
Use
@ -81,6 +83,11 @@ If
is absolute, then
.I dirfd
is ignored.
(See
.BR openat (2)
for an explanation of why the
.I dirfd
argument is useful.)
.SH RETURN VALUE
On success,
.BR futimesat ()
@ -97,8 +104,12 @@ The following additional errors can occur for
.BR futimesat ():
.TP
.B EBADF
.I pathname
is relative but
.I dirfd
is not a valid file descriptor.
is neither
.B AT_FDCWD
nor a valid file descriptor.
.TP
.B ENOTDIR
.I pathname

View File

@ -7,7 +7,7 @@
.\" 2006-02-09, some reformatting by Luc Van Oostenryck; some
.\" reformatting and rewordings by mtk
.\"
.TH GET_KERNEL_SYMS 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GET_KERNEL_SYMS 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
get_kernel_syms \- retrieve exported kernel and module symbols
.SH SYNOPSIS
@ -53,7 +53,7 @@ On success, returns the number of symbols copied to
.IR table .
On error, \-1 is returned and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
There is only one possible error return:
.TP

View File

@ -24,7 +24,7 @@
.\" 2007-08-27, Lee Schermerhorn <Lee.Schermerhorn@hp.com>
.\" more precise specification of behavior.
.\"
.TH GET_MEMPOLICY 2 2017-09-15 Linux "Linux Programmer's Manual"
.TH GET_MEMPOLICY 2 2021-03-22 Linux "Linux Programmer's Manual"
.SH NAME
get_mempolicy \- retrieve NUMA memory policy for a thread
.SH SYNOPSIS
@ -32,11 +32,14 @@ get_mempolicy \- retrieve NUMA memory policy for a thread
.nf
.PP
.BI "long get_mempolicy(int *" mode ", unsigned long *" nodemask ,
.BI " unsigned long " maxnode ", void *" addr ,
.BI " unsigned long " flags );
.BI " unsigned long " maxnode ", void *" addr ,
.BI " unsigned long " flags );
.PP
Link with \fI\-lnuma\fP.
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
.SH DESCRIPTION
.BR get_mempolicy ()
retrieves the NUMA policy of the calling thread or of a memory address,
@ -239,6 +242,7 @@ system call was added to the Linux kernel in version 2.6.7.
.SH CONFORMING TO
This system call is Linux-specific.
.SH NOTES
Glibc does not provide a wrapper for this system call.
For information on library support, see
.BR numa (7).
.SH SEE ALSO

View File

@ -27,22 +27,26 @@
.\" FIXME Something could be added to this page (or exit(2))
.\" about exit_robust_list processing
.\"
.TH GET_ROBUST_LIST 2 2019-10-10 Linux "Linux System Calls"
.TH GET_ROBUST_LIST 2 2021-03-22 Linux "Linux System Calls"
.SH NAME
get_robust_list, set_robust_list \- get/set list of robust futexes
.SH SYNOPSIS
.nf
.B #include <linux/futex.h>
.B #include <sys/types.h>
.B #include <syscall.h>
.BR "#include <linux/futex.h>" \
" /* Definition of " "struct robust_list_head" " */"
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "long get_robust_list(int " pid ", struct robust_list_head **" head_ptr ,
.BI " size_t *" len_ptr );
.BI "long set_robust_list(struct robust_list_head *" head ", size_t " len );
.BI "long syscall(SYS_get_robust_list, int " pid ,
.BI " struct robust_list_head **" head_ptr ", size_t *" len_ptr );
.BI "long syscall(SYS_set_robust_list,"
.BI " struct robust_list_head *" head ", size_t " len );
.fi
.PP
.IR Note :
There are no glibc wrappers for these system calls; see NOTES.
glibc provides no wrappers for these system calls,
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
These system calls deal with per-thread robust futex lists.
These lists are managed in user space:
@ -139,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
@ -165,8 +166,8 @@ and
.BR futex (2),
.BR pthread_mutexattr_setrobust (3)
.PP
.IR Documentation/robust-futexes.txt
.IR Documentation/robust\-futexes.txt
and
.IR Documentation/robust-futex-ABI.txt
.IR Documentation/robust\-futex\-ABI.txt
in the Linux kernel source tree
.\" http://lwn.net/Articles/172149/

View File

@ -9,15 +9,15 @@
.\"
.\" 2008, mtk, various edits
.\"
.TH GETCPU 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETCPU 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getcpu \- determine CPU and NUMA node on which the calling thread is running
.SH SYNOPSIS
.nf
.B #include <linux/getcpu.h>
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.B #include <sched.h>
.PP
.BI "int getcpu(unsigned *" cpu ", unsigned *" node \
", struct getcpu_cache *" tcache );
.BI "int getcpu(unsigned int *" cpu ", unsigned int *" node );
.fi
.SH DESCRIPTION
The
@ -37,10 +37,6 @@ or
.I node
is NULL nothing is written to the respective pointer.
.PP
The third argument to this system call is nowadays unused,
and should be specified as NULL
unless portability to Linux 2.6.23 or earlier is required (see NOTES).
.PP
The information placed in
.I cpu
is guaranteed to be current only at the time of the call:
@ -59,7 +55,7 @@ is no longer current by the time the call returns.
On success, 0 is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT
@ -82,16 +78,31 @@ The intention of
.BR getcpu ()
is to allow programs to make optimizations with per-CPU data
or for NUMA optimization.
.\"
.SS C library/kernel differences
The kernel system call has a third argument:
.PP
.in +4n
.nf
.BI "int getcpu(unsigned int *" cpu ", unsigned int *" node ,
.BI " struct getcpu_cache *" tcache );
.fi
.in
.PP
The
.I tcache
argument is unused since Linux 2.6.24.
argument is unused since Linux 2.6.24,
and (when invoking the system call directly)
should be specified as NULL,
unless portability to Linux 2.6.23 or earlier is required.
.PP
.\" commit 4307d1e5ada595c87f9a4d16db16ba5edb70dcb1
.\" Author: Ingo Molnar <mingo@elte.hu>
.\" Date: Wed Nov 7 18:37:48 2007 +0100
.\" x86: ignore the sys_getcpu() tcache parameter
In earlier kernels,
if this argument was non-NULL,
In Linux 2.6.23 and earlier, if the
.I tcache
argument was non-NULL,
then it specified a pointer to a caller-allocated buffer in thread-local
storage that was used to provide a caching mechanism for
.BR getcpu ().

View File

@ -28,24 +28,34 @@
.\" Derived from 'readdir.2'.
.\" Modified Tue Oct 22 08:11:14 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
.\"
.TH GETDENTS 2 2020-11-01 "Linux" "Linux Programmer's Manual"
.TH GETDENTS 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getdents, getdents64 \- get directory entries
.SH SYNOPSIS
.nf
.BI "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
@ -76,7 +86,7 @@ struct linux_dirent {
unsigned long d_ino; /* Inode number */
unsigned long d_off; /* Offset to next \fIlinux_dirent\fP */
unsigned short d_reclen; /* Length of this \fIlinux_dirent\fP */
char d_name[]; /* Filename (null-terminated) */
char d_name[]; /* Filename (null\-terminated) */
/* length is actually (d_reclen \- 2 \-
offsetof(struct linux_dirent, d_name)) */
/*
@ -173,11 +183,11 @@ structures of the following type:
.in +4n
.EX
struct linux_dirent64 {
ino64_t d_ino; /* 64-bit inode number */
off64_t d_off; /* 64-bit offset to next structure */
ino64_t d_ino; /* 64\-bit inode number */
off64_t d_off; /* 64\-bit offset to next structure */
unsigned short d_reclen; /* Size of this dirent */
unsigned char d_type; /* File type */
char d_name[]; /* Filename (null-terminated) */
char d_name[]; /* Filename (null\-terminated) */
};
.EE
.in
@ -186,7 +196,7 @@ On success, the number of bytes read is returned.
On end of directory, 0 is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF
@ -211,13 +221,13 @@ SVr4.
Library support for
.BR getdents64 ()
was added in glibc 2.30;
there is no glibc wrapper for
.BR getdents ().
Calling
Glibc does not provide a wrapper for
.BR getdents ();
call
.BR getdents ()
(or
.BR getdents64 ()
on earlier glibc versions) requires the use of
on earlier glibc versions) using
.BR syscall (2).
In that case you will need to define the
.I linux_dirent
@ -242,7 +252,7 @@ program on an ext2 directory:
.in +4n
.EX
.RB "$" " ./a.out /testfs/"
--------------- nread=120 ---------------
-\-\-\-\-\-\-\-\-\-\-\-\-\-\- nread=120 \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
inode# file type d_reclen d_off d_name
2 directory 16 12 .
2 directory 16 24 ..

View File

@ -26,22 +26,22 @@
.\" Modified 2004-06-17 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" Modified 2008-11-27 by mtk
.\"
.TH GETDOMAINNAME 2 2019-10-10 "Linux" "Linux Programmer's Manual"
.TH GETDOMAINNAME 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getdomainname, setdomainname \- get/set NIS domain name
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int getdomainname(char *" name ", size_t " len );
.br
.BI "int setdomainname(const char *" name ", size_t " len );
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.PP
.ad l
.BR getdomainname (),
.BR setdomainname ():
.nf
@ -49,11 +49,10 @@ Feature Test Macro Requirements for glibc (see
.\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8
_DEFAULT_SOURCE
In glibc 2.19 and 2.20:
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
Up to and including glibc 2.19:
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
.fi
.ad
.SH DESCRIPTION
These functions are used to access or to change the NIS domain name of the
host system.
@ -84,7 +83,7 @@ returns the first \fIlen\fP bytes (glibc) or gives an error (libc).
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.BR setdomainname ()
can fail with the following errors:

View File

@ -22,17 +22,16 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETGID 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETGID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getgid, getegid \- get group identity
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.br
.B #include <sys/types.h>
.PP
.B gid_t getgid(void);
.br
.B gid_t getegid(void);
.fi
.SH DESCRIPTION
.BR getgid ()
returns the real group ID of the calling process.
@ -40,7 +39,11 @@ returns the real group ID of the calling process.
.BR getegid ()
returns the effective group ID of the calling process.
.SH ERRORS
These functions are always successful.
These functions are always successful
and never modify
.\" https://www.austingroupbugs.net/view.php?id=511
.\" 0000511: getuid and friends should not modify errno
.IR errno .
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, 4.3BSD.
.SH NOTES

View File

@ -29,19 +29,19 @@
.\" 2008-05-03, mtk, expanded and rewrote parts of DESCRIPTION and RETURN
.\" VALUE, made style of page more consistent with man-pages style.
.\"
.TH GETGROUPS 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETGROUPS 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getgroups, setgroups \- get/set list of supplementary group IDs
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.nf
.B #include <unistd.h>
.PP
.BI "int getgroups(int " size ", gid_t " list []);
.PP
.B #include <grp.h>
.PP
.BI "int setgroups(size_t " size ", const gid_t *" list );
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
@ -49,10 +49,12 @@ Feature Test Macro Requirements for glibc (see
.RE
.PP
.BR setgroups ():
.nf
Since glibc 2.19:
_DEFAULT_SOURCE
Glibc 2.19 and earlier:
_BSD_SOURCE
.fi
.SH DESCRIPTION
.BR getgroups ()
returns the supplementary group IDs of the calling process in
@ -106,14 +108,14 @@ On success,
returns the number of supplementary group IDs.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.PP
On success,
.BR setgroups ()
returns 0.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT

View File

@ -29,43 +29,40 @@
.\" Modified 2004-06-17 by mtk
.\" Modified 2008-11-27 by mtk
.\"
.TH GETHOSTNAME 2 2019-10-10 "Linux" "Linux Programmer's Manual"
.TH GETHOSTNAME 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
gethostname, sethostname \- get/set hostname
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.BI "int gethostname(char *" name ", size_t " len );
.br
.BI "int sethostname(const char *" name ", size_t " len );
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.PP
.ad l
.PD 0
.BR gethostname ():
.RS 4
Since glibc 2.12:
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
.br
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200112L
.RE
.br
.nf
_XOPEN_SOURCE >= 500 || _POSIX_C_SOURCE >= 200112L
|| /* Glibc 2.19 and earlier */ _BSD_SOURCE
.\" The above is something of a simplification
.\" also in glibc before 2.3 there was a bit churn
.fi
.PP
.BR sethostname ():
.nf
Since glibc 2.21:
.\" commit 266865c0e7b79d4196e2cc393693463f03c90bd8
_DEFAULT_SOURCE
In glibc 2.19 and 2.20:
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_DEFAULT_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
Up to and including glibc 2.19:
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE < 500)
.fi
.PD
.ad
.SH DESCRIPTION
These system calls are used to access or to change the system hostname.
More precisely, they operate on the hostname associated with the calling
@ -97,7 +94,7 @@ includes a terminating null byte.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT

View File

@ -10,7 +10,7 @@
.\" 2005-04-06 mtk, Matthias Lang <matthias@corelatus.se>
.\" Noted MAX_SEC_IN_JIFFIES ceiling
.\"
.TH GETITIMER 2 2020-04-11 "Linux" "Linux Programmer's Manual"
.TH GETITIMER 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getitimer, setitimer \- get or set value of an interval timer
.SH SYNOPSIS
@ -18,8 +18,8 @@ getitimer, setitimer \- get or set value of an interval timer
.B #include <sys/time.h>
.PP
.BI "int getitimer(int " which ", struct itimerval *" curr_value );
.BI "int setitimer(int " which ", const struct itimerval *" new_value ,
.BI " struct itimerval *" old_value );
.BI "int setitimer(int " which ", const struct itimerval *restrict " new_value ,
.BI " struct itimerval *restrict " old_value );
.fi
.SH DESCRIPTION
These system calls provide access to interval timers, that is,
@ -134,7 +134,7 @@ if both of its subfields are zero, the timer is single-shot.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT

View File

@ -22,13 +22,15 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETPAGESIZE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETPAGESIZE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getpagesize \- get memory page size
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.B int getpagesize(void);
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
@ -36,26 +38,15 @@ Feature Test Macro Requirements for glibc (see
.RE
.PP
.BR getpagesize ():
.ad l
.RS 4
.PD 0
.TP 4
Since glibc 2.19:
.nf
_DEFAULT_SOURCE || ! (_POSIX_C_SOURCE\ >=\ 200112L)
Since glibc 2.20:
_DEFAULT_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
Glibc 2.12 to 2.19:
_BSD_SOURCE || ! (_POSIX_C_SOURCE >= 200112L)
Before glibc 2.12:
_BSD_SOURCE || _XOPEN_SOURCE >= 500
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
.fi
.TP 4
From glibc 2.12 to 2.19:
.nf
_BSD_SOURCE || ! (_POSIX_C_SOURCE\ >=\ 200112L)
.fi
.TP 4
Before glibc 2.12:
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
.PD
.RE
.ad b
.SH DESCRIPTION
The function
.BR getpagesize ()

View File

@ -39,14 +39,16 @@
.\" Modified 17 Jul 2002, Michael Kerrisk <mtk.manpages@gmail.com>
.\" Added 'socket' to NAME, so that "man -k socket" will show this page.
.\"
.TH GETPEERNAME 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETPEERNAME 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getpeername \- get name of connected peer socket
.SH SYNOPSIS
.nf
.B #include <sys/socket.h>
.PP
.BI "int getpeername(int " sockfd ", struct sockaddr *" addr \
", socklen_t *" addrlen );
.BI "int getpeername(int " sockfd ", struct sockaddr *restrict " addr ,
.BI " socklen_t *restrict " addrlen );
.fi
.SH DESCRIPTION
.BR getpeername ()
returns the address of the peer connected to the socket
@ -69,7 +71,7 @@ will return a value greater than was supplied to the call.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF

View File

@ -22,17 +22,16 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETPID 2 2020-11-01 "Linux" "Linux Programmer's Manual"
.TH GETPID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getpid, getppid \- get process identification
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.nf
.B #include <unistd.h>
.PP
.B pid_t getpid(void);
.br
.B pid_t getppid(void);
.fi
.SH DESCRIPTION
.BR getpid ()
returns the process ID (PID) of the calling process.

View File

@ -42,17 +42,16 @@
.\" Clarified meaning of 0 value for 'who' argument
.\" Modified 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
.\"
.TH GETPRIORITY 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETPRIORITY 2 2021-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
getpriority, setpriority \- get/set program scheduling priority
.SH SYNOPSIS
.B #include <sys/time.h>
.br
.nf
.B #include <sys/resource.h>
.PP
.BI "int getpriority(int " which ", id_t " who );
.br
.BI "int setpriority(int " which ", id_t " who ", int " prio );
.fi
.SH DESCRIPTION
The scheduling priority of the process, process group, or user, as
indicated by
@ -93,7 +92,7 @@ calling process, or the real user ID of the calling process.
.PP
The
.I prio
argument is a value in the range \-20 to 19 (but see NOTES below).
argument is a value in the range \-20 to 19 (but see NOTES below),
with \-20 being the highest priority and 19 being the lowest priority.
Attempts to set a priority outside this range
are silently clamped to the range.
@ -123,12 +122,12 @@ On success,
returns the calling thread's nice value, which may be a negative number.
On error, it returns \-1 and sets
.I errno
to indicate the cause of the error.
to indicate the error.
.PP
Since a successful call to
.BR getpriority ()
can legitimately return the value \-1, it is necessary
to clear the external variable
to clear
.I errno
prior to the
call, then check
@ -138,11 +137,18 @@ if \-1 is an error or a legitimate value.
.PP
.BR setpriority ()
returns 0 on success.
On error, it returns \-1 and sets
On failure, it returns \-1 and sets
.I errno
to indicate the cause of the error.
to indicate the error.
.SH ERRORS
.TP
.B EACCES
The caller attempted to set a lower nice value
(i.e., a higher process priority), but did not
have the required privilege (on Linux: did not have the
.B CAP_SYS_NICE
capability).
.TP
.B EINVAL
.I which
was not one of
@ -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
@ -251,5 +234,5 @@ which may be made standards conformant in the future.
.BR capabilities (7),
.BR sched (7)
.PP
.I Documentation/scheduler/sched-nice-design.txt
.I Documentation/scheduler/sched\-nice\-design.txt
in the Linux kernel source tree (since Linux 2.6.23)

View File

@ -24,13 +24,15 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETRANDOM 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETRANDOM 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getrandom \- obtain a series of random bytes
.SH SYNOPSIS
.nf
.B #include <sys/random.h>
.PP
.BI "ssize_t getrandom(void *"buf ", size_t " buflen ", unsigned int " flags );
.fi
.SH DESCRIPTION
The
.BR getrandom ()
@ -136,7 +138,7 @@ source or the system call was interrupted by a signal.
.PP
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EAGAIN

View File

@ -25,17 +25,17 @@
.\"
.\" Modified, 2003-05-26, Michael Kerrisk, <mtk.manpages@gmail.com>
.\"
.TH GETRESUID 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETRESUID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getresuid, getresgid \- get real, effective and saved user/group IDs
getresuid, getresgid \- get real, effective, and saved user/group IDs
.SH SYNOPSIS
.nf
.BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
.br
.B #include <unistd.h>
.PP
.BI "int getresuid(uid_t *" ruid ", uid_t *" euid ", uid_t *" suid );
.br
.BI "int getresgid(gid_t *" rgid ", gid_t *" egid ", gid_t *" sgid );
.fi
.SH DESCRIPTION
.BR getresuid ()
returns the real UID, the effective UID, and the saved set-user-ID
@ -51,7 +51,7 @@ performs the analogous task for the process's group IDs.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT

View File

@ -61,22 +61,19 @@
.\" 2008-05-07, mtk / Peter Zijlstra, Added description of RLIMIT_RTTIME
.\" 2010-11-06, mtk: Added documentation of prlimit()
.\"
.TH GETRLIMIT 2 2020-11-01 "Linux" "Linux Programmer's Manual"
.TH GETRLIMIT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getrlimit, setrlimit, prlimit \- get/set resource limits
.SH SYNOPSIS
.B #include <sys/time.h>
.br
.nf
.B #include <sys/resource.h>
.PP
.BI "int getrlimit(int " resource ", struct rlimit *" rlim );
.br
.BI "int setrlimit(int " resource ", const struct rlimit *" rlim );
.PP
.BI "int prlimit(pid_t " pid ", int " resource \
", const struct rlimit *" new_limit ,
.br
.BI "int prlimit(pid_t " pid ", int " resource ", const struct rlimit *" new_limit ,
.BI " struct rlimit *" old_limit );
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
@ -84,7 +81,9 @@ Feature Test Macro Requirements for glibc (see
.RE
.PP
.BR prlimit ():
_GNU_SOURCE
.nf
_GNU_SOURCE
.fi
.SH DESCRIPTION
The
.BR getrlimit ()
@ -308,7 +307,7 @@ The actual ceiling for the nice value is calculated as
.IR "20\ \-\ rlim_cur" .
The useful range for this limit is thus from 1
(corresponding to a nice value of 19) to 40
(corresponding to a nice value of -20).
(corresponding to a nice value of \-20).
This unusual choice of range was necessary
because negative numbers cannot be specified
as resource limit values, since they typically have special meanings.
@ -508,7 +507,7 @@ must match the real group ID of the caller.
On success, these system calls return 0.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT
@ -557,9 +556,11 @@ Library support is available since glibc 2.13.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lbw35 lb lb
lbx lb lb
l l l.
Interface Attribute Value
T{
@ -568,6 +569,8 @@ T{
.BR prlimit ()
T} Thread safety MT-Safe
.TE
.hy
.ad
.sp 1
.SH CONFORMING TO
.BR getrlimit (),

View File

@ -36,15 +36,15 @@
.\" document ru_maxrss
.\" 2010-05-24, mtk, enhanced description of various fields
.\"
.TH GETRUSAGE 2 2020-12-21 "Linux" "Linux Programmer's Manual"
.TH GETRUSAGE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getrusage \- get resource usage
.SH SYNOPSIS
.B #include <sys/time.h>
.br
.nf
.B #include <sys/resource.h>
.PP
.BI "int getrusage(int " who ", struct rusage *" usage );
.fi
.SH DESCRIPTION
.BR getrusage ()
returns resource usage measures for
@ -187,7 +187,7 @@ exceeded its time slice.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT
@ -200,15 +200,19 @@ is invalid.
.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.ad l
.nh
.TS
allbox;
lb lb lb
lbx lb lb
l l l.
Interface Attribute Value
T{
.BR getrusage ()
T} Thread safety MT-Safe
.TE
.hy
.ad
.sp 1
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, SVr4, 4.3BSD.
@ -225,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
@ -256,6 +252,9 @@ For backward compatibility, glibc (up until version 2.32) also provides
.BR vtimes ().
All new applications should be written using
.BR getrusage ().
(Since version 2.33, glibc no longer provides an
.BR vtimes ()
implementation.)
.PP
See also the description of
.IR /proc/[pid]/stat

View File

@ -24,31 +24,27 @@
.\"
.\" Modified Thu Oct 31 14:18:40 1996 by Eric S. Raymond <esr@y\thyrsus.com>
.\" Modified 2001-12-17, aeb
.TH GETSID 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETSID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getsid \- get session ID
.SH SYNOPSIS
.B #include <sys/types.h>
.br
.nf
.B #include <unistd.h>
.PP
.BI "pid_t getsid(pid_t" " pid" );
.fi
.PP
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.PP
.ad l
.PD 0
.BR getsid ():
.RS 4
_XOPEN_SOURCE\ >=\ 500
.\" || _XOPEN_SOURCE\ &&\ _XOPEN_SOURCE_EXTENDED
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE\ >=\ 200809L
.RE
.PD
.ad
.nf
_XOPEN_SOURCE >= 500
.\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
|| /* Since glibc 2.12: */ _POSIX_C_SOURCE >= 200809L
.fi
.SH DESCRIPTION
.I getsid(0)
returns the session ID of the calling process.
@ -62,9 +58,9 @@ is 0,
returns the session ID of the calling process.
.SH RETURN VALUE
On success, a session ID is returned.
On error, \fI(pid_t)\ \-1\fP will be returned, and
On error, \fI(pid_t)\ \-1\fP is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EPERM

View File

@ -37,15 +37,15 @@
.\" Modified Tue Oct 22 00:22:35 EDT 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" Modified Sun Mar 28 21:26:46 1999 by Andries Brouwer <aeb@cwi.nl>
.\"
.TH GETSOCKNAME 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH GETSOCKNAME 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getsockname \- get socket name
.SH SYNOPSIS
.nf
.B #include <sys/socket.h>
.PP
.BI "int getsockname(int " sockfd ", struct sockaddr *" addr \
", socklen_t *" addrlen );
.BI "int getsockname(int " sockfd ", struct sockaddr *restrict " addr ,
.BI " socklen_t *restrict " addrlen );
.fi
.SH DESCRIPTION
.BR getsockname ()
@ -68,7 +68,7 @@ will return a value greater than was supplied to the call.
On success, zero is returned.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF

View File

@ -41,16 +41,15 @@
.\" Modified 1999 by Andi Kleen <ak@muc.de>.
.\" Removed most stuff because it is in socket.7 now.
.\"
.TH GETSOCKOPT 2 2020-04-11 "Linux" "Linux Programmer's Manual"
.TH GETSOCKOPT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getsockopt, setsockopt \- get and set options on sockets
.SH SYNOPSIS
.nf
.BR "#include <sys/types.h>" " /* See NOTES */"
.B #include <sys/socket.h>
.PP
.BI "int getsockopt(int " sockfd ", int " level ", int " optname ,
.BI " void *" optval ", socklen_t *" optlen );
.BI " void *restrict " optval ", socklen_t *restrict " optlen );
.BI "int setsockopt(int " sockfd ", int " level ", int " optname ,
.BI " const void *" optval ", socklen_t " optlen );
.fi
@ -131,7 +130,7 @@ and the appropriate protocol man pages.
On success, zero is returned for the standard options.
On error, \-1 is returned, and
.I errno
is set appropriately.
is set to indicate the error.
.PP
Netfilter allows the programmer
to define custom socket options with associated handlers; for such
@ -179,12 +178,6 @@ SVr4, 4.4BSD (these system calls first appeared in 4.2BSD).
.\" .BR SO_SNDLOWAT ", " SO_RCVLOWAT ", " SO_SNDTIMEO ", " SO_RCVTIMEO
.\" options
.SH NOTES
POSIX.1 does not require the inclusion of
.IR <sys/types.h> ,
and this header file is not required on Linux.
However, some historical (BSD) implementations required this header
file, and portable applications are probably wise to include it.
.PP
For background on the
.I socklen_t
type, see

View File

@ -23,14 +23,13 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETTID 2 2020-04-11 "Linux" "Linux Programmer's Manual"
.TH GETTID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
gettid \- get thread identification
.SH SYNOPSIS
.nf
.B #define _GNU_SOURCE
.B #include <unistd.h>
.B #include <sys/types.h>
.PP
.B pid_t gettid(void);
.fi

View File

@ -37,17 +37,17 @@
.\" Modified, 2004-05-27 by Michael Kerrisk <mtk.manpages@gmail.com>
.\" Added notes on capability requirement.
.\"
.TH GETTIMEOFDAY 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETTIMEOFDAY 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
gettimeofday, settimeofday \- get / set time
.SH SYNOPSIS
.nf
.B #include <sys/time.h>
.PP
.BI "int gettimeofday(struct timeval *" tv ", struct timezone *" tz );
.PP
.BI "int settimeofday(const struct timeval *" tv \
", const struct timezone *" tz );
.BI "int gettimeofday(struct timeval *restrict " tv ,
.BI " struct timezone *restrict " tz );
.BI "int settimeofday(const struct timeval *" tv ,
.BI " const struct timezone *" tz );
.fi
.PP
.RS -4
@ -56,10 +56,12 @@ Feature Test Macro Requirements for glibc (see
.RE
.PP
.BR settimeofday ():
.nf
Since glibc 2.19:
_DEFAULT_SOURCE
Glibc 2.19 and earlier:
_BSD_SOURCE
.fi
.SH DESCRIPTION
The functions
.BR gettimeofday ()
@ -144,9 +146,10 @@ No doubt it is a bad idea to use this feature.
.BR gettimeofday ()
and
.BR settimeofday ()
return 0 for success, or \-1 for failure (in which case
return 0 for success.
On error, \-1 is returned and
.I errno
is set appropriately).
is set to indicate the error.
.SH ERRORS
.TP
.B EFAULT

View File

@ -23,17 +23,16 @@
.\" %%%LICENSE_END
.\"
.\" Historical remark, aeb, 2004-06-05
.TH GETUID 2 2019-03-06 "Linux" "Linux Programmer's Manual"
.TH GETUID 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getuid, geteuid \- get user identity
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.br
.B #include <sys/types.h>
.PP
.B uid_t getuid(void);
.br
.B uid_t geteuid(void);
.fi
.SH DESCRIPTION
.BR getuid ()
returns the real user ID of the calling process.
@ -41,7 +40,11 @@ returns the real user ID of the calling process.
.BR geteuid ()
returns the effective user ID of the calling process.
.SH ERRORS
These functions are always successful.
These functions are always successful
and never modify
.\" https://www.austingroupbugs.net/view.php?id=511
.\" 0000511: getuid and friends should not modify errno
.IR errno .
.SH CONFORMING TO
POSIX.1-2001, POSIX.1-2008, 4.3BSD.
.SH NOTES

View File

@ -24,21 +24,25 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH GETUNWIND 2 2017-09-15 Linux "Linux Programmer's Manual"
.TH GETUNWIND 2 2021-03-22 Linux "Linux Programmer's Manual"
.SH NAME
getunwind \- copy the unwind data to caller's buffer
.SH SYNOPSIS
.nf
.B #include <syscall.h>
.B #include <linux/unwind.h>
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.PP
.BI "long getunwind(void " *buf ", size_t " buf_size );
.BI "long syscall(SYS_getunwind, void " *buf ", size_t " buf_size );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
glibc provides no wrapper for
.BR getunwind (),
necessitating the use of
.BR syscall (2).
.SH DESCRIPTION
.I Note: this function is obsolete.
.I Note: this system call is obsolete.
.PP
The
IA-64-specific
@ -68,9 +72,9 @@ The unwind table contains entries of the following form:
.PP
.in +4n
.EX
u64 start; (64-bit address of start of function)
u64 end; (64-bit address of end of function)
u64 info; (BUF-relative offset to unwind info)
u64 start; (64\-bit address of start of function)
u64 end; (64\-bit address of end of function)
u64 info; (BUF\-relative offset to unwind info)
.EE
.in
.PP
@ -102,9 +106,5 @@ and is available only on the IA-64 architecture.
This system call has been deprecated.
The modern way to obtain the kernel's unwind data is via the
.BR vdso (7).
.PP
Glibc does not provide a wrapper for this system call;
in the unlikely event that you want to call it, use
.BR syscall (2).
.SH SEE ALSO
.BR getauxval (3)

View File

@ -22,21 +22,20 @@
.\" <http://www.gnu.org/licenses/>.
.\" %%%LICENSE_END
.\"
.TH GETXATTR 2 2020-06-09 "Linux" "Linux Programmer's Manual"
.TH GETXATTR 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
getxattr, lgetxattr, fgetxattr \- retrieve an extended attribute value
.SH SYNOPSIS
.fam C
.nf
.B #include <sys/types.h>
.B #include <sys/xattr.h>
.PP
.BI "ssize_t getxattr(const char\ *" path ", const char\ *" name ,
.BI " void\ *" value ", size_t " size );
.BI "ssize_t lgetxattr(const char\ *" path ", const char\ *" name ,
.BI " void\ *" value ", size_t " size );
.BI "ssize_t fgetxattr(int " fd ", const char\ *" name ,
.BI " void\ *" value ", size_t " size );
.BI "ssize_t getxattr(const char *" path ", const char *" name ,
.BI " void *" value ", size_t " size );
.BI "ssize_t lgetxattr(const char *" path ", const char *" name ,
.BI " void *" value ", size_t " size );
.BI "ssize_t fgetxattr(int " fd ", const char *" name ,
.BI " void *" value ", size_t " size );
.fi
.fam T
.SH DESCRIPTION
@ -106,7 +105,7 @@ On success, these calls return a nonnegative value which is
the size (in bytes) of the extended attribute value.
On failure, \-1 is returned and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B E2BIG

View File

@ -29,13 +29,15 @@
.\" N.B. calling "idle" from user process used to hang process!
.\" Modified Thu Oct 31 14:41:15 1996 by Eric S. Raymond <esr@thyrsus.com>
.\" "
.TH IDLE 2 2012-12-31 "Linux" "Linux Programmer's Manual"
.TH IDLE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
idle \- make process 0 idle
.SH SYNOPSIS
.nf
.B #include <unistd.h>
.PP
.B int idle(void);
.fi
.SH DESCRIPTION
.BR idle ()
is an internal system call used during bootstrap.

View File

@ -24,24 +24,25 @@
.\" the source, must acknowledge the copyright and authors of this work.
.\" %%%LICENSE_END
.\"
.TH INIT_MODULE 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH INIT_MODULE 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
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 );
.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 finit_module(int " fd ", const char *" param_values ,
.BI " int " flags );
.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 :
glibc provides no header file declaration of
.BR init_module ()
and no wrapper function for
.BR finit_module ();
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,
@ -155,7 +156,7 @@ as expected for malformed modules.
On success, these system calls return 0.
On error, \-1 is returned and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.BR EBADMSG " (since Linux 3.7)"
@ -273,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

@ -25,13 +25,15 @@
.\" 2005-07-19 Robert Love <rlove@rlove.org> - initial version
.\" 2006-02-07 mtk, various changes
.\"
.TH INOTIFY_ADD_WATCH 2 2020-04-11 "Linux" "Linux Programmer's Manual"
.TH INOTIFY_ADD_WATCH 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
inotify_add_watch \- add a watch to an initialized inotify instance
.SH SYNOPSIS
.nf
.B #include <sys/inotify.h>
.PP
.BI "int inotify_add_watch(int " fd ", const char *" pathname ", uint32_t " mask );
.fi
.SH DESCRIPTION
.BR inotify_add_watch ()
adds a new watch, or modifies an existing watch,
@ -80,7 +82,7 @@ On success,
returns a watch descriptor (a nonnegative integer).
On error, \-1 is returned and
.I errno
is set appropriately.
is set to indicate the error.
.SH ERRORS
.TP
.B EACCES

View File

@ -24,15 +24,17 @@
.\" 2005-07-19 Robert Love <rlove@rlove.org> - initial version
.\" 2006-02-07 mtk, minor changes
.\"
.TH INOTIFY_RM_WATCH 2 2017-09-15 "Linux" "Linux Programmer's Manual"
.TH INOTIFY_RM_WATCH 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
inotify_rm_watch \- remove an existing watch from an inotify instance
.SH SYNOPSIS
.nf
.B #include <sys/inotify.h>
.PP
.BI "int inotify_rm_watch(int " fd ", int " wd );
.\" Before glibc 2.10, the second argument was types as uint32_t.
.\" http://sources.redhat.com/bugzilla/show_bug.cgi?id=7040
.fi
.SH DESCRIPTION
.BR inotify_rm_watch ()
removes the watch associated with the watch descriptor
@ -51,7 +53,7 @@ On success,
returns zero.
On error, \-1 is returned and
.I errno
is set to indicate the cause of the error.
is set to indicate the error.
.SH ERRORS
.TP
.B EBADF

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

@ -4,19 +4,18 @@
.\" This file is distributed according to the GNU General Public License.
.\" %%%LICENSE_END
.\"
.TH IO_CANCEL 2 2020-12-21 "Linux" "Linux Programmer's Manual"
.TH IO_CANCEL 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
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 function 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

@ -4,18 +4,23 @@
.\" This file is distributed according to the GNU General Public License.
.\" %%%LICENSE_END
.\"
.TH IO_DESTROY 2 2020-12-21 "Linux" "Linux Programmer's Manual"
.TH IO_DESTROY 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
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 function 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

@ -4,21 +4,25 @@
.\" This file is distributed according to the GNU General Public License.
.\" %%%LICENSE_END
.\"
.TH IO_GETEVENTS 2 2020-12-21 "Linux" "Linux Programmer's Manual"
.TH IO_GETEVENTS 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
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 function 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

@ -4,14 +4,14 @@
.\" This file is distributed according to the GNU General Public License.
.\" %%%LICENSE_END
.\"
.TH IO_SETUP 2 2020-12-21 "Linux" "Linux Programmer's Manual"
.TH IO_SETUP 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
io_setup \- create an asynchronous I/O context
.SH SYNOPSIS
.nf
.BR "#include <linux/aio_abi.h>" " /* Defines needed types */"
.PP
.BI "long io_setup(unsigned " nr_events ", aio_context_t *" ctx_idp );
.BI "long io_setup(unsigned int " nr_events ", aio_context_t *" ctx_idp );
.fi
.PP
.IR Note :
@ -47,7 +47,7 @@ For the failure return, see NOTES.
.B EAGAIN
The specified \fInr_events\fP exceeds the limit of available events,
as defined in
.IR /proc/sys/fs/aio-max-nr
.IR /proc/sys/fs/aio\-max\-nr
(see
.BR proc (5)).
.TP
@ -72,7 +72,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 function for this system call.
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

View File

@ -5,7 +5,7 @@
.\" This file is distributed according to the GNU General Public License.
.\" %%%LICENSE_END
.\"
.TH IO_SUBMIT 2 2020-12-21 "Linux" "Linux Programmer's Manual"
.TH IO_SUBMIT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
.SH NAME
io_submit \- submit asynchronous I/O blocks for processing
.SH SYNOPSIS
@ -247,7 +247,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 function for this system call.
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

Some files were not shown because too many files have changed in this diff Show More