Commit Graph

7750 Commits

Author SHA1 Message Date
Michael Kerrisk 3a6548ffb0 tcp.7: Amend 84b183e
A change in 2.6.28 restored the 2.2 behavior:
https://lkml.org/lkml/2009/6/30/499

Reported-by: lepton <ytht.net@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-26 09:12:59 +12:00
Michael Kerrisk 3326bd1971 scandir.3: Improve EXAMPLE source code: s/0/NULL/ in scandir() call
Reported-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-26 09:12:59 +12:00
Michael Kerrisk 63f0f3d9b8 clock_getres.2: Clarify difference between CLOCK_MONOTONIC and CLOCK_MONOTONIC_RAW
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>
2012-04-26 09:12:59 +12:00
Michael Kerrisk 5f04b9486b gettimeofday.2: gettimeofday() is affected by discontinuous jumps in the system time
Advise reader to use clock_gettime(2), if they need a
monotonically increasing time source.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-26 09:12:10 +12:00
Michael Kerrisk fb6fc61227 gettimeofday.2: SEE ALSO: Add clock_gettime(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-26 09:12:06 +12:00
Michael Kerrisk bc02b3ea72 prctl.2: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-26 09:12:06 +12:00
Michael Kerrisk 06afe6739c prctl.2: Add PR_TASK_PERF_EVENTS_DISABLE and PR_TASK_PERF_EVENTS_ENABLE
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>
2012-04-26 09:12:06 +12:00
Michael Kerrisk 50fe8d5366 ptrace.2: Note SPARC deviation with respect to get/set regs
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>
2012-04-26 09:11:45 +12:00
Michael Kerrisk 4ba272b3e0 inotify.7: Note buffer size that guarantees being able to read at least one event
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-24 09:35:45 +12:00
James Hunt 655684a9d9 inotify.7: Correct description of size of inotify_event structure
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-24 09:33:57 +12:00
Michael Kerrisk dc6a909bc0 strchr.3: srcfix: use . mark-up rather than \fI.\fP
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-24 09:09:26 +12:00
Michael Kerrisk 9640b1b311 memchr.3: Clarify description, omitting mention of "strings" and "characters"
The existing text slipped into talking about characters and
strings, which could mislead readers into thing that, for
example, searches for the byte '\0' are treated specially.
Therefore, rewrite in terms of "bytes" and "memory areas".

At the same time, make a few source file clean-ups.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-24 09:05:08 +12:00
James Hunt 2c4d293c33 strchr.3: Explain behavior when seraching for '\0'
The strchr(3) page does `not explain the behavior if the
character to search for is specified as a null character ('\0').
According to my copy of Harbison and Steele, since the terminator
is considered part of the string, a call such as:

  strchr("hello", '\0')

will return the address of the terminating null in the specified
string.

strchr(3) is inconsistent with index(3) which states:

    "The terminating null byte is considered to be
    a part of the strings."

Adding such a note to strchr(3) is also important since it is not
unreasonable to assume that strchr() will return NULL in this
scenario. This leads to code like the following which is
guaranteed to fail should get_a_char() return '\0':

    char string[] = "hello, world";
    int c = get_a_char();

    if (! strchr(string, c))
        fprintf(stderr, "failed to find character in string\n");

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-24 09:04:40 +12:00
Petr Baudis 6addb6a71d resolv.conf.5: Document "single-request" option
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-24 00:11:11 +12:00
Petr Baudis adc9675dac resolver.3: Note that many options are documented in resolv.conf(5)
Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-24 00:09:25 +12:00
James Hunt 96da8065c2 termios.3: tfix: 'IECHO' should be 'ECHO'.
Signed-off-by: James Hunt <james.hunt@ubuntu.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 23:40:07 +12:00
Michael Kerrisk c7c7235c38 prctl.2: Amend details of PR_SET_PDEATHSIG
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>
2012-04-23 21:30:59 +12:00
lepton 84b183e9f7 tcp.7: Correct description for TCP_MAXSEG on modern kernel
In tcp.7, about TCP_MAXSEG, it reads

    If this option is set before connection establishment,
    it also changes the MSS value announced to the other
    end in the initial packet.

It is correct for kernel version 2.2, but it is not
correct for modern kernel such as 2.4 and 2.6.
On a linux box with a modern kernel, the setting for
TCP_MAXSEG won't change the MSS value announced to the
other end.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 21:17:09 +12:00
Michael Kerrisk 42bd5b3db0 socket.7: Correct description of SO_BROADCAST
As reported by Alexey:

socket(7) says:

SO_BROADCAST
  Set  or  get  the broadcast flag. When enabled, datagram sockets
  receive packets sent to a broadcast address and they are allowed
  to  send  packets  to  a  broadcast address.  This option has no
  effect on stream-oriented sockets.

I believe the second sentence is half wrong: when I try it, it
only affects the ability to send broadcast datagrams. You can only
receive broadcast datagrams if you bind to INADDR_ANY and don't
connect. The POSIX standard agrees with my tests and disagrees
with the manpage:

http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_10.html

Reported-by: Alexey Toptygin <alexeyt@freeshell.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 21:02:31 +12:00
Michael Kerrisk f6dc36110c getpwnam.3: Fix discussion of _SC_GETPW_R_SIZE_MAX
The value is not meant to be a maximum (as was specified in
SUSv3) but an initial guess at the required size
(as specified in SUSv4).

Reported-by: Ulrich Drepper <drepper@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 20:21:23 +12:00
Michael Kerrisk f7bae7f86b getgrnam.3: Fix discussion of _SC_GETGR_R_SIZE_MAX
The value is not meant to be a maximum (as was specified in
SUSv3) but an initial guess at the required size
(as specified in SUSv4).

Reported-by: Ulrich Drepper <drepper@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 20:13:16 +12:00
Michael Kerrisk 61474e1b58 gsignal.3: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 18:59:15 +12:00
Michael Kerrisk ed987e2ee4 rexec.3: grfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 12:18:53 +12:00
Michael Kerrisk 6760cb0176 rexec_af.3: New link to rexec.3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 12:18:22 +12:00
Michael Kerrisk 4cd4a6f890 rexec.3: Document rexec_af()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 12:17:44 +12:00
Michael Kerrisk 5b80f0073c iruserok_af.3, rcmd_af.3, rresvport_af.3, ruserok_af.3: New links to rcmd.3
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 12:03:33 +12:00
Michael Kerrisk 023a57dc59 rcmd.3: Document "_af" variants of these functions
Document rcmd_af(), rresvport_af(), iruserok_af(), ruserok_af().
Also some restructuring and other clarifications.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 12:01:47 +12:00
Michael Kerrisk aa104c88b7 rcmd.3: Add some details of the rresvport() 'port' argument
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 11:15:45 +12:00
Michael Kerrisk 7cb4d005c6 fallocate.2: Fix description of ENOSYS and EOPNOTSUP errors
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>
2012-04-23 10:07:47 +12:00
Michael Kerrisk 61d71e01e2 strerror.3: srcfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 09:25:56 +12:00
Michael Kerrisk 6fb29ca02e strerror.3: Add an example of the kind of string returned by setrerror()
Reported-by: Jon Grant <jg@jguk.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 09:24:28 +12:00
Brian F. G. Bidulock c643e947f7 netdevice.7: Document some SIOC configuration ioctls
This patch adds common but missing SIOC configuration ioctls to
the netdevice.7 manual pages that are not documented anywhere
else. SIOCSIFPFLAGS and SIOCGIFPFLAGS are linux-specific. Flag
values come from Linux 2.6.25 kernel headers for sockios. The
others are standard BSD ioctls that have alwasy been implemented
by Linux and were verified from inspecting netdevice.c kernel
code.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 08:29:44 +12:00
Stefan Puiu 4c49bf908c send.2: Document EACCES error case for UDP
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>
2012-04-23 08:15:01 +12:00
Michael Kerrisk df21098dee btree.3, dbopen.3, hash.3, mpool.3, recno.3: Note that glibc no longer provides these interfaces
glibc stopped providing these interfaces with v2.2.
Nowadays, the user that finds these pages probably wants
the libdb API, so note this in the page.

See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=337581

Reported-by: Brian M. Carlson <sandals@crustytoothpaste.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-23 07:47:35 +12:00
Eugen Dedu 1463d77202 iso_8859-1.7: Add "-" for SOFT HYPHEN
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=156154

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 19:12:38 +12:00
Michael Kerrisk afd6f6c5ea fopen.3: spfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 14:48:29 +12:00
Michael Kerrisk 4d9edb6e7e fopen.3: BUGS: Note limitation on number of flag characters parsed in 'mode' 2012-04-22 14:48:29 +12:00
Michael Kerrisk d33e84666f fopen.3: Document ",ccs=string" feature of 'mode' for fopen()/freopen()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 14:48:28 +12:00
Michael Kerrisk 78a9ad2522 fopen.3: Note that 'c' and 'e' flags are ignored for fdopen()
Determined from reading libio/iofdopen.c.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 14:48:28 +12:00
Michael Kerrisk 20e41f3f02 fopen.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 14:48:28 +12:00
Michael Kerrisk 96285a93ed fopen.3: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 14:48:28 +12:00
Michael Kerrisk 24a690f714 locale.7: srcfix: Add FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 14:48:28 +12:00
Michael Kerrisk f26825206d strerror.3: Note how to use 'errno' to detect errors when calling strerror()
Reviewd-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 14:48:08 +12:00
Eric Blake 8ca6ceb0cf strerror.3: Improve strerror_r() description
POSIX requires that perror() not modify the static storage
returned by strerror().  POSIX 2008 and C99 both require that
strerror() never return NULL (a strerror() that always
returns "" for all inputs is valid for C99, but not for POSIX).

http://sourceware.org/bugzilla/show_bug.cgi?id=12204
documents glibc's change to come into compliance with POSIX
regarding strerror_r() return value.  The GNU strerror_r() use
of 'buf' was confusing - I ended up writing a test program that
proves that 'buf' is unused for valid 'errnum', but contains
truncated "unknown message" for out-of-range 'errnum'.

See also http://austingroupbugs.net/view.php?id=382

Reviewed-by: Stefan Puiu <stefan.puiu@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 12:13:31 +12:00
Bernhard Walle a5fa6dfd19 strerror.3: Correct description of error return for XSI strerror_r()
The XSI-compliant version of strerror_r() doesn't return -1 on
error and set errno. Instead, a positive error number is returned.
That's what POSIX says:

    Upon successful completion, strerror_r() shall return 0.
    Otherwise, an error number shall be returned to indicate
    the error.

I tested with an invalid error number. While some implementations
seem to write "Unknown error xxx" into the supplied buffer, some
others don't and only return EINVAL. The latest glibc 2.14.1 from
Arch Linux belongs to the first category while eglibc 2.13 from
current Debian testing belongs to the second category.

However, both implementation are correct according to POSIX. So I
think the manpage was wrong and POSIX and the implementations are
correct.

Signed-off-by: Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 11:09:37 +12:00
Michael Kerrisk a146d9cccd fchmodat.2: Improve discussion of difference between wrapper and underlying syscall
Reported-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 07:09:18 +12:00
Michael Kerrisk 0364dd73e4 fchmodat.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-22 06:55:30 +12:00
Michael Kerrisk 3c8d6131e8 mkstemp.3: Add "mkstemps" and "mkostemps" to NAME line
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-21 11:54:11 +12:00
Michael Kerrisk 66dd9100d8 posix_openpt.3: Add some details on use of the slave pathname
An explicit pointer to ptsname(3) is useful, as is a note
of the fact that the slave device pathname exists only as
long as the master device is held open.

Reported-by: Vadim Mikhailov <vadim.mikhailov@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-20 15:56:02 +12:00
Michael Kerrisk cbf94ac122 sigaction.2: Remove mention of raise(3) for SI_USER
For a long time now, glibc's raise(3) didn't yield SI_USER
for the signal receiver, so remove mention of raise(3)
here. The user can deduce the details, if needed, by looking
at the recently updated raise(3) page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2012-04-20 13:14:31 +12:00