Commit Graph

6948 Commits

Author SHA1 Message Date
Michael Kerrisk e186261405 malloc.3: Clarify that realloc() may move the memory block
Make it clearer, early in the discussion, that realloc()
may move the block.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:02:29 +02:00
Michael Kerrisk f1d01de4c8 malloc.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:02:29 +02:00
Michael Kerrisk 1949f76560 malloc.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:02:29 +02:00
Michael Kerrisk 5d46c7a934 malloc.3: Add some structuring to improve readability
Add some subsection (.SS) headings and paragraph breaks in
DESCRIPTION, to make the page more easily readable.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:02:25 +02:00
Paul Eggert ddc5192f0c malloc_hook.3: Modernize for glibc 2.34
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:01:01 +02:00
Paul Eggert cfc381be29 malloc.3: Modernize for glibc 2.34
glibc has tightened up its rules for replacing the memory
allocator.  I went through the malloc man page and looked for how
it documented malloc() and related functions, and fixed
discrepancies with glibc malloc() documentation and/or
implementation.  I also reorganized the portability discussion so
that portability issues can be seen more clearly.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 04:00:56 +02:00
Pali Rohár 15af0ac10a termios.3: Use bold style for B0
Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 02:30:21 +02:00
Michael Kerrisk 847487d17f termios.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 02:30:21 +02:00
Pali Rohár 4d3e4af379 termios.3: Clarify zero argument for cfsetispeed()
Zero in this case refers to literal constant 0 and not symbolic
constant B0.

Signed-off-by: Pali Rohár <pali@kernel.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-31 02:30:21 +02:00
Michael Kerrisk 6e00b7a858 iconv.1, ldd.1, accept.2, access.2, add_key.2, arch_prctl.2, bpf.2, chmod.2, chown.2, close_range.2, copy_file_range.2, execve.2, execveat.2, fanotify_mark.2, futex.2, futimesat.2, getpriority.2, intro.2, ioctl_tty.2, keyctl.2, link.2, membarrier.2, mkdir.2, mknod.2, mlock.2, mount.2, mount_setattr.2, open.2, open_by_handle_at.2, perf_event_open.2, pidfd_open.2, readlink.2, readv.2, rename.2, request_key.2, seccomp.2, sigaction.2, stat.2, statx.2, symlink.2, syscalls.2, umount.2, unlink.2, utimensat.2, wait.2, bsearch.3, fflush.3, getaddrinfo.3, getauxval.3, getopt.3, getsubopt.3, mkfifo.3, pthread_mutex_consistent.3, pthread_setname_np.3, pthread_tryjoin_np.3, scandir.3, sem_wait.3, stailq.3, strlen.3, strstr.3, termios.3, tsearch.3, wcslen.3, wcstok.3, wordexp.3, proc.5, capabilities.7, cgroups.7, fanotify.7, mount_namespaces.7, namespaces.7, path_resolution.7, pipe.7, posixoptions.7, user_namespaces.7, vdso.7, iconvconfig.8, ld.so.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 02:44:07 +02:00
Alejandro Colomar fb74563941 getaddrinfo.3: Note that 'errno' is set in parallel with EAI_SYSTEM
The previous wording wasn't very explicit, leaving room for
believing that 'errno' may be 0 after returning EAI_SYSTEM.

Use a wording similar to other pages, for added consistency.

[mtk: edited commit message title; also, POSIX notes that
'errno' is set in this case.]

Reported-by: Cristian Morales Vega <christian.morales.vega@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-27 01:17:59 +02:00
Michael Kerrisk 3d892e9692 getumask.3: Remove page
This function was never implemented on Linux. It seems pointless to
retain such a page 20 years after it was written.
2021-08-20 23:14:46 +02:00
Michael Kerrisk a98bd2de56 strsignal.3: wfix
In NAME line, one of the instances of "sigdescr_np" should be
"sigabbrev_np".

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 09:57:04 +02:00
Michael Kerrisk f589f0e1b8 strsignal.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 08:02:35 +02:00
Michael Kerrisk 5478b148a1 tsearch.3: NAME: add twalk_r
This function is described in the page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 08:00:43 +02:00
Michael Kerrisk 28d0f81e1c sigqueue.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 07:59:32 +02:00
Michael Kerrisk dae872dd27 readv.2, pthread_tryjoin_np.3, stailq.3, strlen.3, wcslen.3: Arrange .SH sections in correct order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 07:38:15 +02:00
Michael Kerrisk 85a7ae7344 intro.2, mount_setattr.2, seccomp_unotify.2, fflush.3, pthread_mutex_consistent.3: Place SEE ALSO entries in correct order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 07:30:52 +02:00
Michael Kerrisk 90879cbd20 chmod.2, chown.2, open.2, mkdir.2, mknod.2, readlink.2, stat.2, symlink.2, mkfifo.3, scandir.3, sem_wait.3: ERRORS: combine errors into a single alphabetic list
These pages split out extra errors for some APIs into a separate
list.  Probably, the pages are easier to ready if all errors are
combined into a single list.

Note that there still remain a few pages where the errors are
listed separately for different APIs. For the moment, it seems
best to leave those pages as is, since the error lists are
largely distinct in those pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 03:47:26 +02:00
Michael Kerrisk 97e2d8e602 arch_prctl.2, perf_event_open.2, pthread_tryjoin_np.3: ERRORS: correct alphabetic order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 03:46:58 +02:00
Michael Kerrisk cfda555640 getpass.3: wfix
Remove redundant phrase.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-18 01:38:14 +02:00
Michael Kerrisk 717c3a7dcf fanotify_mark.2, futimesat.2, mount_setattr.2, statx.2, symlink.2, mkfifo.3: Refer the reader to openat(2) for explanation of why 'dirfd' is useful
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 401819295b scandir.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 6bd4cf741c mkfifo.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 9f4e736ad0 access.2, chmod.2, chown.2, execveat.2, futimesat.2, link.2, mkdir.2, mknod.2, mount_setattr.2, open.2, open_by_handle_at.2, readlink.2, rename.2, stat.2, statx.2, symlink.2, unlink.2, utimensat.2, mkfifo.3, scandir.3: Fix EBADF error description
Make the description of the EBADF error for invalid 'dirfd' more
uniform. In particular, note that the error only occurs when the
pathname is relative, and that it occurs when the 'dirfd' is
neither valid *nor* has the value AT_FDCWD.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-12 05:45:21 +02:00
Michael Kerrisk 44a16bcb61 pthread_setname_np.3: EXAMPLES: remove a bug by simplify the code
From an email conversation with Alexis:

Hello Alexis,

On 8/6/21 7:06 PM, Alexis Wilke wrote:
> Hi guys,
>
> The pthread_setname_np(3) manual page has an example where the second
> argument is used to get a size of the thread name.
>
> https://man7.org/linux/man-pages/man3/pthread_setname_np.3.html#EXAMPLES
>
> The current code:
>
>            rc = pthread_getname_np(thread, thread_name,
>                                    (argc > 2) ? atoi(argv[1]) : NAMELEN);
>
> The suggested code:
>
>            rc = pthread_getname_np(thread, thread_name,
>                                    (argc > 2) ? atoi(argv[2]) : NAMELEN);

I agree that there's a problem, but I think we could go even simpler:

     rc = pthread_getname_np(thread, thread_name, NAMELEN);

> I'm thinking that maybe the author meant to compute the length like so:
>
>            rc = pthread_getname_np(thread, thread_name,
>                                    (argc > 2) ? strlen(argv[1]) + 1 :
> NAMELEN);
>
> But I think that the atoi() points to using argv[2] as a number
> representing the length.
>
> (Of course, it should be tested against NAMELEN as a maximum, but I
> understand that examples do not always show how to verify each possible
> error).

I imagine that the author's intention was to allow the user to do
experiments where argv[2] specified a number less than NAMELEN,
in order to see the resulting ERANGE error. But, that experiment
is of limited value, and complicates the code unnecessarily, IMO,
so that's why I made the change above.

--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

Reported-by: Alexis Wilke <alexis@m2osw.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 11:11:40 +02:00
Jakub Wilk c61a1c396e wcstok.3: Fix type mismatch in the example
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-10 08:41:40 +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
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
наб 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
Michael Kerrisk afaa08a481 strlen.3, wcslen.3: Recommend alternatives where input buffer might not be null-terminated
Reported-by: Jonny Grant <jg@jguk.org>
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 04:16:15 +02:00
Michael Kerrisk dc3037bf4d getauxval.3: SEE ALSO: add execve(2)
Since this page discusses program execution, a link to execve(2)
seems appropriate.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 03:58:01 +02:00
Michael Kerrisk f95aa6f05b strstr.3: wfix
Remove text that is probably redundant.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:52:08 +02:00
Alejandro Colomar ec415ad970 strstr.3: Document special case for empty needle
Reported-by: Stefan Kanthak <stefan.kanthak@nexgo.de>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:50:20 +02:00
Michael Kerrisk 6b1817e09d printf.3: tfix
Reported-by: Sergey Petrakov <kr@spmail.info>
Reported-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-08 01:08:01 +02:00
Thomas Voss aa1f53ccf9 Various pages: Consistently use '*argv[]'
Scripted change:

$ find man? -type f \
  | sed -i 's/int argc, char \*\*argv/int argc, char \*argv\[\]/';

Signed-off-by: Thomas Voss <thomasavoss@protonmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-08-07 23:34:45 +02:00
Michael Kerrisk 17a4cff3e4 crypt.3: ffix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-26 01:31:54 +02:00
Michael Kerrisk bffbd4d0e2 bzero.3: wfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-25 22:29:27 +02:00
Michael Kerrisk 444cf9b152 atanh.3: tfix
Reported-by: Helge Kreutzmann <debian@helgefjell.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-07-25 22:28:18 +02:00
Michael Kerrisk d597316503 exit_group.2, ioprio_set.2, process_madvise.2, seccomp_unotify.2, set_mempolicy.2, set_tid_address.2, bswap.3, kernel_lockdown.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-22 12:58:31 +12:00
Alejandro Colomar 0c292c5f93 strcmp.3: tfix
With a simple backslash, '\0' ended up as ' ' in the man output.

Reported-by: Štěpán Němec <stepnem@gmail.com>
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 15:49:15 +12:00
thomasavoss 53de89a5fa ferror.3: tfix
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2021-06-20 15:49:10 +12:00