Commit Graph

6576 Commits

Author SHA1 Message Date
Dimitry Andric
9f0c8034d8 Remove some unneeded spaces from the __sym_compat() macro, since newer
versions of gas are more fussy about spaces surrounding '@' signs in
versioned symbol names.
2010-11-11 21:36:52 +00:00
Ed Schouten
736fc28680 Add a new libc function: cfmakesane(3).
I've noticed various terminal emulators that need to obtain a sane
default termios structure use very complex `hacks'. Even though POSIX
doesn't provide any functionality for this, extend our termios API with
cfmakesane(3), which is similar to the commonly supported cfmakeraw(3),
except that it fills the termios structure with sane defaults.

Change all code in our base system to use this function, instead of
depending on <sys/ttydefaults.h> to provide TTYDEF_*.
2010-11-02 17:00:56 +00:00
Jaakko Heinonen
2feecf0bfb - Note that non-superusers are not allowed to set the SF_ARCHIVED
flag. [1]
- Note that also fchflags(2) will return EPERM for attempts to set or
  unset the SF_SNAPSHOT flag.

Submitted by:	Garrett Cooper [1]
MFC after:	1 week
2010-10-29 15:03:29 +00:00
David Xu
b67cc292dc Add sysctl kern.sched.cpusetsize to export the size of kernel cpuset,
also add sysconf() key _SC_CPUSET_SIZE to get sysctl value.

Submitted by: gcooper
2010-10-29 13:31:10 +00:00
Jayachandran C.
5bf52f1fb5 Fix PIC_RETURN when abicalls are not defined.
Submitted by:	Artem Belevich (artemb at gmail dot com)
2010-10-24 05:22:07 +00:00
Benedict Reuschling
a10502a58b Revert to r214147, errno is not clobbered as originally
thought.
2010-10-22 08:51:49 +00:00
Benedict Reuschling
a8af8b783a Document strtonum()s behavior of setting errno to 0 when no error is found.
PR:             docs/143330
Submitted by:   Efstratios Karatzas (gpf dot kira at gmail dot com)
Discussed with: ru@
MFC after:      7 days
2010-10-21 18:30:48 +00:00
Benedict Reuschling
e9e38bc2e7 Sync with OpenBSD rev. 1.13:
strtonum does not require limits.h

Obtained from:  OpenBSD
Discussed with: ru@
MFC after:      5 days
2010-10-21 18:21:19 +00:00
Ed Schouten
9301df8179 Fix error handling logic of pututxline(3).
Instead of only returning NULL when the entry is invalid and can't be
matched against the current database, also return it when it cannot open
the log files properly.
2010-10-21 15:10:35 +00:00
Ulrich Spörlein
2914feeb7e mdoc: make pages render with mandoc
It's a bit more pedantic regarding .Bl list elements. This has an added
benefit of unbreaking the ipfw(8) manpage, where groff was silently
skipping one list element.
2010-10-21 12:27:13 +00:00
David Xu
de1e74c6a5 Revert revision 214007, I realized that MySQL wants to resolve
a silly rwlock deadlock problem, the deadlock is caused by writer
waiters, if a thread has already locked a reader lock, and wants to
acquire another reader lock, it will be blocked by writer waiters,
but we had already fixed it years ago.
2010-10-20 02:34:02 +00:00
David Xu
7672cbaaf9 Unbreak buildworld by including pthread_rwlockattr_setkind_np and
pthread_rwlockattr_getkind_np.
2010-10-18 09:44:21 +00:00
Rui Paulo
565424b2fd Clang related fixes:
* When calling syslog(), pass a format string.
* Define YY_NO_INPUT on nslexer.l

Submitted by:	Norberto Lopes <nlopes.ml at gmail.com>
2010-10-13 16:57:06 +00:00
Ulrich Spörlein
0d9deed52c mdoc: drop redundant .Pp and .LP calls
They have no effect when coming in pairs, or before .Bl/.Bd
2010-10-08 12:40:16 +00:00
Konstantin Belousov
3ac535965a Missed space.
Submitted by:	brueffer
MFC after:	1 week
2010-10-06 09:24:33 +00:00
Konstantin Belousov
866dcc9462 Add cross-references to lrand48(3) and arc4random(3) from rand(3)
and random(3).

Submitted by:	Valentin Nechayev <netch netch kiev ua>
MFC after:	1 week
2010-10-06 09:05:47 +00:00
Hajimu UMEMOTO
c618a8562e When no protocol entry is found, getproto*_r(3) should
return zero.

Spotted by:	Kostik Belousov <kostikbel__at__gmail.com>
MFC after:	2 weeks
2010-10-05 15:40:59 +00:00
Hajimu UMEMOTO
f700faa590 Clear errno for each method dispatch.
Spotted by:	Kostik Belousov <kostikbel__at__gmail.com>
MFC after:	2 weeks
2010-10-04 15:28:01 +00:00
Jilles Tjoelker
220856f376 libc: Remove the i386 assembler version of strlen(3).
On anything modern, the C version, which processes a word at a time, is much
faster. The Intel optimization manual explicitly warns against using REP
prefixes with SCAS or CMPS, which is exactly what the assembler version
does.

A simple test on a Phenom II showed the C version, compiled with -O2, to be
about twice as fast determining the length of 100000 strings between 0 and
255 bytes long.

MFC after:	2 weeks
2010-10-01 13:10:11 +00:00
Dimitry Andric
3c1594be0a Retire the amd64 and i386 specific inline assembly versions of ldexp.c,
as they are slower than the generic version in C, at least on modern
hardware.  This leaves us with just five implementations.

Suggested by:	bde
Approved by:	rpaulo (mentor)
2010-09-30 19:20:21 +00:00
Dimitry Andric
12894d9d66 Apply the same workaround for clang to amd64's version of ldexp.c (as in
r212976): order the incoming arguments to fscale as st(0), st(1), and
mark temp2 volatile (only in case of compilation with clang) to force
clang to pop it correctly.  No binary change when compiled with gcc.

This fixes ldexp() when compiled with clang on amd64, which makes
drand48() and friends work correctly again, and this in turn fixes
perl's tempfile().

Reported by:	Renato Botelho, Derek Tattersall
Approved by:	rpaulo (mentor)
2010-09-29 21:20:29 +00:00
David Xu
f4213b9006 To support stack unwinding for cancellation points, add -fexceptions flag
for them, two functions _pthread_cancel_enter and _pthread_cancel_leave
are added to let thread enter and leave a cancellation point, it also
makes it possible that other functions can be cancellation points in
libraries without having to be rewritten in libthr.
2010-09-25 01:57:47 +00:00
Rui Paulo
7e78863707 Workaround LLVM bug #4434:
Reorder inline assembly arguments temp2, temp, value and texp to follow
the st(0), st(1), etc. style.
Also mark the temp2 variable as volatile to workaround another clang
bug.
This allows clang to buildworld FreeBSD/i386.

Submitted by:	dim
2010-09-21 20:23:19 +00:00
Alan Cox
8f7f5a7f26 Fix exec_imgact_shell()'s handling of two error cases: (1) Previously, if
the first line of a script exceeded MAXSHELLCMDLEN characters, then
exec_imgact_shell() silently truncated the line and passed on the truncated
interpreter name or argument.  Now, exec_imgact_shell() will fail and return
ENOEXEC, which is the commonly used errno among Unix variants for this type
of error. (2) Previously, exec_imgact_shell()'s check on the length of the
interpreter's name was ineffective.  In other words, exec_imgact_shell()
could not possibly fail and return ENAMETOOLONG.  The reason being that the
length of the interpreter name had to exceed MAXSHELLCMDLEN characters in
order that ENAMETOOLONG be returned.  But, the search for the end of the
interpreter name stops after at most MAXSHELLCMDLEN - 2 characters are
scanned.  (In the end, this particular error is eventually discovered
outside of exec_imgact_shell() and ENAMETOOLONG is returned.  So, the real
effect of this second change is that the error is detected earlier, in
exec_imgact_shell().)

Update the definition of MAXINTERP to the actual limit on the size of
the interpreter name that has been in effect since r142453 (from
2005).

In collaboration with: kib
2010-09-21 16:24:51 +00:00
Edward Tomasz Napierala
4089cc8aa1 First step at adopting FreeBSD to support PSARC/2010/029. This makes
acl_is_trivial_np(3) properly recognize the new trivial ACLs.  From
the user point of view, that means "ls -l" no longer shows plus signs
for all the files when running ZFS v28.
2010-09-20 17:10:06 +00:00
Glen Barber
416d1e6f23 Bump dates in dbopen(3) and cpuset_getaffinity(2) from r212441 and
r212438, repectively.

Approved by:	keramida (mentor)
MFC after:	1 week
2010-09-12 14:04:05 +00:00
Rebecca Cran
5512804bb8 Revert changes of 'assure' to 'ensure' made in r211936.
Approved by: rrs (mentor)
2010-09-11 10:49:56 +00:00
Glen Barber
1569ab8c49 Note O_SYNC and O_NOFOLLOW flags in dbopen(3) since r190497.
PR:		150030
Submitted by:	Janne Snabb snabb at epipe com
Patch by:	Janne Snabb
Approved by:	keramida (mentor)
MFC after:	1 week
2010-09-10 23:24:55 +00:00
Glen Barber
cbd5df1c04 Add EINVAL to list of possible return values for cpuset_getaffinity(2).
PR:		149978
Submitted by:	gcooper
Patch by:	gcooper
Approved by:	keramida (mentor)
MFC after:	1 week
2010-09-10 23:15:05 +00:00
David Xu
83c9e0893f Because POSIX does not allow EINTR to be returned from sigwait(),
add a wrapper for it in libc and rework the code in libthr, the
system call still can return EINTR, we keep this feature.

Discussed on: thread
Reviewed by:  jilles
2010-09-10 01:47:37 +00:00
Edward Tomasz Napierala
781413510d Arrgh, tested wrong source tree _again_. Fix previous commit. Also,
this and previous one are MFC candidate.

MFC after:	1 month
2010-09-09 20:37:19 +00:00
Edward Tomasz Napierala
7eaa29b5d8 Add minor optimization. It's less strict than its kernel counterpart
due to upcoming ACL changes required by the new ZFS.
2010-09-09 20:07:40 +00:00
Glen Barber
1bc1532c36 Add ECONNRESET to list of possible errors in connect(2).
PR:		148683
Submitted by:	Gennady Proskurin <gpr at mail dot ru>
Approved by:	keramida (mentor)
MFC after:	1 week
2010-09-06 21:39:54 +00:00
Konstantin Belousov
da881cad07 Use NULL instead of 0 for pointer in example.
MFC after:	3 days
2010-08-29 16:38:08 +00:00
Alan Cox
74ffb9af15 Add the MAP_PREFAULT_READ option to mmap(2).
Reviewed by:	jhb, kib
2010-08-28 16:57:07 +00:00
Rebecca Cran
e7f8dd75b3 Fix incorrect usage of 'assure' and 'insure'.
Approved by: rrs (mentor)
2010-08-28 16:32:01 +00:00
Konstantin Belousov
3eaca8526c Do not call __pthread_cxa_finalize with invalid struct dl_phdr_info.
Reported and tested by:	Fabian Keil <freebsd-listen fabiankeil de>
MFC after:	17 days
2010-08-27 19:57:17 +00:00
Nathan Whitehorn
f61ce56845 Allow ABIs to provide their own LIBC_ARCH in a more generic way. As a side
effect, this fixes the build on powerpc64.

Reviewed by:	imp
2010-08-25 20:48:24 +00:00
Warner Losh
bff351d7fe Fix an accidental sed... 2010-08-24 21:28:34 +00:00
Warner Losh
2c0959ae6b Powerpc is special here. powerpc and powerpc64 use different ABIs, so
their implementations aren't in the same files.  Introduce LIBC_ARCH
and use that in preference to MACHINE_CPUARCH.  Tested by amd64 and
powerpc64 builds (thanks nathanw@)
2010-08-24 20:54:43 +00:00
Konstantin Belousov
3e3fbd3f25 Remove extra FreeBSD tag.
MFC after:	3 days
2010-08-24 13:02:22 +00:00
Konstantin Belousov
da2a0df59c Move the __stack_chk_fail_local@FBSD_1.0 compat symbol definition into
the separate .o for libc_pic.a. This prevents rtld from making the
symbol global.

Putting the stack_protector_compat.c into the public domain acknowledged
by kan.

Reviewed by:	kan
MFC after:	2 weeks
2010-08-24 12:58:54 +00:00
Warner Losh
25faff346c MFtbemd:
Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want
to test of all the CPUs of a given family conform.
2010-08-23 22:24:11 +00:00
Konstantin Belousov
ea246b6369 On shared object unload, in __cxa_finalize, call and clear all installed
atexit and __cxa_atexit handlers that are either installed by unloaded
dso, or points to the functions provided by the dso.

Use _rtld_addr_phdr to locate segment information from the address of
private variable belonging to the dso, supplied by crtstuff.c. Provide
utility function __elf_phdr_match_addr to do the match of address against
dso executable segment.

Call back into libthr from __cxa_finalize using weak
__pthread_cxa_finalize symbol to remove any atfork handler which
function points into unloaded object.

The rtld needs private __pthread_cxa_finalize symbol to not require
resolution of the weak undefined symbol at initialization time. This
cannot work, since rtld is relocated before sym_zero is set up.

Idea by:	kan
Reviewed by:	kan (previous version)
MFC after:	3 weeks
2010-08-23 15:38:02 +00:00
Konstantin Belousov
e048186a62 Introduce implementation-private rtld interface _rtld_addr_phdr, which
fills struct dl_phdr_info for the shared object that contains the
specified address, if any.

Idea and reviewed by:	kan
MFC after:	3 weeks
2010-08-23 15:27:03 +00:00
Konstantin Belousov
aeaffd647e Style.
MFC after:	3 days
2010-08-23 15:18:35 +00:00
Konstantin Belousov
2793b01844 Use aux vector to get values for SSP canary, pagesize, pagesizes array,
number of host CPUs and osreldate.

This eliminates the last sysctl(2) calls from the dynamically linked image
startup.

No objections from:	kan
Tested by:	marius (sparc64)
MFC after:	1 month
2010-08-17 09:13:26 +00:00
Joel Dahl
c2025a7660 Fix typos, spelling, formatting and mdoc mistakes found by Nobuyuki while
translating these manual pages.  Minor corrections by me.

Submitted by:	Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
2010-08-16 15:18:30 +00:00
Hajimu UMEMOTO
2db99256b1 Correct the return code from _dns_gethostby*() to correspond
with h_errno.

Obtained from:	NetBSD
MFC after:	2 weeks
2010-08-15 16:28:08 +00:00
Hajimu UMEMOTO
225edeac51 - When there is no room for returning the result, nss backend
have to return ERANGE and terminate with NS_RETURN.
- When gethostbyname_r(3) and the friends end with an error,
  set errno to the value nss backend returns, and return errno
  value.

PR:		kern/131623
MFC after:	2 weeks
2010-08-13 06:39:54 +00:00
Joel Dahl
f6ac23919b Fix typos and spelling mistakes. 2010-08-06 14:33:42 +00:00
Andrey A. Chernov
01e14bff35 Comment out IEEE Std 1003.1-2001 conformance proclaimed too early,
see problems described in the comment to:
http://www.freebsd.org/cgi/query-pr.cgi?pr=kern/128933
2010-08-05 01:39:25 +00:00
Joel Dahl
edfa427cf1 Spelling fixes. 2010-08-02 16:01:45 +00:00
Ulrich Spörlein
3d05ebbcf8 mdoc: remove unbalanced quotes 2010-08-02 13:11:41 +00:00
Ulrich Spörlein
c0da74038d mdoc: make sure to pass at least one argument to quotation macros 2010-08-02 13:11:35 +00:00
Rui Paulo
271e7c594b Disable all warnings when building gdtoa. This allows building libc with
clang.
The general idea is that the vendor will not accept our compilation
patches and so disabling the warnings is the best way to go as it makes
future imports bearable.

Submitted by:	Dimitry Andric <dimitry at andric.com>
Discussed with:	das
2010-08-01 12:35:01 +00:00
Ulrich Spörlein
32ba16b6e6 Fix a couple of typos.
PR:		docs/148891
Submitted by:	olgeni
MFC after:	1 week
2010-07-30 11:58:18 +00:00
Edward Tomasz Napierala
d8561f0a50 Update mlockall(2) to mention that it's superuser-only syscall, just
like the mlock(2) manual page says.  Update mlock(2) to say that hitting
RLIMIT_MEMLOCK results in ENOMEM, not EAGAIN.

MFC after:	1 month
2010-07-27 20:34:37 +00:00
Benedict Reuschling
29a6389aeb Apply a small grammar fix to {toupper,tolower}(3).
PR:		docs/140458
Submitted by:	Jeremy Huddleston (Jeremyhu at apple dot com)
MFC after:	5 days
2010-07-25 13:32:19 +00:00
Konstantin Belousov
e2b801ddd9 Verify return value of the sigset manipulation functions
to catch invalid signal numbers [1]. Use consistent style of
not assigning the return value to a local variable.

Reported by:	Garrett Cooper <yanegomi gmail com> [1]
MFC after:	1 week
2010-07-22 09:14:18 +00:00
Ed Schouten
8b18f12fc6 Also link getutxent.3 to utmpx.3.
If you run `man utmpx', you expect to get some info on it.
2010-07-21 08:51:38 +00:00
Konstantin Belousov
5ebe96648b For xsi_sigpause(3), remove the supplied signal from the process mask
during sigpause(2) call. It was backward.
Check that the signal number is valid.

Reported by:	Garrett Cooper <yanegomi gmail com>
MFC after:	1 week
2010-07-12 10:14:24 +00:00
Nathan Whitehorn
840b91cc52 Provide 64-bit PowerPC support in libc.
Obtained from:	projects/ppc64
2010-07-10 14:45:03 +00:00
Nathan Whitehorn
8869de5e55 The 64-bit PowerPC ABI implemented in binutils 2.15 requires some special
quirks for weak-symbol handling. Text symbols require also marking weak
the special dot-symbol associated with the function, and data symbols
require that you not do that. To fix this, provide a hacked
__weak_reference for powerpc64, and define a new __weak_reference_data
for the single weak data symbol in base.

Revert after:	binutils 2.17 import
Obtained from:	projects/ppc64
2010-07-10 14:39:08 +00:00
Konstantin Belousov
cefac16712 Document pl_siginfo and PT_FLAG_SI for PT_LWPINFO.
MFC after:	1 month
2010-07-10 14:31:44 +00:00
Randall Stewart
335a2d00c4 If a user calls sctp_sendx() with a NULL
sinfo we will crash. Instead we should provide
our own temp structure to use internally.

MFC after:	1 month
2010-07-07 11:19:06 +00:00
Edward Tomasz Napierala
f59646c2af Fix acl_from_text(3) - and, therefore, setfacl(1) - for user and group
names names starting with a digit.

MFC after:	1 month
2010-07-06 17:20:08 +00:00
Edward Tomasz Napierala
ec1f83f78e Remove comment which didn't match reality for a long time.
Reviewed by:	rwatson
2010-07-05 19:01:10 +00:00
Rebecca Cran
45d35a30bd Increment 'sa' at the end of the loop; otherwise, only the first
address ever gets checked.

Approved by: rrs (mentor)
MFC after: 1 month
2010-07-05 03:55:49 +00:00
Rebecca Cran
3d36ac9877 Use ISO C99 integer types instead of the BSD-specific u_int*_t.
Approved by: rrs (mentor)
2010-07-04 08:09:33 +00:00
Marcel Moolenaar
af448c52e4 Simplify the calculation of s_scale by rewriting the FP expression to
use uintmax_t instead of float and thereby eliminating the need for
a non-FP version.

Tested on: amd64, ia64 & powerpc (book-E)
Suggested by:	bde
MFC after:	1 month
2010-07-01 00:48:00 +00:00
Marcel Moolenaar
c5e0ba5fe4 On powerpc, calculate s_scale using the non-FP version previously
specific to hp300. Since FreeBSD does not support hp300, hp300 has
been removed from the condition altogether.

The FP version broke profiling on powerpc due to invalid results.
Casting to double instead of float resolved the issue, but with
Book-E not having a FP unit, the non-FP version looked preferrable.
Note that even on AIM hardware the FP version yielded an invalid
value for s_scale, so the problem is most likely with the compiler
or with the expression itself.
2010-06-30 01:40:25 +00:00
Pawel Jakub Dawidek
da6ee3126b Just like in case of setgroups(2), for getgroups(2) also advice including
sys/param.h instead of sys/types.h so we get NGROUPS_MAX and NGROUPS
definitions.
2010-06-26 21:44:05 +00:00
Jayachandran C.
60ddfa2837 use PTR_WORD for __curbrk and minbrk instead of .word, the new version
wil support all ABIs.

Approved by:	rrs (mentor)
2010-06-25 05:36:36 +00:00
Maxim Konovalov
03678e1179 Merge from English r198040: add C message catalogue entries for newer
errnos: EBADMSG, EMULTIHOP, ENOLINK, EPROTO, ENOTCAPABLE.

PR:		docs/147983
Submitted by:	pluknet
MFC after:	1 week
2010-06-20 06:52:10 +00:00
Jayachandran C.
9279d32a64 Merge jmallett@'s n64 work into HEAD - changeset 2
Update libc Makefiles.
Add makecontext implementation.

Changes from http://svn.freebsd.org/base/user/jmallett/octeon

Approved by:	rrs(mentor), jmallett
2010-06-16 14:13:36 +00:00
Jayachandran C.
a7c139c0af Merge jmallett@'s n64 work into HEAD - changeset 1.
Update libc assembly code to use macros that work on both o32 and n64.
Merge string functions from NetBSD.

The changes are from http://svn.freebsd.org/base/user/jmallett/octeon

Approved by:	rrs (mentor), jmallett
2010-06-16 12:55:14 +00:00
Tim Kientzle
2ca090b308 Separate _posix1e_acl_id_to_name() into a separate file, to
break an unnecessary dependency on getpwuid() and getgrgid().

MFC after: 1 month
2010-06-14 02:26:13 +00:00
Colin Percival
ff847ecb82 In threaded processes, destroy the mutex atexit_mutex when we've
finished using it.  This allows the mutex's allocated memory to be
freed.

This is one sense a rather silly change, since at this point we're
less than a microsecond away from calling _exit; but fixing this
memory leak is likely to make life easier for anyone trying to
track down other memory leaks.
2010-06-13 01:13:36 +00:00
Rebecca Cran
cefac273a4 sctp_recvmsg returns the number of bytes received, not sent.
Approved by:	rrs (mentor)
MFC after:	1 month
2010-06-11 18:43:55 +00:00
Ulrich Spörlein
a6dcdf3b5f mdoc: stop abusing -column lists and use .Bl -tag instead 2010-06-11 06:03:54 +00:00
Ulrich Spörlein
ef8a3e5cf2 mdoc: remove literal tabs where they don't belong 2010-06-08 16:48:59 +00:00
Edward Tomasz Napierala
eec80038e3 Don't use pointer to 64 bit value (id_t) to point to 32 bit value (uid_t).
Found with:	Coverity Prevent
CID:		7466, 7467
MFC after:	2 weeks
2010-06-05 07:40:32 +00:00
Edward Tomasz Napierala
a3a11ad455 Don't forget to free the string in error case.
Found with:	Coverity Prevent
CID:		6585
2010-06-03 14:51:29 +00:00
Edward Tomasz Napierala
d72fb30a43 _posix1e_acl_sort() never returns anything other than 0; change its
return type to void and update callers.  This simplifies code and
fixes one place where the returned value was not actually checked.

Found with:	Coverity Prevent
CID:		4791
2010-06-03 14:29:17 +00:00
Edward Tomasz Napierala
7945d60d1e Fix usage of uninitialized variable.
Found with:	Coverity Prevent
CID:		7517
MFC after:	2 weeks
2010-06-03 14:27:18 +00:00
Edward Tomasz Napierala
18c12a53a1 The 'acl_cnt' field is unsigned; no point in checking if it's >= 0.
Found with:	Coverity Prevent
CID:		6192
2010-06-03 14:16:58 +00:00
Edward Tomasz Napierala
d243a85e99 The 'acl_cnt' field is unsigned; no point in checking if it's >= 0.
Found with:	Coverity Prevent
CID:		6193
2010-06-03 14:15:08 +00:00
Ulrich Spörlein
e3303e900e mdoc: spell macros correctly, there's no need for the backslash escape 2010-06-02 10:20:38 +00:00
Colin Percival
8fd6c56d29 Change the current working directory to be inside the jail created by
the jail(8) command. [10:04]

Fix a one-NUL-byte buffer overflow in libopie. [10:05]

Correctly sanity-check a buffer length in nfs mount. [10:06]

Approved by:	so (cperciva)
Approved by:	re (kensmith)
Security:	FreeBSD-SA-10:04.jail
Security:	FreeBSD-SA-10:05.opie
Security:	FreeBSD-SA-10:06.nfsclient
2010-05-27 03:15:04 +00:00
Konstantin Belousov
0475ecd50a Improve the documentation for PT_LWPINFO. Note that some features are
not implemented on MIPS and ARM.

MFC after:	1 month
2010-05-24 17:23:14 +00:00
Ulrich Spörlein
668d8dd3c8 These features will first appear in 8.1, soon to be released
MFC after:	3 days
2010-05-24 11:14:40 +00:00
Edward Tomasz Napierala
9fcd375657 Make acl_get_perm_np(3) work with NFSv4 ACLs.
Reviewed by:	kientzle@
MFC after:	1 week
2010-05-23 08:12:36 +00:00
Ulrich Spörlein
62486687ed mdoc: consistently spell our email addresses <foo@FreeBSD.org>
Reviewed by:	ru
2010-05-19 08:57:53 +00:00
Edward Tomasz Napierala
1ccc2ae37f Make branding less intrusive - in acl_set(3), in case ACL brand
is ACL_BRAND_UNKNOWN, do what the programmer says instead of failing.

MFC after:	1 week
2010-05-13 16:44:27 +00:00
Edward Tomasz Napierala
6a3cf4c80b Make it possible to actually use NFSv4 permission bits with acl_set_perm(3)
and acl_delete_perm(3).  It went undetected, because neither setfacl(1)
nor Samba use this routines.  D'oh.

MFC after:	1 week
2010-05-13 16:42:01 +00:00
Ulrich Spörlein
0afc94c17a mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the
bottom of the manpages and order them consistently.

GNU groff doesn't care about the ordering, and doesn't even mention
CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put
them.

Found by:	mdocml lint run
Reviewed by:	ru
2010-05-13 12:07:55 +00:00
Gordon Tetlow
5b3fab81ab Fix a bug due to a type conversion from 64 to 32 bits. The side effect of
this type conversion is the high bits which were used to indicate if a
special character was a literal or special were dropped. As a result, all
special character were treated as special, even if they were supposed to
be literals.

Reviewed by:	gad@
Approved by:	mentor (wes@)
2010-05-12 17:44:00 +00:00
Christian Brueffer
e91cb7f003 The previous revision actually removed the bug being hinted at, so
go ahead and remove the hint.

PR:		143944
Submitted by:	Jeremy Huddleston <jeremyhu@apple.com>
MFC after:	1 week
2010-05-12 01:13:49 +00:00
Ulrich Spörlein
2583690e62 mdoc: simplify quotation scheme
Reviewed by:	brueffer
2010-05-11 23:08:38 +00:00
Ulrich Spörlein
2a10d6d199 mdoc: fix parenthesis
Reviewed by:	brueffer
2010-05-11 23:08:31 +00:00
Ulrich Spörlein
488704b28a mdoc: use macro for +- that is understood by mdocml
Reviewed by:	brueffer
2010-05-11 23:08:15 +00:00
Christian Brueffer
0b35d6a71b Document FIONREAD, FIONWRITE and FIONSPACE.
Obtained from:	NetBSD
Submitted by:	emaste
MFC after:	1 week
2010-05-11 17:02:12 +00:00
Edwin Groothuis
3d74e220a5 strptime(3) confused July with June with the fr_FR locale.
When parsing the month "juillet" (abbr "jul"), %B recognized it as
"juin" (abbr "jui") because the full name of the month names is
checked at the same time as the abbrevation.

The new behaviour checks the full names first before checking the
abbrevation names.

PR:		kern/141939
Submitted by:	Denis Chatelain <denis@tikuts.com>
MFC after:	1 week
2010-05-09 22:01:35 +00:00
Jilles Tjoelker
b88c83ff14 sigprocmask(2): pthread_sigmask(3) must be used in threaded processes.
Although libthr's pthread_sigmask() just calls sigprocmask() and this is
unlikely to change, mention this POSIX requirement on applications.

MFC after:	1 week
2010-05-07 20:46:22 +00:00
Jilles Tjoelker
8949fcf0dc raise(3): Note that this sends a signal to the current thread, not process.
This is how it works (with threading libraries loaded) and what POSIX
requires.

MFC after:	1 week
2010-05-07 17:20:15 +00:00
Kirk McKusick
e27ed89aef Merger of the quota64 project into head.
This joint work of Dag-Erling Smørgrav and myself updates the
FFS quota system to support both traditional 32-bit and new 64-bit
quotas (for those of you who want to put 2+Tb quotas on your users).

By default quotas are not compiled into the kernel. To include them
in your kernel configuration you need to specify:

options         QUOTA                   # Enable FFS quotas

If you are already running with the current 32-bit quotas, they
should continue to work just as they have in the past. If you
wish to convert to using 64-bit quotas, use `quotacheck -c 64';
if you wish to revert from 64-bit quotas back to 32-bit quotas,
use `quotacheck -c 32'.

There is a new library of functions to simplify the use of the
quota system, do `man quotafile' for details. If your application
is currently using the quotactl(2), it is highly recommended that
you convert your application to use the quotafile interface.
Note that existing binaries will continue to work.

Special thanks to John Kozubik of rsync.net for getting me
interested in pursuing 64-bit quota support and for funding
part of my development time on this project.
2010-05-07 00:41:12 +00:00
Jilles Tjoelker
c84cab5626 Update xrefs from 4.3BSD to modern signal functions in various man pages.
sigvec(2) references have been updated to sigaction(2), sigsetmask(2) and
sigblock(2) to sigprocmask(2), sigpause(2) to sigsuspend(2).

Some legacy man pages still refer to them, that is OK.
2010-05-06 22:49:54 +00:00
Jilles Tjoelker
29b7bdea79 sigaltstack(2): document some modernizations:
* un-document 'struct sigaltstack' tag for stack_t as this is BSD-specific;
  this doesn't seem useful enough to document as such
* alternate stacks are per thread, not per process
* update error codes to what the kernel does and POSIX requires

MFC after:	1 week
2010-05-06 22:06:14 +00:00
Kirk McKusick
945f418ab8 Final update to current version of head in preparation for reintegration. 2010-05-06 17:37:23 +00:00
Konstantin Belousov
f742a317e6 Document RUSAGE_THREAD.
Reviewed by:	bde
MFC after:	1 week
2010-05-04 06:01:25 +00:00
Kirk McKusick
a4bf5fb987 Update to current version of head. 2010-04-28 05:33:59 +00:00
Jilles Tjoelker
b559746adb unlinkat(2): unlinkat(AT_REMOVEDIR) fails with ENOTEMPTY like rmdir()
for non-empty directories.

POSIX permits both ENOTEMPTY and EEXIST, but we use the clearer ENOTEMPTY,
following BSD tradition.

MFC after:	1 week
2010-04-25 13:55:52 +00:00
Jilles Tjoelker
67c8bc1bfb sysctl(3): Update description of various kern.* variables.
Also add xrefs for confstr(3) (as sysconf(3) but for strings) and kvm(3)
(which is a more convenient way to access some of the variables).

PR:		116480
MFC after:	1 week
2010-04-25 12:35:39 +00:00
Konstantin Belousov
431c9bf2d5 C language does not has references, it provides pointers.
Suggested by:	bde
MFC after:	2 weeks
2010-04-21 19:35:56 +00:00
Konstantin Belousov
7e36a19d51 Add standards section, improve wording, taking into account the handling
of NULL and changed type in declaration.

Suggested by:	bde
MFC after:	2 weeks
2010-04-21 16:41:02 +00:00
Konstantin Belousov
655c8a600b Free() is not allowed to modify errno, remove safety brackets around it [1].
Add small optimization, do not copy a string to the buffer that is
to be freed immediately after.

Noted by:	jh [1]
Reviewed by:	jh
MFC after:	2 weeks
2010-04-20 14:22:29 +00:00
Konstantin Belousov
9d79ec20fb Slightly modernize realpath(3).
SUSv4 requires that implementation returns EINVAL if supplied path is NULL,
and ENOENT if path is empty string [1].
Bring prototype in conformance with SUSv4, adding restrict keywords.
Allow the resolved path buffer pointer be NULL, in which case realpath(3)
allocates storage with malloc().

PR:	kern/121897 [1]
MFC after:	2 weeks
2010-04-20 10:16:44 +00:00
Konstantin Belousov
8d03319930 Revert r206649.
Simplify the presented declaration of struct sigaction, noting the
caveat in the text. Real layout of the structure and exposed
implementation namespace only obfuscates the usage.

Submitted by:	bde
MFC after:	3 days
2010-04-18 18:23:11 +00:00
Jilles Tjoelker
702f62fb48 getcwd(3): Clarify that EACCES may or may not be checked.
POSIX permits but does not require checking access on the current and parent
directories.

Because various programs do not like it if getcwd(3) fails, it seems best
to avoid checking access as much as possible. There are various reports in
GNATS about this (search for getcwd).

Our getcwd(3) implementation first queries the kernel for the pathname
directly, which does not check any permissions but sometimes fails, and then
falls back to reading all parent directories for the names.

PR:		standards/44425
MFC after:	2 weeks
2010-04-17 15:52:50 +00:00
Jilles Tjoelker
139ac6b239 fnmatch: Fix bad FNM_PERIOD disabling if an asterisk has been seen.
Example: fnmatch("a*b/*", "abbb/.x", FNM_PATHNAME | FNM_PERIOD)

PR:		116074
MFC after:	1 week
2010-04-16 22:29:24 +00:00
Konstantin Belousov
fdfa00ba83 Still reference struct __sigaction with clarification when this form
of argument declaration is needed.

Discussed with:	bde
MFC after:	3 days
2010-04-15 08:32:50 +00:00
Ulrich Spörlein
aa12cea2cc mdoc: order prologue macros consistently by Dd/Dt/Os
Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by:	ru
Approved by:	philip, ed (mentors)
2010-04-14 19:08:06 +00:00
Ulrich Spörlein
e03aa09b61 mdoc: don't abuse Bo/Pc to get what looks like an interval
Be explicit and use the general bracketing form plus symbols which are
to be interpreted mathematically in this case.

Complaint by:	mdocml
Reviewed by:	ru
Approved by:	philip, ed (mentors)
2010-04-14 18:29:34 +00:00
Ulrich Spörlein
a17c1cc009 mdoc: remove .Pp where not needed
This trips up mdocml and can simply go away.

Reviewed by:	ru
Approved by:	philip, ed (mentors)
2010-04-14 18:29:26 +00:00
Konstantin Belousov
c720aa5217 Align the declaration for sa_sigaction with POSIX.
MFC after:	3 days
2010-04-13 08:56:03 +00:00
Marius Strobl
92cb9b0578 Add #endif missed in r206490. 2010-04-11 21:22:02 +00:00
Marius Strobl
b7e9bee71c While SPARC V9 allows tininess to be detected either before or after
rounding (impl. dep. #55), the SPARC JPS1 responsible for SPARC64 and
UltraSPARC processors defines that in all cases  tininess is detected
before rounding therefore rounding up to the smallest normalized number
should set the underflow flag. This change is needed for using SoftFloat
on sparc64 for reference purposes.

PR:		144900
Submitted by:	Peter Jeremy
2010-04-11 20:08:54 +00:00
Hajimu UMEMOTO
79bbdc60dc Use the stored length value instead of calculating it by strlen(). 2010-04-06 12:33:05 +00:00
David E. O'Brien
6a18a77221 I feel this wording of the history is more clear.
ANSIfy vasprintf() while I'm here.
2010-04-05 22:09:29 +00:00
Andriy Gapon
f3c733e82b libc/db/hash: cap auto-tuned block size with a value that actually works
This fix mostly matters after r206129 that made it possible for
st_blksize to be greater than 4K.  For this reason, this change should
be MFC-ed before r206129.
Also, it seems that all FreeBSD uitlities that use db(3) hash databases
and create new databases in files, specify their own block size value
and thus do not depend on block size autotuning.

PR:		bin/144446
Submitted by:	Peter Jeremy <peterjeremy@acm.org>
MFC after:	5 days
2010-04-05 10:12:21 +00:00
Andriy Gapon
983419fe1e hash.3: fix a factual mistake in the man page
PR:		bin/144446
Submitted by:	Peter Jeremy <peterjeremy@acm.org>
MFC after:	3 days
2010-04-05 10:01:53 +00:00
Hajimu UMEMOTO
e622b47989 Add capability to use a db version of services. It is enabled by
specifying `db' as source of service in /etc/nsswitch.conf.

MFC after:	2 weeks
2010-04-04 08:31:03 +00:00
Hajimu UMEMOTO
dc6ab8ddb4 Reduce duplicate code.
MFC after:	2 weeks
2010-04-04 07:31:10 +00:00
Hajimu UMEMOTO
aea86367e8 Treat '+' as special only when in compat mode, and simplify
the logic bit.

MFC after:	2 weeks
2010-04-04 07:21:45 +00:00
Hajimu UMEMOTO
8390eaedcc Stop adding trailing '\n'. The servent_unpack() doesn't expect
lines terminated with '\n'.

MFC after:	2 weeks
2010-04-04 07:02:10 +00:00
Xin LI
64c12e81e2 Add prototype for libc internal interfaces. 2010-03-31 18:37:00 +00:00
Xin LI
9fd9d097aa Add prototypes for libc private interfaces.
While I'm there, apply __unused whenever appropriate.

Reviewed by:	md5(1)
2010-03-31 18:36:04 +00:00
Edward Tomasz Napierala
48463a6747 Make acl_to_text_np(3) not crash on long group or user names in NFSv4 ACLs.
PR:		amd64/145091
MFC after:	2 weeks
2010-03-28 17:29:15 +00:00
Ed Schouten
435d267423 Don't forget to bump the date in the man page. 2010-03-28 13:40:13 +00:00
Ed Schouten
510ea843ba Rename st_*timespec fields to st_*tim for POSIX 2008 compliance.
A nice thing about POSIX 2008 is that it finally standardizes a way to
obtain file access/modification/change times in sub-second precision,
namely using struct timespec, which we already have for a very long
time. Unfortunately POSIX uses different names.

This commit adds compatibility macros, so existing code should still
build properly. Also change all source code in the kernel to work
without any of the compatibility macros. This makes it all a less
ambiguous.

I am also renaming st_birthtime to st_birthtim, even though it was a
local extension anyway. It seems Cygwin also has a st_birthtim.
2010-03-28 13:13:22 +00:00
Pietro Cerutti
071ab531db - Remove const'ness from dlerror(3) prototype, for consistency with POSIX.
Approved by:	cognet
MFC after:	1 week
2010-03-24 15:59:51 +00:00
John Baldwin
5711bf30da Reject attempts to create a MAP_ANON mapping with a non-zero offset.
PR:		kern/71258
Submitted by:	Alexander Best
MFC after:	2 weeks
2010-03-23 21:08:07 +00:00
Ed Schouten
070f2a9831 Let opendir() use O_DIRECTORY.
I am not removing the fstat() calls here, since we cannot yet assume
people will always run kernels that respect O_DIRECTORY.
2010-03-21 20:45:06 +00:00
Ed Schouten
0fef797f4a Actually make O_DIRECTORY work.
According to POSIX open() must return ENOTDIR when the path name does
not refer to a path name. Change vn_open() to respect this flag. This
also simplifies the Linuxolator a bit.
2010-03-21 20:43:23 +00:00
Marius Strobl
be05bc3ffb Avoid aliasing which leads to incorrect results when compiling with the
default strict aliasing rules.

PR:		144900
Submitted by:	Peter Jeremy
MFC after:	3 days
2010-03-21 13:18:08 +00:00
Marius Strobl
b28ad3ebc9 - While SPARC V9 allows tininess to be detected either before or after
rounding (impl. dep. #55), the SPARC JPS1 responsible for SPARC64 and
  UltraSPARC processors defines that in all cases tinyness is detected
  before rounding, therefore rounding up to the smallest normalised
  number should set the underflow flag.
- If an infinite result is rounded down, the result should have an
  exponent 1 less than the value for infinity.

PR:		144900
Submitted by:	Peter Jeremy
MFC after:	3 days
2010-03-20 22:32:13 +00:00
Marius Strobl
bd2ec8519e Division should take both arguments' signs into account when the
the dividend is infinity or zero and the divisor is not the same.

PR:		144900
Submitted by:	Peter Jeremy
MFC after:	3 days
2010-03-20 22:12:15 +00:00
Marius Strobl
484bacf4b9 FPU_DEBUG requires <stdio.h>.
PR:		144900
Submitted by:	Peter Jeremy
MFC after:	3 days
2010-03-20 21:27:44 +00:00
Marius Strobl
4dda9dfd81 Ensure that __fpu_ftox() both returns the high bits and res[1] contains
the low bits also in the default case.

PR:		144900
Obtained from:	OpenBSD
MFC after:	3 days
2010-03-20 21:15:56 +00:00