thirdparty/man-pages.git
28 hours agoexecve.2: Since Linux 5.1, the limit on the #! line is 255 chars (rather than 127) master
Michael Kerrisk [Wed, 19 Jun 2019 19:06:11 +0000 (21:06 +0200)]
execve.2: Since Linux 5.1, the limit on the #! line is 255 chars (rather than 127)

Reported-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
28 hours agoexecve.2: ffix
Michael Kerrisk [Wed, 19 Jun 2019 18:47:10 +0000 (20:47 +0200)]
execve.2: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
28 hours agoexecve.2: ffix: remove spaces that suggest a space is needed after #!
Michael Kerrisk [Wed, 19 Jun 2019 18:45:00 +0000 (20:45 +0200)]
execve.2: ffix: remove spaces that suggest a space is needed after #!

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
28 hours agoexecve.2: Linux is not alone in ignoring the set-UID and set-GID bits for scripts
Michael Kerrisk [Wed, 19 Jun 2019 18:42:10 +0000 (20:42 +0200)]
execve.2: Linux is not alone in ignoring the set-UID and set-GID bits for scripts

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 days agocredentials.7: SEE ALSO: add tcgetsid(3)
Michael Kerrisk [Tue, 18 Jun 2019 11:44:14 +0000 (13:44 +0200)]
credentials.7: SEE ALSO: add tcgetsid(3)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 days agoproc.5: Minor fix: add some paragraph breaks to /proc/[pid]/attr/current text
Michael Kerrisk [Sun, 16 Jun 2019 18:46:35 +0000 (20:46 +0200)]
proc.5: Minor fix: add some paragraph breaks to /proc/[pid]/attr/current text

Break the text up a little, to improve readability.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
3 days agochdir.2: Add ENOTDIR error for fchdir()
Michael Kerrisk [Mon, 17 Jun 2019 18:36:37 +0000 (20:36 +0200)]
chdir.2: Add ENOTDIR error for fchdir()

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 days agoon_exit.3: Atack variables may be out of scope when exit handler is invoked
Michael Kerrisk [Sat, 15 Jun 2019 10:41:36 +0000 (12:41 +0200)]
on_exit.3: Atack variables may be out of scope when exit handler is invoked

Here's a program for doing experiments:

/* on_expt_scope_expt.c

   (C) Michael Kerrisk, 2019, Licensed GNU GPLv2+
*/

char *tos;

static void
exitFunc(int status, void *p)
{
    int efloc;
    int *xp = (int *) p;

    printf("====== Entered exit handler\n");
    printf("&efloc = %p (0x%llx)\n",
            (void *) &efloc, (long long) (tos - (char *) &efloc));
    printf("xp     = %p (value: %d)\n", (void *) xp, *xp);

    if (*xp != INIT_VALUE)
        printf("It looks like the variable passed to the exit handler "
                "has gone out of scope\n");

    /* Produce a core dump, which we can examine with GDB to look at the
       frames on the stack, if desired */

    printf("===\n");
    printf("About to abort\n");
    abort();
}

static void
recur(int lev, int *xp)
{
    int rloc;
    int big[65536-12];  /* 12*4 == 48 other bytes allocated on
                           this stack frame */
    tos = (char *) &rloc;

    big[0] = lev;
    big[0]++;

    printf("&rloc = %p (%d)    (%d)\n", (void *) &rloc, lev, *xp);

    if (lev > 1)
        recur(lev - 1, xp);
    else {
        printf("exit() from recur()\n");
        exit(EXIT_SUCCESS);
    }
}

int
main(int argc, char *argv[])
{
    int lev;
    int *xp;
    int xx;

    if (argc < 2) {
        fprintf(stderr, "Usage: %s {s|h} [how]\n", argv[0]);
        fprintf(stderr, "\ts => exitFunc() arg is in main() stack\n");
        fprintf(stderr, "\th => exitFunc() arg is allocated on heapn");
        fprintf(stderr, "\tIf 'how' is not present, then return from main()\n");
        fprintf(stderr, "\tIf 'how' is 0, then exit() from main()\n");
        fprintf(stderr, "\tIf 'how' is > 0, then make 'how' recursive "
                        "function calls, and then exit()\n");
        exit(EXIT_FAILURE);
    }

    tos = (char *) &xp;

    if (argv[1][0] == 'h') {
        xp = malloc(sizeof(int));
        if (xp == NULL) {
            perror("malloc");
            exit(EXIT_FAILURE);
        }
        printf("Argument for exitFunc() is allocated on heap\n");
    } else {
        xp = &xx;
        printf("Argument for exitFunc() is allocated on stack in main()\n");
    }

    *xp = INIT_VALUE;

    printf("xp     = %p (value: %d)\n", (void *) xp, *xp);
    printf("===\n");

    on_exit(exitFunc, xp);

    if (argc == 2) {
        printf("return from main\n");
        return 0;
    }

    lev = atoi(argv[2]);

    if (lev < 1) {
        printf("Calling exit() from main\n");
        exit(EXIT_SUCCESS);
    } else {
        recur(lev, xp);
    }
}

Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 days agopkey_alloc.2, mprotect.2: _GNU_SOURCE is required for the pkey functions.
Mark Wielaard [Wed, 29 May 2019 23:05:55 +0000 (01:05 +0200)]
pkey_alloc.2, mprotect.2: _GNU_SOURCE is required for the pkey functions.

To get the pkey_alloc, pkey_free and pkey_mprotect functions
_GNU_SOURCE needs to be defined before including sys/mman.h.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 days agomprotect.2: pkey_mprotect() acts like mprotect() if pkey is set to -1, not 0
Mark Wielaard [Wed, 29 May 2019 23:08:39 +0000 (01:08 +0200)]
mprotect.2: pkey_mprotect() acts like mprotect() if pkey is set to -1, not 0

The mprotect.2 NOTES say:

    On systems that do not support protection keys in
    hardware, pkey_mprotect() may still be used, but pkey must
    be set to 0.  When called this way, the operation of
    pkey_mprotect() is equivalent to mprotect().

But this is not what the glibc manual says:

    It is also possible to call pkey_mprotect with a key value
    of -1, in which case it will behave in the same way as
    mprotect.

Which is correct. Both the glibc implementation and the
kernel check whether pkey is -1. 0 is not a valid pkey when
memory protection keys are not supported in hardware.

Signed-off-by: Mark Wielaard <mark@klomp.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
7 days agoexec.3: ffix
Michael Kerrisk [Thu, 13 Jun 2019 19:39:45 +0000 (21:39 +0200)]
exec.3: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
7 days agoexec.3: Minor tweaks to Matthew Kenigsberg's patch
Michael Kerrisk [Thu, 13 Jun 2019 19:50:56 +0000 (21:50 +0200)]
exec.3: Minor tweaks to Matthew Kenigsberg's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
7 days agoexec.3: Explain function groupings
Matthew Kenigsberg [Wed, 12 Jun 2019 22:37:40 +0000 (15:37 -0700)]
exec.3: Explain function groupings

I've found the exec man page quite difficult to read when trying
to find the behavior for a specific function. Since the names of
the functions are inline and the order of the descriptions isn't
clear, it's hard to find which paragraphs apply to each function.
I thought it would be much easier to read if the grouping based on
letters is stated.

7 days agovdso.7: Mention removal of Blackfin port
Tobias Klauser [Thu, 13 Jun 2019 11:25:26 +0000 (13:25 +0200)]
vdso.7: Mention removal of Blackfin port

The Blackfin port was removed in Linux 4.17. Mention this in the
section concerning Blackfin vDSO functions.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 days agofanotify.7: wfix
Michael Kerrisk [Wed, 12 Jun 2019 21:13:43 +0000 (23:13 +0200)]
fanotify.7: wfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 days agofanotify.7: Reword FAN_REPORT_FID data structure inclusion semantics
Matthew Bobrowski [Tue, 11 Jun 2019 10:00:48 +0000 (20:00 +1000)]
fanotify.7: Reword FAN_REPORT_FID data structure inclusion semantics

Improved the readability of a sentence that describes the use of
FAN_REPORT_FID and how this particular flag influences what data
structures a listening application could expect to receive when
describing an event.

Signed-off-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 days agovdso.7: Document vDSO for RISCV
Tobias Klauser [Tue, 11 Jun 2019 13:33:56 +0000 (15:33 +0200)]
vdso.7: Document vDSO for RISCV

Document the symbols exported by the RISCV vDSO which is present
from kernel 4.15 onwards.

See kernel source files in arch/riscv/kernel/vdso.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Reviewed-by: Palmer Dabbelt <palmer@sifive.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
10 days agofanotify.7: Minor fixes after feedback from Matthew Bobrowski
Michael Kerrisk [Mon, 10 Jun 2019 09:11:01 +0000 (11:11 +0200)]
fanotify.7: Minor fixes after feedback from Matthew Bobrowski

Reported-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agoChanges.old: tfix
Jakub Wilk [Thu, 16 May 2019 19:39:17 +0000 (21:39 +0200)]
Changes.old: tfix

Remove duplicated word.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify.7: Reorder text in EXAMPLE
Michael Kerrisk [Sat, 8 Jun 2019 11:47:39 +0000 (13:47 +0200)]
fanotify.7: Reorder text in EXAMPLE

Group each example shell session together with each example
program.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify.7: ffix: boldface user commands in shell sessions
Michael Kerrisk [Sat, 8 Jun 2019 10:40:03 +0000 (12:40 +0200)]
fanotify.7: ffix: boldface user commands in shell sessions

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify.7: tfix
Michael Kerrisk [Sat, 8 Jun 2019 10:34:55 +0000 (12:34 +0200)]
fanotify.7: tfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify.7: Reformat program output to fit in 80 columns
Michael Kerrisk [Sat, 8 Jun 2019 10:34:14 +0000 (12:34 +0200)]
fanotify.7: Reformat program output to fit in 80 columns

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify.7: Clarify logic in ESTALE check
Michael Kerrisk [Sat, 8 Jun 2019 10:32:17 +0000 (12:32 +0200)]
fanotify.7: Clarify logic in ESTALE check

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify.7: Minor code consistency clean-ups
Michael Kerrisk [Sat, 8 Jun 2019 10:27:01 +0000 (12:27 +0200)]
fanotify.7: Minor code consistency clean-ups

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify.7: tfix
Michael Kerrisk [Sat, 8 Jun 2019 10:24:33 +0000 (12:24 +0200)]
fanotify.7: tfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify.7: Minor code typesetting fix-ups
Michael Kerrisk [Sat, 8 Jun 2019 07:34:45 +0000 (09:34 +0200)]
fanotify.7: Minor code typesetting fix-ups

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify.7: Minor fix: format comments consistently
Michael Kerrisk [Sat, 8 Jun 2019 07:32:33 +0000 (09:32 +0200)]
fanotify.7: Minor fix: format comments consistently

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify.7: tfix
Michael Kerrisk [Sat, 8 Jun 2019 09:58:17 +0000 (11:58 +0200)]
fanotify.7: tfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify_init.2, fanotify_mark.2, fanotify.7: Minor tweak: s/object/filesystem object/
Michael Kerrisk [Sat, 8 Jun 2019 07:20:15 +0000 (09:20 +0200)]
fanotify_init.2, fanotify_mark.2, fanotify.7: Minor tweak: s/object/filesystem object/

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify_init.2, fanotify_mark.2, fanotify.7: Minor fixes to Matthew Bobrowski's...
Michael Kerrisk [Sat, 8 Jun 2019 07:07:48 +0000 (09:07 +0200)]
fanotify_init.2, fanotify_mark.2, fanotify.7: Minor fixes to Matthew Bobrowski's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agofanotify.7, fanotify_init.2, fanotify_mark.2: Document FAN_REPORT_FID and directory...
Matthew Bobrowski [Thu, 6 Jun 2019 09:48:02 +0000 (19:48 +1000)]
fanotify.7, fanotify_init.2, fanotify_mark.2: Document FAN_REPORT_FID and directory modification events

Details relating to the new initialization flag FAN_REPORT_FID has been
added. As part of the FAN_REPORT_FID feature, a new set of event masks are
available and have been documented accordingly.

A simple example program has been added to also support the understanding
and use of FAN_REPORT_FID and directory modification events.

Signed-off-by: Matthew Bobrowski <mbobrowski@mbobrowski.org>
Reviewed-by: Amir Goldstein <amir73il@gmail.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agosyscalls.2: tfix
Petr Vaněk [Thu, 6 Jun 2019 13:02:45 +0000 (15:02 +0200)]
syscalls.2: tfix

Signed-off-by: Petr Vaněk <arkamar@atlas.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
12 days agostrcat.3: Fix off-by-one error in example code
Michael Kerrisk [Sat, 8 Jun 2019 06:09:45 +0000 (08:09 +0200)]
strcat.3: Fix off-by-one error in example code

Reported-by: Eric Sanchis <eric.sanchis@iut-rodez.fr>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
13 days agoman-pages-5.02.lsm: Update primary site; remove alternate site
Michael Kerrisk [Sat, 1 Jun 2019 21:33:18 +0000 (23:33 +0200)]
man-pages-5.02.lsm: Update primary site; remove alternate site

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 weeks agosocket.7: select()/poll()/epoll honor SO_RCVLOWAT since Linux 2.6.28
Michael Kerrisk [Fri, 31 May 2019 14:45:51 +0000 (16:45 +0200)]
socket.7: select()/poll()/epoll honor SO_RCVLOWAT since Linux 2.6.28

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
3 weeks agoelf.5: SEE ALSO: add ld.so(8)
Michael Kerrisk [Tue, 28 May 2019 07:32:40 +0000 (09:32 +0200)]
elf.5: SEE ALSO: add ld.so(8)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 weeks agocpuid.4: SEE ALSO: add cpuid(1)
Michael Kerrisk [Thu, 23 May 2019 11:18:26 +0000 (13:18 +0200)]
cpuid.4: SEE ALSO: add cpuid(1)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 weeks agold.so.8: srcfix
Michael Kerrisk [Thu, 23 May 2019 10:28:23 +0000 (12:28 +0200)]
ld.so.8: srcfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 weeks agold.so.8: Note some further details of secure-execution mode
Michael Kerrisk [Wed, 22 May 2019 19:38:36 +0000 (21:38 +0200)]
ld.so.8: Note some further details of secure-execution mode

Note some further details of the treatment of environment
variables in secure execution mode. In particular (as noted by
Matthias Hertel), note that ignored environment variables are also
stripped from the environment. Furthermore, there are some other
variables, not used by the dynamic linker itself, that are also
treated in this way (see the glibc source file
sysdeps/generic/unsecvars.h).

Reported-by: Matthias Hertel <Matthias.Hertel@rohde-schwarz.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 weeks agocgroup_namespaces.7: In the example shell session, give second shell a different...
Michael Kerrisk [Mon, 20 May 2019 19:52:13 +0000 (21:52 +0200)]
cgroup_namespaces.7: In the example shell session, give second shell a different prompt

Give the shell in the second cgroup namespace a different prompt,
so as to clearly distinguish the two namespaces.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 weeks agocgroup_namespaces.7: Some wording fixes to improve clarity
Michael Kerrisk [Mon, 20 May 2019 19:34:50 +0000 (21:34 +0200)]
cgroup_namespaces.7: Some wording fixes to improve clarity

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 weeks agocgroup_namespaces.7: tfix
Michael Kerrisk [Mon, 20 May 2019 19:47:08 +0000 (21:47 +0200)]
cgroup_namespaces.7: tfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 weeks agocgroup_namespaces.7: wfix: s/original namespace/initial namespace/
Michael Kerrisk [Mon, 20 May 2019 19:16:36 +0000 (21:16 +0200)]
cgroup_namespaces.7: wfix: s/original namespace/initial namespace/

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 weeks agocgroup_namespaces.7: wfix: remove some superfluous (and slightly misleading) words
Michael Kerrisk [Mon, 20 May 2019 19:14:05 +0000 (21:14 +0200)]
cgroup_namespaces.7: wfix: remove some superfluous (and slightly misleading) words

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 weeks agouser_namespaces.7: wfix
Michael Kerrisk [Sat, 18 May 2019 20:00:05 +0000 (22:00 +0200)]
user_namespaces.7: wfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 weeks agoprctl.2: tfix
Michael Kerrisk [Thu, 16 May 2019 17:22:32 +0000 (12:22 -0500)]
prctl.2: tfix

Reported-by: Tomas Skäre <tomas.skare@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
5 weeks agopthread_spin_init.3: tfix
Michael Kerrisk [Thu, 16 May 2019 17:20:09 +0000 (12:20 -0500)]
pthread_spin_init.3: tfix

Reported-by: Kumar Chaudhary, Naveen <naveen.kumar.chaudhary@intel.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agoChanges.old: Tweaks to 5.01 changelog
Michael Kerrisk [Thu, 9 May 2019 12:07:02 +0000 (14:07 +0200)]
Changes.old: Tweaks to 5.01 changelog

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agoStart of man-pages-5.02: updating Changes and Changes.old
Michael Kerrisk [Thu, 9 May 2019 07:46:26 +0000 (09:46 +0200)]
Start of man-pages-5.02: updating Changes and Changes.old

6 weeks agoStart of man-pages-5.02: updating .Announce and .lsm files
Michael Kerrisk [Thu, 9 May 2019 07:46:26 +0000 (09:46 +0200)]
Start of man-pages-5.02: updating .Announce and .lsm files

6 weeks agoStart of man-pages-5.02: renaming .Announce and .lsm files
Michael Kerrisk [Thu, 9 May 2019 07:46:26 +0000 (09:46 +0200)]
Start of man-pages-5.02: renaming .Announce and .lsm files

6 weeks agoReady for 5.01 man-pages-5.01
Michael Kerrisk [Thu, 9 May 2019 07:44:04 +0000 (09:44 +0200)]
Ready for 5.01

6 weeks agoChanges: Expanded tabs
Michael Kerrisk [Thu, 9 May 2019 07:43:55 +0000 (09:43 +0200)]
Changes: Expanded tabs

6 weeks agoexecve.2, setfsgid.2, setfsuid.2, splice.2, fopen.3, malloc_trim.3, posix_memalign...
Michael Kerrisk [Thu, 9 May 2019 07:43:09 +0000 (09:43 +0200)]
execve.2, setfsgid.2, setfsuid.2, splice.2, fopen.3, malloc_trim.3, posix_memalign.3, stdarg.3, sysconf.3, tsearch.3, elf.5, hostname.7, inode.7: tstamp

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agoChanges: Read for 5.01
Michael Kerrisk [Thu, 9 May 2019 07:36:19 +0000 (09:36 +0200)]
Changes: Read for 5.01

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agoconsole_codes.4: tfix
Jakub Wilk [Sat, 9 Mar 2019 14:55:03 +0000 (15:55 +0100)]
console_codes.4: tfix

Add missing periods.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agoconsole_codes.4: Document that \e[1;n] and \e[2;n] support 16 colors
Jakub Wilk [Sat, 9 Mar 2019 14:55:02 +0000 (15:55 +0100)]
console_codes.4: Document that \e[1;n] and \e[2;n] support 16 colors

Source: setterm_command() in drivers/tty/vt/vt.c

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agointro.1, execve.2, getcontext.3, passwd.5, bpf-helpers.7: wfix
Jakub Wilk [Sat, 16 Mar 2019 14:15:40 +0000 (15:15 +0100)]
intro.1, execve.2, getcontext.3, passwd.5, bpf-helpers.7: wfix

Use gender-neutral pronouns.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agotwalk_r.3: New link to twalk(3) page
Michael Kerrisk [Sun, 5 May 2019 23:30:23 +0000 (18:30 -0500)]
twalk_r.3: New link to twalk(3) page

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agotsearch.3: Minor tweak to Florian's patch
Michael Kerrisk [Sat, 4 May 2019 22:50:09 +0000 (17:50 -0500)]
tsearch.3: Minor tweak to Florian's patch

Use consistent argument names in twalk() and twalk_r().

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agotsearch.3: Reformat twalk() and twalk_r() prototypes for easier readability
Michael Kerrisk [Sat, 4 May 2019 22:48:45 +0000 (17:48 -0500)]
tsearch.3: Reformat twalk() and twalk_r() prototypes for easier readability

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agotsearch.3: SYNOPSIS: clarify that twalk_r() requires _GNU_SOURCE
Michael Kerrisk [Sat, 4 May 2019 22:42:57 +0000 (17:42 -0500)]
tsearch.3: SYNOPSIS: clarify that twalk_r() requires _GNU_SOURCE

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agotsearch.3: Minor tweaks to Florian Weimer's patch
Michael Kerrisk [Sat, 4 May 2019 22:32:23 +0000 (17:32 -0500)]
tsearch.3: Minor tweaks to Florian Weimer's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agotsearch.3: Document the twalk_r() function added in glibc 2.30
Florian Weimer [Fri, 3 May 2019 10:01:59 +0000 (12:01 +0200)]
tsearch.3: Document the twalk_r() function added in glibc 2.30

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agotsearch.3: Do not use const arguments in twalk() callback
Florian Weimer [Fri, 3 May 2019 09:49:21 +0000 (11:49 +0200)]
tsearch.3: Do not use const arguments in twalk() callback

The const specifier is not part of the prototype (it only applies to the
implementation), so showing it here confuses the reader.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agosched_setaffinity.2: Correct details of return value of sched_getaffinity() syscall
Michael Kerrisk [Sun, 5 May 2019 18:02:30 +0000 (13:02 -0500)]
sched_setaffinity.2: Correct details of return value of sched_getaffinity() syscall

Things changed a little with:

    commit cd3d8031eb4311e516329aee03c79a08333141f1
    Author: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
    Date:   Fri Mar 12 16:15:36 2010 +0900

Reported-by: Brice Goglin <Brice.Goglin@inria.fr>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agosysconf.3: Clearly note that _SC_PAGESIZE and _SC_PAGE_SIZE are synonyms
Michael Kerrisk [Sun, 5 May 2019 17:32:52 +0000 (12:32 -0500)]
sysconf.3: Clearly note that _SC_PAGESIZE and _SC_PAGE_SIZE are synonyms

Reported-by: Hugues Evrard <hevrard@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agostdarg.3: Remove the NOTES section describing the ancient varargs macros
Michael Kerrisk [Sun, 5 May 2019 17:09:55 +0000 (12:09 -0500)]
stdarg.3: Remove the NOTES section describing the ancient varargs macros

stdarg.h is now 30 years old, and gcc long ago (2004) ceased to
implement <varargs.h>. There seems little value in keeping this
text.

See https://bugzilla.kernel.org/show_bug.cgi?id=202907

Reported-by: Vincent Lefevre <vincent@vinc17.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agoCPU_SET.3: wfix
Seth Troisi [Sun, 5 May 2019 15:42:23 +0000 (10:42 -0500)]
CPU_SET.3: wfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agoexecve.2: wfix
Michael Kerrisk [Sun, 5 May 2019 12:36:37 +0000 (07:36 -0500)]
execve.2: wfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agoexecve.2: Note that stack+environ size is also limited to 3/4 of _STK_LIM
Michael Kerrisk [Sun, 5 May 2019 12:34:13 +0000 (07:34 -0500)]
execve.2: Note that stack+environ size is also limited to 3/4 of _STK_LIM

In fs/exec.c::prepare_arg_pages(), we have:

        limit = _STK_LIM / 4 * 3;
        limit = min(limit, bprm->rlim_stack.rlim_cur / 4);

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agoclose.2: srcfix (comment on EINTR error)
Michael Kerrisk [Sun, 5 May 2019 11:14:45 +0000 (06:14 -0500)]
close.2: srcfix (comment on EINTR error)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agotee.2: EAGAIN can occur when called on nonblocking file descriptors
Slavomir Kaslev [Fri, 12 Apr 2019 14:02:47 +0000 (17:02 +0300)]
tee.2: EAGAIN can occur when called on nonblocking file descriptors

Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agosplice.2: EAGAIN can occur when called on nonblocking file descriptors
Slavomir Kaslev [Fri, 12 Apr 2019 14:02:46 +0000 (17:02 +0300)]
splice.2: EAGAIN can occur when called on nonblocking file descriptors

Signed-off-by: Slavomir Kaslev <kaslevs@vmware.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agoposix_memalign.3: Some functions set errno
Elliot Hughes [Fri, 19 Apr 2019 20:25:21 +0000 (13:25 -0700)]
posix_memalign.3: Some functions set errno

True of bionic, glibc, and musl. (I didn't check elsewhere.)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agotsearch.3: SYNOPSIS: add missing definition of 'VISIT' type
Michael Kerrisk [Sat, 4 May 2019 22:18:57 +0000 (17:18 -0500)]
tsearch.3: SYNOPSIS: add missing definition of 'VISIT' type

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agohostname.7: HOSTALIASES/search path processing is DNS-specific
Florian Weimer [Tue, 23 Apr 2019 09:11:33 +0000 (11:11 +0200)]
hostname.7: HOSTALIASES/search path processing is DNS-specific

Other NSS modules do not necessarily honor these settings.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agomallinfo.3: Further discourage use of mallinfo()
Elliott Hughes [Tue, 30 Apr 2019 19:36:46 +0000 (12:36 -0700)]
mallinfo.3: Further discourage use of mallinfo()

The BUGS section already explains why you need to be cautious
about using mallinfo, but given the number of bug reports we see
on Android, it seems not many people are reading that far. Call it
out up front.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agomount_namespaces.7: Minor fix: remove a crufty sentence
Michael Kerrisk [Sat, 4 May 2019 12:58:17 +0000 (07:58 -0500)]
mount_namespaces.7: Minor fix: remove a crufty sentence

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
6 weeks agomount_namespaces.7: wfix: "parent directory" ==> "parent mount"
Michael Kerrisk [Sat, 4 May 2019 12:57:39 +0000 (07:57 -0500)]
mount_namespaces.7: wfix: "parent directory" ==> "parent mount"

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
8 weeks agosetfsuid.2: wfix
Michael Kerrisk [Thu, 25 Apr 2019 21:06:50 +0000 (16:06 -0500)]
setfsuid.2: wfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agoelf.5: A data segment does not have PF_X
Michael Kerrisk [Mon, 15 Apr 2019 15:09:32 +0000 (17:09 +0200)]
elf.5: A data segment does not have PF_X

Reported-by: Keegan Saunders <keeganwsaunders@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agoclone.2: CLONE_CHILD_SETTID has effect before clone() returns *in the child*
Michael Kerrisk [Sun, 14 Apr 2019 17:34:35 +0000 (19:34 +0200)]
clone.2: CLONE_CHILD_SETTID has effect before clone() returns *in the child*

CLONE_CHILD_SETTID may not have had effect by the time clone()
returns in the parent, which could bre relevant if the
CLONE_VM flag is employed. The relevant kernel code is in
schedule_tail(), which is called in ret_from_fork()
in the child.

See https://bugzilla.kernel.org/show_bug.cgi?id=203105

Demonstration using the program shown below (inspired by a simpler
example from Jakub):

$ ./a.out
parent start: ctid =     0    ptid =  6212
child start:  ctid =  6212    ptid =  6212
child later:  ctid =  6212    ptid =  6212
cat parent later: ctid =  6212    ptid =  6212
f.child -- bye

$ cat prog.c

static volatile pid_t ctid, ptid;

static int
child_fn(void *arg)
{
    printf("child start:  ctid = %5d    ptid = %5d\n", ctid, ptid);
    sleep(1);
    printf("child later:  ctid = %5d    ptid = %5d\n", ctid, ptid);
    sleep(2);
    printf("child -- bye\n");
    return 0;
}

int
main(void)
{
    void *stack = malloc(0x1000);
    char *stack_top = (char *) stack + 0x1000;
    int flags =  SIGCHLD | CLONE_VM |
                 // CLONE_VFORK |
                 CLONE_PARENT_SETTID | CLONE_CHILD_SETTID;

    if (clone(child_fn, stack_top, flags, NULL, &ptid, NULL, &ctid) == -1) {
        perror("clone");
        exit(EXIT_SUCCESS);
    }

    fprintf(stderr, "parent start: ctid = %5d    ptid = %5d\n", ctid, ptid);
    sleep(2);
    fprintf(stderr, "parent later: ctid = %5d    ptid = %5d\n", ctid, ptid);

    if (wait(NULL) == -1) {
        perror("wait");
        exit(EXIT_FAILURE);
    }

    exit(EXIT_SUCCESS);
}

Reported-by: Jakub Nowak <jakub.jakub.nowak@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agogetpt.3: tfix
Jakub Wilk [Thu, 11 Apr 2019 20:30:29 +0000 (22:30 +0200)]
getpt.3: tfix

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agoio_getevents.2: wsfix: fix stray tab
Lucas Werkmeister [Sun, 31 Mar 2019 14:14:07 +0000 (16:14 +0200)]
io_getevents.2: wsfix: fix stray tab

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agomalloc_trim.3: Minor fixes to Carlos's patch
Michael Kerrisk [Fri, 12 Apr 2019 09:42:32 +0000 (11:42 +0200)]
malloc_trim.3: Minor fixes to Carlos's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agomalloc_trim.3: Update trimming information
Carlos O'Donell [Thu, 28 Mar 2019 18:01:28 +0000 (14:01 -0400)]
malloc_trim.3: Update trimming information

Since glibc 2.8, commit 68631c8eb92, the malloc_trim function has
iterated over all arenas and free'd back to the OS all page runs
that were free.  This allows an application to call malloc_trim to
consolidate fragmented chunks and free back any pages it can to
potentially reduce RSS usage.

This correctness of the man page was recently brought to light by
an article [1] where Ruby developers discovered that malloc_trim
did not behave as the man page indicated.

This change makes it clear that the intent of malloc_trim is to
trim all space that is no longer needed, and any restrictions are
implementation details. In the notes we highlight the change in
behaviour for post glibc 2.8 and pre glibc 2.8.

[1] https://www.joyfulbikeshedding.com/blog/2019-03-14-what-causes-ruby-memory-bloat.html#a-magic-trick-trimming

Signed-off-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agofopen.3: Minor tweaks to Elliot's patch
Michael Kerrisk [Fri, 12 Apr 2019 09:31:35 +0000 (11:31 +0200)]
fopen.3: Minor tweaks to Elliot's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agofopen.3: Explain BSD vs glibc "a+" difference
enh [Wed, 10 Apr 2019 19:30:24 +0000 (12:30 -0700)]
fopen.3: Explain BSD vs glibc "a+" difference

Where is the initial read position for an "a+" stream?

POSIX leaves this unspecified. Most BSD man pages are silent, and MacOS
has the ambiguous "The stream is positioned at the end of the file", not
differentiating between reads and writes other than to say that fseek(3)
does not affect writes. glibc's documentation explicitly specifies that
the initial read position is the beginning of the file.

My new wording is based on the BSD implementations, so you may prefer
to replace the non-glibc section with "unspecified", or indeed remove
all claims about the initial read position.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agostdarg.3: Add a note that ... in function signature means a variadic function
Michael Kerrisk [Fri, 12 Apr 2019 09:11:03 +0000 (11:11 +0200)]
stdarg.3: Add a note that ... in function signature means a variadic function

Egmont suggested adding this, because the string "..." appears
at several other points in the page, but just to indicate that
some text is omitted from example code.

Reported-by: Egmont Koblinger <egmont@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agosyscalls.2: Remove crufty text about i386 syscall dispatch table
Michael Kerrisk [Fri, 12 Apr 2019 08:56:59 +0000 (10:56 +0200)]
syscalls.2: Remove crufty text about i386 syscall dispatch table

The removed text long ago ceased to be accurate. Nowadays, the
dispatch table is autogenerated when building the kernel (via
the kernel makefile, arch/x86/entry/syscalls/Makefile).

Reported-by: Andreas Korb <andreas.d.korb@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agobpf.2: Update kernel version info for JIT compiler
Michael Kerrisk [Thu, 4 Apr 2019 09:53:38 +0000 (11:53 +0200)]
bpf.2: Update kernel version info for JIT compiler

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agosetfsgid.2: Rewrite for improved clarity and defer to setfsuid() for details
Michael Kerrisk [Tue, 26 Mar 2019 05:11:58 +0000 (06:11 +0100)]
setfsgid.2: Rewrite for improved clarity and defer to setfsuid() for details

Rewrite for improved clarity and defer to setfsuid(2) for the
rationale of the fsGID rather than repeating the same details
in this page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2 months agosetfsuid.2: Rewrite for improved clarity and to hint history more explicitly
Michael Kerrisk [Tue, 26 Mar 2019 04:58:54 +0000 (05:58 +0100)]
setfsuid.2: Rewrite for improved clarity and to hint history more explicitly

The current text reads somewhat clumsily. Rewrite it to introduce
the eUID and fsUID in parallel, and more clearly hint at the the
historical rationale for the fsUID, which is detailed lower in
the page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
3 months agobpf.2: tfix
Abhinav Upadhyay [Wed, 20 Mar 2019 07:57:56 +0000 (08:57 +0100)]
bpf.2: tfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
3 months agoman-pages.7: tfix
Jakub Wilk [Sat, 16 Mar 2019 19:23:02 +0000 (20:23 +0100)]
man-pages.7: tfix

Escape hyphen.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
3 months agoman-pages.7: spfix
Jakub Wilk [Sat, 16 Mar 2019 19:36:01 +0000 (20:36 +0100)]
man-pages.7: spfix

The section "Example Programs ..." was renamed to "Example programs ..."
(with lowercase p) in c634028ab5768a04, but the reference was not
updated.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
3 months agocore.5: tfix
Jakub Wilk [Tue, 19 Mar 2019 16:12:44 +0000 (17:12 +0100)]
core.5: tfix

Escape hyphens.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
3 months agoaccept.2: Note that 'addrlen' is left unchanged in the event of an error
Michael Kerrisk [Sun, 17 Mar 2019 20:00:01 +0000 (21:00 +0100)]
accept.2: Note that 'addrlen' is left unchanged in the event of an error

See http://austingroupbugs.net/view.php?id=836.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>