Commit Graph

6177 Commits

Author SHA1 Message Date
Michael Kerrisk 8678102abe pidfd_getfd.2, select.2, exit.3, time.7, time_namespaces.7: srcfix: Trim trailing white spaces
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-11 22:33:10 +02:00
Michael Kerrisk e8426ca2b4 getent.1, localedef.1, accept.2, arch_prctl.2, clock_getres.2, clock_nanosleep.2, connect.2, dup.2, epoll_create.2, epoll_ctl.2, epoll_wait.2, execve.2, getitimer.2, getsockopt.2, gettid.2, inotify_add_watch.2, inotify_init.2, io_submit.2, ioctl.2, lseek.2, madvise.2, mlock.2, mmap.2, mprotect.2, msgctl.2, msgop.2, open_by_handle_at.2, openat2.2, pidfd_open.2, poll.2, prctl.2, quotactl.2, s390_sthyi.2, select.2, select_tut.2, semctl.2, semget.2, semop.2, setns.2, shmctl.2, shmget.2, shmop.2, sigaction.2, stat.2, statx.2, syscalls.2, timer_create.2, timerfd_create.2, unshare.2, wait.2, CPU_SET.3, aio_init.3, atoi.3, des_crypt.3, dirfd.3, fmemopen.3, fopencookie.3, ftok.3, fts.3, getaddrinfo.3, getifaddrs.3, getrpcent.3, gsignal.3, lio_listio.3, nl_langinfo.3, posix_memalign.3, posix_openpt.3, posix_spawn.3, scanf.3, sem_init.3, sem_post.3, shm_open.3, strcmp.3, strftime.3, st.4, elf.5, group.5, proc.5, services.5, aio.7, cgroups.7, feature_test_macros.7, keyrings.7, man-pages.7, namespaces.7, path_resolution.7, sigevent.7, signal.7, socket.7, sysvipc.7, time.7, udp.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-11 22:07:24 +02:00
Michael Kerrisk 8de73d59bb strcmp.3: SEE ALSO: add ascii(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk 3ffa5156fe strcmp.3: Add an example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk 70920875ec strcmp.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk befaf7f4c7 strcmp.3: Rework text describing return value to be clearer
Reported-by: Andrew Micallef <andrew.micallef@live.com.au>
Reported-by: Walter Harms <wharms@bfs.de>
Reviewed-by: Andrew Micallef <andrew.micallef@live.com.au>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk fd2f02239f strcmp.3: Note that the comparison is done using unsigned char
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 10:14:29 +02:00
Michael Kerrisk ed09120acd accept.2, epoll_create.2, inotify_add_watch.2, open.2, open_by_handle_at.2, pidfd_open.2, dirfd.3, posix_openpt.3, shm_open.3: Fix clumsy wording around "nonnegative file descriptors"
Reported-by: Christian Brauner <christian@brauner.io>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-10 09:41:55 +02:00
Michael Kerrisk 98511af299 pthread_getcpuclockid.3: Minor clarification to usage of 'clockid' argument
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 12:57:25 +02:00
Michael Kerrisk 9e099e691e clock_getcpuclockid.3, pthread_getcpuclockid.3: wfix: use 'clockid' rather than 'clock_id'
For consistency across pages.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-04-02 12:57:25 +02:00
Jakub Wilk cf178e9319 printf.3: ffix
Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-26 08:48:52 +01:00
Michael Kerrisk 3d5a6df077 sem_post.3: Add a reference to code example code in shm_open(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk 3137ba8843 sem_init.3: Add references to example code in shm_open(3) and sem_wait(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk 145b262dda shm_open.3: EXAMPLE: add some example programs
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk 88ea6ab903 ftok.3: EXAMPLE: add a reference to the example in semget(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-03-12 09:24:44 +01:00
Michael Kerrisk cb2e25d873 getifaddrs.3: EXAMPLE: remove unneeded loop variable
Reported-by: Michael Galassi <michael@galassi.us>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-29 22:41:15 +01:00
Eugene Syromyatnikov 5c6233fd47 strftime.3: tfix
Fixes: 13e5f960f3 "strftime.3: Minor tweaks to Eugene Syromyatnikov's patch"
Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-24 10:28:21 +01:00
Michael Kerrisk 7776aac98a exit.3: Small improvement to the discussion of 'status' argument
Reported-by: Walter Harms <wharms@bfs.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-24 09:00:30 +01:00
Michael Kerrisk 13e5f960f3 strftime.3: Minor tweaks to Eugene Syromyatnikov's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov b0f9cb5e85 strftime.3: Expand %E and %O description
* man3/strftime.3 (%C): Describe the meaning of %EC conversion
specification.
(%E): Mention the concept of "era" in description.
(%O): Mention that alternative format is related to numeric
representation.
(%y): Describe the meaning of %Ey conversion specification.
(%Y): Describe the meaning of %EY conversion specification.
(.SH DESCRIPTION): Mention that the behaviour of %E modifier is governed
by ERA locale element and provide ja_JP locale as an example.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Michael Kerrisk 9c85099e92 strftime.3: Tweaks to Eugene Syromyatnikov's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov a748a16aaf strftime.3: Refer to the relevant nl_langinfo(3) items
As it wasn't clear before where this kind of information can be
obtained from.

* man3/strftime.3 (%a, %A, %b, %B, %c, %p, %r, %x, %X): Add information
about the locale elements that can be used to retrieve the relevant
information using nl_langinfo() library call.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov cb573e410b strftime.3: Consistently document fall-back format string
The information is taken from POSIX[1] and the
implementations[2][3][4].

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_05_03
[2] https://sourceware.org/git/?p=glibc.git;a=blob;f=time/strftime_l.c
[3] https://git.musl-libc.org/cgit/musl/tree/src/locale/langinfo.c#n15
[4] https://git.uclibc.org/uClibc/tree/libc/misc/locale/locale.c#n992

* man3/strftime.3 (%c, %x, %X): Add information about fall-back format.
(%r): Move it behind SU comment.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Michael Kerrisk b18f942307 nl_langinfo.3: Tweaks to Eugene Syromyatnikov's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov 2969f2cc3d nl_langinfo.3: Document era-related locale elements
Information is mostly taken from POSIX[1], GNU C Library
documentation[2], glibc strftime implementation[3], and Japanese
locale definition[4].

[1] https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap07.html#tag_07_03_05_02
[2] https://www.gnu.org/software/libc/manual/html_node/The-Elegant-and-Fast-Way.html
[3] https://sourceware.org/git/?p=glibc.git;a=blob;f=time/strftime_l.c
[4] https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/locales/ja_JP

* man3/nl_langinfo.3 (.SH DESCRIPTION): Add information about ERA,
ERA_D_T_FMT, ERA_D_FMT, and ERA_T_FMT locale elements.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov 6602e55a7c nl_langinfo.3: Add information about AM/PM time format locale elements
* man3/nl_langinfo.3 (.SH DESCRIPTION): Add description for AM_STR,
PM_STR, T_FMT_AMPM locale elements.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Eugene Syromyatnikov 6c21e49f97 nl_langinfo.3: mention the respective strftime(3) conversion specifications
* man3/nl_langinfo.3 (D_T_FMT, D_FMT, T_FMT, DAY_{1–7},
ABDAY_{1–7}, MON_{1–12}, ABMON_{1–12}): Mention the respective
strftime(3) conversion specifications.

Signed-off-by: Eugene Syromyatnikov <evgsyr@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 22:47:39 +01:00
Michael Kerrisk 390f1f349a termios.3: srcfix: Add self to copyright
I've added quite a few pieces to this page over the years.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk db4a4ba77d malloc.3: srcfix: Add self to copyright
By now, I've written quite a bit of the text of this page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk af88b3d3bd getopt.3: srcfix: add self to copyright
I'm the author of various parts of the page, and one
of the example programs.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 50fd1cfe6f poll.2, atoi.3, gsignal.3, posix_memalign.3, scanf.3: Remove a few mentions of the ancient "Linux libc"
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 0019177eac getent.1, localedef.1, clock_nanosleep.2, fcntl.2, getitimer.2, getsockopt.2, inotify_init.2, ioctl.2, mlock.2, mprotect.2, quotactl.2, s390_sthyi.2, semctl.2, shmctl.2, shmget.2, wait.2, CPU_SET.3, aio_init.3, des_crypt.3, fmemopen.3, fopencookie.3, fts.3, getaddrinfo.3, getrpcent.3, lio_listio.3, posix_spawn.3, shm_open.3, st.4, elf.5, group.5, proc.5, services.5, aio.7, feature_test_macros.7, keyrings.7, man-pages.7, sigevent.7, tcp.7, udp.7: Global formatting fix: disfavor nonstandard .TP indents
In many cases, these don't improve readability, and (when stacked)
they sometimes have the side effect of sometimes forcing text
to be justified within a narrow column range.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-23 09:58:23 +01:00
Michael Kerrisk 6b621d05b3 _exit.2, capget.2, fcntl.2, futex.2, listen.2, memfd_create.2, modify_ldt.2, move_pages.2, open.2, perf_event_open.2, ptrace.2, set_thread_area.2, stime.2, syscall.2, sysctl.2, userfaultfd.2, cmsg.3, exit.3, ftime.3, getpt.3, malloc.3, console_codes.4, loop.4, inotify.7, netlink.7, packet.7, rtnetlink.7, tcp.7, unix.7, vsock.7, ldconfig.8: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-09 11:53:28 +01:00
Michael Kerrisk 9ec6412745 malloc.3: Minor tweaks to Vegard Nossum's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 23:37:21 +01:00
Vegard Nossum 813d606b00 malloc.3: realloc() return value
One might be tempted to think that realloc() always requests a new
allocation before moving the contents over (at least in the case
where the new size is bigger than the original). This is not the
case; for example, on my system the following program:

	#include <stdlib.h>
	#include <stdio.h>
	#include <unistd.h>

	int main(int argc, char *argv[])
	{
		void *x = malloc(15);
		void *y = malloc(32);

		printf("x = %p\n", x);
		printf("y = %p\n", y);
		printf("usable_size(x) = %lu\n", malloc_usable_size(x));

		void *z = realloc(x, 24);
		printf("z = %p\n", z);

		return 0;
	}

prints:

	x = 0x1b3a010
	y = 0x1b3a030
	usable_size(x) = 24
	z = 0x1b3a010

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 23:37:10 +01:00
Benjamin Peterson f3491e47ba exit.3: Use hex for the status mask
Admittedly, the POSIX specification for exit() also uses octal.
However, 0xFF immediately indicates the lowest 8 bits to me
whereas I had to think a bit about the octal mask.

Cowritten-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-08 11:59:37 +01:00
Dmitry V. Levin 0482a85341 cmsg.3: ffix
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-07 16:16:34 +01:00
Michael Kerrisk e4c98f64d1 cmsg.3: Modify CMSG_DATA() example to use memcpy()
See previous patch to this page for rationale

Reported-by: Rich Felker <dalias@libc.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-05 01:21:17 +01:00
Rich Felker 36d25246b4 cmsg.3: Clarify alignment issues and correct method of accessing CMSG_DATA()
From an email by Rich Felker:

It came to my attention while reviewing possible breakage with
move to 64-bit time_t that some applications are dereferencing
data in socket control messages (particularly SCM_TIMESTAMP*)
in-place as the message type, rather than memcpy'ing it to
appropriate storage. This necessarily does not work and is not
supportable if the message contains data with greater alignment
requirement than the header. In particular, on 32-bit archs,
cmsghdr has size 12 and alignment 4, but struct timeval and
timespec may have alignment requirement 8.

I found at least ptpd, socat, and ssmping doing this via Debian
Code Search:

https://sources.debian.org/src/ptpd/2.3.1-debian1-4/src/dep/net.c/?hl=1578#L1578
https://sources.debian.org/src/socat/1.7.3.3-2/xio-socket.c/?hl=1839#L1839
https://sources.debian.org/src/ssmping/0.9.1-3/ssmpngcl.c/?hl=307#L307

and I suspect there are a good deal more out there. On most archs
they won't break, or will visibly break with SIGBUS, but in theory
it's possible that they silently read wrong data and this might
happen on some older and more tiny-embedded-oriented archs.

I think it's clear to someone who understands alignment and who's
thought about it that applications just can't do this, but it
doesn't seem to be documented, and an example in cmsg(3) even
shows access to int payload via *(int *)CMSG_DATA(cmsg) (of course
int is safe because its alignment is <= header alignment, but this
is not mentioned).

Could we add text, and perhaps change the example, to indicate
that in general memcpy needs to be used to copy the payload
to/from a suitable object?

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-05 01:16:10 +01:00
Michael Kerrisk 477b8f4b6f exec.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-02-04 00:42:34 +01:00
Mike Salvatore 4207253f85 getcwd.3: wfix
This patch is a minor wording fix in getcwd.3 that changes "In the case getcwd()" to "In the case of getcwd()". This patch should apply cleanly to the master branch of the git repository.

Regards,
Mike Salvatore

From 3b68ad225dbaada2b1b55153dc57807b04531cd6 Mon Sep 17 00:00:00 2001
From: Mike Salvatore <mike.salvatore@canonical.com>
Date: Thu, 16 Jan 2020 16:08:08 -0500
Subject: [PATCH] getcwd.3: wfix

Signed-off-by: Mike Salvatore <mike.salvatore@canonical.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-21 20:13:56 +01:00
Petr Vorel d1715bcd15 malloc.3: Remove duplicate _GNU_SOURCE
Fixes: d8d701003 ("malloc.3: Since glibc 2.29, realloc() is exposed by
defining _DEFAULT_SOURCE")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-10 20:57:14 +01:00
Samuel Thibault 378e5745a4 getpt.3: Remove mention of O_NOCTTY
The glibc implementation of getpt has actually never been setting
O_NOCTTY when opening /dev/ptmx or BSD ptys.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2020-01-01 08:26:31 +01:00
Michael Kerrisk 5afb9373df nl_langinfo.3: tfix
See https://sourceware.org/bugzilla/show_bug.cgi?id=25255

Reported-by: Weitian LI <liweitianux@live.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-12-11 23:01:08 +01:00
Michael Kerrisk 0f18a233a3 ftime.3: Note that this function is deprecated
As noted in glibc 2.31 feature notes.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-23 10:38:28 +01:00
Jashank Jeremy 96605dde98 strtok.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-21 09:31:27 +01:00
Jakub Wilk 0f2b59f5ca strftime.3: wfix
Fix comma splice.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-11-13 20:35:53 +01:00
Michael Kerrisk 576b9ea7ae abort.3: wfix
Reported-by: Mikael Magnusson <mikachu@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-16 21:47:20 +02:00
Michael Kerrisk 0b1348ba35 getauxval.3: Clarify that AT_BASE_PLATFORM and AT_EXECFN return pointers to strings
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=942207

Reported-by: Witold Baryluk <witold.baryluk@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-12 14:23:15 +02:00
Jakub Wilk 22bff75859 strptime.3: tfix
Escape hyphens.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2019-10-11 23:45:02 +02:00