Compare commits

...

29 Commits

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

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

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

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

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

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

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

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

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

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

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

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

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

Those, on my system, are:

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

And they all seem to also be part of glibc.

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

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

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

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

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

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

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

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

Cheers.
 emanuele6

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

///////

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

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

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

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

Test program below. Example runs:

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

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

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

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

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

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

    xfnd = 0;
    pstr = NULL;

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

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

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

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

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

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

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

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

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

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

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

Reported-by: наб <nabijaczleweli@nabijaczleweli.xyz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-09 02:32:36 +02:00
28 changed files with 337 additions and 60 deletions

View File

@ -23,14 +23,11 @@ ldd \- print shared object dependencies
prints the shared objects (shared libraries) required by each program or
shared object specified on the command line.
An example of its use and output
(using
.BR sed (1)
to trim leading white space for readability in this page)
is the following:
.PP
.in +4n
.EX
$ \fBldd /bin/ls | sed \(aqs/^ */ /\(aq\fP
$ \fBldd /bin/ls\fP
linux\-vdso.so.1 (0x00007ffcc3563000)
libselinux.so.1 => /lib64/libselinux.so.1 (0x00007f87e5459000)
libcap.so.2 => /lib64/libcap.so.2 (0x00007f87e5254000)

View File

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

View File

@ -358,8 +358,8 @@ call will still fail.
These calls
may not work correctly on NFSv2 filesystems with UID mapping enabled,
because UID mapping is done on the server and hidden from the client,
which checks permissions. (NFS versions 3 and higher perform the check on
the server.)
which checks permissions.
(NFS versions 3 and higher perform the check on the server.)
Similar problems can occur to FUSE mounts.
.\"
.\"

View File

@ -33,9 +33,6 @@ close_range \- close all file descriptors in a given range
.BI "int close_range(unsigned int " first ", unsigned int " last ,
.BI " unsigned int " flags );
.fi
.PP
.IR Note :
There is no glibc wrapper for this system call; see NOTES.
.SH DESCRIPTION
The
.BR close_range ()
@ -100,8 +97,6 @@ Library support was added in glibc in version 2.34.
.BR close_range ()
is a nonstandard function that is also present on FreeBSD.
.SH NOTES
Glibc does not provide a wrapper for this system call; call it using
.BR syscall (2).
.SS Closing all open file descriptors
.\" 278a5fbaed89dacd04e9d052f4594ffd0e0585de
To avoid blindly closing file descriptors

View File

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

View File

@ -43,7 +43,8 @@ The
operation requires privilege
.RB ( CAP_SYS_ADMIN ).
.SH RETURN VALUE
On success zero is returned. On error, \-1 is returned, and
On success zero is returned.
On error, \-1 is returned, and
.I errno
is set to indicate the error.
.SH ERRORS
@ -77,7 +78,8 @@ The maximum string length for this interface is
.BR FSLABEL_MAX ,
including the terminating null byte (\(aq\\0\(aq).
Filesystems have differing maximum label lengths, which may or
may not include the terminating null. The string provided to
may not include the terminating null.
The string provided to
.B FS_IOC_SETFSLABEL
must always be null-terminated, and the string returned by
.B FS_IOC_GETFSLABEL

View File

@ -71,6 +71,67 @@ Equivalent to
Allow the output buffer to drain, discard pending input, and
set the current serial port settings.
.PP
The following four ioctls, added in Linux 2.6.20,
.\" commit 64bb6c5e1ddcd47c951740485026ef08975ee2e6
.\" commit 592ee3a5e5e2a981ef2829a0380093006d045661
are just like
.BR TCGETS ,
.BR TCSETS ,
.BR TCSETSW ,
.BR TCSETSF ,
except that they take a
.I "struct termios2\ *"
instead of a
.IR "struct termios\ *" .
If the structure member
.B c_cflag
contains the flag
.BR BOTHER ,
then the baud rate is stored in the structure members
.B c_ispeed
and
.B c_ospeed
as integer values.
These ioctls are not supported on all architectures.
.RS
.TS
lb l.
TCGETS2 \fBstruct termios2 *\fPargp
TCSETS2 \fBconst struct termios2 *\fPargp
TCSETSW2 \fBconst struct termios2 *\fPargp
TCSETSF2 \fBconst struct termios2 *\fPargp
.TE
.RE
.PP
The following four ioctls are just like
.BR TCGETS ,
.BR TCSETS ,
.BR TCSETSW ,
.BR TCSETSF ,
except that they take a
.I "struct termios2\ *"
instead of a
.IR "struct termios\ *" .
If the structure member
.B c_cflag
contains the flag
.B BOTHER
then, the baud rate is stored in the structure members
.B c_ispeed
and
.B c_ospeed
as integer values.
These ioctls are not supported on all architectures.
.RS
.TS
lb l.
TCGETS2 \fBstruct termios2 *\fPargp
TCSETS2 \fBconst struct termios2 *\fPargp
TCSETSW2 \fBconst struct termios2 *\fPargp
TCSETSF2 \fBconst struct termios2 *\fPargp
.TE
.RE
.PP
The following four ioctls are just like
.BR TCGETS ,
.BR TCSETS ,
@ -701,7 +762,8 @@ Insufficient permission.
Check the condition of DTR on the serial port.
.PP
.EX
#include <termios.h>
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>

View File

@ -439,7 +439,8 @@ call.
.B EAGAIN
.BR RESOLVE_CACHED
was set, and the open operation cannot be performed using only cached
information. The caller should retry without
information.
The caller should retry without
.B RESOLVE_CACHED
set in
.I how.resolve .

View File

@ -141,9 +141,7 @@ are atomic: the data written by
.\" Regarding atomicity, see https://bugzilla.kernel.org/show_bug.cgi?id=10596
.BR writev ()
is written as a single block that is not intermingled with output
from writes in other processes (but see
.BR pipe (7)
for an exception);
from writes in other processes;
analogously,
.BR readv ()
is guaranteed to read a contiguous block of data from the file,

View File

@ -261,6 +261,44 @@ This flag is meaningful only when establishing a signal handler.
.\" .I sa_sigaction
.\" field was added in Linux 2.1.86.)
.\"
.TP
.B SA_UNSUPPORTED
Used to dynamically probe for flag bit support.
.IP
If an attempt to register a handler succeeds with this flag set in
.I act\->sa_flags
alongside other flags that are potentially unsupported by the kernel,
and an immediately subsequent
.BR sigaction ()
call specifying the same signal number and with a non-NULL
.I oldact
argument yields
.B SA_UNSUPPORTED
.I clear
in
.IR oldact->sa_flags ,
then
.I oldact->sa_flags
may be used as a bitmask
describing which of the potentially unsupported flags are,
in fact, supported.
See the section "Dynamically probing for flag bit support"
below for more details.
.TP
.BR SA_EXPOSE_TAGBITS " (since Linux 5.11)"
Normally, when delivering a signal,
an architecture-specific set of tag bits are cleared from the
.I si_addr
field of
.IR siginfo_t .
If this flag is set,
an architecture-specific subset of the tag bits will be preserved in
.IR si_addr .
.IP
Programs that need to be compatible with Linux versions older than 5.11
must use
.B SA_UNSUPPORTED
to probe for support.
.SS The siginfo_t argument to a SA_SIGINFO handler
When the
.B SA_SIGINFO
@ -846,6 +884,61 @@ Triggered by a
.BR seccomp (2)
filter rule.
.RE
.SS Dynamically probing for flag bit support
The
.BR sigaction ()
call on Linux accepts unknown bits set in
.I act\->sa_flags
without error.
The behavior of the kernel starting with Linux 5.11 is that a second
.BR sigaction ()
will clear unknown bits from
.IR oldact\->sa_flags .
However, historically, a second
.BR sigaction ()
call would typically leave those bits set in
.IR oldact\->sa_flags .
.PP
This means that support for new flags cannot be detected
simply by testing for a flag in
.IR sa_flags ,
and a program must test that
.B SA_UNSUPPORTED
has been cleared before relying on the contents of
.IR sa_flags .
.PP
Since the behavior of the signal handler cannot be guaranteed
unless the check passes,
it is wise to either block the affected signal
while registering the handler and performing the check in this case,
or where this is not possible,
for example if the signal is synchronous, to issue the second
.BR sigaction ()
in the signal handler itself.
.PP
In kernels that do not support a specific flag,
the kernel's behavior is as if the flag was not set,
even if the flag was set in
.IR act\->sa_flags .
.PP
The flags
.BR SA_NOCLDSTOP ,
.BR SA_NOCLDWAIT ,
.BR SA_SIGINFO ,
.BR SA_ONSTACK ,
.BR SA_RESTART ,
.BR SA_NODEFER ,
.BR SA_RESETHAND ,
and, if defined by the architecture,
.B SA_RESTORER
may not be reliably probed for using this mechanism,
because they were introduced before Linux 5.11.
However, in general, programs may assume that these flags are supported,
since they have all been supported since Linux 2.6,
which was released in the year 2003.
.PP
See EXAMPLES below for a demonstration of the use of
.BR SA_UNSUPPORTED .
.SH RETURN VALUE
.BR sigaction ()
returns 0 on success; on error, \-1 is returned, and
@ -1051,6 +1144,49 @@ This bug was fixed in kernel 2.6.14.
.SH EXAMPLES
See
.BR mprotect (2).
.SS Probing for flag support
The following example program exits with status
.B EXIT_SUCCESS
if
.B SA_EXPOSE_TAGBITS
is determined to be supported, and
.B EXIT_FAILURE
otherwise.
.PP
.EX
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
void
handler(int signo, siginfo_t *info, void *context)
{
struct sigaction oldact;
if (sigaction(SIGSEGV, NULL, &oldact) == \-1 ||
(oldact.sa_flags & SA_UNSUPPORTED) ||
!(oldact.sa_flags & SA_EXPOSE_TAGBITS)) {
_exit(EXIT_FAILURE);
}
_exit(EXIT_SUCCESS);
}
int
main(void)
{
struct sigaction act = { 0 };
act.sa_flags = SA_SIGINFO | SA_UNSUPPORTED | SA_EXPOSE_TAGBITS;
act.sa_sigaction = &handler;
if (sigaction(SIGSEGV, &act, NULL) == \-1) {
perror("sigaction");
exit(EXIT_FAILURE);
}
raise(SIGSEGV);
}
.EE
.SH SEE ALSO
.BR kill (1),
.BR kill (2),

View File

@ -412,6 +412,10 @@ T}
.\" Was named sys_kexec_load() from 2.6.7 to 2.6.16
\fBkeyctl\fP(2) 2.6.10
\fBkill\fP(2) 1.0
\fBlandlock_add_rule\fP(2) 5.13
\fBlandlock_create_ruleset\fP(2) 5.13
\fBlandlock_restrict_self\fP(2) 5.13
\fBlandlock_add_rule\fP(2) 5.13
\fBlchown\fP(2) 1.0 T{
See \fBchown\fP(2) for
version details
@ -562,6 +566,7 @@ T}
\fBpwritev2\fP(2) 4.6
\fBquery_module\fP(2) 2.2 Removed in 2.6
\fBquotactl\fP(2) 1.0
\fBquotactl_path\fP(2) 5.13
\fBread\fP(2) 1.0
\fBreadahead\fP(2) 2.4.13
\fBreaddir\fP(2) 1.0

View File

@ -293,7 +293,8 @@ returning the number of bytes actually transferred.
An error return value while performing
.BR write ()
using direct I/O does not mean the
entire write has failed. Partial data may be written
entire write has failed.
Partial data may be written
and the data at the file offset on which the
.BR write ()
was attempted should be considered inconsistent.

View File

@ -153,12 +153,15 @@ There are several scenarios when the address of a global symbol is NULL.
For example, a symbol can be placed at zero address by the linker, via
a linker script or with
.I \-\-defsym
command-line option. Undefined weak symbols also have NULL value.
command-line option.
Undefined weak symbols also have NULL value.
Finally, the symbol value may be the result of
a GNU indirect function (IFUNC) resolver function that returns
NULL as the resolved value. In the latter case,
NULL as the resolved value.
In the latter case,
.BR dlsym ()
also returns NULL without error. However, in the former two cases, the
also returns NULL without error.
However, in the former two cases, the
behavior of GNU dynamic linker is inconsistent: relocation processing
succeeds and the symbol can be observed to have NULL value, but
.BR dlsym ()

View File

@ -130,7 +130,7 @@ A legitimate option character is any visible one byte
.BR ascii (7)
character (for which
.BR isgraph (3)
would return nonzero) that is not \(aq\-\(aq or \(aq:\(aq.
would return nonzero) that is not \(aq\-\(aq, \(aq:\(aq, or \(aq;\(aq.
If such a
character is followed by a colon, the option requires an argument, so
.BR getopt ()
@ -166,9 +166,18 @@ If the first character of
.B POSIXLY_CORRECT
is set, then option processing stops as soon as a nonoption argument is
encountered.
If \(aq+\(aq is not the first character of
.IR optstring ,
it is treated as a normal option.
If
.B POSIXLY_CORRECT
behaviour is required in this case
.I optstring
will contain two \(aq+\(aq symbols.
If the first character of \fIoptstring\fP is \(aq\-\(aq, then
each nonoption \fIargv\fP-element is handled as if it were the argument of
an option with character code 1. (This is used by programs that were
an option with character code 1.
(This is used by programs that were
written to expect options and other \fIargv\fP-elements in any order
and that care about the ordering of the two.)
The special argument "\-\-" forces an end of option-scanning regardless

View File

@ -111,7 +111,7 @@ conversion specification.)
.BR T_FMT_AMPM \ (LC_TIME)
Return a string that can be used as a format string for
.BR strftime (3)
to represent a time in a.m. or p.m. notation a locale-specific way
to represent a time in a.m. or p.m. notation in a locale-specific way
.RB ( %r
conversion specification).
.TP
@ -200,7 +200,8 @@ for alternative representation of a time in a locale-specific way
conversion specification).
.TP
.BR DAY_ "{1\(en7} (LC_TIME)"
Return name of the \fIn\fP-th day of the week. [Warning: this follows
Return name of the \fIn\fP-th day of the week.
[Warning: this follows
the US convention DAY_1 = Sunday, not the international convention
(ISO 8601) that Monday is the first day of the week.]
(Used in

View File

@ -66,8 +66,8 @@ All regular expression searching must be done via a compiled pattern
buffer, thus
.BR regexec ()
must always be supplied with the address of a
.BR regcomp ()
initialized pattern buffer.
.BR regcomp ()-initialized
pattern buffer.
.PP
.I cflags
is the

View File

@ -331,7 +331,8 @@ Ignore modem control lines.
.TP
.B LOBLK
(not in POSIX) Block output from a noncurrent shell layer.
For use by \fBshl\fP (shell layers). (Not implemented on Linux.)
For use by \fBshl\fP (shell layers).
(Not implemented on Linux.)
.TP
.B CIBAUD
(not in POSIX) Mask for input speeds.
@ -945,24 +946,76 @@ to by \fItermios_p\fP to \fIspeed\fP, which must be one of these constants:
B57600
B115200
B230400
B460800
B500000
B576000
B921600
B1000000
B1152000
B1500000
B2000000
.ft P
.fi
.PP
The zero baud rate, \fBB0\fP,
These constants are additionally supported on the SPARC architecture:
.PP
.nf
.ft B
B76800
B153600
B307200
B614400
.ft P
.fi
.PP
These constants are additionally supported on non-SPARC architectures:
.PP
.nf
.ft B
B2500000
B3000000
B3500000
B4000000
.ft P
.fi
.PP
Due to differences between architectures, portable applications should check
if a particular
.BI B nnn
constant is defined prior to using it.
.PP
The zero baud rate,
.BR B0 ,
is used to terminate the connection.
If B0 is specified, the modem control lines shall no longer be asserted.
Normally, this will disconnect the line.
\fBCBAUDEX\fP is a mask
.B CBAUDEX
is a mask
for the speeds beyond those defined in POSIX.1 (57600 and above).
Thus, \fBB57600\fP & \fBCBAUDEX\fP is nonzero.
Thus,
.BR B57600 " & " CBAUDEX
is nonzero.
.PP
Setting the baud rate to a value other than those defined by
.BI B nnn
constants is possible via the
.B TCSETS2
ioctl; see
.BR ioctl_tty (2).
.PP
.BR cfgetispeed ()
returns the input baud rate stored in the \fItermios\fP structure.
returns the input baud rate stored in the
.I termios
structure.
.PP
.BR cfsetispeed ()
sets the input baud rate stored in the \fItermios\fP structure to
sets the input baud rate stored in the
.I termios
structure to
.IR speed ,
which must be specified as one of the \fBBnnn\fP constants listed above for
which must be specified as one of the
.BI B nnn
constants listed above for
.BR cfsetospeed ().
If the input baud rate is set to zero, the input baud rate will be
equal to the output baud rate.
@ -1056,8 +1109,14 @@ and
are nonstandard, but available on the BSDs.
.SH NOTES
UNIX\ V7 and several later systems have a list of baud rates
where after the fourteen values B0, ..., B9600 one finds the
two constants EXTA, EXTB ("External A" and "External B").
where after the values
.BR B0
through
.B B9600
one finds the two constants
.BR EXTA ,
.B EXTB
("External A" and "External B").
Many systems extend the list with much higher baud rates.
.PP
The effect of a nonzero \fIduration\fP with

View File

@ -24,8 +24,8 @@ xencrypt, xdecrypt, passwd2des \- RFS password encryption
.fi
.SH DESCRIPTION
.BR WARNING :
Do not use these functions in new code. They do not achieve
any type of acceptable cryptographic security guarantees.
Do not use these functions in new code.
They do not achieve any type of acceptable cryptographic security guarantees.
.PP
The function
.BR passwd2des ()

View File

@ -38,7 +38,8 @@ You can explicitly deny access to a host by preceding the
.I hostname
by a minus (\-) sign.
Users from that host must always supply additional credentials,
including possibly a password. For security reasons you should always
including possibly a password.
For security reasons you should always
use the FQDN of the hostname and not the short hostname.
.PP
The

View File

@ -102,9 +102,10 @@ Shadow user passwords, used by
.BR getspnam (3)
and related functions.
.PP
The GNU C Library ignores databases with unknown names. Some
applications use this to implement special handling for their own
databases. For example,
The GNU C Library ignores databases with unknown names.
Some applications use this to implement special handling for their own
databases.
For example,
.BR sudo (8)
consults the
.B sudoers

View File

@ -92,8 +92,8 @@ was eventually made official with the release of Linux 4.5.
Differences between the two versions are described in the text below.
The file
.IR cgroup.sane_behavior ,
present in cgroups v1, is a relic of this mount option. The file
always reports "0" and is only retained for backward compatibility.
present in cgroups v1, is a relic of this mount option.
The file always reports "0" and is only retained for backward compatibility.
.PP
Although cgroups v2 is intended as a replacement for cgroups v1,
the older system continues to exist

View File

@ -525,7 +525,8 @@ 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
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.)
@ -541,7 +542,8 @@ As an example:
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
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).
As an example:
@ -638,7 +640,7 @@ makes it easier to write tools that parse man page source files.)
.SS Use semantic newlines
In the source of a manual page,
new sentences should be started on new lines,
and long sentences should split into lines at clause breaks
and long sentences should be split into lines at clause breaks
(commas, semicolons, colons, and so on).
This convention, sometimes known as "semantic newlines",
makes it easier to see the effect of patches,

View File

@ -71,7 +71,8 @@ Time CLONE_NEWTIME \fBtime_namespaces\fP(7) T{
Boot and monotonic
clocks
T}
User CLONE_NEWUSER \fBuser_namespaces\fP(7) T{User and group IDs
User CLONE_NEWUSER \fBuser_namespaces\fP(7) T{
User and group IDs
T}
UTS CLONE_NEWUTS \fButs_namespaces\fP(7) T{
Hostname and NIS

View File

@ -189,7 +189,8 @@ message signals an error and the payload contains an
.I nlmsgerr
structure,
.B NLMSG_DONE
message terminates a multipart message. Error messages get the
message terminates a multipart message.
Error messages get the
original request appened, unless the user requests to cap the
error message, and get extra error data if requested.
.PP

View File

@ -177,10 +177,11 @@ with the
flag set (though note that this also restricts bind mount traversal).
.SS Trailing slashes
If a pathname ends in a \(aq/\(aq, that forces resolution of the preceding
component as in Step 2: it has to exist and resolve to a directory.
component as in Step 2:
the component preceding the slash either exists and resolves to a directory
of it names a directory that is to be created immediately after the
pathname is resolved.
Otherwise, a trailing \(aq/\(aq is ignored.
(Or, equivalently, a pathname with a trailing \(aq/\(aq is equivalent to
the pathname obtained by appending \(aq.\(aq to it.)
.SS Final symlink
If the last component of a pathname is a symbolic link, then it
depends on the system call whether the file referred to will be

View File

@ -244,9 +244,7 @@ and
limits; see BUGS.
.\"
.SS PIPE_BUF
POSIX.1 says that
.BR write (2)s
of less than
POSIX.1 says that writes of less than
.B PIPE_BUF
bytes must be atomic: the output data is written to the pipe as a
contiguous sequence.

View File

@ -1247,7 +1247,8 @@ Alternatively,
or
.IR <wordexp.h> .
.PP
Used for a count of bytes. It is the result of the
Used for a count of bytes.
It is the result of the
.I sizeof
operator.
According to the C language standard,

View File

@ -819,7 +819,7 @@ reference to it is closed.
To pass file descriptors or credentials over a
.BR SOCK_STREAM
socket, you must
to send or receive at least one byte of nonancillary data in the same
send or receive at least one byte of nonancillary data in the same
.BR sendmsg (2)
or
.BR recvmsg (2)