From 81b8997f5fbdbd86b26da348983cc261d2a6b02a Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Tue, 19 May 2020 09:59:28 +0200 Subject: [PATCH] pipe.2, sigaltstack.2, abort.3, signal.7: Place SH sections in standard order Fix various pages that deviated from the norm described in man-pages(7). Signed-off-by: Michael Kerrisk --- man2/pipe.2 | 12 ++++---- man2/sigaltstack.2 | 72 +++++++++++++++++++++++----------------------- man3/abort.3 | 4 +-- man7/signal.7 | 52 ++++++++++++++++----------------- 4 files changed, 70 insertions(+), 70 deletions(-) diff --git a/man2/pipe.2 b/man2/pipe.2 index 4a5a10567..bbd5cff92 100644 --- a/man2/pipe.2 +++ b/man2/pipe.2 @@ -193,6 +193,12 @@ has been reached and the caller is not privileged; see was added to Linux in version 2.6.27; glibc support is available starting with version 2.9. +.SH CONFORMING TO +.BR pipe (): +POSIX.1-2001, POSIX.1-2008. +.PP +.BR pipe2 () +is Linux-specific. .SH NOTES .\" See http://math-atlas.sourceforge.net/devel/assembly/64.psabi.1.33.ps.Z .\" for example, section 3.2.1 "Registers and the Stack Frame". @@ -210,12 +216,6 @@ wrapper function transparently deals with this. See .BR syscall (2) for information regarding registers used for storing second file descriptor. -.SH CONFORMING TO -.BR pipe (): -POSIX.1-2001, POSIX.1-2008. -.PP -.BR pipe2 () -is Linux-specific. .SH EXAMPLE .\" fork.2 refers to this example program. The following program creates a pipe, and then diff --git a/man2/sigaltstack.2 b/man2/sigaltstack.2 index 22f57b92a..98d4d9c70 100644 --- a/man2/sigaltstack.2 +++ b/man2/sigaltstack.2 @@ -286,42 +286,6 @@ system call. It used a slightly different struct, and had the major disadvantage that the caller had to know the direction of stack growth. -.SH EXAMPLE -The following code segment demonstrates the use of -.BR sigaltstack () -(and -.BR sigaction (2)) -to install an alternate signal stack that is employed by a handler -for the -.BR SIGSEGV -signal: -.PP -.in +4n -.EX -stack_t ss; - -ss.ss_sp = malloc(SIGSTKSZ); -if (ss.ss_sp == NULL) { - perror("malloc"); - exit(EXIT_FAILURE); -} - -ss.ss_size = SIGSTKSZ; -ss.ss_flags = 0; -if (sigaltstack(&ss, NULL) == \-1) { - perror("sigaltstack"); - exit(EXIT_FAILURE); -} - -sa.sa_flags = SA_ONSTACK; -sa.sa_handler = handler(); /* Address of a signal handler */ -sigemptyset(&sa.sa_mask); -if (sigaction(SIGSEGV, &sa, NULL) == -1) { - perror("sigaction"); - exit(EXIT_FAILURE); -} -.EE -.in .SH BUGS In Linux 2.2 and earlier, the only flag that could be specified in @@ -360,6 +324,42 @@ give an error if .B SS_ONSTACK is specified in .IR ss.ss_flags . +.SH EXAMPLE +The following code segment demonstrates the use of +.BR sigaltstack () +(and +.BR sigaction (2)) +to install an alternate signal stack that is employed by a handler +for the +.BR SIGSEGV +signal: +.PP +.in +4n +.EX +stack_t ss; + +ss.ss_sp = malloc(SIGSTKSZ); +if (ss.ss_sp == NULL) { + perror("malloc"); + exit(EXIT_FAILURE); +} + +ss.ss_size = SIGSTKSZ; +ss.ss_flags = 0; +if (sigaltstack(&ss, NULL) == \-1) { + perror("sigaltstack"); + exit(EXIT_FAILURE); +} + +sa.sa_flags = SA_ONSTACK; +sa.sa_handler = handler(); /* Address of a signal handler */ +sigemptyset(&sa.sa_mask); +if (sigaction(SIGSEGV, &sa, NULL) == -1) { + perror("sigaction"); + exit(EXIT_FAILURE); +} +.EE +.in .SH SEE ALSO .BR execve (2), .BR setrlimit (2), diff --git a/man3/abort.3 b/man3/abort.3 index beafdc8db..28cdf9da5 100644 --- a/man3/abort.3 +++ b/man3/abort.3 @@ -79,6 +79,8 @@ T{ .BR abort () T} Thread safety MT-Safe .TE +.SH CONFORMING TO +SVr4, POSIX.1-2001, POSIX.1-2008, 4.3BSD, C89, C99. .SH NOTES Up until glibc 2.26, if the @@ -94,8 +96,6 @@ terminates the process without flushing streams. POSIX.1 permits either possible behavior, saying that .BR abort () "may include an attempt to effect fclose() on all open streams". -.SH CONFORMING TO -SVr4, POSIX.1-2001, POSIX.1-2008, 4.3BSD, C89, C99. .SH SEE ALSO .BR gdb (1), .BR sigaction (2), diff --git a/man7/signal.7 b/man7/signal.7 index 433bfc304..b1b3fffaa 100644 --- a/man7/signal.7 +++ b/man7/signal.7 @@ -814,6 +814,32 @@ Linux 2.4 and earlier: .BR nanosleep (2). .SH CONFORMING TO POSIX.1, except as noted. +.SH NOTES +For a discussion of async-signal-safe functions, see +.BR signal-safety (7). +.PP +The +.I /proc/[pid]/task/[tid]/status +file contains various fields that show the signals +that a thread is blocking +.RI ( SigBlk ), +catching +.RI ( SigCgt ), +or ignoring +.RI ( SigIgn ). +(The set of signals that are caught or ignored will be the same +across all threads in a process.) +Other fields show the set of pending signals that are directed to the thread +.RI ( SigPnd ) +as well as the set of pending signals that are directed +to the process as a whole +.RI ( ShdPnd ). +The corresponding fields in +.I /proc/[pid]/status +show the information for the main thread. +See +.BR proc (5) +for further details. .SH BUGS There are six signals that can be delivered as a consequence of a hardware exception: @@ -844,32 +870,6 @@ even though .B SIGILL would make more sense, because of how the CPU reports the forbidden operation to the kernel. -.SH NOTES -For a discussion of async-signal-safe functions, see -.BR signal-safety (7). -.PP -The -.I /proc/[pid]/task/[tid]/status -file contains various fields that show the signals -that a thread is blocking -.RI ( SigBlk ), -catching -.RI ( SigCgt ), -or ignoring -.RI ( SigIgn ). -(The set of signals that are caught or ignored will be the same -across all threads in a process.) -Other fields show the set of pending signals that are directed to the thread -.RI ( SigPnd ) -as well as the set of pending signals that are directed -to the process as a whole -.RI ( ShdPnd ). -The corresponding fields in -.I /proc/[pid]/status -show the information for the main thread. -See -.BR proc (5) -for further details. .SH SEE ALSO .BR kill (1), .BR clone (2),