Commit Graph

6490 Commits

Author SHA1 Message Date
Michael Kerrisk 35deeb8703 bind.2, chmod.2, chown.2, chroot.2, clock_getres.2, clone.2, connect.2, dup.2, fallocate.2, get_mempolicy.2, getpeername.2, getpriority.2, getsockname.2, getsockopt.2, gettimeofday.2, ioctl_ficlonerange.2, ioctl_fideduperange.2, kill.2, mbind.2, mmap.2, mount.2, mprotect.2, nfsservctl.2, nice.2, open.2, perf_event_open.2, pipe.2, pkey_alloc.2, prctl.2, ptrace.2, quotactl.2, remap_file_pages.2, sched_setscheduler.2, set_mempolicy.2, signal.2, signalfd.2, swapon.2, sync_file_range.2, syscalls.2, timer_create.2, timerfd_create.2, utime.2, utimensat.2, wait.2, atof.3, ctime.3, errno.3, fclose.3, fflush.3, insque.3, malloc_get_state.3, mallopt.3, mbsnrtowcs.3, mq_close.3, mq_open.3, mq_receive.3, mq_send.3, printf.3, pthread_attr_init.3, pthread_create.3, pthread_setaffinity_np.3, ptsname.3, remainder.3, strtod.3, tgamma.3, timegm.3, tmpnam.3, ttyname.3, console_ioctl.4, elf.5, filesystems.5, proc.5, utmp.5, capabilities.7, cgroups.7, credentials.7, ddp.7, feature_test_macros.7, fifo.7, inotify.7, libc.7, mount_namespaces.7, namespaces.7, netlink.7, pid_namespaces.7, pkeys.7, shm_overview.7, standards.7, uri.7, user_namespaces.7: tstamp
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-12 10:45:24 +01:00
Michael Kerrisk 2da72a435c prctl.2: Minor tweaks to Eugene Syromyatnikov's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-12 07:21:41 +01:00
Eugene Syromyatnikov 0e2c6b8c1b prctl.2: Some additional details regarding PR_GET_UNALIGNED operation
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-12 07:18:46 +01:00
Michael Kerrisk c7f2f9ed16 prctl.2: Minor tweaks to Eugene Syromyatnikov's patch
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-12 07:17:48 +01:00
Eugene Syromyatnikov c49be32cd9 prctl.2: Note the output buffer size for PR_GET_TID_ADDRESS operation on x32/n32
Add note regarding the size of the output user space buffer
for PR_GET_TID_ADDRESS operation on x32/n32.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-12 07:13:56 +01:00
Michael Kerrisk 86c91a79a5 execve.2: tfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-11 19:24:25 +01:00
Michael Kerrisk 16109ab354 sched_setscheduler.2: Mention SCHED_DEADLINE
Give the reader a clue that there is another policy()
available that can't be set via sched_setscheduler(2).

See https://bugzilla.redhat.com/show_bug.cgi?id=1390546

Reported-by: Daniel Berrange <berrange@redhat.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-10 15:18:29 +01:00
Michael Kerrisk 698b2f349f syscall.2: Minor fix in example program
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-10 12:22:35 +01:00
Michael Kerrisk 2101b953ac signal.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-10 12:22:22 +01:00
Michael Kerrisk d823c56d06 syscalls.2: Add ppc_swapcontext(2)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-10 12:21:39 +01:00
Michael Kerrisk e6f3afdb62 write.2: wfix
See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=574041

Reported-by: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-10 11:33:46 +01:00
Michael Kerrisk 60c3c265ea stat.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-10 11:28:09 +01:00
Michael Kerrisk 966d59d524 fsync.2: SEE ALSO: add fflush(3)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-10 10:58:51 +01:00
Michael Kerrisk bf4c35a873 fsync.2: SEE ALSO: add fileno(3)
fileno(3) is useful if one is combining fflush(3)/fclose(3)
and fsync(2).

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-10 10:57:02 +01:00
Michael Kerrisk 92b722248a clone.2: Remove ancient libc5 details
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-09 13:21:56 +01:00
Michael Kerrisk ae18c8cd32 reboot.2: Remove mention of ancient libc4 and lib5
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-09 13:21:56 +01:00
Michael Kerrisk 61d75c37b3 reboot.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-09 13:21:55 +01:00
Michael Kerrisk a05774c442 accept.2: Simplify the discussion of 'socklen_t'
We don't really need to list the old OSes in this discussion.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-09 13:21:55 +01:00
Michael Kerrisk ec5df7afea bind.2, connect.2, getpeername.2, getsockname.2, getsockopt.2: Replace discussion of 'socklen_t' with reference to accept(2)
The discussion of 'socklen_t' editorializes and is repeated
across several pages. Replace it with a reference to accept(2),
where some details about this type are provided.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-09 13:21:55 +01:00
Michael Kerrisk 049c89bdc0 close.2: Place discussion of error handling under a subheading in NOTES
No content changes.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-08 10:15:00 +01:00
Michael Kerrisk d24623ee57 close.2: Note that future POSIX plans to require that the FD is closed on error
See http://austingroupbugs.net/view.php?id=529#c1200.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-07 08:28:29 +01:00
Michael Kerrisk e8730f0ee7 close.2: Further reworking of discussion of error return from close()
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-07 08:26:44 +01:00
Michael Kerrisk ca734d5b67 close.2: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-06 16:52:43 +01:00
Michael Kerrisk 1cab7c163d close.2: Further clarify how to treat an error return
Further clarify that an error return should be used only
for diagnostic or remedial purposes.

Lifting Linus's words freely from
http://lkml.iu.edu/hypermail/linux/kernel/0207.2/0409.html
Re: close return value (was Re: [ANNOUNCE] Ext3 vs Reiserfs benchmarks)
Date: Wed Jul 17 2002 - 12:43:57 EST

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-06 16:52:43 +01:00
Michael Kerrisk 7fe8ca51a3 close.2: Other UNIX implementations also close the FD, even if reporting an error
Looking at some historical source code (mostly from [1]) suggests
that the "close() always closes regardless of error return"
behavior has a long history, predating even POSIX.1-1990.

For example, in SVR4 for x86 (from the file sysvr4.tar.bz2 at
[1]), we see the following:

        int
        close(uap, rvp)
                register struct closea *uap;
                rval_t *rvp;
        {
                file_t *fp;
                register int error;

                if (error = getf(uap->fdes, &fp))
                        return error;
                error = closef(fp);
                setf(uap->fdes, NULLFP);
                return error;
        }

In the above, getf() can return EBADF. The other errors are
returned by closef(), but the file descriptor is deallocated
regardless of errors by setf().

A similar pattern seems to have been preserved into at least late
OpenSolaris days (verified from looking at the initial commit of
the illumos source code). There we find the following in
closeandsetf() (called by close()):

        error = closef(fp);

        setf(fd, newfp);

        return (error);

Looking at the code of closef() in AIX 4.1.3 suggests that, as on
on Linux and FreeBSD, the open file is always released, regardless
of errors.

For Irix, 6.5.5, I'm not sure (the code is not so easy to quickly
read); it may be that it does return errors while leaving the FD
open.

[1] https://archive.org/download/various_operating_system_source_code

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-06 16:52:16 +01:00
Michael Kerrisk 7155aa7750 close.2: Minor text reworking
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-06 16:16:31 +01:00
Michael Kerrisk 73c922eac8 close.2: ffix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-06 16:16:31 +01:00
Michael Kerrisk 35e0ce1c58 close.2: Minor text relocation
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-06 16:16:31 +01:00
Michael Kerrisk b36a3b92b6 close.2: Clarify the variation in EINTR behavior per POSIX and other systems
See also https://news.ycombinator.com/item?id=3363819
and http://www.daemonology.net/blog/2011-12-17-POSIX-close-is-broken.html

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-06 16:16:28 +01:00
Michael Kerrisk eb74a52bb5 close.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-06 15:13:57 +01:00
Michael Kerrisk b61a87d567 close.2: Rework initial paragraph in NOTES on checking close() errors
As Daniel Wagner noted, saying on the one hand that failing
to check the return value of close() is a "serious error"
seems contradicted by the next paragraph that notes that
the return value should be used for "just diagnostics".
Rework the text to resolve the apparent contradiction.

Reported-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-06 15:13:57 +01:00
Michael Kerrisk f65f00b085 close.2: wfix
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-06 15:00:59 +01:00
Michael Kerrisk f5f4165105 mmap.2: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 16:07:12 +01:00
Michael Kerrisk 00d82ce875 open.2: srcfix: FIXME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 16:02:06 +01:00
Michael Kerrisk 2904e19a2b close.2: Further clarify that close() should not be retried after an error
See Linus ancient comments re EINTR in
    https://lkml.org/lkml/headers/2005/9/10/129
    Date	Sat, 10 Sep 2005 12:00:01 -0700 (PDT)
    From	Linus Torvalds <>
    Subject	Re: [patch 7/7] uml: retry host close() on EINTR

The FreeBSD 11.0 close() man page says similar:

    In case of any error except EBADF, the supplied file
    descriptor is deallocated and therefore is no longer valid.

For AIX:
http://publib16.boulder.ibm.com/doc_link/en_US/a_doc_lib/libs/basetrf1/close.htm

    If the FileDescriptor parameter refers to a device and the
    close subroutine actually results in a device close, and the
    device close routine returns an error, the error is returned
    to the application. However, the FileDescriptor parameter is
    considered closed and it may not be used in any subsequent
    calls.

See also:
http://austingroupbugs.net/view.php?id=529
and in particular:
http://austingroupbugs.net/view.php?id=529#c1200

Reported-by: Daniel Wagner <wagi@monom.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 16:02:06 +01:00
Michael Kerrisk 540038a17d nice.2: Move discussion of handling the -1 success return to RETURN VALUE
This detail was rather hidden in NOTES. Also, rework the text
a little.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk 226f6909f0 nice.2: CONFORMING TO: Remove an ancient SVr4 detail on errno values
At this stage, vague details (when does EINVAL get returned?) of
ancient implementations are little more than noise in the page.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk 32ff480294 nice.2: Rework discussion of nice() return value and standards conformance
Make the text a little clearer. In particular, clarify that the
raw system call (still) returns 0 on success.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk 52694f0979 nice.2: Add mention of RLIMIT_NICE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk 384c705b19 getrlimit.2: Refer to sched(7) in discussion of RLIMIT_RTPRIO and RLIMIT_RTTIME
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk a67b298f5c getrlimit.2: SEE ALSO: add credentials(7)
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk dfc3c7dedc getrlimit.2: refer to sched(7) in the discussion of RLIMIT_NICE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk bbc069dd5b getrlimit.2: Minor wording fix for RLIMIT_NICE
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk d17de8336c getrlimit.2: Describe the range of the RLIMIT_NICE limit
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk b5bde13cbc setsid.2: SEE ALSO: add sched(7)
List sched(7), because setsid(2) is part of the machinery
of autogrouping.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Kees Cook 998f951bf8 bpf.2: tfix
Changed to "will" instead of "with".

Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk 1af83f4a7a nice.2: Warn that autogrouping voids the effect of 'nice' in many cases
Refer the reader to sched(7) for the details.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk ccc127001c getpriority.2: Warn that autogrouping voids the effect of 'nice' in many cases
Refer the reader to sched(7) for the details.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-12-05 12:13:33 +01:00
Michael Kerrisk 40fcb004f0 getpriority.2: The nice value supplied to setpriority() is clamped
Note that the nice value supplied to setpriority() is clamped
to the permitted range.

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-11-29 21:50:15 +01:00
Michael Kerrisk 57865ad728 nice.2: Clarify that nice() changes the nice value of the calling *thread*
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
2016-11-28 06:58:54 +01:00