Commit Graph

7110 Commits

Author SHA1 Message Date
Michael Kerrisk 1130df606b Amend copyright notices, in particular those where I had significant
authorship.
2006-02-15 23:15:29 +00:00
Michael Kerrisk 2486cacf6d ffix 2006-02-14 18:16:45 +00:00
Michael Kerrisk 3adb464791 tfix 2006-02-13 22:46:01 +00:00
Michael Kerrisk 2d7195b8fb Change "path name" to "pathname" 2006-02-12 22:19:08 +00:00
Michael Kerrisk 2c5f10893e Change "file name" to "filename" 2006-02-12 22:15:41 +00:00
Michael Kerrisk 069c98bab0 Minor wording fix. 2006-02-12 01:54:40 +00:00
Michael Kerrisk 435827ff1d tfix 2006-02-11 20:54:15 +00:00
Michael Kerrisk 360c175e1a Documented the EAGAIN error for msgrcv(). 2006-02-11 20:53:04 +00:00
Michael Kerrisk 0483625f84 ffix 2006-02-11 20:16:44 +00:00
Michael Kerrisk 8548d8e240 Under ERRORS: Separate out EAGAIN error for locking mmaped files. 2006-02-10 20:29:38 +00:00
Michael Kerrisk c533af9d27 Reformatted FIXMEs 2006-02-10 18:46:42 +00:00
Michael Kerrisk dcec8eb551 Formatting fixes 2006-02-09 20:29:51 +00:00
Michael Kerrisk 9ff08aad91 Formatting fixes 2006-02-09 20:24:53 +00:00
Michael Kerrisk c4d4162c93 Modified versions of old GPL pages on kernel modules API. 2006-02-09 19:32:36 +00:00
Michael Kerrisk 0b3189d89a minor wording change 2006-02-08 19:36:09 +00:00
Michael Kerrisk ad31978e25 Minor changes after suggestions from Robert Love. 2006-02-08 19:16:12 +00:00
Michael Kerrisk 92057f4dbc Updated FIXMEs 2006-02-08 09:44:13 +00:00
Michael Kerrisk 64c7bb8a52 Add SEE ALSO for pwrite(2). 2006-02-08 04:18:44 +00:00
Michael Kerrisk 6188db2db4 Add SEE ALSO for pread(2).
As per Debian bug 351873.
2006-02-08 04:18:25 +00:00
Michael Kerrisk 4d2b74dded New pages for inotify API 2006-02-08 04:13:22 +00:00
Michael Kerrisk 314093c9cd New pages on NUMA memory allocation policy API. 2006-02-08 03:20:44 +00:00
Michael Kerrisk 1363cf9511 Added xref under dnotify description to inotify.7. 2006-02-06 22:43:15 +00:00
Michael Kerrisk 083ddbc2c7 Added BUGS txt on interaction between MCL_FUTURE and RLIMIT_MEMLOCK.
See the following LKML thread:
http://marc.theaimsgroup.com/?l=linux-kernel&m=113801392825023&w=2
"Rationale for RLIMIT_MEMLOCK"
2006-02-03 20:56:21 +00:00
Michael Kerrisk cbea10b39a Small wording change under NOTES to clarify
what happends when a process sends a signal to itself.
See Debian bug 350236.
2006-02-03 03:46:54 +00:00
Michael Kerrisk a5a997ca09 On x86, clone() should not be called through vsyscall,
but directly through "int $0x80".
2006-02-03 03:32:38 +00:00
Michael Kerrisk 48be114450 Major rewrite. 2006-02-02 19:46:34 +00:00
Michael Kerrisk 21045df8dd Other minor wording changes. 2006-02-02 18:18:55 +00:00
Michael Kerrisk 071dbad970 Added return types to prototypes for FD_SET(), FD_CLR(),
FD_ZERO, and FD_ISSET().
2006-02-02 18:15:36 +00:00
Michael Kerrisk 6e0e514c76 Rewrote declaration of 'msgp' to be "void *" in response
to Debian bug report 350884.
Various other wording fixes.
2006-02-02 10:47:23 +00:00
Michael Kerrisk 68b93ce208 Small wording changes 2006-02-02 03:25:50 +00:00
Michael Kerrisk bfe9ba6712 Clarify distinction between "file creation flags" and
"file status flags".
2006-02-02 03:25:41 +00:00
Michael Kerrisk 74f3f90ba5 Noted that portable applications should specify fd as -1
when using MAP_ANONYMOUS.
Some rewriting of description of MAP_ANONYMOUS.
2006-02-01 19:19:59 +00:00
Michael Kerrisk c72dada18f tfix 2006-02-01 18:39:15 +00:00
Michael Kerrisk 04d6ea6b8a Noted that waitid() does not set infop->si_uid field on
most other implementations.
2006-01-23 06:41:46 +00:00
Michael Kerrisk d6c1d7e0b5 New link to sigreturn.2 2006-01-17 21:45:31 +00:00
Michael Kerrisk cd84309e6b new link to sigsuspend.2 2006-01-17 21:45:04 +00:00
Michael Kerrisk 736e551b25 tfix 2006-01-16 19:40:20 +00:00
Michael Kerrisk ed645f8762 Clarify relationship between mmap2(2) and mmap64(3)
A few other small rewordings.
2006-01-15 20:47:36 +00:00
Michael Kerrisk b50582ebfa Added BUG noting that O_ASYNC can't be enabled via
open(): fcntl() must be used for this purpose.
2006-01-15 04:39:23 +00:00
Michael Kerrisk 6e126ed614 Formatting fix 2006-01-14 17:09:59 +00:00
Michael Kerrisk 964d4d9c5c Format fix 2006-01-14 17:05:44 +00:00
Michael Kerrisk e75529df3b Noted bug that could wrongly cause EPERM in unprivileged
capset() with 'pid' field == getpid().
2006-01-14 03:25:01 +00:00
Michael Kerrisk 80b50848d0 Replace "SYSV" by "System V" 2006-01-13 09:44:53 +00:00
Michael Kerrisk aa651b3950 Replace "SysV" by "System V" 2006-01-13 09:39:55 +00:00
Michael Kerrisk 62d4f1bd38 Relocate misplaced discussion of MSG_DONTWAIT. 2006-01-13 07:56:23 +00:00
Michael Kerrisk 28d88c1751 Global change to many pages...
Various pages use inconsistent terms for 'null byte' (which
is the C99/SUSv3 term for the '\0' character).
To rectify this the following changes were made in these pages:

Replace 'zero byte' with 'null byte'.
Replace 'null character' with 'null byte'.
Replace 'nulls' with 'null bytes'.
Replace 'NUL-terminated' by 'null-terminated'.
Replace 'NUL' by 'null byte'.
Replace 'terminating NUL' by 'terminating null byte'.
Replace 'final NUL' by 'terminating null byte'.
Replace 'NUL character' by 'null byte'.
2006-01-13 02:09:44 +00:00
Michael Kerrisk 16055a24f3 Added GLIBC NOTES describing operation of glibc's
gethostname() wrapper function.
2006-01-12 21:53:50 +00:00
Michael Kerrisk fee44d9bff Noted that EPOLLONESHOT was added in 2.6.2 2006-01-04 11:03:07 +00:00
Michael Kerrisk dc81d42e12 Updated FIXME 2006-01-04 10:25:08 +00:00
Michael Kerrisk 34fa629837 Added some text to explain the usual scenario in which
sigaltstack() is employed.
2006-01-01 07:02:49 +00:00
Michael Kerrisk 5059acc358 Remove text under EINVAL error: "This may change in the future:
see linux/unix/sock.c for details."  This behaviour has been
unchanged for a long time, and seems unlikely to change.

Add EADDRINUSE to errors.
2005-12-19 10:46:01 +00:00
Michael Kerrisk 1df419f2b7 Add cmsg.3 to SEE ALSO. 2005-12-19 09:16:57 +00:00
Michael Kerrisk 69c4c18902 updated FIXME 2005-12-14 16:46:05 +00:00
Michael Kerrisk 512c311c5e Put 'flags' list in alphabetical order. 2005-12-14 16:44:39 +00:00
Michael Kerrisk a28ed21cec Put flags list in alphabetcal order 2005-12-14 16:41:14 +00:00
Michael Kerrisk 145ff0249e Added cross-reference from discussion of MSG_MORE to UDP_CORK in udp(7). 2005-12-14 16:30:49 +00:00
Michael Kerrisk 711672c037 ffix 2005-12-14 11:40:27 +00:00
Michael Kerrisk ffa01655e5 Added mention of AF_INET6 address family.
Added discussion of sockaddr structure and an example in the Unix domain.
2005-12-14 11:37:28 +00:00
Michael Kerrisk cde9f44b19 Added comment noting that fork.2 refers to the example program on this
page.
2005-12-12 09:19:46 +00:00
Michael Kerrisk d7b0e083ce Added xref to pipe.2 for another example of use of fork(). 2005-12-12 09:18:35 +00:00
Michael Kerrisk 8440a332f7 Formatting fix 2005-12-09 16:37:46 +00:00
Michael Kerrisk 1fa343d1ab Added example program demonstrating use of fork() and waitpid(). 2005-12-09 16:37:05 +00:00
Michael Kerrisk 2f59b1bc3c Added pointer to example of fork() in wait.2. 2005-12-09 16:36:12 +00:00
Michael Kerrisk 15740f8afd Added example program. 2005-12-09 14:24:10 +00:00
Michael Kerrisk be37f2c558 Added SEE ALSO for new pipe.7 page 2005-12-08 18:57:25 +00:00
Michael Kerrisk eeabb34e30 The -1 error return of shmat() should be cast "(void *)". 2005-12-02 08:09:44 +00:00
Michael Kerrisk c1164764b0 Added NOTES about INFTIM contant provided on some other implementations. 2005-12-01 16:03:36 +00:00
Michael Kerrisk f6179c2fbd Formatting fix 2005-12-01 14:05:11 +00:00
Michael Kerrisk a14245c218 Add as new link to vm86.2 2005-11-30 15:24:52 +00:00
Michael Kerrisk 30ecea55d4 Changed SEE ALSO to reflect movement of sig* pages between sections. 2005-11-29 15:01:54 +00:00
Michael Kerrisk e3f86a1c91 Moved to section 3. 2005-11-29 14:58:23 +00:00
Michael Kerrisk c7dd2834b5 These pages will be replaced by a new, better sigvec.3. 2005-11-29 14:46:00 +00:00
Michael Kerrisk c625361fea Noted that si_signo is unused on Linux. 2005-11-28 16:17:54 +00:00
Michael Kerrisk 81551079f0 Added BUGS noting wrapper function problem that existed
in glibc versions <= 2.2.1.
2005-11-21 15:05:20 +00:00
Michael Kerrisk 55430ae964 Added text describing the 2.6.[0-7] EPERM bug that occurred
when sending signals to a process group.
2005-11-21 13:37:53 +00:00
Michael Kerrisk b2216ffee6 Clarified parts of the discussion of file leases,
noting effect of open(O_NONBLOCK), interruption
by signal handler, or termination by signal in lease breaker.
In response to Debian bug 339037.
2005-11-17 14:56:41 +00:00
Michael Kerrisk d3952311d4 Add EWOULDBLOCK error for file leases. 2005-11-17 14:55:31 +00:00
Michael Kerrisk 246a500fe8 Added LINUX NOTES describing nanosecond timestamps. 2005-11-17 13:36:31 +00:00
Michael Kerrisk d636589fde Added FIXME 2005-11-14 13:24:17 +00:00
Michael Kerrisk 3b3ce330e7 Added FIXME 2005-11-14 11:39:08 +00:00
Michael Kerrisk 4989c2f337 Improved description of E2BIG error: it relates to the sum
of the bytes in both environment and argument list.
2005-11-08 15:25:07 +00:00
Michael Kerrisk 64f828d585 Updated discussion about lack of prototype in glibc. 2005-11-03 14:14:09 +00:00
Michael Kerrisk bd12ab88af Formatting fixes 2005-11-03 12:47:27 +00:00
Michael Kerrisk 8478ee0279 Formatting fixes 2005-11-02 13:55:25 +00:00
Michael Kerrisk 836f07c1c3 Change things like "NULL-terminated string" to "null-terminated string" 2005-11-02 11:55:24 +00:00
Michael Kerrisk 31e9a9ec99 Change itacised function names and page xrefs to bold 2005-11-02 11:34:24 +00:00
Michael Kerrisk 9961bb4f07 Formatting fix 2005-11-02 11:06:40 +00:00
Michael Kerrisk 197889d00b Formatting fixes 2005-11-02 10:53:26 +00:00
Michael Kerrisk ac7a498150 Added some comments 2005-10-31 09:47:01 +00:00
Michael Kerrisk 6a0f26867c Reworked (cut down) discussion of capabilities, moving part of
it into capabilities.7
2005-10-28 17:40:41 +00:00
Michael Kerrisk bb40bc01bd Add text to note that setresuid() always modifies the file
system UID, and setresgid() likewise always modifies the
file system GID.
2005-10-28 16:57:37 +00:00
Michael Kerrisk ae050d9ae1 Formatting fixes 2005-10-28 13:40:41 +00:00
Michael Kerrisk 4a04cd9a4d Fix typos 2005-10-28 13:32:01 +00:00
Michael Kerrisk 62efe3ef2d Hello Andries,
Let us return to path_resolution.2...

> Von: Andries Brouwer <Andries.Brouwer@cwi.nl>
> Betreff: Re: ***UNCHECKED*** man-pages-2.11
> Datum: Mon, 24 Oct 2005 20:43:42 +0200
> 
> On Mon, Oct 24, 2005 at 05:27:56PM +0200, Michael Kerrisk wrote:
> 
> > PS I changed some text in path_rolution.2, where it seems to 
> > me that you made an error.  But I could be wrong -- you 
> > might like to double check it?
> 
> Hmm, I think it was precisely correct and no longer is.
> 
> I see some change in wording that does not actually change anything,
> and the addition of "as well" that may be incorrect.

Let's begin with a diff:

=====
--- man-pages-2.10/man2/path_resolution.2       2005-07-18 18:17:52.000000000 +0200
+++ man-pages-2.11/man2/path_resolution.2       2005-10-24 13:18:13.000000000 +0200
@@ -185,11 +185,13 @@

 Traditional systems do not use capabilities and root (user ID 0) is
 all-powerful. Such systems are presently (2.6.7) handled by giving root
-all capabilities except for CAP_SETPCAP. More precisely, at exec time
-a process gets all capabilities except CAP_SETPCAP and the five capabilities
+all capabilities except for CAP_SETPCAP. More precisely,
+a process gets all capabilities except CAP_SETPCAP
+and the five capabilities
 CAP_CHOWN, CAP_DAC_OVERRIDE, CAP_DAC_READ_SEARCH, CAP_FOWNER, CAP_FSETID,
-in case it has zero effective UID, and it gets these last five capabilities
-in case it has zero fsuid, while all other processes get no capabilities.
+if its effective UID is 0,
+and it gets these last five capabilities if its fsuid is 0 as well,
+while all other processes get no capabilities.

 The CAP_DAC_OVERRIDE capability overrides all permission checking,
 but will only grant execute permission when at least one
====

The main points of change are the following:

1. Removal of discussion of "exec time".

2. Addition of "as well".

I'll start with point 2.  I'm wrong.  I had it in my mind that 
fsuid could only be made 0 if euid was already 0.  But that isn't
true; setfsuid(x) allows us to turn this (somewhat unusual, but
theoretically possible scenario):

Real Eff Saved FS
0    y   y     y

into this (setfsuid() allows us to set the fsuid to any of the R/E/S 
UID values):

Real Eff Saved FS
0    y   y     0

And indeed the process then has the 5 CAP_FS_MASK capabilities,
in its effective set, but none of the others.

I've removed the words "as well".

On to point 1.

I removed "exec time" because it seems misleading.  As far as I can
tell, exec is not directly relevant, except in as much as we exec
a set-user-ID-root program.  The real point is that effective 
capabilities are dropped as a result of changes to the euid and 
fsuid.  Those can happen because we exec a set-user-ID-root program, 
or via manipulations via seteuid(), setfsuid(), and friends.
As such, that change still seems to me to be correct.  But 
perhaps I have still missed something that you were trying to
say.  If so, let me know.

Cheers,

Michael
2005-10-27 15:33:25 +00:00
Michael Kerrisk 3582e90689 Reworded text around PAGESIZE, noting also that
sysconf(_SC_PAGESIZE) can be used.
2005-10-27 11:14:15 +00:00
Michael Kerrisk ed978af23d Added .\" comment about SHMMNI off-by-one error in kernels 2.4.x-2.6.8. 2005-10-26 11:37:47 +00:00
Michael Kerrisk a749f870a8 s/XXX/FIXME/ 2005-10-26 11:27:52 +00:00
Michael Kerrisk f39637fad6 Minor changes 2005-10-26 11:23:22 +00:00
Michael Kerrisk eb57338fe9 Added (brief) description of SHM_HUGETLB. 2005-10-26 10:31:14 +00:00
Michael Kerrisk 75cad98162 Noted that ss_sp is automatically aligned by the kernel. 2005-10-25 15:35:08 +00:00
Michael Kerrisk b270eba946 Added EINVAL error for rlim_cur > rlim_max when calling setrlimit(). 2005-10-24 15:26:31 +00:00
Michael Kerrisk ab2e1a6c34 Repaired discussion of capabilities and file system UID, which
mistakenly had involved exec() in the discussion.
2005-10-24 11:18:13 +00:00
Michael Kerrisk 6060319831 formattinf fixes 2005-10-24 09:00:36 +00:00
Michael Kerrisk 1e32103455 Formatting fixes 2005-10-20 15:11:10 +00:00
Michael Kerrisk f87925c6bf Formatting fixes 2005-10-19 16:30:05 +00:00
Michael Kerrisk 4d52e8f81c Formatting fixes 2005-10-19 14:54:31 +00:00
Michael Kerrisk b5cc2ffbaa Formatting fixes 2005-10-19 14:48:35 +00:00
Michael Kerrisk 4a225b7a41 Formatting fixes 2005-10-19 14:16:57 +00:00
Michael Kerrisk a68b4927bf Minor wording fix 2005-10-19 13:54:51 +00:00
Michael Kerrisk d3777ff056 Formatting fix 2005-10-19 13:51:36 +00:00
Michael Kerrisk 35e21ba7ca Formatting fixes 2005-10-19 13:48:50 +00:00
Michael Kerrisk 7eda86b16c Updated FIXME 2005-10-19 13:31:49 +00:00
Michael Kerrisk 3382bd94ff Manual fixes of parentheses formatting 2005-10-19 08:35:30 +00:00
Michael Kerrisk e1d6264d9f Manual fixes for parentheses formatting 2005-10-19 07:29:28 +00:00
Michael Kerrisk 63aa9df02f Automated unformatting of parentheses using unformat_parens.sh 2005-10-19 07:07:02 +00:00
Michael Kerrisk e511ffb6bc Automated addition of parentheses by add_parens_for_own_funcs.sh 2005-10-19 06:54:38 +00:00
Michael Kerrisk a7a0588842 Further improvements to recently changed leases text 2005-10-13 09:30:54 +00:00
Michael Kerrisk 1a6d974a99 Since kernel 2.6.10, a read lease can only be placed on a
file descriptor that is opened read-only.
See the following LKML thread of Aug 2005
("fcntl(F GETLEASE) semantics??"):
http://marc.theaimsgroup.com/?l=linux-kernel&m=112371777712197&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=112374818213000&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=112376335305284&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=112377294030092&w=2
2005-10-12 14:54:00 +00:00
Michael Kerrisk 9f8d688afd Added .\" comment pointing out that O_DIRECTORY | O_CREAT causes
O_DIRECTORY to be ignored
2005-10-12 10:35:09 +00:00
Michael Kerrisk 4f76dae069 Added description of MREMAP_FIXED and 'new_address' argument under NOTES.
Revised text of EINVAL error.
2005-10-11 08:24:39 +00:00
Michael Kerrisk 94604cf710 EINVAL can happen with O_DIRECT 2005-10-10 13:07:32 +00:00
Michael Kerrisk f717467217 s/int/size_t/ for type of 'size' argument (fix from Fedora man-pages-2.07-7 2005-10-04 12:39:34 +00:00
Michael Kerrisk f8ad0aeb4b Added new text for ENOMEM 2005-09-21 15:47:18 +00:00
Michael Kerrisk 314df009da fix version in .TH 2005-09-21 06:28:33 +00:00
Michael Kerrisk 9eabf77ada fix typo 2005-09-21 06:28:16 +00:00
Michael Kerrisk 614f40af1d Further reorking of RLIMIT_NICE text.
Noted 2.6.12 change in credentials checking for setpriority().
2005-09-20 17:45:12 +00:00
Michael Kerrisk cedd678ff7 Further reworking of discussion or RLIMIT_NICE and RLIMIT_RTPRIO 2005-09-20 17:43:58 +00:00
Michael Kerrisk 8ba10b3e91 Added cross-reference to setrlimit(2) for discussion on RLIMIT_NICE. 2005-09-20 17:42:39 +00:00
Michael Kerrisk afdee10dbc Further reworking of text on privileges and RLIMIT_RTPRIO 2005-09-20 14:52:34 +00:00
Michael Kerrisk 6151ea9a91 Noted 2.6.12 off-by-one error for RLIMIT_NICE. 2005-09-20 06:52:49 +00:00
Michael Kerrisk 23b1b9bc40 Uncommented text that I wrote earlier that added mention of RLIMIT_NICE
and a cross reference to getrlimit.2 under the description of the EACCES 
error.
2005-09-19 14:57:58 +00:00
Michael Kerrisk a23bf8a396 Uncommented description of RLIMIT_NICE that I wrote earlier 2005-09-19 14:57:05 +00:00
Michael Kerrisk 58d323a7f7 Formatting fix 2005-09-19 12:18:57 +00:00
Michael Kerrisk b327744384 Wording improvements to new dumpable text 2005-09-16 15:36:12 +00:00
Michael Kerrisk c0dc044574 Since kernel 2.6.13 PR_SET_DUMPABLE can also have the value 2. 2005-09-16 14:05:39 +00:00
Michael Kerrisk 1b6145807d fix typo in version number 2005-09-15 12:29:07 +00:00
Michael Kerrisk 1176900f3e formatting fix 2005-09-15 12:06:26 +00:00
Michael Kerrisk 924dca35fe New page created by splitting out from sigaction.2
Added NOTES on usage.
Added new text to DESCRIPTION.
Changed CONFORMING TO.
2005-09-15 11:50:30 +00:00
Michael Kerrisk 7ff599e2ac New page created by splitting out from sigaction.2
Added text on effect of NULL for 'set' argument.
Added text noting effect of ignoring SIGBUS, SIGFPE, SIGILL,
       and SIGSEGV.
Noted that sigprocmask() can't be used in multithreaded process.
Fixed EINVAL error diagnostic.
Changed CONFORMING TO.
2005-09-15 11:48:46 +00:00
Michael Kerrisk bfac9793eb New page created by splitting out from sigaction.2
Changed CONFORMING TO.
2005-09-15 11:48:01 +00:00
Michael Kerrisk 00161f1ba6 Split sigpending(), sigprocmask(), and sigsuspend() out
into separate new pages.

Other minor changes

NOTES: described SA_NODER / sa_mask bug which was present in
                all kernels up to and including 2.6.13.
See http://marc.theaimsgroup.com/?l=linux-kernel&m=112360948603171&w=2
and http://marc.theaimsgroup.com/?l=linux-kernel&m=112362164911432&w=2
List:       linux-kernel
Subject:    Signal handling possibly wrong
From:       Bodo Stroesser
Date:       2005-08-09 17:44:06
2005-09-15 11:47:39 +00:00
Michael Kerrisk b469222561 Added SEE ALSO for sigsuspend.2
Some formatting fixes.
2005-09-15 11:46:02 +00:00
Michael Kerrisk 479377fb38 Updated SEE ALSO to reflect splitting of sigaction.2 into
sigaction.2, sigsuspend.2, sigpending.2, sigprocmask.2
2005-09-15 09:20:05 +00:00
Michael Kerrisk 22b6a68b91 Added text to note that start and size are both rounded downwards. 2005-09-14 13:51:30 +00:00
Michael Kerrisk d2243fd63e Minor change to FIXME 2005-09-14 08:16:03 +00:00
Michael Kerrisk dbc53ca8b2 Noted bug in MAP_POPULATE for kernels before 2.6.7. 2005-09-14 08:15:27 +00:00
Michael Kerrisk ceb6743d1f Added _GNU_SOURCE to prototype.
Rewrote description of MREMAP_MAYMOVE.
Rewrote description of EAGAIN error.
Added discussion of resizing of memory locks.
Added entries to SEE ALSO.
Some formatting fixes.
2005-09-13 10:27:22 +00:00
Michael Kerrisk f55c92c489 Fix small error in description of CLONE_PARENT_SETTID 2005-08-16 15:13:39 +00:00
Michael Kerrisk 96296ef0fa nfds should be prototyped as nfds_t; as per Debian bug 322934
Some wording and formatting improvements.
2005-08-16 08:46:16 +00:00
Michael Kerrisk 8a1dd51447 Added LINUX NOTES on trickery performed by glibc when vector size
exceeds IOV_MAX.
Formatting clean-ups.
2005-08-09 17:32:16 +00:00
Michael Kerrisk 18bc490536 fix typo 2005-08-02 12:12:52 +00:00
Michael Kerrisk 79dded64b7 Added IPC_INFO, SHM_INFO, SHM_STAT descriptions. 2005-08-02 12:09:50 +00:00
Michael Kerrisk 24ed820aca Added IPC_INFO, SEM_INFO, SEM_STAT descriptions. 2005-08-02 12:09:40 +00:00
Michael Kerrisk f302169769 Added IPC_INFO, MSG_INFO, MSG_STAT descriptions. 2005-08-02 12:09:28 +00:00
Michael Kerrisk 5e1f91cfd1 Commented out RLIMIT_NICE text, pending the fix to align
the 2.6.12 mismatch between [gs]etpriority() and RLIMIT_NICE.
See: http://marc.theaimsgroup.com/?l=linux-kernel&m=112256338703880&w=2
2005-07-29 11:44:53 +00:00
Michael Kerrisk 1bf844f164 Added RLIMIT_RTPRIO and RLIMIT_NICE 2005-07-28 14:38:36 +00:00
Michael Kerrisk fd04afa828 Modified discussion of privileges; added mention of RLIMIT_RTPRIO 2005-07-28 14:37:51 +00:00
Michael Kerrisk 0fdbc1eb4a Modified discussion of privileges; added pointer to sched_setscheduler.2 for a discussion of privilegs and resource limits. 2005-07-28 14:36:53 +00:00
Michael Kerrisk 4c11163972 spelling fix 2005-07-28 14:29:14 +00:00
Michael Kerrisk d818502d25 Expanded discussion of relationship between user and kernel
representations of the nice value.
Added mention of RLIMIT_NICE and a cross reference to getrlimit.2 
under the description of the EACCES error.
2005-07-28 13:21:39 +00:00
Michael Kerrisk 7d5b6eb812 Added sentence noting that range of nice value is described in getpriority.2 2005-07-28 12:33:20 +00:00
Michael Kerrisk 7dc020ccf4 Clarified the order of value and port arguments;
As per Debian bug 263756
2005-07-25 11:45:25 +00:00
Michael Kerrisk 998c7b3d5b Add to prototype: define _POSIX_C_SOURCE 199309
As per Debian bug 314435
2005-07-25 11:33:22 +00:00
Michael Kerrisk 6ca594c529 Add EINTR error
See http://lkml.org/lkml/2005/7/12/254
2005-07-25 11:22:58 +00:00
Michael Kerrisk 29de83af2a Fix typo 2005-07-25 09:55:44 +00:00
Michael Kerrisk 331da7c3a0 RFC references are now always writen as "RFC\ nnn" (not "RFC nnn" or
"RFCnnn").
2005-07-20 07:50:45 +00:00
Michael Kerrisk 14ee3bff41 Formatting fixes 2005-07-19 15:38:39 +00:00
Michael Kerrisk a5e0a0e427 Formatting fixes. 2005-07-19 15:36:19 +00:00
Michael Kerrisk 32f3001571 Improve st_blocks description. 2005-07-19 14:20:38 +00:00
Michael Kerrisk 310b79194a Consistent use of st_atime, st_ctime, st_mtime, with explanatory text,
instead if atime/ctime/mtime.
2005-07-19 07:15:17 +00:00
Michael Kerrisk e360c3a9cf s/pid/PID/ 2005-07-19 06:32:54 +00:00
Michael Kerrisk 1aa1268f29 s/super user/superuser/ 2005-07-18 17:13:06 +00:00
Michael Kerrisk 1e568304e5 s/file pointer/file offset/ 2005-07-18 17:10:25 +00:00
Michael Kerrisk d9df8ff80a Consistent use of "saved set-user-ID" and "saved set-group-ID". 2005-07-18 16:55:22 +00:00
Michael Kerrisk b5a5add044 euid-> effective UID 2005-07-18 16:17:52 +00:00
Michael Kerrisk 499d62f2a6 s/\\-ID/ ID/ 2005-07-18 16:13:49 +00:00
Michael Kerrisk c7400a2caf set-(group|user)-ID fixes 2005-07-18 16:09:29 +00:00
Michael Kerrisk 357cf3fe97 id --> ID 2005-07-18 16:02:32 +00:00
Michael Kerrisk e75a454257 gid --> GID 2005-07-18 15:54:49 +00:00
Michael Kerrisk fdc196f51f uid --> UID 2005-07-18 15:51:22 +00:00
Michael Kerrisk b14d4aa5b8 Classical BSD versions are now always named x.yBSD (formerly
there was a mix of x.yBSD and BSD x.y).
2005-07-18 15:05:56 +00:00
Michael Kerrisk 880f5b4bc3 Consistent use of "set-user-ID" and "set-group-ID". 2005-07-18 14:25:42 +00:00
Michael Kerrisk da2d9dad4e Improve st_dev and st_rdev descriptions; other wording and formatting
improvements.
2005-07-18 13:54:59 +00:00
Michael Kerrisk df8a3cac32 hyphen/dash fixes 2005-07-18 12:43:00 +00:00
Michael Kerrisk 9426c9ddbf RLIMIT_RSS ceased to have any effect in 2.4 in kernel 2.4.30.
(It already didn't have any effect in 2.2.x and 2.6.x.)
2005-07-13 13:05:56 +00:00
Michael Kerrisk 9d8b1d5f55 Documented RLIMIT_MSGQUEUE limit.
s/MADVISE_WILLNEED/MADV_WILLNEED/
2005-07-13 12:51:27 +00:00
Michael Kerrisk 3e4d52e15f Added BUG: in some circumstances, a process that is
waiting for a semaphore to become zero is not not woken
up when the value does actually reach zero.
http://marc.theaimsgroup.com/?l=linux-kernel&m=110260821123863&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=110261701025794&w=2
2005-07-12 10:25:16 +00:00
Michael Kerrisk 8c383102d0 hyphen/dash fixes 2005-07-07 08:27:03 +00:00
Michael Kerrisk 2bc2f4798f hyphen/dash fixes 2005-07-06 12:57:38 +00:00
Michael Kerrisk 84d60f7955 s/can can/can/ 2005-07-06 11:23:52 +00:00
Michael Kerrisk fba59d25ec Eliminate consecutive duplicate words 2005-07-06 11:21:27 +00:00
Michael Kerrisk e9496f74fa Hyphen/dash fixes 2005-07-06 06:54:27 +00:00
Michael Kerrisk bed66765fa Formatting fixes 2005-07-06 06:52:35 +00:00
Michael Kerrisk 4c8a01a695 This has never been a 'real' syscall on any Unix. 2005-07-05 15:29:29 +00:00
Michael Kerrisk 8c45053412 s/the the/the/ 2005-07-05 13:50:51 +00:00
Michael Kerrisk b97a922231 s/positive/non-negative/ [file descriptor] 2005-07-04 06:47:34 +00:00
Michael Kerrisk 4041a5abf1 Von: "Michael Kerrisk" <mtk-manpages@gmx.net>
An: Olivier Croquette <ocroquette@free.fr>
Betreff: Re: 2.6.12 and setitimer
Datum: Mon, 4 Jul 2005 08:36:35 +0200 (MEST)

Hi Olivier,

> You will probably consider adding also a note to point out that the bug 
> will stay a known bug of the 2.4 serie:
> 
> http://lkml.org/lkml/2005/7/1/165

First off, I _very_ much appreciate the fact that you keep 
informing me of the progress of this bug!  Thank you.

At the moment, I'm inlined yo leave the manual page as it is.
It currently reads:

       On certain systems (including x86), Linux ker&#8208;
       nels  before  version  2.6.12 have a bug which
       will produce premature timer expirations of up
       to  one  jiffy under some circumstances.  This
       bug is fixed in kernel 2.6.12.

To me that implies that the bug also affects kernels before 
2.4 -- e.g., 2.4.x.  Now, what would be interesting is if the
bug *does* get fixed in 2.4, then I could also add a note 
about the 2.4.x version where it is fixed.

In the meantime, I have added a note to myself (i.e., a comment
in the man page source) about this point.

If the bug *does* eventually get fixed in 2.4.x, and you 
hear of it, please do let me know.

Thanks,

Michael
2005-07-04 06:44:50 +00:00
Michael Kerrisk 3e6b03a02b Renamed 's' arg to 'sockfd' 2005-06-30 10:32:41 +00:00
Michael Kerrisk 44d4d09df6 Various wording and formatting fixes. 2005-06-30 10:29:56 +00:00
Michael Kerrisk ae1a9ff438 Various wording and formatting fixes. 2005-06-30 10:16:11 +00:00
Michael Kerrisk 884dda7b87 Removed historic comment on BSD backlog ceiling.
Minor formatting changes.
2005-06-30 09:44:14 +00:00
Michael Kerrisk 85a3dc20db Added SEE ALSO for shutdown(2) 2005-06-30 09:40:35 +00:00
Michael Kerrisk a089ce72bb Minor formatting changes 2005-06-30 09:36:24 +00:00
Michael Kerrisk 0680fbb0e8 Various minor wording changes 2005-06-30 09:31:55 +00:00
Michael Kerrisk 0e5b601a02 Added getaddrinfo(3) to SEE ALSO 2005-06-30 09:31:11 +00:00
Michael Kerrisk edcc65ff8a Various minor wording improvements; some formatting fixes 2005-06-30 08:58:03 +00:00
Michael Kerrisk d1fd6d3d74 Added mkdir(2) to discussion, made term "file mode creation mask" clearer.
Various, mostly small, wording changes
2005-06-30 08:07:33 +00:00
Michael Kerrisk a6a99a4c8c wording fix 2005-06-29 09:19:41 +00:00
Michael Kerrisk 2c4bff3681 Various further wording changes related to open file description, etc. 2005-06-27 15:35:32 +00:00
Michael Kerrisk 0847872439 Minor wording changes 2005-06-27 14:42:40 +00:00
Michael Kerrisk cb1a9e12d2 one word change 2005-06-27 14:42:14 +00:00
Michael Kerrisk 98740ac7a7 Formatting changes 2005-06-24 10:53:06 +00:00
Michael Kerrisk 94dd7e3bd7 White space fix 2005-06-23 15:27:41 +00:00
Michael Kerrisk 2985d7dd81 Slight rewording 2005-06-23 15:27:21 +00:00
Michael Kerrisk 9e16036151 Remove confusing text describe real and effective IDs.
As per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=285852
2005-06-23 14:56:40 +00:00
Michael Kerrisk fefaf5f952 whitespace cleanups 2005-06-23 13:40:38 +00:00
Michael Kerrisk 7f185ad2cb Noted that the nice value rande is -20..20 on some systems 2005-06-23 13:36:09 +00:00
Michael Kerrisk ee6573b952 Changed range documented in main text from -20..20 to -20..19. 2005-06-23 13:33:14 +00:00
Michael Kerrisk 24b1a0121f Added .\" comment about behaviour change for
length == 0 in kernel 2.6.12.
2005-06-23 12:11:22 +00:00
Michael Kerrisk 18f2ce4067 Reversed 2.04 introduction of the term "process termination function". 2005-06-23 09:45:21 +00:00
Michael Kerrisk 7704d9671e The short sleep bug (up to 1 jiffy) that was newly noted in
man-pages-2.04 has just been fixed in 2.6.12.
2005-06-23 07:16:55 +00:00
Michael Kerrisk 72da38ce1d Minor wording changes 2005-06-22 10:59:21 +00:00
Michael Kerrisk 1864073923 Added FIXME 2005-06-22 10:56:11 +00:00
Michael Kerrisk 082aa7841d Clarified what type of lock close() affects.
Minor formatting changes.
2005-06-22 10:49:19 +00:00
Michael Kerrisk cff88e99ab Consistent use of terms "open file description",
"file status flags", and "file decriptor flags"
Some rewriting of discussion of file descriptor flags
Under F_DUPFD, replaced some text duplicated in dup.2 with a cross ref to dup.2
Minor wording and formatting fixes
2005-06-22 09:53:58 +00:00
Michael Kerrisk 0a5a85eb64 Consistent use of terms "open file description",
"file status flags", and "file decriptor flags"
Removed mention of lock sharing -- it was not accurate.
Minor formatting fixes
2005-06-22 09:53:00 +00:00
Michael Kerrisk e366dbc4fb Clarification of term "open file description" along with
explanation of what information it maintains.
Various minor wording changes
2005-06-22 09:52:33 +00:00
Michael Kerrisk 5ae873ff97 Formatting changes 2005-06-22 08:16:22 +00:00
Michael Kerrisk 42eda4aea7 Minor wording changes (after email with AEB). 2005-06-22 06:52:22 +00:00
Michael Kerrisk d04e1109b9 Clarified semantics of relationship between flock() locks
and open file entries and file descriptors.
See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=291121
2005-06-21 14:43:56 +00:00
Michael Kerrisk fb654466a6 Minor changes 2005-06-21 13:50:30 +00:00
Michael Kerrisk 1f6ceb400b O_DIRECT needs _GNU_SOURCE.
O_ASYNC works for pipes and FIFOs in Linux 2.6
Vaious minor fixes
2005-06-21 10:04:56 +00:00
Michael Kerrisk dd61d68cc4 Since Linux 2.6, the ru_nvcsw and ru_nivcsw fields are used. 2005-06-20 08:58:09 +00:00
Michael Kerrisk 019934ed21 BUGS: In kernels < 2.6.9, EPOLL_CTL_DEL required a non-NULL
'event', even though this argument is ignored.
As per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=306517.
2005-06-17 11:33:07 +00:00
Michael Kerrisk 2a01941630 Rewrote description of return value.
As per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=296183
2005-06-16 15:07:57 +00:00
Michael Kerrisk adb036712f removed fixed FIXMEs 2005-06-16 10:35:03 +00:00
Michael Kerrisk 4a3f7c5fbc formatting 2005-06-16 10:32:30 +00:00
Michael Kerrisk 8729177b44 global edit s/ -1/ \\-1/g 2005-06-15 14:10:23 +00:00
Michael Kerrisk f59a3f1941 Global edit: s/nonzero/non-zero/ 2005-06-15 13:32:34 +00:00
Michael Kerrisk 2e0eee5451 RLIMIT_RSS only has affect "in 2.4.x", not "in 2.4 and later". 2005-06-15 11:35:49 +00:00
Michael Kerrisk 7b57506d6d Various minor changes 2005-06-14 11:20:57 +00:00
Michael Kerrisk c13fcab060 Salut Olivier (and Nishanth),
Regarding man page documentation of the problem of short sleeps 
for setiteimer(2)...

> > -- pointers to those threads
> 
> http://bugzilla.kernel.org/show_bug.cgi?id=4569
> http://lkml.org/lkml/2005/4/29/163
> 
> > -- indications of which kernel versions show this bahaviour
> 
> AFAIK, all versions as far as x86 is concerned.
> Dunno if it is hardware specific.
> 
> > -- a (short) test program to demonstrate it, if you have one.
> 
> See the bugzilla bug's attachments

Sorry for the long delay in following this up, but I've got to 
it now.  I tweaked your suggestions slightly:

{{
Timers will never expire before the requested time,
-instead expiring some short, constant time afterwards, dependent
-on the system timer resolution (currently 10ms).  
+but may expire some (short) time afterwards, which depends
+on the system timer resolution and on the system load.
+Upon expiration, a signal will be generated and the timer reset.
+If the timer expires while the process is active (always true for

+On certain systems (including x86), the Linux kernel has a bug which will
+produce premature timer expirations of up to one jiffy under some
+circumstances.
}}

Thanks for this bug reporet,

Nishanth: if and when your changes are accepted, and the problem 
is thus fixed, could you please send me a notification of that
fact, and I can then further amend the manual pages.

Cheers,

Michael



/* itimer_short_interval_bug.c 

   June 2005

   In current Linux kernels, an interval timer set using setitimer() 
   can sometimes sleep *less* than the specified interval.
   This program demonstrates the behaviour by looping through all
   itimer values from 1 microsecond upwards, in one microsecond steps.
*/
/* Adapted from a program by Olivier Croquette, June 2005 */

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/wait.h>



typedef unsigned long long int u_time_t; /* in microsecs */

static int handler_flag;

/* return time as a number of microsecs  */

static u_time_t 
gettime(void ) 
{
    struct timeval tv;

    if ( gettimeofday(&tv, NULL) == -1) {
        perror("gettimeofday()");
        return 0;
    }
    return (tv.tv_usec + tv.tv_sec * 1000000LL);
}


static void 
handler (int sig, siginfo_t *siginfo, void *context) 
{
    handler_flag++;
    return ;
}


/* Sleep for 'time' microsecs. */
static int 
isleep(u_time_t time) 
{
    struct itimerval  newtv;
    sigset_t sigset;
    struct sigaction  sigact;

    if (time == 0)
        return 0;

    /* block SIGALRM */
    sigemptyset (&sigset);
    sigaddset (&sigset, SIGALRM);
    sigprocmask (SIG_BLOCK, &sigset, NULL);

    /* set up our handler */
    sigact.sa_sigaction  = handler;
    sigemptyset(&sigact.sa_mask);
    sigact.sa_flags = SA_SIGINFO;
    sigaction (SIGALRM, &sigact, NULL);
 
    newtv.it_interval.tv_sec  = 0;
    newtv.it_interval.tv_usec = 0;
    newtv.it_value.tv_sec     = time / 1000000;
    newtv.it_value.tv_usec    = time % 1000000;
    if (setitimer(ITIMER_REAL,&newtv,NULL) == -1) {
        perror("setitimer(set)");
        return 1;
    }

    sigemptyset (&sigset);
    sigsuspend (&sigset);
    return 0;
}


int 
main(int argc, char *argv[]) {
    u_time_t wait;
    int loop, numLoops;
    u_time_t t1, t2;
    u_time_t actual;
    long long minDiff, maxDiff, totDiff, diff;
    int numFail = 0;

    if (argc != 2) {
	fprintf(stderr, "Usage: %s num-loops\n", argv[0]);
	exit(EXIT_FAILURE);
    } /* if */

    numLoops = atoi(argv[1]);
    setbuf(stdout, NULL);

    for (wait = 1; ; wait++) {
	maxDiff = 0;
	numFail = 0;
	totDiff = 0;
	minDiff = -wait;

        if (wait % 10000 == 0)
	    printf("%llu\n", wait);
        
	for (loop = 0; loop < numLoops; loop++) {
            t1 = gettime();

            handler_flag = 0;
            isleep(wait);
	    
	    if ( handler_flag != 1 ) 
                printf("Problem with the handler flag (%d)!\n", handler_flag);
    
            t2 = gettime();
            actual = t2 - t1;
            if ( actual < wait ) {
	        diff = actual - wait;
		if (diff < maxDiff)
		    maxDiff = diff;
		if (diff > minDiff)
		    minDiff = diff;
		totDiff += diff;
		numFail++;
	    } /* if */

        } /* for */
	if (numFail > 0) 
            printf("%llu: %3d fail (%4lld %4lld; avg=%6.1f)\n", 
		    wait, numFail, minDiff, maxDiff, 
		    (double) totDiff / numFail);
    } /* for */

    return 0;
} /* main */
2005-06-13 09:01:49 +00:00
Michael Kerrisk 561aa928db Remove duplicated CLONE_VFORK text 2005-06-13 06:09:43 +00:00
Michael Kerrisk 6e2d1c54dd Formatting fix 2005-06-09 07:12:30 +00:00
Michael Kerrisk 3616b7c0cf New pthreads.7 page 2005-06-07 12:35:32 +00:00
Michael Kerrisk de7639e575 Updated copyright date 2005-06-02 12:52:15 +00:00
Michael Kerrisk f7110f6014 Noted that any thread in a thread group can wait for a child
that one of them creates using fork().
2005-06-02 10:22:34 +00:00
Michael Kerrisk 6aacaf94e5 Hi Andries,
> The question came up whether execve of a suid binary while being ptraced
> would fail or ignore the suid part. The answer today seems to be the
> latter:
> 
> E.g. (in 2.6.11) security/dummy.c:
> 
> static void dummy_bprm_apply_creds (struct linux_binprm *bprm, int 
> unsafe)
> {
>         if (bprm->e_uid != current->uid || bprm->e_gid != current->gid) {
>                 if ((unsafe & ~LSM_UNSAFE_PTRACE_CAP) &&
> !capable(CAP_SETUID)) {
>                         bprm->e_uid = current->uid;
>                         bprm->e_gid = current->gid;
>                 }
>         }
> }
> 
> and fs/exec.c:
> 
> void compute_creds(struct linux_binprm *bprm) {
>         int unsafe;
> 
>         unsafe = unsafe_exec(current);
>         security_bprm_apply_creds(bprm, unsafe);
> }
> 
> static inline int unsafe_exec(struct task_struct *p) {
>         int unsafe = 0;
>         if (p->ptrace & PT_PTRACED) {
>                 if (p->ptrace & PT_PTRACE_CAP)
>                         unsafe |= LSM_UNSAFE_PTRACE_CAP;
>                 else
>                         unsafe |= LSM_UNSAFE_PTRACE;
>         }
>         return unsafe;
> }
> 
> That is: if the process that calls execve() is being traced,
> the LSM_UNSAFE_PTRACE bit is et in unsafe and security_bprm_apply_creds()
> will make sure the suid/sgid bits are ignored.
> 
> ---
> 
> In my man page I do not read anything like that. It says
> 
>  EPERM  The process is being traced, the user is not the  superuser and
>         the file has an SUID or SGID bit set.
> and
> 
>  If  the current program is being ptraced, a SIGTRAP is sent to it after
>  a successful execve().
> 
>  If the set-uid bit is set on the program file pointed  to  by filename
>  the  effective user ID of the calling process is changed to that of the
>  owner of the program file.
> 
> So, maybe this sentence should be amended to read
> 
>  If the set-uid bit is set on the program file pointed  to  by filename
>  and the current process is not being ptraced, the  effective user ID
>  of the calling process is changed to ...

I changed your "current" to "calling" (to be consistent with the 
rest of the page), but otherwise applied as you suggest.

The revision will appear in man-pages-2.03, which I can release
any time now.  Are you avialable to do an upload tomorrow?
2005-05-31 16:07:24 +00:00
Michael Kerrisk 5e4e13a313 SEE ALSO s/threads/pthreads 2005-05-30 16:47:35 +00:00
Michael Kerrisk 2202881e83 Noted changes in permissions required for SHM_LOCK/SHM_UNLOCK. 2005-05-30 11:58:06 +00:00
Michael Kerrisk 9d2a7b1f62 Noted F_SETOWN bug for socket file descriptor in Linux 2.4 and earlier.
Added text on permissions required to send signal to owner.

====

Hello Johannes,

> Betreff: Inaccuracy of fcntl man page
> Datum: Mon, 2 May 2005 20:07:12 +0200

Thanks for yor note.

Sorry for the delay in getting back to you.  I needed to find time 
to set aside to look at the details.  Now I've finally got there.

> I have attached a simple program 

Thanks -- a little program is always helpful.

> that uses the fcntl system call in order
> to kill an arbitrary process of the same user.
> According to the fcntl man page, fcntl(fd,F_SETOWN,pid) returns zero if 
> it has success.

Yes.

> If you strace the program while killing for exampe man running in another 
> terminal, you will see that man is killed, but fcntl(fd,F_SETOWN,pid)
> will return EPERM, 

I confirm that I see this problem in 2.4, with both Unix domain 
and Internet domain sockets.

> where you can only find a very confusing explanation 
> in the fcntl man page.

I'm not sure what explanation you mean here.  As far as I can 
tell, the manual page just doesn't cover this point.

> I have looked into the kernel source of 2.4.30 and found out, that 
> net/core/socket::sock_no_fcntl is the culprit if you use fcntl on Unix 
> sockets.

Yes, looks that way to me, as well,  And the 2.2 code looks 
similar.

> If pid is not your own pid or not your own process group, 
> the system call will return EPERM but will also set the pid 
> as you wanted to.

Yes.

> In the 2.6 kernel line, fcntl will react according the specification in
> the manual page.

Yes.

> If you also think, that one should clarify the return specification of 
> fcntl(fd,F_SETOWN,pid) or 2.4.x kernels, please tell me and I will 
> provide you with a patch for the manual page.

In fact I've written some new text under BUGS, which describes
the problem:

  In Linux 2.4 and earlier, there is bug that can occur  when  an
  unprivileged  process  uses  F_SETOWN to specify the owner of a
  socket file descriptor as a  process  (group)  other  than  the
  caller.   In this case, fcntl() can return -1 with errno set to
  EPERM, even when the owner process  (group)  is  one  that  the
  caller  has  permission to send signals to.  Despite this error
  return, the file descriptor owner is set, and signals  will  be
  sent to the owner.

Does that seem okay to you?

> Furthermore, it would be interseting to write there, what permissions 
> one need in order to send signals to processes via fcntl 

Good idea.  I added the following new text:

  Sending a signal to  the  owner  process  (group)  specified  by
  F_SETOWN  is  subject  to  the  same  permissions  checks as are
  described for kill(2), where the sending process is the one that
  employs F_SETOWN (but see BUGS below).

====


#define _GNU_SOURCE		/* needed to get the defines */
#include <fcntl.h>		/* in glibc 2.2 this has the needed
				   values defined */
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>


/**
 * Funnykill kills a program with fcntl
**/
int
main (int argc, char **argv)
{
  if (argc != 2)
    {
      fprintf (stderr, "Usage: funnykill <pid>\n");
      return 1;
    }

  int sockets[2];
  socketpair (AF_UNIX, SOCK_STREAM, 0, sockets);
  if (fcntl (sockets[0], F_SETFL, O_ASYNC | O_NONBLOCK) == -1) 
      errMsg("fcntl-F_SETFL");
  if (fcntl (sockets[0], F_SETOWN, atoi (argv[1])) == -1) 
      errMsg("fcntl-F_SETOWN");
//  fcntl (sockets[0], F_SETOWN, getpid());
  if (fcntl (sockets[0], F_SETSIG, SIGKILL) == -1) 
      errMsg("fcntl-_FSETSIG");
  write (sockets[1], "good bye", 9);
}
2005-05-20 12:11:25 +00:00
Michael Kerrisk 80ca8aba1d Added EAGAIN error description for umount2(). 2005-05-18 14:42:07 +00:00
Michael Kerrisk 8df37e4d66 Added MNT_EXPIRE, plus a few other tidy-ups. 2005-05-18 14:34:43 +00:00
Michael Kerrisk 6e5a730913 Added comment:
.\" For Unix domain sockets and regular files, EPERM is only returned in
.\" Linux 2.2 and earlier; in Linux 2.4 and later, unprivileged can
.\" use mknod() to make these files.
2005-05-18 09:39:52 +00:00
Michael Kerrisk 99408a60ee Minor fixes to CLONE_THREAD material. 2005-05-18 08:29:38 +00:00
Michael Kerrisk e2fbf61d5a Added text on CLONE_THREAD and signals. 2005-05-17 16:21:20 +00:00
Michael Kerrisk fd8a5be48e Substantially enhanced discussion of CLONE_THREAD. 2005-05-17 15:06:30 +00:00
Michael Kerrisk 948fb4ed37 __W* flags can't be used with waitid() 2005-05-10 17:16:28 +00:00
Michael Kerrisk a69b6bda71 Added CLONE_SYSVSEM, CLONE_UNTRACED, CLONE_STOPPED. 2005-05-10 16:48:27 +00:00
Michael Kerrisk 6a916f1c28 Noted that lock conversions are not atomic. 2005-05-10 06:43:47 +00:00
Michael Kerrisk 2d93f55ce7 Added FIXME (capabilities are per-thread) 2005-05-03 14:27:04 +00:00
Michael Kerrisk d2b761645c Added a NOTE to point out that the affinity mask is actually a
per-thread attribute that can be adjusted independently
for each thread in a thread group.
2005-05-03 14:24:08 +00:00
Michael Kerrisk 6fbc0235a6 Add text to note that sched_setaffinity() will migrate the
affected process to one of the specified CPUs if necessary.
2005-05-03 11:24:33 +00:00
Michael Kerrisk 75ced2e8a3 Noted aberrant Linux behaviour w.r.t. new
attaches to a segment that has already been marked for deletion.
2005-04-25 08:36:43 +00:00
Michael Kerrisk dde7d1a947 Typos/grammar fixes. 2005-04-25 07:08:00 +00:00
Michael Kerrisk cbc84c6e74 Fix typo 2005-04-19 10:58:30 +00:00
Michael Kerrisk 30e6794a25 Clarified wording of the 'pid == -1' case. 2005-04-19 10:53:55 +00:00
Michael Kerrisk 79e860131f ru_nswap has never contained useful information.
Kernel 2.6.6 clarified that with a patch
("[PATCH] eliminate nswap and cnswap").  See also:
http://www.ussg.iu.edu/hypermail/linux/kernel/0404.1/0720.html
2005-04-19 09:02:05 +00:00
Michael Kerrisk d301ee6c72 Fix typos and spelling mistakes 2005-04-18 14:25:45 +00:00
Michael Kerrisk 704a18f06d Fixed typos and spelling mistakes 2005-04-18 13:35:29 +00:00
Michael Kerrisk 7502db97e2 Fix typo in 2.02 release 2005-04-14 09:24:26 +00:00
Michael Kerrisk 7c088cb1d8 Date: Fri, 28 Jan 2005 11:00:59 +0000
From: Jamie Lokier <jamie@shareable.org>
To: mtk-manpages@gmx.net
Subject: Update to fcntl(2) man page

Hi Michael,

I have a correction to the fcntl(2) man page.

Under the section for F_SETOWN, which describes how to set the
recipient process or group for SIGIO signals, see this paragraph:

	The process or process  group  to  receive  the  signal  can  be
	selected  by  using  the F_SETOWN command to the fcntl function.
	If the file descriptor is a socket, this also selects the recip-
	ient  of SIGURG signals that are delivered when out-of-band data
	arrives on that socket.  (SIGURG is sent in any situation  where
	select(2) would report the socket as having an "exceptional con-
	dition".)  If the file  descriptor  corresponds  to  a  terminal
	device,  then  SIGIO  signals are sent to the foreground process
	group of the terminal.

I would like to add an additional paragraph:

	The value given to F_SETOWN has a slightly different meaning
	when F_SETSIG is used in a multi-threaded process.

	If a non-zero value is given to F_SETSIG, then a positive
	value given to F_SETOWN identifies a specific thread within a
	process, instead of a whole process.  The value is a thread id
	not a process id, so you may need to pass the result of
	gettid() instead of getpid() to get sensible results when
	F_SETSIG is used.  (Thread ids are different from process ids,
	although they have the same value for some threads depending
	on details of the threading library used).

Also, this is the first paragraph of the F_SETSIG section:

	Sets the signal sent when input or output becomes  possible.   A
	value of zero means to send the default SIGIO signal.  Any other
	value (including SIGIO) is the signal to send  instead,  and  in
	this  case additional info is available to the signal handler if
	installed with SA_SIGINFO.

I'd like to append another paragraph right after that one:

	Additionally, passing a non-zero value to F_SETSIG changes the
	signal recipient from a whole process to a specific thread
	within a process.  The section on F_SETOWN gives more details.


Date: Thu, 7 Apr 2005 17:58:59 +0100
From: Jamie Lokier <jamie@shareable.org>
To: Michael Kerrisk <mtk-manpages@gmx.net>
Subject: Re: Update to fcntl(2) man page

[[...]]

> I've been trying to follow the kernel source code to verify
> the details you describe above.  The relevant place is the 
> 'switch' in fs/fcntl.c::send_sigio_to_task() right?

Yes.

> Also, for NPTL, perhaps one needs to mention that for the main
> thread, gettid() == getpid(), which allows the traditional
> use of F_SETSIG / F_SETOWN in programs consisting of a single
> thread -- right?

Yes, that makes sense.  It's also fine for the "main thread" with
NPTL, so programs which spawn threads can still use F_SETOWN/F_SETSIG
in the main thread using getpid().


Date: Tue, 12 Apr 2005 15:25:49 +0100
From: Jamie Lokier <jamie@shareable.org>
To: Michael Kerrisk <mtk-manpages@gmx.net>
Subject: Re: Update to fcntl(2) man page

Michael Kerrisk wrote:
>   F_SETOWN
>          Set  the  process ID or process group ID that will
>          receive SIGIO and SIGURG  signals  for  events  on
>          file  descriptor fd.  A process ID is specified as
>          a positive value; a process group ID is  specified
>          as a negative value.
> 
>          If  you  set  the  O_ASYNC  status  flag on a file
>          descriptor (either by providing this flag with the
>          open(2)  call,  or by using the F_SETFL command of
>          fcntl), a SIGIO signal is sent whenever  input  or
>          output  becomes  possible on that file descriptor.
>          F_SETSIG can be used to obtain delivery of a  sig&#8208;
>          nal other than SIGIO.
> 
>          If  the  file  descriptor  fd  refers to a socket,
>          F_SETOWN also selects the recipient of SIGURG sig&#8208;
>          nals  that  are  delivered  when  out-of-band data
>          arrives on that socket.  (SIGURG is  sent  in  any
>          situation  where select(2) would report the socket
>          as having an "exceptional condition".)
> 
>          If a non-zero value is  given  to  F_SETSIG  in  a
>          multi-threaded  process,  then  a  positive  value
>          value given to F_SETOWN has a  different  meaning:
>          instead  of being a process ID identifying a whole
>          process, it is a thread ID identifying a  specific
>          thread  within a process.  Consequently, it may be
>          necessary to pass F_SETOWN the result of  gettid()
>          instead  of  getpid() to get sensible results when
>          F_SETSIG is used.   (In  current  Linux  threading
>          implementations,  a main thread's thread ID is the
>          same as its process ID.  This means that a single-
>          threaded  program can equally use gettid() or get&#8208;
>          pid() in this scenario.)  Note, however, that  the
>          statements  in  this paragraph do not apply to the
>          SIGURG signal generated for out-of-band data on  a
>          socket:  this  signal  is  always sent to either a
>          process or a process group, depending on the value
>          given to F_SETOWN.
> 
> And the first part of the description of F_SETSIG now reads:
> 
>   F_SETSIG
>          Sets the signal sent when input or output  becomes
>          possible.   A  value  of  zero  means  to send the
>          default SIGIO signal.  Any other value  (including
>          SIGIO)  is the signal to send instead, and in this
>          case additional info is available  to  the  signal
>          handler if installed with SA_SIGINFO.
> 
>          Additionally, passing a non-zero value to F_SETSIG
>          changes the signal recipient from a whole  process
>          to  a  specific  thread within a process.  See the
>          desciption of F_SETOWN for more details.
> 
> Does the above seem okay to you?

It looks good, but: 

  1. An omission: It mentions that SIGURG is always sent to the whole
     process.  SIGIO is also sent to the whole process, instead of
     queueing a thread-specific signal, when the signal queue is full.
     Programs that mustn't miss readiness events need to handle it.

  2. The description could be confusing to LinuxThreads users, because
     all the signals are thread-specific in LinuxThreads.


Date: Tue, 12 Apr 2005 16:53:19 +0100
From: Jamie Lokier <jamie@shareable.org>
To: Michael Kerrisk <mtk-manpages@gmx.net>
Subject: Re: Update to fcntl(2) man page

Michael Kerrisk wrote:
> >   1. An omission: It mentions that SIGURG is always sent to the whole
> >      process.  SIGIO is also sent to the whole process, instead of
> >      queueing a thread-specific signal, when the signal queue is full.
> >      Programs that mustn't miss readiness events need to handle it.
> 
> Sorry -- can you point me to the relevant code for the 
> above point please.

In 2.6:

	switch (fown->signum) {
		siginfo_t si;
		default:
			/* Queue a rt signal with the appropriate fd as its
			   value.  We use SI_SIGIO as the source, not 
			   SI_KERNEL, since kernel signals always get 
			   delivered even if we can't queue.  Failure to
			   queue in this case _should_ be reported; we fall
			   back to SIGIO in that case. --sct */
			si.si_signo = fown->signum;
			si.si_errno = 0;
		        si.si_code  = reason;
			/* Make sure we are called with one of the POLL_*
			   reasons, otherwise we could leak kernel stack into
			   userspace.  */
			if ((reason & __SI_MASK) != __SI_POLL)
				BUG();
			if (reason - POLL_IN >= NSIGPOLL)
				si.si_band  = ~0L;
			else
				si.si_band = band_table[reason - POLL_IN];
			si.si_fd    = fd;
			if (!send_sig_info(fown->signum, &si, p))
				break;
		/* fall-through: fall back on the old plain SIGIO signal */
		case 0:
			send_group_sig_info(SIGIO, SEND_SIG_PRIV, p);

2.4 is exactly the same, except:

		/* fall-through: fall back on the old plain SIGIO signal */
		case 0:
			send_sig(SIGIO, p, 1);

The fall-through happens when send_sig_info() fails, which happens
when the real-time signal queue is full.

Programs using a queued signal to track file readiness efficiently (as
an alternative to select/poll), must listen for SIGIO in addition to
the real-time signal, as otherwise they will miss notifications when
the queue is full (which happens often on a busy server).

Multi-threaded programs using NPTL must be aware this SIGIO is
process-wide - so receiving it on one thread must cause all threads to
assume a queued signal may be lost.  Programs using LinuxThreads do
not have to assume this (but it's safe if they do).


Date: Wed, 13 Apr 2005 17:25:44 +0100
From: Jamie Lokier <jamie@shareable.org>
To: Michael Kerrisk <mtk-manpages@gmx.net>
Subject: Re: Update to fcntl(2) man page

Michael Kerrisk wrote:
> I added a few more sentences to the end of that paragraph
> on F_SETOWN:
> 
>     If a non-zero value is given  to  F_SETSIG  in  a multi-threaded
>     process  running with  a threading  library that supports thread
>     groups (e.g., NPTL),  then  a  positive  value  value  given to
>     F_SETOWN has a different meaning: instead  of being a process ID
>     identifying a whole  process, it is a  thread  ID identifying  a
>     specific thread  within a process.  Consequently, it may be nec-
>     essary to pass  F_SETOWN the result of gettid() instead  of  get
>     pid() to  get sensible results  when F_SETSIG is used.  (In cur-
>     rent Linux threading implementations, a main thread's thread  ID
>     is  the  same  as  its  process  ID.   This means that a single-
>     threaded program can equally use gettid() or  getpid()  in  this
>     scenario.)  Note, however, that the statements in this paragraph
>     do not apply to the SIGURG signal generated for out-of-band data
>     on a socket: this signal is always sent to either a process or a
>     process group, depending on the value given to  F_SETOWN.   Note
>     also  that Linux imposes a limit on the number of real-time sig-
>     nals that may be queued to a process (see getrlimit(2) and  sig-
>     nal(7)) and if this limit is reached, then the kernel reverts to
>     delivering SIGIO, and  this  signal is  delivered to the  entire 
>     process rather than to a specifc thread.
> 
> Look oay now?

Looks ood.

It will take a minor genius to translate that to working
multi-threaded RT-SIGIO code without a tutorial -- and in fact I
haven't heard of any program or library which does it (though I'm
trying to write one) -- but technically it seems to include everything.
2005-04-05 05:54:09 +00:00
Michael Kerrisk b6ac53546a Added notes on non-standard behaviour: Linux allows 'buf' to
be NULL, but POSIX.1 doesn't specify this and it's non-portable.
2005-04-04 15:34:13 +00:00
Michael Kerrisk 31830ef083 Noted the PID caching behaviour of NPTL's getpid() wrapper under BUGS. 2005-04-12 08:11:06 +00:00
Michael Kerrisk f2d0bbf129 Added set_thread_area(2), tkill (2) under SEE ALSO 2005-04-11 15:10:47 +00:00
Michael Kerrisk f21a10c814 Noted kernel version where posix_fadvise() appeared and
noted bug in handling of 'len' in kernels < 2.6.6.
2005-04-11 15:04:27 +00:00
Michael Kerrisk 2b44301c2a Added futex(2) and set_tid_address(2) to SEE ALSO 2005-04-11 15:03:38 +00:00
Michael Kerrisk 2f36a80706 Jamie Lokier / mtk
Improved discussion of F_SETOWN and F_SETSIG with respect to
multi-threaded programs.

Generally cleaned up the discussion of F_SETOWN.
2005-04-08 13:42:00 +00:00
Michael Kerrisk 055fd5fae5 Noted kernel version numbers for semtimedop() 2005-04-08 06:19:20 +00:00
Michael Kerrisk fcad9022d3 Matthias Lang, mtk
Noted MAX_SEC_IN_JIFFIES ceiling.
Added note about treatment of out-of-range tv_usec values.
2005-04-06 15:29:32 +00:00
Michael Kerrisk 2a44706019 More clean-up of ERRORS after further communication with Gordon Jin. 2005-04-06 12:59:19 +00:00
Michael Kerrisk 6e01dc7e8d Fixed EINVAL description after mesage from
"Jin, Gordon" <gordon.jin@intel.com>
2005-04-05 17:01:47 +00:00
Michael Kerrisk e8de013ac1 More changes from Marko Kohtala <marko.kohtala@gmail.com> 2005-04-05 12:49:00 +00:00
Michael Kerrisk 490df3ae03 Noted discrepancy between Linux and POSIX.1 when oldpath is a symbolic
link.
2005-04-04 16:54:25 +00:00
Michael Kerrisk 3d9a2200a6 Improved various error descriptions after message from
Marko Kohtala <marko.kohtala@gmail.com>.
2005-04-04 16:33:48 +00:00
Michael Kerrisk 2d5d4b0dd0 Clarified description of EXDEV error with respect to
file system mounted at multiple points, as per rename.2
patch from Michael Haardt <michael@moria.de>.
2005-04-04 14:14:02 +00:00
Michael Kerrisk 1dba3c20aa Patch from AEB: improved DESCRIPTION; clarified distinction between
EACCES and ENOEXEC.
2005-04-04 13:10:49 +00:00
Michael Kerrisk 9fe9d301af mmap() improvements from Martin Pool 2005-03-31 14:42:09 +00:00
Michael Kerrisk 042d7c1b37 Added sigqueue(2) to SEE ALSO 2005-03-31 14:27:35 +00:00
Michael Kerrisk e17d909d2b Typo fix: s/joey@infodeom.org/joey@infodrom.org/ 2005-03-31 14:12:28 +00:00
Michael Kerrisk c1f2160361 Removed SVr2, AT&T, and BSD from CONFORMING TO, since
a pipe on those systems is actually bidirectional
(Pipes are implemented as STREAMS on the former, and
sockets on the latter.)
2005-03-31 14:08:14 +00:00
Michael Kerrisk c5a2d222f8 Added EINTR error 2005-03-31 13:41:40 +00:00
Michael Kerrisk b7d1c64591 Fixed typo as per msg from Michael Mühlebach <michael@anduin.ch> 2005-03-31 12:59:18 +00:00
Michael Kerrisk cca657e227 triggered by http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=283179
The wording describing how errno is set was tidied up in a number of
pages.
2004-12-20 12:24:06 +00:00
Michael Kerrisk d3018c3c5e "from a socket" --> "on a socket" 2004-12-20 10:53:41 +00:00
Michael Kerrisk cf257cc501 Adjusted descriptors of argument file tyypes to be closer to
2.6 reality.
Wording and formatting changes
2004-12-17 15:27:42 +00:00
Michael Kerrisk 168df94099 Enrico Zini
Added text to clarify that S_IS*() macros should be applied
to st_mode field.
as per: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=249698
2004-12-16 14:45:45 +00:00
Michael Kerrisk 0ca68756a9 Changed CONFORMING TO 2004-12-15 17:30:03 +00:00
Michael Kerrisk 631f43ca2d Added 'const' to declaration of 'my_addr' in prototype.
as per http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=239762
2004-12-15 15:35:02 +00:00
Michael Kerrisk 526f4e1ffe Formatting fixes plus additional material in ERRORS 2004-12-15 13:37:09 +00:00
Michael Kerrisk e28334cee7 http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=204292
[[
swapon(2) indicates that EINVAL wil lbe returned only if the path
specified does not exist or is not a block device.

The kernel will also return EINVAL is a swap signature is not detected
on the indicated path as well.
]]
2004-12-15 13:24:42 +00:00
Michael Kerrisk c6c4abc835 Fix typo 2004-12-14 18:39:17 +00:00
Michael Kerrisk 48dd5a6767 Changed
.TH UNIMPLEMENTED
to:
    .TH UNDOCUMENTED
as per
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=220741
2004-12-14 18:00:43 +00:00
Michael Kerrisk 4b62ba5094 Fixed as per: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=222145 2004-12-14 17:14:19 +00:00
Michael Kerrisk 3ba7aed4ab Minor wording changes 2004-12-13 15:39:11 +00:00
Michael Kerrisk 8505c1f1d6 Date: Mon, 13 Dec 2004 12:09:43 +0100 (MET)
From: "Michael Kerrisk" <mtk-manpages@gmx.net>
To: Andries Brouwer <Andries.Brouwer@cwi.nl>
Subject: Re: errno

Hi Andries,

> On Fri, Dec 10, 2004 at 05:07:36PM +0100, Michael Kerrisk wrote:
> 
> > I added this text to fcntl.2:
> > 
> >     BUGS
> >        A  limitation of the Linux system call conventions means that
> >        if a (negative) process group ID to be returned  by  F_GETOWN
> >        falls  in  the  range  -1  to -4095, then the return value is
> >        wrongly interpreted by glibc as an error in the system  call;
> >        that  is,  the  return value of fcntl() will be -1, and errno
> >        will contain the (positive) process group ID.
> 
> Yes.
> 
> (Maybe glibc always did this, early libc considered any negative
> return value an error. On the other hand, not all the world is an i386 -
> IBM has just decided that we don't need any i386's anymore
> and sold their stuff to the Chinese - we must use PPC, as Linus
> does already - and on other architectures we do not have this
> ugliness, I think.)
> 
> You might consider adding "i386" somewhere:
>  A limitation of the Linux i386 system call conventions ...

Some testing on ia64 (RedHat EL 3.0, 2.4.21) and 
alpha (2.4.18, Debian 3.0) showed that any negative PGID value
causes F_GETOWN to fail.

My limited reading of the ia64 source:

sysdeps/unix/sysv/linux/ia64/sysdep.h

shows that there is a comment about the -4095 value there, 
but that doesn't seem to reflect the reality of the code.

Reading the source, the -4095 limit seems to hold on some 
other architectures, e.g.:

sysdeps/unix/sysv/linux/m68k/sysdep.h
sysdeps/unix/sysv/linux/hppa/sysdep.h
sysdeps/unix/sysv/linux/s390/s390-32/sysdep.h
sysdeps/unix/sysv/linux/s390/s390-64/sysdep.h
sysdeps/unix/sysv/linux/x86_64/sysdep.h

Unfortunately, I have no non-x86 systems other than the above 
alpha and ia64 (HP-testdrive) on which I can test.

I modified the text a little:

   BUGS
       A  limitation  of the Linux system call conventions on some
       architectures (notably x86) means that if a (negative) pro&#8208;
       cess group ID to be returned by F_GETOWN falls in the range
       -1 to -4095, then the return value is  wrongly  interpreted
       by  glibc  as  an  error  in  the system call; that is, the
       return value of fcntl() will be -1, and errno will  contain
       the (positive) process group ID.

I've left a FIXME in the man page source noting that details have
yet to be sorted out for ia64, alpha, etc.
2004-12-13 11:32:37 +00:00
Michael Kerrisk d3c8b3e9b7 minor wording chnages 2004-12-13 08:58:09 +00:00
Michael Kerrisk 99d2b7a267 minor wording changes 2004-12-13 08:40:20 +00:00
Michael Kerrisk ba17901d0c minor wording/formatting fixes 2004-12-13 08:39:46 +00:00
Michael Kerrisk 540036b2fd minor wording/formatting fixes 2004-12-13 08:39:28 +00:00
Michael Kerrisk 30ca894053 minor wording fixes 2004-12-13 07:23:31 +00:00
Michael Kerrisk 9a8a1136fa typo fix 2004-12-13 06:58:38 +00:00
Michael Kerrisk 599be3eef2 updated header comments to reflect recent changes 2004-12-10 16:44:25 +00:00
Michael Kerrisk 0ff184704f [Further notes on that F_GETOWN bug]
Hi Andries,

[Just for my own  reference, I reinclude the pointer to Philippe 
Troin's patch
http://marc.theaimsgroup.com/?l=linux-kernel&m=108380640603164&w=2
]

> > > Except of course for fcntl(fd, F_GETOWN) where the owner is a
> > > (negative) process group... If the owning process group has a "low
> > > enough" PGID, it collides with errors and glibc reports an error and
> > > sets errno to -PGID. One might argue that in this instance, that the
> > > BSD's overloading of the pid field with pgids is at fault, but the 
> > > bug
> > > still remains :-)
> > 
> > I believe that practically speaking this is a non-issue.  The 
> > lowest PID / PGID that can be allocated to a process other than 
> > init or a kernel thread is 300.  (RESERVED_PID in kernel/pid.c 
> > in 2.6, details differ, but same limit in <= 2.4.)
> 
> Hmm. RESERVED_PIDS is used as starting value after overflow,
> not as a starting value at the beginning. I think you are mistaken.

Hmm -- yes.  And I was in any case assuming the notion
of a process that might do an F_SETOWN assigning
its own PGID to the socket -- but that might not be so.

And I was overlooking a comment in the fs/fcntl.c 
sources that reiterates the point:

        case F_GETOWN:
                /*
                 * XXX If f_owner is a process group, the
                 * negative return value will get converted
                 * into an error.  Oops.  If we keep the
                 * current syscall conventions, the only way
                 * to fix this will be in libc.
                 */
                err = filp->f_owner.pid;
                force_successful_syscall_return();
                break;

And now I've actually created the error in userland code.
It seems that whenever the -PGID retrieved by F_GETOWN is 
smaller than 4096, then it is interpreted as an error.

Now I see the relevant code in 
sysdeps/unix/sysv/linux/i386/sysdep.h:

==
/* Linux uses a negative return value to indicate syscall errors,
   unlike most Unices, which use the condition codes' carry flag.

   Since version 2.1 the return value of a system call might be
   negative even if the call succeeded.  E.g., the `lseek' system call
   might return a large offset.  Therefore we must not anymore test
   for < 0, but test for a real error by making sure the value in %eax
   is a real error number.  Linus said he will make sure the no syscall
   returns a value in -1 .. -4095 as a valid result so we can savely
   test with -4095.  */

[...]
    DO_CALL (syscall_name, args);
    cmpl $-4095, %eax;          
    jae SYSCALL_ERROR_LABEL;    

==

Ugh.
2004-12-10 16:28:25 +00:00
Michael Kerrisk 7c3b0e957d noted F_GETOWN bug after suggestion from aeb. 2004-12-10 16:26:28 +00:00
Michael Kerrisk 527d993350 After a note from Vasya Pupkin, I added <errno.h> to the SYNOPSIS
of several Section 2 pages using the _syscallN() macros.  

    In addition:
        -- erroneous semicolons at the end of _syscallN() were removed
           on various pages.

	-- types such as "uint" in syscalN() declarations were changed
	   to "unsigined int", etc.

	-- various other minor breakages in the synopses were fixed.
2004-12-10 09:03:08 +00:00
Michael Kerrisk 25743dd704 Removed erroneous semicolons at the end of _syscall() instances in
SYNOPSIS of several section 2 man pages.
2004-12-10 07:49:56 +00:00
Michael Kerrisk e1c77b3901 added SI_TKILL + other minor changes 2004-12-09 10:26:18 +00:00
Michael Kerrisk 1c1e15ed85 Martin Pool (and mtk) -- added O_NOATIME 2004-12-08 16:41:10 +00:00
Michael Kerrisk 1a956089b0 Eric Estievenart <eric.estievenart@free.fr>
Note that MAP_FIXED replaces existing mappings
2004-12-08 13:47:41 +00:00
Michael Kerrisk e263839c06 In Linux 2.6, the return value of times() changed 2004-12-08 09:26:32 +00:00
Michael Kerrisk 8b6aacb004 tweak RLIMIT_SIGPENDING details 2004-12-07 17:57:48 +00:00
Michael Kerrisk 4bdd9f775b tweak RLIMIT_SIGPENDING details 2004-12-07 17:30:27 +00:00
Michael Kerrisk 1c287bbf01 fix typo 2004-12-06 13:39:28 +00:00
Michael Kerrisk e6c5832f19 Rewrote discussion on RLIMIT_MEMLOCK to incorporate kernel 2.6.9 changes.
Added note on RLIMIT_CPU error in older kernels.
Added RLIMIT_SIGPENDING
2004-12-03 16:06:22 +00:00
Michael Kerrisk 93e4c37f65 more fixes to synopsis 2004-12-02 09:25:55 +00:00
Michael Kerrisk b4c0e1cb44 Fixed headers listed in synopsis, after message from Vasya Pupkin 2004-12-01 15:19:22 +00:00
Michael Kerrisk 3aadaa6594 noted buggy mlock() half RAM check in 2.4.x; some rewording of discussion of MCL_FUTURE 2004-12-01 09:43:35 +00:00
Michael Kerrisk 7f3256956e Changed wording of sentence under NOTES describing when signals can be sent to init. 2004-11-30 17:47:32 +00:00
Michael Kerrisk 8ce20bf7ba These are now just links; their content has been consoldiated intomlock.2 2004-11-25 14:40:17 +00:00
Michael Kerrisk 8176b81ab6 Consolidated mlock.2, munlock.2, mlockall.2, and munlockall.2 material into single page to eliminate duplicated material; updated notes for 2.6.9 changes in permissions and limist on memory locking 2004-11-25 14:39:43 +00:00
Michael Kerrisk 583d5fd39a Notes on 2.6.9 RLIMIT_MEMLOCK changes 2004-11-25 13:38:17 +00:00
Michael Kerrisk 83cd3686ed Added cross-ref to setrlimit(2) concerning memory locking limits 2004-11-25 13:36:04 +00:00
Michael Kerrisk 102f39b88e 2.4 limits locks to half of physical mem; MCL_FUTURE bug note 2004-11-25 13:34:08 +00:00
Michael Kerrisk c1832fd1eb 2.4 limits locks to half of physical me 2004-11-25 13:33:38 +00:00
Michael Kerrisk 3b85198195 removed stray #endif; formatting fix 2004-11-25 07:50:05 +00:00
Michael Kerrisk 3d3886497f CAP_IPC_LOCK is not required for SHM_UNLOCK since kernel 2.6.9 2004-11-23 10:06:02 +00:00
Michael Kerrisk f8c31d602c CLD_CONTINUED is supported since Linux 2.6.9 2004-11-19 17:35:57 +00:00
Michael Kerrisk 197362df19 Removed text on ignoring SIGCHL; replaced with pointer to sigaction.2 2004-11-19 17:34:32 +00:00
Michael Kerrisk b7769f32c5 Updated discussion for POSIX.1-2001 and SIGCHLD and sa_flags; formatting fixes 2004-11-18 13:37:14 +00:00
Michael Kerrisk 5775745fa4 Added FIXME -- the return value of times() has changed in Linux 2.6 -- what is it? 2004-11-16 19:38:07 +00:00
Michael Kerrisk 4c926acf03 Minor formatting changes 2004-11-16 17:08:25 +00:00
Michael Kerrisk 81841f39af SIGCHLD non-conformance was fixed in 2.6.9 2004-11-16 16:59:09 +00:00
Michael Kerrisk e3a887db90 split out from getrlimit.2; noted that SIGCHLD non-conformance was fixed in 2.6.9 2004-11-16 16:58:54 +00:00
Michael Kerrisk 0fc46b5a65 split getrusage(2) into own page; other minor changes 2004-11-16 16:57:47 +00:00
Michael Kerrisk d3b2ef5de2 Added waitid(); added SA_NOCLDSTOP; updated SA_NOCLDWAIT; much other text rewritten 2004-11-11 14:40:35 +00:00
Michael Kerrisk fe4992a761 Major rewrite; removed duplicated text, replacing with pointers to wait.2 2004-11-11 14:39:29 +00:00
Michael Kerrisk f2351505cb Rewrote this page, removing much duplicated information
and replacing with pointers to wait.2
2004-11-11 14:17:30 +00:00
Michael Kerrisk 84b13f1e40 Minor changes to SEE ALSO 2004-11-11 14:13:28 +00:00
Michael Kerrisk 1cbdceb181 Added SIGCONT under SA_NOCLDSTOP; added SA_NOCLDWAID; other minor changes 2004-11-11 14:09:54 +00:00
Michael Kerrisk 5d4a590c7d new link to wait.2 2004-11-11 14:08:30 +00:00
Michael Kerrisk 2c8d1c7d5e changed spelling of "super-user" to "superuser" 2004-11-10 18:17:26 +00:00
Michael Kerrisk 9907019a39 Formatting & lang clean-ups; added data structure defns; added SHM_LOCKED & SHM_DEST test 2004-11-10 17:27:34 +00:00
Michael Kerrisk 70d0e5ef63 Formatting & lang clean-ups; added data structure defns 2004-11-10 17:27:07 +00:00
Michael Kerrisk f998edca67 Formatting & lag clean-ups; changed sentence regarding attachment of segments marked for destruction 2004-11-10 17:25:44 +00:00
Michael Kerrisk fe1c5199cc Formatting & lag clean-ups; added /proc file notes 2004-11-10 17:24:20 +00:00
Michael Kerrisk c952e22670 Formatting & lag clean-ups; added /proc file notes 2004-11-10 17:23:19 +00:00
Michael Kerrisk 6891999e31 Patches from Martin Schulze <joey@infodeom.org> 2004-11-03 15:32:55 +00:00
Michael Kerrisk 305a0578bf Global change of email address for MTK (now: mtk-manpages@gmx.net) 2004-11-03 14:43:40 +00:00
Michael Kerrisk fea681dafb Import of man-pages 1.70 2004-11-03 13:51:07 +00:00