This patch isolates the since/version related fixes as requested.
This change introduces the following delta:
* The page states it was added in 2.6.32 but it is only added
2.6.33 (ref: http://kernelnewbies.org/Linux_2_6_33)
* The MSG_WAITFORONE flag was in turn only added in 2.6.34
(ref: http://kernelnewbies.org/Linux_2_6_34)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The return error EDQUOT is not documented in open(2), write(2),
symlink(2) etc..
Whether inodes or disk blocks are required for each function
is something I based on received wisdom and BSD documentation,
rather than tracing the code to the kernel. For symlink(2)
this certainly depends on the file system type.
This patch was previously sent to the linux-man mailing list
as an RFC in September 2010.
Signed-off-by: Mark Hills <mark@pogo.org.uk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The example uses sendmmsg() to send out a string "onetwo"
on a first datagram, where both halves originate from
distinct buffers and a second datagram contains "three",
coming from a single buffer.
Tested with netcat listening:
root@ubuntu:~# nc -l -u -p 1234
onetwothree
And tcpdump peeking:
root@ubuntu:~# tcpdump -c 2 -s 0 -X -ni lo tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
18:45:16.632134 IP 127.0.0.1.34715 > 127.0.0.1.1234: UDP, length 6
0x0000: 4500 0022 c21c 4000 4011 7aac 7f00 0001 E.."..@.@.z.....
0x0010: 7f00 0001 879b 04d2 000e fe21 6f6e 6574 ...........!onet
0x0020: 776f wo
18:45:16.633267 IP 127.0.0.1.34715 > 127.0.0.1.1234: UDP, length 5
0x0000: 4500 0021 c21d 4000 4011 7aac 7f00 0001 E..!..@.@.z.....
0x0010: 7f00 0001 879b 04d2 000d fe20 7468 7265 ............thre
0x0020: 65 e
2 packets captured
4 packets received by filter
0 packets dropped by kernel
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
SYSLOG_ACTION_SIZE_UNREAD returns the number of bytes
available for reading via SYSLOG_ACTION_READ.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The SYSLOG_ACTION_CLEAR command (5) does not really clear
the ring buffer; rather it affects the semantics of what
is returned by commands 3 (SYSLOG_ACTION_READ_ALL) and
4 (SYSLOG_ACTION_READ_CLEAR).
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Upon encountering the RLIMIT_CPU soft limit when a SIGXCPU handler
has been installed, Linux invokes the signal handler *and* raises
the soft limit by one second. This behavior repeats until the
limit is encountered. No other implementation that I tested
(Solaris 10, FreeBSD 9.0, OpenBSD 5.0) does this, and it seems
unlikely to be POSIX-conformant. The (Linux-specific)
RLIMIT_RTTIME soft limit exhibits similar behavior.
Reported-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The EOVERFLOW error is not only for st_size, but also
inode and block size fields. See glibc source file
sysdeps/unix/sysv/linux/xstatconv.c and kernel source
file fs/stat.c. Also, fix bit/byte confusion
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=604928
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
PTRACE_GETREGS, PTRACE_SETGREFS, PTRACE_GETFPREGS,
and PTRACE_GETSPREGS are not present on all architectures.
PTRACE_SYSEMU and PTRACE_SYSEMU_SINGLESTEP are present only
on x86.
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=122383
Simon Paillard <spaillard@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Recommend clock_gettime(2), not gettimeofday(2) as alternative to times(2).
From times(2):
"To measure changes in elapsed time, use gettimeofday(2)
instead."
From gettimeofday(2):
"POSIX.1-2008 marks gettimeofday() as obsolete, recommending the
use of clock_gettime(2) instead."
Some context, showing how use of gettimeofday() causes actual bugs
(also read comments):
http://blog.habets.pp.se/2010/09/gettimeofday-should-never-be-used-to-measure-time
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This adds a short description of the no_new_privs bit,
as described in Documentation/prctl/no_new_privs.txt.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Note type of 'arg3' for SECCOMP_MODE_FILTER.
Add pointer to Documentation/prctl/seccomp_filter.txt.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This adds a short summary of the arguments used
for "mode 2" (BPF) seccomp.
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The line(s) in the NAME section should only use capitals
where English usage dictates that. Otherwise, use
lowercase throughout.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Existing pages variously use "userspace or "user space".
But, "userspace" is not quite an English word.
So change "userspace" to "user space" or, when used
attributively, "user-space".
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
There is now nothing left of the original FSF-copyrighted
page. So, change the copyright and license.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Rusty notes that O_NONBLOCK is almost always used in
practice. Therefore, it would be better to reorganize
the page to consider that "the default".
Reviewed-by: Lucas De Marchi <lucas.de.marchi@gmail.com>
Reviewed-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
For a better visual result, disable justification and hyphenation
in SEE ALSO where page names are long.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Eric Dumazet noted that EINVAL was not documented. Some further
digging shows that it's also not diagnosed consistently.
See https://bugzilla.kernel.org/show_bug.cgi?id=47111.
Reported-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Executive summary: a sane application can't rely on any
particular behavior if another thread closes a file descriptor
being monitored by select().
See https://bugzilla.kernel.org/show_bug.cgi?id=40852
Reported-by: Stephane Fillod <fillods@users.sf.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
As reported by Fredrik (and as far as I can tell the problem
went back to 2.6.0):
The timeout argument has an upper limit. Any values above that
limit are treated the same as -1, i.e. to wait indefinitely.
The limit is given by:
#define EP_MAX_MSTIMEO min(1000ULL * MAX_SCHEDULE_TIMEOUT / HZ, \
(LONG_MAX - 999ULL) / HZ)
That is, the limit depends on the size of a long and the timer
frequency. Assuming the a long is never smaller than 32 bits
and HZ never larger than 1000, the worst case is 35 minutes.
I think this should be mentioned under "BUGS".
Although this is likely to be fixed in the future
(http://lkml.org/lkml/2010/8/8/144), the problem exists in
at least 2.6.14 - 2.6.35. I don't know if select(2) and poll(2)
are affected.
https://bugzilla.kernel.org/show_bug.cgi?id=20762
Reported-by: Fredrik Arnerup <arnerup@kth.se>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
As reported by Rasmus:
Both my system's man-pages (3.22) and the latest online
(3.41) show:
int mprotect(const void *addr, size_t len, int prot);
as the prototype for mprotect(2). However, POSIX [1] and the
actual sys/mman.h (on all the systems I checked) do not have
the const qualifier on the first argument.
Reported-by: Rasmus Villemoes <Rasmus.Villemoes@decode.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The syntax .UR http://example.com paired with .UE will create
links which one can interact, if the pager allows that. One
way to see the effect is ask the man(1) command to use browser
display, e.g.:
man -H man7/uri.7
("\:" is optional groff syntax to permit hyphenless line breaks.)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
I didn't like ithe "SIGKILL operates similarly, with exceptions"
phrase (if it's different, then it's not "similar", right?),
and now I got around to changing it. Now it says simply:
"SIGKILL does not generate signal-delivery-stop and therefore
the tracer can't suppress it."
Replaced "why WNOHANG is not reliable" example with a more
realistic one (the one which actually inspired to add this
information to man page in the first place): we got
ESRCH - process is gone! - but waitpid(WNOHANG) can still
confusingly return 0 "no processes to wait for".
Replaced "This means that unneeded trailing arguments may
be omitted" part with a much better recommendation
to never do that and to supply zero arguments instead.
(The part about "undocumentedness" of gcc behavior was bogus,
btw - deleted).
Expanded BUGS section with the explanation and an example
of visible strace behavior on the buggy syscalls which
exit with EINTR on ptrace attach. I hope this will lead
to people submitting better bug reports to lkml about
such syscalls.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
For IOPRIO_WHO_PROCESS, who==0 means operate on the caller.
For IOPRIO_WHO_PGRP, who==0 means operate on the caller's
process group.
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=652443
Reported-by: Марк Коренберг <socketpair@gmail.com>
Reported-by: Kalle Olavi Niemitalo <kon@iki.fi>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Mainly rewording things like "is delivered" to "becomes pending",
which is more accurate terminology.
Reported-by: Daniel Zingaro <daniel.zingaro@utoronto.ca>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This system call was never visible to user space, so it makes
sense to move it out of the main table of system calls into
the notes below the table.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Reduce the chance that the reader may be misled into thinking
that there is a wrapper function for this system call by noting
explicitly in the SYNOPSIS that there is no glibc wrapper and
pointing the reader to NOTES for further details.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
And add another example of using syscall() to the program example.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
syscall.2: fix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Remove links >= 5 years old that were created after historical
moves of pages to new sections.
Reported-by: Bjarni Ingi Gislason <bjarniig@rhi.hi.is>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Add text to NOTES to say that the <sys/types.h> and <sys/ipc.h>
header files aren't required by Linux or the standards, but may
be needed for portability to old systems.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
There's no need to mention that the 'ipc_perm' structure
is defined in <sys/ipc.h>. That's an implementation detail,
and furthermore <sys/ipc.h> is itself included by the other
System V IPC header files. The current text might lead the
reader to conclude that they must include <sys/ipc.h>, which
is not the case (it is required neither on Linux, nor by the
standards).
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Rework 04cd7f64, which didn't capture the details correctly.
See the April/May 2012 linux-man@ mail thread "[PATCH]
Describe race of direct read and fork for unaligned buffers"
http://thread.gmane.org/gmane.linux.kernel.mm/77571
Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cowritten-by: Jan Kara <jack@suse.cz>
Cowritten-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
From "groff -ww ..." (or "man --warnings=w ..."):
warning: around line 157: table wider than line width
Have to use text blocks. Move some text to its correct column.
Split text to two columns to avoid hyphenation.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
From "groff -ww" (or "man --warnings=w ..."):
warning: around line 442: table wider than line width
GNU man uses line length of 78.
Use text blocks. Two spaces between sentences or better: start
each sentence in a new line.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Clarify that glibc (as well as old libc) provides emulation
using select(2) on older kernels that don't have a poll()
system call.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Make it clear that 'timeout' interval will be rounded up to the
system clock granularity, and may overrun because of kernel
scheduling delays.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Make it clear that 'timeout' interval will be rounded up to the
system clock granularity, and may overrun because of kernel
scheduling delays.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Make it clear that 'timeout' is a minimum interval; the actual
interval will be rounded up to the system clock granularity,
and may overrun because of kernel scheduling delays.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Make it clear that 'timeout' is a minimum interval; the actual
interval will be rounded up to the system clock granularity,
and may overrun because of kernel scheduling delays.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Make it clear that 'timeout' is a minimum interval; the actual
interval will be rounded up to the system clock granularity,
and may overrun because of kernel scheduling delays.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Make it clear that 'timeout' is a minimum interval; the actual
interval will be rounded up to the system clock granularity,
and may overrun because of kernel scheduling delays.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Make it clear that this clock may be discontinuous, and is
affected my incremental NTP and clock-adjtime(2) adjustments.
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=540872
Reported-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Note interactions of these two clocks with discontinuous
adjustments to the system time and NTP/adjtime(2).
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
Add some basic documentation of these operations, with a pointer to
tools/perf/design.txt for more information.
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
SPARC reverses the use of 'addr' and 'data' for
PTRACE_GETREGS, PTRACE_GETFPREGS, PTRACE_SETREGS,
and PTRACE_SETFPREGS.
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
The corresponding kernel change from Marchel Holtmann was
The attached patch fixes a flaw in the "parent process
death signal" when executing SUID binaries. An
unprivileged user may send arbitrary signal to a child
process even if it is running with higher privileges.
The idea to fix this issue is to reset pdeath_signal not
only on fork, but also on the execution of a SUID binary.
Reported-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
As reported in https://bugzilla.redhat.com/show_bug.cgi?id=680214
the descriptions of ENOSYS and EOPNOTSUP are not corrected
Reported-by: John Sullivan <jsrhbz@kanargh.force9.co.uk>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
It seems sendto() can return EACCES for UDP as well; the current
man page in git only says it can return EACCES for Unix sockets.
I was able to make sendto() return EACCES if I try to send from
192.168.1.1/24 to 192.168.1.0. I think the relevant code (in
kernel 2.6.38, but also present in 2.6.7 and 2.6.32, the 2 kernels
we use) is this (net/ipv4/udp.c, udp_sendmsg()):
910 err = -EACCES;
911 if ((rt->rt_flags & RTCF_BROADCAST) &&
912 !sock_flag(sk, SOCK_BROADCAST))
913 goto out;
So I guess if the kernel finds a route to the destination and
it's a broadcast route (and the socket doesn't have the broadcast
flag), then it returns EACCES.
I can verify the behavior with a very simple program (attached).
I've run it on my Ubuntu 10.10 (2.6.35 kernel) and got this:
stefan@spuiu-vml2:~/src/test/broadcast$ ./broadcast_test 10.205.20.94
10.205.20.1
sendto() returned 4
stefan@spuiu-vml2:~/src/test/broadcast$ ./broadcast_test 10.205.20.94
10.205.20.0
sendto() returned negative, errno: 13/Permission denied
(10.205.20.94 is my local IP, of course).
=====
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int sock;
if (argc < 2) {
printf("Usage: %s local_address destination_address\n", argv[0]);
exit(1);
}
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {
perror("socket");
return -1;
}
struct sockaddr_in local_addr;
local_addr.sin_family = AF_INET;
local_addr.sin_port = htons(1234);
local_addr.sin_addr.s_addr = inet_addr(argv[1]);
int ret = bind(sock, (struct sockaddr *) &local_addr, sizeof(local_addr));
if (ret < 0) {
perror("bind");
return -1;
}
struct sockaddr_in remote_addr;
remote_addr.sin_family = AF_INET;
remote_addr.sin_port = htons(1234);
remote_addr.sin_addr.s_addr = inet_addr(argv[2]);
ret = sendto(sock, "blah", 4, 0, (struct sockaddr *)&remote_addr, sizeof(remote_addr));
if (ret < 0) {
printf("sendto() returned negative, errno: %d/%m\n", errno);
}
else {
printf("sendto() returned %d\n", ret);
}
return 0;
}
=====
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>