Commit Graph

9334 Commits

Author SHA1 Message Date
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
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
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 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 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
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 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 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
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
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
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 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 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
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
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
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 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 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
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
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
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
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
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 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
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
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
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
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
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 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
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
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 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 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
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 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 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
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
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
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 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
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 36dce68747 open.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-01-09 12:30:48 +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 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 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 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 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 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 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 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 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 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
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 e111e485ed recv.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-31 09:24:56 +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
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 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 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 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
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 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 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 9f43659f85 getent.1, access.2, cacheflush.2, chroot.2, clock_getres.2, fcntl.2, getrusage.2, io_cancel.2, io_destroy.2, io_getevents.2, io_setup.2, io_submit.2, link.2, llseek.2, mmap.2, mount.2, readv.2, restart_syscall.2, semctl.2, set_mempolicy.2, set_tid_address.2, shmctl.2, sigaction.2, sigaltstack.2, spu_create.2, statfs.2, subpage_prot.2, syscalls.2, timer_getoverrun.2, uselib.2, INFINITY.3, __ppc_set_ppr_med.3, bstring.3, btree.3, ctime.3, fgetc.3, fopen.3, getcontext.3, gethostbyname.3, getnetent.3, getprotoent.3, getservent.3, inet.3, j0.3, list.3, makecontext.3, nextafter.3, posix_memalign.3, profil.3, pthread_tryjoin_np.3, puts.3, rcmd.3, resolver.3, rtime.3, sigsetops.3, strnlen.3, tailq.3, elf.5, filesystems.5, nscd.conf.5, proc.5, utmp.5, attributes.7, ipv6.7, packet.7, pthreads.7, signal-safety.7, signal.7, spufs.7, system_data_types.7, tcp.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-21 16:19:35 +01:00
Michael Kerrisk adce9485ce cacheflush.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 21:52:42 +01:00
Alejandro Colomar 08811c1418 cacheflush.2: Document Architecture-specific variants
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 21:49:49 +01:00
Alejandro Colomar d7e7ab0e34 cacheflush.2: Document __builtin___clear_cache() as a more portable alternative
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Cc: Martin Sebor <msebor@redhat.com>
Cc: Dave Martin <Dave.Martin@arm.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 21:47:43 +01:00
Michael Kerrisk ab949f50af setns.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-20 11:54:31 +01:00
Michael Kerrisk 300ef55cf2 perf_event_open.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-16 15:51:34 +01:00
Arusekk e2e73b468a keyctl.2: tfix
Fixes: fa76da808e

Signed-off-by: Arusekk <arek_koz@o2.pl>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-12-01 20:46:58 +01:00
Alejandro Colomar e115d825c3 subpage_prot.2: SYNOPSIS: Fix return type: s/long/int/
The Linux kernel uses 'int' instead of 'long' for the return type.
As glibc provides no wrapper, use the same type the kernel uses.

......

$ grep -n wrapper man-pages/man2/subpage_prot.2
40:There is no glibc wrapper for this system call; see NOTES.
99:Glibc does not provide a wrapper for this system call; call it using

$ grep -rn SYSCALL_DEFINE.*subpage_prot linux/;
linux/arch/powerpc/mm/book3s64/subpage_prot.c:190:
SYSCALL_DEFINE3(subpage_prot, unsigned long, addr,

$ sed -n /SYSCALL.*subpage_prot/,/^}/p \
  linux/arch/powerpc/mm/book3s64/subpage_prot.c \
  |grep return;
		return -ENOENT;
		return -EINVAL;
		return -EINVAL;
		return 0;
		return -EFAULT;
			return -EFAULT;
	return err;

$ sed -n /SYSCALL.*subpage_prot/,/^}/p \
  linux/arch/powerpc/mm/book3s64/subpage_prot.c \
  |grep '\<err\>';
	int err;
			err = -ENOMEM;
		err = -ENOMEM;
	err = 0;
	return err;

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-28 09:56:37 +01:00
Michael Kerrisk c8efc05e6a spu_create.2: Clarify that spu_create() now has 4 arguments but once had only 3
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 11:15:14 +01:00
Michael Kerrisk c15912550f spu_create.2: Relocate paragraph on 'mode' argument
This paragraph is a little bit hidden at the end of DESCRIPTION;
make it a little more prominent.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 11:05:44 +01:00
Michael Kerrisk 42c7a19c5f spu_create.2: Add kernel version numbers for SPU_CREATE_AFFINITY_SPU/_MEM
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 11:04:02 +01:00
Michael Kerrisk 7be45add14 spu_run.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 10:05:38 +01:00
Michael Kerrisk 61d6b66a58 getpriority.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 09:29:12 +01:00
Michael Kerrisk fe2764329d getpriority.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-27 09:28:11 +01:00
Michael Kerrisk 373a3de56d link.2: ffix
Reported-by: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-26 13:52:15 +01:00
Mathias Rav 336be2e745 link.2: ERRORS: add ENOENT when target is deleted
Linux kernel commit aae8a97d3ec30788790d1720b71d76fd8eb44b73 (part
of kernel release v2.6.39) added a check to disallow creating a
hardlink to an unlinked file.

The manual page already describes the trick of using
AT_SYMLINK_FOLLOW as an alternative to AT_EMPTY_PATH, and for
AT_EMPTY_PATH the manual page already notes that it "will
generally not work if the file has a link count of zero". However,
the precise error (ENOENT) is not mentioned, and the error case
isn't mentioned in the ERRORS section at all.

This makes it easy to overlook the fact that the AT_SYMLINK_FOLLOW
trick on /proc/self/fd/NN won't work on deleted files, as
evidenced by the follow message (which turns up when googling
"linkat deleted ENOENT"):
https://groups.google.com/g/linux.kernel/c/zZO4lqqwp64

Signed-off-by: Mathias Rav <m@git.strova.dk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-26 10:58:54 +01:00
Michael Kerrisk 32a72b3e1b pivot_root.2: tfix
Reported-by: Davide Giorgio <davide@giorgiodavide.it>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-26 10:30:35 +01:00
Michael Kerrisk 6e94330a07 getrusage.2: Note that the 'vtimes' symbol exists only up to glibc 2.32
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-25 23:42:44 +01:00
Alejandro Colomar 36ded6fe89 set_tid_address.2: SYNOPSIS: Fix set_tid_address() return type
The Linux kernel uses 'pid_t' instead of 'long' for the return type.
As glibc provides no wrapper, use the same types the kernel uses.

$ sed -n 34,36p man-pages/man2/set_tid_address.2
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.

$ grep -rn 'SYSCALL_DEFINE.*set_tid_address' linux/
linux/kernel/fork.c:1632:
SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)

$ sed -n 1632,1638p linux/kernel/fork.c
SYSCALL_DEFINE1(set_tid_address, int __user *, tidptr)
{
	current->clear_child_tid = tidptr;

	return task_pid_vnr(current);
}

$ grep -rn 'task_pid_vnr(struct' linux/
linux/include/linux/sched.h:1374:
static inline pid_t task_pid_vnr(struct task_struct *tsk)

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-24 10:49:48 +01:00
Alejandro Colomar 701b2272cd restart_syscall.2: SYNOPSIS: Fix restart_syscall() return type
The Linux kernel uses 'long' instead of 'int' for the return type.
As glibc provides no wrapper, use the same types the kernel uses.

$ grep -rn 'SYSCALL_DEFINE.*(restart_syscall'
kernel/signal.c:2891:SYSCALL_DEFINE0(restart_syscall)

$ sed -n 2891,2895p kernel/signal.c
SYSCALL_DEFINE0(restart_syscall)
{
	struct restart_block *restart = &current->restart_block;
	return restart->fn(restart);
}

$ grep -rn 'struct restart_block {'
include/linux/restart_block.h:25:struct restart_block {

$ sed -n 25,56p include/linux/restart_block.h
struct restart_block {
	long (*fn)(struct restart_block *);
	union {
		/* For futex_wait and futex_wait_requeue_pi */
		struct {
			u32 __user *uaddr;
			u32 val;
			u32 flags;
			u32 bitset;
			u64 time;
			u32 __user *uaddr2;
		} futex;
		/* For nanosleep */
		struct {
			clockid_t clockid;
			enum timespec_type type;
			union {
				struct __kernel_timespec __user *rmtp;
				struct old_timespec32 __user *compat_rmtp;
			};
			u64 expires;
		} nanosleep;
		/* For poll */
		struct {
			struct pollfd __user *ufds;
			int nfds;
			int has_timeout;
			unsigned long tv_sec;
			unsigned long tv_nsec;
		} poll;
	};
};

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 22:52:30 +01:00
Michael Kerrisk 7c1a416d65 llseek.2: Point the reader to lseek64(3) for info about llseek(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 07:18:43 +01:00
Michael Kerrisk 48a830d7c8 llseek.2: Note size of 'loff_t' type
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-23 07:11:13 +01:00
Michael Kerrisk 940a0979de llseek.2: Some mild rewriting to ease reading of the info in this page
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-22 07:34:56 +01:00
Alejandro Colomar e7ff75357d capget.2, execve.2, readv.2, socketpair.2, utime.2, utimensat.2, getloadavg.3, proc.5, mount_namespaces.7, unix.7: ffix
{.IR var [x]} -> {.I var[x]}

There were around 15 entries of the former,
and around 360 of the latter.

Found using:
$ grep -rn '^\.I[ |R].* \[.*\]' |sort

Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-11-21 23:33:07 +01:00