Commit Graph

12555 Commits

Author SHA1 Message Date
Michael Kerrisk 6fe8bb88e4 pthreads.7: SEE ALSO: add fork(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:13 +01:00
Heinrich Schuchardt 7f810a615d fork.2: Child and parent run in separate memory spaces
fork.2 should clearly point out that child and parent
process run in separate memory spaces.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:13 +01:00
J William Piggott feb9265db8 tzset.3: ffix
Signed-off-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 481daa3194 time.1: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 2bec57c646 time.1: Make option argument formatting consistent with other pages
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk f14c973aaa ldconfig.8: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk a831ad17ee ld.so.8: ffix: Make option argument formatting consistent with other pages
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 5c656ff121 ldconfig.8: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk de34d450a8 ldconfig.8: Document -i/--ignore-aux-cache option
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 5a4289a24c ldconfig.8: Document -c/--format option
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 1c2f799e47 ldconfig.8: Document -V/--version option
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 303bef83bd ldconfig.8: Add long form of some options
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 8df2b50312 ldconfig.8: Note glibc version number for '-l' option
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 1d0a65fdb4 ldconfig.8: Place options in alphabetical order
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk e481989327 ldconfig.8: ld.so.conf uses only newlines as delimiters
mtk: confirmed by reading source of parse_conf() in
elf/ldconfig.c.

Reported-by: Patrick Horgan <phorgan1@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 3b01fb87a0 ldconfig.8: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk e2cef38d9f ldconfig.8: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk ef43b7cd3a zic.8: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
JWP 036ea82541 tzset.3: Add offset format
tzset.3 does not illustrate the POSIX offset format.
Specifically, there is no indication in the manual
what the optional components of it are.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 7672e08e00 proc.5: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk c3b494c295 proc.5: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 53cdec414b ptrace.2: Minor tweaks to Denys Vlasenko's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Denys Vlasenko 28e2ca574f ptrace.2: Add information on PTRACE_SEIZE versus PTRACE_ATTACH differences
Extend description of PTRACE_SEIZE with the short summary of its
differences from PTRACE_ATTACH.

The following paragraph:

PTRACE_EVENT_STOP
       Stop induced by PTRACE_INTERRUPT command, or group-stop, or ini-
       tial  ptrace-stop when a new child is attached (only if attached
       using PTRACE_SEIZE), or PTRACE_EVENT_STOP if PTRACE_SEIZE was used.

has an editing error (the part after last comma makes no sense).
Removing it.

Mention that legacy post-execve SIGTRAP is disabled by PTRACE_SEIZE.

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 0e48cd5a7c getxattr.2: Add pointer to example in listxattr(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk a8215524ac listxattr.2: Add note on handling increases in sizes of keys or values
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Michael Kerrisk 9c321ba20b listxattr.2: Minor fixups
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:12 +01:00
Heinrich Schuchardt 636a38776c listxattr.2: Provide example program
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk 7e3aca25bc capabilities.7: Mention SECBIT_KEEP_CAPS as an alternative to prctl() PR_SET_KEEPCAPS
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk 0f2ea061ef capget.2: Rewrite discussion of kernel versions that support file capabilities
File capabilities ceased to be optional in Linux 2.6.33.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk 1872536844 capget.2: tfix 2015-02-21 08:32:11 +01:00
Michael Kerrisk 58bdfd464d capget.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk 5d33c0808b capget.2: Document V3 capabilities constants
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk 487c2f050d mmap.2: grfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk 39b23549b8 syslog.3: Remove unneeded <stdarg.h>
vsyslog() does not need this.

Reported-by: Doug Goldstein <cardoe@gentoo.org>

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk de2a932abd ld.so.8: (Briefly) document LD_TRACE_PRELINKING
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk 549c992a6e ld.so.8: Remove duplicate description of LD_BIND_NOT
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk 8ce45022bb ld.so.8: Relocate "Hardware capabilities" to be a subsection under notes
This is more consistent with standard man-pages headings
and layout.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk f794d5274f capabilities.7: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk 6016943675 capabilities.7: Minor tweaks
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Chris Mayo 16512b57bc capabilities.7: NOTES: add last kernel versions for obsolete options
The CONFIG_SECURITY_CAPABILITIES option was removed by
commit 5915eb53861c5776cfec33ca4fcc1fd20d66dd27

The CONFIG_SECURITY_FILE_CAPABILITIES option removed in
Linux 2.6.33 as already mentioned in DESCRIPTION.

Signed-off-by: Chris Mayo <aklhfex@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk 11af2d4b98 socket.7: Add some details for SO_REUSEPORT
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk c28f1dd3ec socket.7: Minor fixes
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
David Wilson 75979920fe socket.7: Document SO_REUSEPORT socket option
Signed-off-by: David Wilson <dw@botanicus.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
James Hunt 674f11ecbc ptrace.2: Explain behaviour should ptrace tracer call execve(2)
This behaviour was verified by reading the kernel source and
confirming the behaviour using a test program.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Michael Kerrisk ca12634681 pthread_attr_setschedparam.3: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Tobias Herzke 3f6dadab7b pthread_attr_setschedparam.3: Describe EINVAL in ERRORS
The following example proves that the man page
pthread_attr_setschedparam.3 is incorrect when it claims that the
pthread_attr_setschedparam function always succeeds on linux:

int main() {
   pthread_attr_t attr;
   struct sched_param p = {-1}; /* invalid priority */
   if (pthread_attr_init(&attr) == 0)
     if (pthread_attr_setschedpolicy(&attr, SCHED_OTHER) == 0)
       if (pthread_attr_setschedparam(&attr, &p) == EINVAL)
	return 1;
   return 0;
}

The program exits with exit code 1, therefore
pthread_attr_setschedparam() has returned error code EINVAL.

I could evoke this error on ubuntu 14.04, and verify it by
examining the eglibc-2.19 source code. The function is
implemented in file fbtl/pthread_attr_setschedparam.c. For
error checking, it calls the helper function
check_sched_priority_attr which is implemented inline in
file ./fbtl/pthreadP.h. This function returns EINVAL if a
range check fails.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Eric Wong 7b6a329977 sendfile.2: Caution against modifying sent pages
The following program illustrates the difference between TCP
and Unix stream sockets doing sendfile.  Since TCP implements
zero-copy, the new modifications to the file transferred is
seen upon reading despite the modifications happening after
sendfile was last called.

Unix stream sockets do not implement zero-copy (as of
Linux 3.15), so readers continue to see the contents of the
file at the time it was sent, not as they are at the time of
reading.

----------------- sendfile-mod.c ---------------
	#define _GNU_SOURCE
	#include <sys/ioctl.h>
	#include <sys/types.h>
	#include <sys/socket.h>
	#include <sys/sendfile.h>
	#include <arpa/inet.h>
	#include <stdio.h>
	#include <errno.h>
	#include <string.h>
	#include <unistd.h>
	#include <assert.h>
	#include <fcntl.h>

static void tcp_socketpair(int sv[2])
{
	struct sockaddr_in addr;
	socklen_t addrlen = sizeof(addr);
	int l = socket(PF_INET, SOCK_STREAM, 0);
	int c = socket(PF_INET, SOCK_STREAM, 0);
	int a;
	int val = 1;

	addr.sin_family = AF_INET;
	addr.sin_addr.s_addr = INADDR_ANY;
	addr.sin_port = 0;
	assert(0 == bind(l, (struct sockaddr*)&addr, addrlen));
	assert(0 == listen(l, 1024));
	assert(0 == getsockname(l, (struct sockaddr *)&addr, &addrlen));
	assert(0 == connect(c, (struct sockaddr *)&addr, addrlen));
	a = accept4(l, NULL, NULL, SOCK_NONBLOCK);
	assert(a >= 0);
	close(l);
	assert(0 == ioctl(c, FIONBIO, &val));
	sv[0] = a;
	sv[1] = c;
}

int main(int argc, char *argv[])
{
	int pair[2];
	FILE *tmp = tmpfile();
	int tfd;
	char buf[16384];
	ssize_t w, r;
	size_t i;
	const size_t n = 2048;
	off_t off = 0;
	char expect[4096];
	int flags = SOCK_STREAM|SOCK_NONBLOCK;

	tfd = fileno(tmp);
	assert(tfd >= 0);

	/* prepare the tempfile */
	memset(buf, 'a', sizeof(buf));
	for (i = 0; i < n; i++)
		assert(sizeof(buf) == write(tfd, buf, sizeof(buf)));

	if (argc == 2 && strcmp(argv[1], "unix") == 0)
		assert(0 == socketpair(AF_UNIX, flags, 0, pair));
	else if (argc == 2 && strcmp(argv[1], "pipe") == 0)
		assert(0 == pipe2(pair, O_NONBLOCK));
	else
		tcp_socketpair(pair);

	/* fill up the socket buffer */
	for (;;) {
		w = sendfile(pair[1], tfd, &off, n);
		if (w > 0)
			continue;
		if (w < 0 && errno == EAGAIN)
			break;
		assert(0 && "unhandled error" && w && errno);
	}
	printf("wrote off=%lld\n", (long long)off);

	/* rewrite the tempfile */
	memset(buf, 'A', sizeof(buf));
	assert(0 == lseek(tfd, 0, SEEK_SET));
	for (i = 0; i < n; i++)
		assert(sizeof(buf) == write(tfd, buf, sizeof(buf)));

	/* we should be reading 'a's, not 'A's */
	memset(expect, 'a', sizeof(expect));
	do {
		r = read(pair[0], buf, sizeof(expect));

		/* TCP fails here since it is zero copy (on Linux 3.15.5) */
		if (r > 0)
			assert(memcmp(buf, expect, r) == 0);
	} while (r > 0);

	return 0;
}

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Peng Haitao 87ab04792c clone.2: Fix description of CLONE_PARENT_SETTID
CLONE_PARENT_SETTID only stores child thread ID in parent memory.

Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Kevin Easton 8a76b19ecd clone.2, execve.2: Document interaction of execve(2) with CLONE_FILES
This patch the fact that a successful execve(2) in a process that
is sharing a file descriptor table results in unsharing the table.

I discovered this through testing and verified it by source
inspection - there is a call to unshare_files() early in
do_execve_common().

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00
Jan Stancek 3d350ba3c9 migrate_pages.2: Document EFAULT and EINVAL errors
I encountered these errors while writing testcase for migrate_pages
syscall for LTP (Linux test project).

I checked stable kernel tree 3.5 to see which paths return these.
Both can be returned from get_nodes(), which is called from:
SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode,
                const unsigned long __user *, old_nodes,
                const unsigned long __user *, new_nodes)

The testcase does following:
EFAULT
a) old_nodes/new_nodes is area mmaped with PROT_NONE
b) old_nodes/new_nodes is area not mmapped in process address
   space, -1 or area that has been just munmmaped

EINVAL
a) maxnodes overflows kernel limit
b) new_nodes contain node, which has no memory or does not exist
   or is not returned for get_mempolicy(MPOL_F_MEMS_ALLOWED).

Signed-off-by: Jan Stancek <jstancek@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2015-02-21 08:32:11 +01:00