]> git.ipfire.org Git - thirdparty/man-pages.git/log
thirdparty/man-pages.git
4 years agocapabilities.7: Add pivot_root(2) to CAP_SYS_ADMIN list
Michael Kerrisk [Sun, 28 Jul 2019 07:39:28 +0000 (09:39 +0200)] 
capabilities.7: Add pivot_root(2) to CAP_SYS_ADMIN list

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agomount.2: ERRORS: Add a couple of EINVAL errors for MS_MOVE
Michael Kerrisk [Sat, 27 Jul 2019 14:41:42 +0000 (16:41 +0200)] 
mount.2: ERRORS: Add a couple of EINVAL errors for MS_MOVE

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agomount.2: tfix
Michael Kerrisk [Fri, 26 Jul 2019 21:28:08 +0000 (23:28 +0200)] 
mount.2: tfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agomount.2: SEE ALSO: add chroot(2) and pivot_root(2)
Michael Kerrisk [Fri, 26 Jul 2019 21:27:18 +0000 (23:27 +0200)] 
mount.2: SEE ALSO: add chroot(2) and pivot_root(2)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agopivot_root.2: 'put_old' can't be a mount point with MS_SHARED propagation
Michael Kerrisk [Fri, 26 Jul 2019 21:22:59 +0000 (23:22 +0200)] 
pivot_root.2: 'put_old' can't be a mount point with MS_SHARED propagation

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agopivot_root.2: SEE ALSO: add mount(2)
Michael Kerrisk [Fri, 26 Jul 2019 15:10:58 +0000 (17:10 +0200)] 
pivot_root.2: SEE ALSO: add mount(2)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agopivot_root.2: ERRORS: EINVAL occurs if 'new_root' or its parent has shared propagation
Michael Kerrisk [Fri, 26 Jul 2019 15:10:06 +0000 (17:10 +0200)] 
pivot_root.2: ERRORS: EINVAL occurs if 'new_root' or its parent has shared propagation

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agopivot_root.2: 'new_root' must be a mount point
Michael Kerrisk [Fri, 26 Jul 2019 14:54:16 +0000 (16:54 +0200)] 
pivot_root.2: 'new_root' must be a mount point

It appears that 'new_root' may not have needed to be a mount
point on ancient kernels, but already in Linux 2.4.5, there
was the diff shown below. Verified also by testing.

@@ -1631,8 +1605,9 @@
  *  - we don't move root/cwd if they are not at the root (reason: if something
  *    cared enough to change them, it's probably wrong to force them elsewhere)
  *  - it's okay to pick a root that isn't the root of a file system, e.g.
- *    /nfs/my_root where /nfs is the mount point. Better avoid creating
- *    unreachable mount points this way, though.
+ *    /nfs/my_root where /nfs is the mount point. It must be a mountpoint,
+ *    though, so you may need to say mount --bind /nfs/my_root /nfs/my_root
+ *    first.
  */

 asmlinkage long sys_pivot_root(const char *new_root, const char *put_old)
@@ -1640,7 +1615,7 @@
        struct dentry *root;
        struct vfsmount *root_mnt;
        struct vfsmount *tmp;
-       struct nameidata new_nd, old_nd;
+       struct nameidata new_nd, old_nd, parent_nd, root_parent;
        char *name;
        int error;

@@ -1688,6 +1663,10 @@
        if (new_nd.mnt == root_mnt || old_nd.mnt == root_mnt)
                goto out2; /* loop */
        error = -EINVAL;
+       if (root_mnt->mnt_root != root)
+               goto out2;
+       if (new_nd.mnt->mnt_root != new_nd.dentry)
+               goto out2; /* not a mountpoint */
        tmp = old_nd.mnt; /* make sure we can reach put_old from new_root */
        spin_lock(&dcache_lock);
        if (tmp != new_nd.mnt) {

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agomount_namespaces.7: Clarify implications for other NS if mount point is removed in...
Michael Kerrisk [Tue, 23 Jul 2019 21:04:27 +0000 (23:04 +0200)] 
mount_namespaces.7: Clarify implications for other NS if mount point is removed in one NS

If a mount point is deleted or renamed or removed in one mount
namespace, this will cause an object that is mounted at that
location in another mount namespace to be unmounted (as verified
by experiment). This was implied by the existing text, but it is
better to make this detail explicit.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agonamespaces.7: srcfix
Michael Kerrisk [Tue, 23 Jul 2019 19:42:58 +0000 (21:42 +0200)] 
namespaces.7: srcfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agomount_namespaces.7: SEE ALSO: add pivot_root(2), pivot_root(8)
Michael Kerrisk [Mon, 22 Jul 2019 18:59:38 +0000 (20:59 +0200)] 
mount_namespaces.7: SEE ALSO: add pivot_root(2), pivot_root(8)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agonamespaces.7: Note initial values of hostname and domainname in a new UTS namespace
Michael Kerrisk [Sat, 20 Jul 2019 21:50:50 +0000 (23:50 +0200)] 
namespaces.7: Note initial values of hostname and domainname in a new UTS namespace

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agogetutent.3: Fix missing include file in EXAMPLE
Michael Kerrisk [Sat, 20 Jul 2019 13:56:34 +0000 (15:56 +0200)] 
getutent.3: Fix missing include file in EXAMPLE

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=932382

Reported-by: Thorsten Glaser <tg@mirbsd.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agocapabilities.7: Add a note about using strace on binaries that have capabilities
Michael Kerrisk [Wed, 17 Jul 2019 02:19:01 +0000 (04:19 +0200)] 
capabilities.7: Add a note about using strace on binaries that have capabilities

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agogetgroups.2: ffix
Michael Kerrisk [Mon, 15 Jul 2019 22:23:22 +0000 (00:23 +0200)] 
getgroups.2: ffix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agopldd.1: ffix
Michael Kerrisk [Sat, 13 Jul 2019 19:03:00 +0000 (13:03 -0600)] 
pldd.1: ffix

Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agopldd.1: ffix: replace tab with spaces
Michael Kerrisk [Sat, 13 Jul 2019 19:00:26 +0000 (13:00 -0600)] 
pldd.1: ffix: replace tab with spaces

Reported-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agopldd.1: Note that the glibc 2.30 pldd fix has been backported on some distros
Michael Kerrisk [Sat, 13 Jul 2019 18:57:27 +0000 (12:57 -0600)] 
pldd.1: Note that the glibc 2.30 pldd fix has been backported on some distros

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agopldd.1: Minor wording fixes
G. Branden Robinson [Sat, 13 Jul 2019 18:50:48 +0000 (12:50 -0600)] 
pldd.1: Minor wording fixes

* Establish the abbreviations DSO and PID in the lead paragraph
  since they are used later.
* Parallelize descriptions of help, usage, and version options
  with the "and exit" language used in getent(1), iconv(1),
  locale(1), localedef(1), memusage(1), memusagestat(1),
  mtrace(1), pldd(1), sprof(1), time(1), iconvconfig(8),
  zdump(8), and zic(8).

Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agopldd.1: Document glibc's unbreakage of tool.
G. Branden Robinson [Sat, 13 Jul 2019 18:48:55 +0000 (12:48 -0600)] 
pldd.1: Document glibc's unbreakage of tool.

glibc 2.30 isn't released yet, but a fix has been committed, and
Debian has even cherry-picked it for Debian GNU/Linux 10
("buster").  pldd works nicely now.

Signed-off-by: G. Branden Robinson <g.branden.robinson@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agosignal.7: Minor text rework
Michael Kerrisk [Sat, 13 Jul 2019 18:17:21 +0000 (12:17 -0600)] 
signal.7: Minor text rework

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agosignal.7: Some reworking of Michal Sekletar's text
Michael Kerrisk [Sat, 13 Jul 2019 18:15:32 +0000 (12:15 -0600)] 
signal.7: Some reworking of Michal Sekletar's text

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agosignal.7: Relocate Michal Sekletar's text
Michael Kerrisk [Sat, 13 Jul 2019 17:49:04 +0000 (11:49 -0600)] 
signal.7: Relocate Michal Sekletar's text

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agosignal.7: Clarify that siginfo_t isn't changed on coalescing
Michal Sekletar [Thu, 11 Jul 2019 12:53:24 +0000 (14:53 +0200)] 
signal.7: Clarify that siginfo_t isn't changed on coalescing

Confirmed by experiment by mtk:

$ cat siginfo_nonqueuing.c

                        } while (0)

static void
grimReaper(int sig, siginfo_t *si, void *ucontext)
{
    printf("caught signal %d\n", sig);

    printf("    si_pid=%ld, si_uid=%ld, si_status=%d\n",
            (long) si->si_pid, (long) si->si_uid, si->si_status);
}

static void
child(int sleepTime, uid_t uid, int status)
{
    switch (fork()) {
    case -1:
        errExit("fork");
    case 0:
        sleep(sleepTime);
        if (geteuid() == 0)
            setuid(uid);

        printf("Child %ld with UID %ld exiting with status %d\n",
                (long) getpid(),(long) getuid(), status);
        exit(status);
    default:
        return;
    }
}

int
main(int argc, char *argv[])
{
    struct sigaction sa;
    sigset_t blocking;

    sa.sa_sigaction = grimReaper;
    sa.sa_flags = SA_SIGINFO;
    sigemptyset(&sa.sa_mask);

    if (sigaction(SIGCHLD, &sa, NULL) == -1)
        errExit("sigaction");

    sigemptyset(&blocking);
    sigaddset(&blocking, SIGCHLD);
    if (sigprocmask(SIG_BLOCK, &blocking, NULL) == -1)
        errExit("sigprocmask");

    child(2, 20000, 20);
    child(3, 30000, 30);
    child(1, 10000, 10);

    sleep(5);

    if (sigprocmask(SIG_UNBLOCK, &blocking, NULL) == -1)
        errExit("sigprocmask");

    exit(EXIT_SUCCESS);
}
$ ./siginfo_nonqueuing
Child 4042 with UID 1000 exiting with status 10
Child 4040 with UID 1000 exiting with status 20
Child 4041 with UID 1000 exiting with status 30
caught signal 17
    si_pid=4042, si_uid=1000, si_status=10

Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Lennart Poettering <lennart@poettering.net>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Michal Sekletar <msekleta@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agosignal.7: Add subsection on queuing and delivery semantics for standard signals
Michael Kerrisk [Sat, 13 Jul 2019 17:42:09 +0000 (11:42 -0600)] 
signal.7: Add subsection on queuing and delivery semantics for standard signals

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoexecve.2: tfix
Jakub Wilk [Wed, 10 Jul 2019 17:27:49 +0000 (19:27 +0200)] 
execve.2: tfix

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agobpf.2: Correct kernel version for JIT support on s390
Michael Kerrisk [Fri, 12 Jul 2019 12:47:31 +0000 (14:47 +0200)] 
bpf.2: Correct kernel version for JIT support on s390

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agocredentials.7: Note that /proc/PID/status shows a process's credentials
Michael Kerrisk [Wed, 10 Jul 2019 13:44:47 +0000 (15:44 +0200)] 
credentials.7: Note that /proc/PID/status shows a process's credentials

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agosignal.7: Various fields in /proc/PID/status show signal-related information
Michael Kerrisk [Wed, 10 Jul 2019 13:19:31 +0000 (15:19 +0200)] 
signal.7: Various fields in /proc/PID/status show signal-related information

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoproc.5: Correct description of /pro/PID/status 'ShdPnd' and 'SigPnd' fields
Michael Kerrisk [Wed, 10 Jul 2019 12:54:10 +0000 (14:54 +0200)] 
proc.5: Correct description of /pro/PID/status 'ShdPnd' and 'SigPnd' fields

These fields are signal masks, not counters.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoproc.5: Clarify that various mask fields in /proc/PID/status are in hexadecimal
Michael Kerrisk [Wed, 10 Jul 2019 12:14:03 +0000 (14:14 +0200)] 
proc.5: Clarify that various mask fields in /proc/PID/status are in hexadecimal

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoproc.5: tfix
Michael Kerrisk [Wed, 10 Jul 2019 12:11:07 +0000 (14:11 +0200)] 
proc.5: tfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agotkill.2: glibc 2.30 provides a wrapper for tgkill()
Michael Kerrisk [Mon, 8 Jul 2019 10:23:55 +0000 (12:23 +0200)] 
tkill.2: glibc 2.30 provides a wrapper for tgkill()

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agold.so.8: wfix: fix a clumsy wording that is hard to parse
Michael Kerrisk [Fri, 5 Jul 2019 08:16:01 +0000 (10:16 +0200)] 
ld.so.8: wfix: fix a clumsy wording that is hard to parse

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agold.so.8: Minor rewordings to ease readability
Michael Kerrisk [Wed, 3 Jul 2019 12:17:58 +0000 (14:17 +0200)] 
ld.so.8: Minor rewordings to ease readability

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agodlopen.3: wfix: consistently use "object" rather than "library"
Michael Kerrisk [Wed, 3 Jul 2019 11:59:36 +0000 (13:59 +0200)] 
dlopen.3: wfix: consistently use "object" rather than "library"

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agodlopen.3: Make it clear that RTLD_NODELETE also affects global variables
Michael Kerrisk [Wed, 3 Jul 2019 09:46:16 +0000 (11:46 +0200)] 
dlopen.3: Make it clear that RTLD_NODELETE also affects global variables

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agodlopen.3: An object opened with RTLD_LOCAL can be promoted to RTLD_GLOBAL
Michael Kerrisk [Wed, 3 Jul 2019 08:57:33 +0000 (10:57 +0200)] 
dlopen.3: An object opened with RTLD_LOCAL can be promoted to RTLD_GLOBAL

Verified by experiment:

$ cat prog.c
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

static int
callback(struct dl_phdr_info *info, size_t size, void *data)
{
    printf("\tName = %s\n", info->dlpi_name);

    return 0;
}

int
main(int argc, char *argv[])
{
    void *x1Handle, *x2Handle, *yHandle;
    void (*funcp)(void);
    char *err;

    x1Handle = dlopen("./lib_x1.so", RTLD_NOW | RTLD_LOCAL);
    if (x1Handle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    if (argc > 1) {
        x2Handle = dlopen("./lib_x2.so", RTLD_NOW | RTLD_GLOBAL);
        if (x2Handle == NULL) {
            fprintf(stderr, "dlopen: %s\n", dlerror());
            exit(EXIT_FAILURE);
        }
    }

    yHandle = dlopen("./lib_y1.so", RTLD_NOW | RTLD_LOCAL);
    if (yHandle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    (void) dlerror();                           /* Clear dlerror() */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
    funcp = (void (*)(void)) dlsym(yHandle, "y1_enter");
#pragma GCC diagnostic pop
    err = dlerror();
    if (err != NULL) {
        fprintf(stderr, "dlsym: %s", err);
        exit(EXIT_FAILURE);
    }

    (*funcp)();

    exit(EXIT_SUCCESS);
}

$ cat lib_x1.c
#include <stdio.h>

void
x1_enter(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat lib_x2.c
#include <stdio.h>

void
testfunc(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat lib_y1.c
#include <stdio.h>

void
testfunc(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void
y1_enter(void)
{
    extern void y2(void);

    printf("Called %s\n\n", __func__);

    testfunc();
}

$ cat Build.sh
#!/bin/sh

CFLAGS="-Wno-implicit-function-declaration -Wl,--no-as-needed"

cc $CFLAGS -g -fPIC -shared -o lib_x2.so lib_x2.c
cc $CFLAGS -g -fPIC -shared -o lib_x1.so lib_x1.c ./lib_x2.so
cc $CFLAGS -g -fPIC -shared -o lib_y1.so lib_y1.c

cc $CFLAGS -o prog prog.c -ldl

$ sh Build.sh

$ ./prog
Called y1_enter

Called lib_y1.c::testfunc
$ ./prog x
Called y1_enter

Called lib_x2.c::testfunc

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agodlopen.3: Minor wording fix
Michael Kerrisk [Wed, 3 Jul 2019 08:55:49 +0000 (10:55 +0200)] 
dlopen.3: Minor wording fix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agodlopen.3: Clarify when an executable's symbols can be used for symbol resolution
Michael Kerrisk [Wed, 3 Jul 2019 08:06:36 +0000 (10:06 +0200)] 
dlopen.3: Clarify when an executable's symbols can be used for symbol resolution

The --export-dynamic linker option is not the only way that main's
global symbols may end up in the dynamic symbol table and thus be
used to satisfy symbol reference in a shared object. A symbol
may also be placed into the dynamic symbol table if ld(1)
notices a dependency in another object during the static link.

Verified by experiment; see previous commit.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agodlopen.3: Clarify the rules for symbol resolution in a dlopen'ed object
Michael Kerrisk [Wed, 3 Jul 2019 07:45:55 +0000 (09:45 +0200)] 
dlopen.3: Clarify the rules for symbol resolution in a dlopen'ed object

The existing text wrongly implied that symbol look up first
occurred in the object and then in main, and did not mention
whether dependencies of main where used for symbol resolution.

Verified by experiment:

$ cat prog.c
#define _GNU_SOURCE
#include <link.h>
#include <dlfcn.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void            /* A function defined in both main and lib_x1 */
prog_x1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

/* The following function is forced into prog's dynamic symbol table
   because of the static link-time reference in lib_m1.so */

void            /* A function defined in both main and lib_y1 */
prog_y1_exp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

/* The following function is not forced into prog's dynamic symbol table */

void            /* A function defined in both main and lib_y1 */
prog_y1_noexp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

static int
callback(struct dl_phdr_info *info, size_t size, void *data)
{
    printf("\tName = %s\n", info->dlpi_name);

    return 0;
}

int
main(int argc, char *argv[])
{
    void *xHandle, *yHandle;
    void (*funcp)(void);
    char *err;

    xHandle = dlopen("./lib_x1.so", RTLD_NOW | RTLD_GLOBAL);
    if (xHandle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    yHandle = dlopen("./lib_y1.so", RTLD_NOW | RTLD_GLOBAL);
    if (yHandle == NULL) {
        fprintf(stderr, "dlopen: %s\n", dlerror());
        exit(EXIT_FAILURE);
    }

    /* Optionally display the link map() */

    if (argc > 1) {
        printf("Link map as shown from dl_iterate_phdr() callbacks:\n");
        dl_iterate_phdr(callback, NULL);
        printf("\n");
    }

    (void) dlerror();                           /* Clear dlerror() */
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wpedantic"
    funcp = (void (*)(void)) dlsym(yHandle, "y1_enter");
#pragma GCC diagnostic pop
    err = dlerror();
    if (err != NULL) {
        fprintf(stderr, "dlsym: %s", err);
        exit(EXIT_FAILURE);
    }

    (*funcp)();

    exit(EXIT_SUCCESS);
}

$ cat lib_m1.c
#include <stdio.h>

void /* A function defined in both lib_m1 and lib_y1 */
m1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

#if 1
void
dummy(void)
{
    extern void prog_y1_exp(void);

    prog_y1_exp(); /* Forces prog_y1_exp into prog's dynamic symbol table,
   so that it will be visible also to lib_y1.so */
}
#endif

$ cat lib_x1.c
#include <stdio.h>

void /* A function defined in both main and lib_x1 */
prog_x1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void /* A function defined in both lib_x1 and lib_y1 */
x1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat lib_y1.c
#include <stdio.h>

void /* A function defined in both lib_x1 and lib_y1 */
x1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void /* A function defined in both main and lib_y1 */
prog_y1_exp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void /* A function defined in both lib_m1 and lib_y1 */
m1_y1(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void /* A function defined in both main and lib_y1 */
prog_y1_noexp(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

void
y1_enter(void)
{
    extern void y2(void);

    printf("Called %s\n\n", __func__);

    prog_x1();
    prog_y1_exp();
    prog_y1_noexp();
    x1_y1();
    m1_y1();
    y2();
}

$ cat lib_y2.c
#include <stdio.h>

void
y2(void)
{
    printf("Called %s::%s\n", __FILE__, __func__);
}

$ cat Build.sh
#!/bin/sh

CFLAGS="-Wno-implicit-function-declaration -Wl,--no-as-needed"

cc $CFLAGS -g -fPIC -shared -o lib_x1.so lib_x1.c
cc $CFLAGS -g -fPIC -shared -o lib_y2.so lib_y2.c
cc $CFLAGS -g -fPIC -shared -o lib_y1.so lib_y1.c ./lib_y2.so
cc $CFLAGS -g -fPIC -shared -o lib_m1.so lib_m1.c

#ED="-Wl,--export-dynamic"
cc $CFLAGS $ED -Wl,--rpath,$PWD -o prog prog.c -ldl lib_m1.so

$ sh Build.sh

$ ./prog x
Link map as shown from dl_iterate_phdr() callbacks:
Name =
Name = linux-vdso.so.1
Name = /lib64/libdl.so.2
Name = /home/mtk/tlpi/code/shlibs/dlopen_sym_res_expt/lib_m1.so
Name = /lib64/libc.so.6
Name = /lib64/ld-linux-x86-64.so.2
Name = ./lib_x1.so
Name = ./lib_y1.so
Name = ./lib_y2.so

Called y1_enter

Called lib_x1.c::prog_x1
Called prog.c::prog_y1_exp
Called lib_y1.c::prog_y1_noexp
Called lib_x1.c::x1_y1
Called lib_m1.c::m1_y1
Called lib_y2.c::y2

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agodlopen.3: Note that symbol use might keep a dlclose'd object in memory
Michael Kerrisk [Tue, 2 Jul 2019 13:55:09 +0000 (15:55 +0200)] 
dlopen.3: Note that symbol use might keep a dlclose'd object in memory

My earlier commit was in error:

    commit 4a1af09bd1aae1fdfc783dd017cb5bc392dccc1b
    Author: Michael Kerrisk <mtk.manpages@gmail.com>
    Date:   Sat Mar 14 21:40:35 2015 +0100

        dlopen.3: Amend error in description of dlclose() behavior

    -If the reference count drops to zero and no other loaded libraries use
    -symbols in it, then the dynamic library is unloaded.
    +If the reference count drops to zero,
    +then the dynamic library is unloaded.

I doubted the removed text, because it provide little clue about
the scenario. The POSIX dlclose(3) specification actually details
the scenario sufficiently:

       Although  a dlclose() operation is not required to remove
       any functions or data objects  from  the  address  space,
       neither  is  an  implementation prohibited from doing so.
       The only restriction on such a removal is that  no  func‐
       tion nor data object shall be removed to which references
       have been relocated, until or unless all such  references
       are removed. For instance, an executable object file that
       had been loaded with a dlopen() operation specifying  the
       RTLD_GLOBAL flag might provide a target for dynamic relo‐
       cations performed in the processing of other  relocatable
       objects—in  such  environments, an application may assume
       that no relocation, once made, shall be undone or  remade
       unless  the  executable  object file containing the relo‐
       cated object has itself been removed.

Verified by experiment:

$ cat openlibs.c       # Test program

int
main(int argc, char *argv[])
{
    void *libHandle[MAX_LIBS];
    int lcnt;

    if (argc < 2) {
        fprintf(stderr, "Usage: %s lib-path...\n", argv[0]);
        exit(EXIT_FAILURE);
    }

    lcnt = 0;

    for (int j = 1; j < argc; j++) {
        if (argv[j][0] != '-') {
            if (lcnt >= MAX_LIBS) {
                fprintf(stderr, "Too many libraries (limit: %d)\n", MAX_LIBS);
                exit(EXIT_FAILURE);
            }

            printf("[%d] Opening %s\n", lcnt, argv[j]);
            libHandle[lcnt] = dlopen(argv[j], RTLD_NOW | RTLD_GLOBAL);
            if (libHandle[lcnt] == NULL) {
                fprintf(stderr, "dlopen: %s\n", dlerror());
                exit(EXIT_FAILURE);
            }
            lcnt++;

        } else {    /* "-N" closes the Nth handle */

            int i = atoi(&argv[j][1]);
            printf("Closing handle %d\n", i);
            dlclose(libHandle[i]);
        }

        sleep(1);
        printf("\n");
    }

    printf("Program about to exit\n");

    exit(EXIT_SUCCESS);
}

$ cat lib_x1.c

void x1_func(void) { printf("Hello world\n"); }

__attribute__((constructor)) void x1_cstor(void)
{ printf("Called %s\n", __FUNCTION__); }

__attribute__((destructor)) void x1_dstor(void)
{ printf("Called %s\n", __FUNCTION__); }

$ cat lib_y1.c

void y1_func(void) { printf("Hello world\n"); }

__attribute__((constructor)) void y1_cstor(void)
{ printf("Called %s\n", __FUNCTION__); }

__attribute__((destructor)) void y1_dstor(void)
{ printf("Called %s\n", __FUNCTION__); }

static void testref(void) {
    /* The following reference, to a symbol in lib_x1.so shows that
       RTLD_GLOBAL may pin a library when it might otherwise have been
       released with dlclose() */
    extern void x1_func(void);
    x1_func();
}

$ cc -shared -fPIC -o lib_x1.so lib_x1.c
$ cc -shared -fPIC -o lib_y1.so lib_y1.c
$ cc -o openlibs openlibs.c -ldl

$ LD_LIBRARY_PATH=. ./openlibs lib_x1.so lib_y1.so -0 -1
[0] Opening lib_x1.so
Called x1_cstor

[1] Opening lib_y1.so
Called y1_cstor

Closing handle 0

Closing handle 1
Called y1_dstor
Called x1_dstor

Program about to exit
<end program output>

Note that x1_dstor was called only when handle 1 (lib_y1.so) was closed.
But, if we edit lib_y1 to remove the reference to x1_func(), things are
different:

$ cat lib_y1.c      # After editing

void y1_func(void) { printf("Hello world\n"); }

__attribute__((constructor)) void y1_cstor(void)
{ printf("Called %s\n", __FUNCTION__); }

__attribute__((destructor)) void y1_dstor(void)
{ printf("Called %s\n", __FUNCTION__); }

static void testref(void) {
    // extern void x1_func(void);
    // x1_func();
}

$ cc -shared -fPIC -o lib_y1.so lib_y1.c
$ LD_LIBRARY_PATH=. ./openlibs lib_x1.so lib_y1.so -0 -1
[0] Opening lib_x1.so
Called x1_cstor

[1] Opening lib_y1.so
Called y1_cstor

Closing handle 0
Called x1_dstor

Closing handle 1
Called y1_dstor

Program about to exit
<end program output>

This time, x1_dstor was called when handle 0 (lib_x1.so) was closed.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agodlopen.3: Clarify that constructors are called only when library is first loaded
Michael Kerrisk [Tue, 2 Jul 2019 13:01:20 +0000 (15:01 +0200)] 
dlopen.3: Clarify that constructors are called only when library is first loaded

And fix a wording error that I introduced back in 2015.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agodlopen.3: On dlclose(), destructors are called when reference count falls to 0
Michael Kerrisk [Tue, 2 Jul 2019 12:56:15 +0000 (14:56 +0200)] 
dlopen.3: On dlclose(), destructors are called when reference count falls to 0

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agogetauxval.3: grfix
Michael Kerrisk [Tue, 2 Jul 2019 08:19:00 +0000 (10:19 +0200)] 
getauxval.3: grfix

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agouser_namespaces.7: Minor rewordings of recently added text
Michael Kerrisk [Mon, 1 Jul 2019 18:44:43 +0000 (20:44 +0200)] 
user_namespaces.7: Minor rewordings of recently added text

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agouser_namespaces.7: Minor wording fix to recently added text
Michael Kerrisk [Tue, 2 Jul 2019 04:20:44 +0000 (06:20 +0200)] 
user_namespaces.7: Minor wording fix to recently added text

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agouser_namespaces.7: Describe the effect of file-related capabilities inside use namespaces
Michael Kerrisk [Mon, 1 Jul 2019 10:18:44 +0000 (12:18 +0200)] 
user_namespaces.7: Describe the effect of file-related capabilities inside use namespaces

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agouser_namespaces.7: Describe how kernel treats UIDs/GIDs when a process access to...
Michael Kerrisk [Mon, 1 Jul 2019 09:11:19 +0000 (11:11 +0200)] 
user_namespaces.7: Describe how kernel treats UIDs/GIDs when a process access to files

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agocapabilities.7: CAP_FOWNER also allows modifying user xattrs on sticky directories
Michael Kerrisk [Mon, 1 Jul 2019 07:48:11 +0000 (09:48 +0200)] 
capabilities.7: CAP_FOWNER also allows modifying user xattrs on sticky directories

See fs/xattr.c::xattr_permission()"

        /*
         * In the user.* namespace, only regular files and directories can have
         * extended attributes. For sticky directories, only the owner and
         * privileged users can write attributes.
         */
        if (!strncmp(name, XATTR_USER_PREFIX, XATTR_USER_PREFIX_LEN)) {
                if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
                        return (mask & MAY_WRITE) ? -EPERM : -ENODATA;
                if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
                    (mask & MAY_WRITE) && !inode_owner_or_capable(inode))
                        return -EPERM;
        }

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoxattr.7: s/extended system attributes/system extended attributes/
Michael Kerrisk [Mon, 1 Jul 2019 07:54:42 +0000 (09:54 +0200)] 
xattr.7: s/extended system attributes/system extended attributes/

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoxattr.7: wfix: s/extended user attributes/user extended attributes/
Michael Kerrisk [Mon, 1 Jul 2019 07:52:41 +0000 (09:52 +0200)] 
xattr.7: wfix: s/extended user attributes/user extended attributes/

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agounix.7: Note SCM_RIGHTS interaction with RLIMIT_NOFILE
Michael Kerrisk [Sat, 29 Jun 2019 20:06:10 +0000 (22:06 +0200)] 
unix.7: Note SCM_RIGHTS interaction with RLIMIT_NOFILE

If the file descriptors received in SCM_RIGHTS would cause
the process to its exceed RLIMIT_NOFILE limit, the excess
FDs are discarded.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoipc.5: Remove old link to svipc.7/sysvipc.7 page
Michael Kerrisk [Tue, 25 Jun 2019 04:40:21 +0000 (06:40 +0200)] 
ipc.5: Remove old link to svipc.7/sysvipc.7 page

Long ago, the sysvipc.7 page was called ipc.5, which was both a
misnaming (too general a name) and an inconsistent section. The
page was renamed (to svipc.7) many years ago, and the link with
the old name has probably ceased to be needed. So, remove it.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agosvipc.7: Add old name of sysvipc(7) page as a link
Michael Kerrisk [Tue, 25 Jun 2019 04:39:05 +0000 (06:39 +0200)] 
svipc.7: Add old name of sysvipc(7) page as a link

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoclone.2, intro.2, ipc.2, msgctl.2, msgget.2, msgop.2, semctl.2, semget.2, semop.2...
Michael Kerrisk [Tue, 25 Jun 2019 04:38:01 +0000 (06:38 +0200)] 
clone.2, intro.2, ipc.2, msgctl.2, msgget.2, msgop.2, semctl.2, semget.2, semop.2, shmctl.2, shmget.2, shmop.2, ftok.3, proc.5, namespaces.7: Change reference to svipc(7) to sysvipc(7)

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agosysvipc.7: Minor fixes for page renaming
Michael Kerrisk [Tue, 25 Jun 2019 04:33:16 +0000 (06:33 +0200)] 
sysvipc.7: Minor fixes for page renaming

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agosysvipc.7: Rename svipc.7 to sysvipc.7
Michael Kerrisk [Tue, 25 Jun 2019 04:31:50 +0000 (06:31 +0200)] 
sysvipc.7: Rename svipc.7 to sysvipc.7

The name sysvipc is a bit more natural, and is the name used in
/proc/sysvipc.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agopid_namespaces.7: tfix
Michael Kerrisk [Mon, 24 Jun 2019 14:26:51 +0000 (16:26 +0200)] 
pid_namespaces.7: tfix

Reported-by: Guillaume Laporte <guillaume.laporte.adm@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoptrace.2: wfix: s/proper superset/superset/ in "Ptrace access mode checking"
Michael Kerrisk [Fri, 21 Jun 2019 06:04:58 +0000 (08:04 +0200)] 
ptrace.2: wfix: s/proper superset/superset/ in "Ptrace access mode checking"

Reported-by: Alexey Izbyshev <izbyshev@ispras.ru>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoexecve.2: Some tweaks to Shawn Landden's patch
Michael Kerrisk [Fri, 21 Jun 2019 06:00:11 +0000 (08:00 +0200)] 
execve.2: Some tweaks to Shawn Landden's patch

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoexecve.2: Add more detail about Shebangs
Shawn Landden [Fri, 21 Jun 2019 05:52:25 +0000 (07:52 +0200)] 
execve.2: Add more detail about Shebangs

Signed-off-by: Shawn Landden <shawn@git.icu>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
4 years agoexecve.2: Since Linux 5.1, the limit on the #! line is 255 chars (rather than 127)
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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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.

4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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>
4 years 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 years 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>