Commit Graph

6119 Commits

Author SHA1 Message Date
John Baldwin
5ff95453cc MFC 199606, 199614:
Add an internal _once() method.  This works identical to pthread_once(3)
with the additional property that it is safe for routines in libc to use
in both single-threaded and multi-threaded processes.  Multi-threaded
processes use the pthread_once() implementation from the threading library
while single-threaded processes use a simplified "stub" version internal
to libc.
2009-12-17 20:41:27 +00:00
Robert Watson
f7000239aa Merge r197841 from head to stable/8:
Add a new errno, ENOTCAPABLE, to be returned when a process requests an
  operation on a file descriptor that is not authorized by the descriptor's
  capability flags.

  Sponsored by:	Google
2009-12-14 13:13:43 +00:00
Xin LI
931d13672c MFC revision 197579 and 199617:
Add two new fcntls to enable/disable read-ahead:

 - F_READAHEAD: specify the amount for sequential access.  The amount is
   specified in bytes and is rounded up to nearest block size.
 - F_RDAHEAD: Darwin compatible version that use 128KB as the sequential
   access size.

A third argument of zero disables the read-ahead behavior.

Please note that the read-ahead amount is also constrainted by sysctl
variable, vfs.read_max, which may need to be raised in order to better
utilize this feature.

Thanks Igor Sysoev for proposing the feature and submitting the original
version, and kib@ for his valuable comments.
2009-12-07 19:59:28 +00:00
John Baldwin
cd6d7a15cf MFC 200061:
The fd_mask type is an unsigned long, not an int, so treat the mask as a
long instead of an int when examining the results of select() to look for
RPC requests.  Previously this routine would ignore RPC requests to sockets
whose file descriptor mod 64 was greater than 31 on a 64-bit platform.
2009-12-07 19:07:45 +00:00
Christian Brueffer
02a7ccf746 MFC: r200019
Fix the dprintf() prototype.
2009-12-07 08:38:44 +00:00
Jilles Tjoelker
2ffbb2cea1 MFC r198406: wordexp(3): fix some bugs with signals and long outputs
* retry various system calls on EINTR
* retry the rest after a short read (common if there is more than about 1K
  of output)
* block SIGCHLD like system(3) does (note that this does not and cannot
  work fully in threaded programs, they will need to be careful with wait
  functions)

PR:		90580
2009-12-06 22:14:58 +00:00
Jaakko Heinonen
21148e9257 MFC r199843:
Clarify that the value of the fts_info field is different in post-order.

Approved by:	trasz (mentor)
2009-12-04 11:26:52 +00:00
Christian Brueffer
e043b4c399 MFC: r199988
Add an .Nm for strncat.
2009-12-04 07:08:15 +00:00
Garrett Wollman
28f2223875 MFC revs 199781,199782,199784,199785,199786:
Eliminate dead stores.

  In __mbsconv(), if prec was zero, nconv could have been used
  uninitialized.  Initialize it to a safe value so that there's no
  chance of returning an error if stack garbage happens to be equal to
  (size_t)-1 or (size_t)-2.

  In svc_raw_reply(), don't leave stat uninitialized if the MSG_ACCEPTED
  && SUCCESS case succeeds.  The stack garbage might be zero.

  In clnt_raw_create(), avoid minor race condition initializing the
  file-scope variable clntraw_private.

Found by:		Clang static analyzer
2009-12-02 02:47:29 +00:00
Peter Pentchev
c6a4ef661d Merge rev. 199180 to 8.x-STABLE, the change to isblank(3):
Fix the grammar as in the PR, and then some.

PR:             140454
Submitted by:   Jeremy Huddleston <jeremyhu@apple.com>
2009-11-25 10:52:07 +00:00
Christian Brueffer
25cf40cbc9 MFC: r199320
Fix grammar.
2009-11-23 09:44:08 +00:00
Christian Brueffer
234c497e6a MFC: r199317
Fix a memory leak in acl_from_text() in case the conversion succeeded.
2009-11-23 09:10:08 +00:00
Hajimu UMEMOTO
1b05fd6074 MFC r199092: Add gai_strerror() catalog for ja_JP.UTF-8
and ja_JP.eucJP.
2009-11-22 17:08:52 +00:00
Hajimu UMEMOTO
b119cf74a1 MFC r199083: Add NLS catalogs support to gai_strerror(3).
Controlled by NLS define.
2009-11-22 17:05:46 +00:00
Christian Brueffer
a154a457ff MFC: r199255, r199257
Improved the manpage description.  The committed wording
was provided by jhb.

Remove a note about vfork(4) going to be eliminated, it's here to stay.
2009-11-20 06:55:35 +00:00
Hajimu UMEMOTO
a1a32e5e31 MFC r199188: ANSIfy. 2009-11-18 14:40:00 +00:00
Christian Brueffer
841de8ae65 MFC: r199046
Fix a copy+paste error by checking the correct variable against MM_NULLACT.
2009-11-16 08:26:56 +00:00
Hajimu UMEMOTO
26520868bc MFC r199080, r199081, r199082:
Add ja_JP.UTF-8 and ja_JP.eucJP catalogs.
2009-11-16 03:52:18 +00:00
Alan Cox
225da9692c MFC r197524
Make malloc(3) superpage aware.
2009-11-02 18:44:01 +00:00
Alan Cox
12e8008e6d MFC r197163
Add the FBSD_1.2 namespace.

Reminded by:	kib
2009-11-01 20:24:17 +00:00
Alan Cox
588b5e6ee8 MFC r197331, r197394
Add getpagesizes(3).
2009-11-01 19:22:07 +00:00
Stacey Son
83613795b2 MFC 197240,197241,197242,197243,197293,197294,197407:
Add EVFILT_USER filter and EV_DISPATCH/EV_RECEIPT flags to kevent(2).

Approved by: rwatson (mentor)
2009-10-31 21:22:18 +00:00
Edwin Groothuis
05edd60be4 MFCs of r197764, r197765, r197766, r197847:
Modified locale(1) to be able to show the altmon_X fields and the
[cxX]_fmt's.  Also modify the "-k list" option to display only
fields with a certain prefix.

Add the comment "(FreeBSD only)" to the altmonth_x keywords
2009-10-31 06:35:40 +00:00
Alexander Kabaev
8ed4544ca7 MFC Revision 197277:
Make libc.a provide __stack_chk_fail_local weak alias. This is
needed to satisfy static libraries that are compiled with -fpic
and linked into static binary afterwards. Several libraries in
gcc are examples of such static libs.

Approved by: re (kib)
2009-10-20 19:05:43 +00:00
Konstantin Belousov
f7bca35675 MFC r197958:
In nanosleep(2), note that the calling thread is put to sleep, not the
whole process. Also explicitely name the parameter that specifies
sleep interval.

Approved by:	re (kensmith)
2009-10-14 14:26:19 +00:00
Christian Brueffer
225cdb4e6c MFC: r197312
Fix setfib(1) section number.

Approved by:	re (kib)
2009-10-09 13:52:49 +00:00
Joe Marcus Clarke
6c09384ae8 MFC: rev. 197681
Correct the pthread stub prototype for pthread_mutexattr_settype to allow for
the type argument.  This is known to fix some pthread_mutexattr_settype()
invocations, especially when it comes to pulseaudio.

Approved by:	re (kib)
2009-10-04 21:46:43 +00:00
Konstantin Belousov
80bc871bdd MFC r196861:
Handle zero size for posix_memalign. Return NULL or unique address
according to the 'V' option.

Approved by:	re (kensmith)
2009-09-12 18:16:46 +00:00
Ken Smith
ac7d4c93c6 Remove extra debugging support that is turned on for head but turned off
for stable branches:

	- shift to MALLOC_PRODUCTION
	- turn off automatic crash dumps
	- Remove kernel debuggers, INVARIANTS*[1], WITNESS* from
	  GENERIC kernel config files[2]

[1] INVARIANTS* left on for ia64 by request marcel
[2] sun4v was left as-is

Reviewed by:	marcel, kib
Approved by:	re (implicit)
2009-09-10 14:04:00 +00:00
Edward Tomasz Napierala
b9d99ec84d MFC r196740:
Fix regression introduced with NFSv4 ACL support - make acl_to_text(3)
and acl_calc_mask(3) return error instead of crashing when acl passed
to them is NULL.

Submitted by:	markus
Reviewed by:	rwatson
Approved by:	re (kib)
2009-09-05 15:01:56 +00:00
Xin LI
c291f85f32 MFC r196525:
Consider flag == 0 as the same of flag == R_NEXT.  This change will restore
a historical behavior that has been changed by revision 190491, and has seen
to break exim.

Approved by:	re (kib)
2009-08-28 19:48:06 +00:00
Ed Schouten
2025af696e MFC r196508:
Our implementation of granpt(3) could be valid in the future.

  When I wrote the pseudo-terminal driver for the MPSAFE TTY code, Robert
  Watson and I agreed the best way to implement this, would be to let
  posix_openpt() create a pseudo-terminal with proper permissions in place
  and let grantpt() and unlockpt() be no-ops.

  This isn't valid behaviour when looking at the spec. Because I thought
  it was an elegant solution, I filed a bug report at the Austin Group
  about this. In their last teleconference, they agreed on this subject.
  This means that future revisions of POSIX may allow grantpt() and
  unlockpt() to be no-ops if an open() on /dev/ptmx (if the implementation
  has such a device) and posix_openpt() already do the right thing.

  I'd rather put this in the manpage, because simply mentioning we don't
  comply to any standard makes it look worse than it is. Right now we
  don't, but at least we took care of it.

  Approved by:  re (kib)
2009-08-28 10:25:26 +00:00
Robert Watson
1f9b1ccbd0 Merge r196123 from head to stable/8:
Update posix1e-related man pages, especially as relates to MAC, to more
  accurately reflect the last ten years of work.

Approved by:	re (kib)
2009-08-13 15:08:05 +00:00
Alan Cox
5592fb2f9b Eliminate a stale paragraph from the BUGS section. This "bug" was
eliminated in r195693.

Approved by:	re (kensmith)
2009-07-26 06:38:56 +00:00
Ken Smith
764eca2591 It is believed the last subsystem that limited ID sizes to something
other than the current system-wide size (32-bits) has been updated so
for now just cautiously turn the check off.  While here fix the check
for IDs being too large which doesn't work due to type mis-matches.

Reviewed by:    jhb (previous version)
Approved by:	re (kib)
MFC after:	1 month (type mis-match fixes only)
2009-07-22 20:46:17 +00:00
Jilles Tjoelker
22e4c1c47c Correct AT_SYMLINK_FOLLOW flag name in linkat(2) man page.
Approved by:	re (kib), ed (mentor)
2009-07-19 16:48:25 +00:00
Konstantin Belousov
49e8c06b45 Implement RTLD_NOLOAD flag for dlopen(3).
Requested and tested by:	jkim
Reviewed by:	kan
Approved by:	re (kensmith)
2009-07-17 19:45:42 +00:00
Alexander Kabaev
2286fe7635 Second attempt at eliminating .text relocations in shared libraries
compiled with stack protector.

Use libssp_nonshared library to pull __stack_chk_fail_local symbol into
each library that needs it instead of pulling it from libc. GCC
generates local calls to this function which result in absolute
relocations put into position-independent code segment, making dynamic
loader do extra work every time given shared library is being relocated
and making affected text pages non-shareable.

Reviewed by:        kib
Approved by:        re (kib)
2009-07-14 21:19:13 +00:00
John Baldwin
0fe0ed8bf8 - Change mmap() to fail requests with EINVAL that pass a length of 0. This
behavior is mandated by POSIX.
- Do not fail requests that pass a length greater than SSIZE_MAX
  (such as > 2GB on 32-bit platforms).  The 'len' parameter is actually
  an unsigned 'size_t' so negative values don't really make sense.

Submitted by:	Alexander Best  alexbestms at math.uni-muenster.de
Reviewed by:	alc
Approved by:	re (kib)
MFC after:	1 week
2009-07-14 19:45:36 +00:00
Edward Tomasz Napierala
ec71a417a8 Add missing MLINKS for acl_{get,set}_link_fd(3).
Approved by:	re (kib)
2009-07-14 19:37:53 +00:00
Edward Tomasz Napierala
e64e7115aa Move msg{snd,recv,get,ctl} manual pages from section 3 to 2.
Approved by:	re (kib)
2009-07-13 12:53:43 +00:00
Ed Schouten
77822acff7 Fix fwrite() to return 0 when size or nmemb are zero.
Right now nmemb is returned when size is 0. In newer versions of the
standards, it is explicitly required that fwrite() should return 0.

Submitted by:	Christoph Mallon
Approved by:	re (kib)
2009-07-12 13:09:43 +00:00
Edward Tomasz Napierala
c38898116a There is an optimization in chmod(1), that makes it not to call chmod(2)
if the new file mode is the same as it was before; however, this
optimization must be disabled for filesystems that support NFSv4 ACLs.
Chmod uses pathconf(2) to determine whether this is the case - however,
pathconf(2) always follows symbolic links, while the 'chmod -h' doesn't.

This change adds lpathconf(3) to make it possible to solve that problem
in a clean way.

Reviewed by:	rwatson (earlier version)
Approved by:	re (kib)
2009-07-08 15:23:18 +00:00
Pawel Jakub Dawidek
69a789b985 - Don't suggest opening file for writing in preparation for fexecve(2).
- execve(2)/fexecve(2) won't return ETXTBSY if file is open for reading.

Approved by:	re (kib)
2009-07-05 20:20:09 +00:00
Edward Tomasz Napierala
bc8036862b Make it clear where to look for for protocol-specific socket options.
Reviewed by:	rwatson
Approved by:	re (kib)
2009-06-30 20:53:56 +00:00
Konstantin Belousov
8c8484d103 Make the structure definitions in the man pages match the real code, and
remove no longer valid caution.

Approved by:	re (kensmith)
2009-06-29 18:54:17 +00:00
Alexander Kabaev
d48890cfb8 Back out previous revision until better tested fix is ready.
Approved by: re (impliciti, by approving previos check-in)
2009-06-29 01:33:59 +00:00
Alexander Kabaev
a162c9ae9c Eliminate .text relocations in shared libraries compiled with stack protector.
Use libssp_nonshared library to pull __stack_chk_fail_local symbol into
each library that needs it instead of pulling it from libc. GCC generates
local calls to this function which result in absolute relocations put into
position-independent code segment, making dynamic loader do extra work everys
time given shared library is being relocated and making affected text pages
non-shareable.

Reviewed by:        kib
Approved by:        re (kensmith)
2009-06-28 23:51:39 +00:00
Xin LI
40523da708 Implement %z for strptime.
PR:		kern/63064
Submitted by:	Stefan `Sec` Zehl <sec 42 org> (with some small changes)
MFC after:	1 month
2009-06-25 23:59:23 +00:00
Edward Tomasz Napierala
c3380d406a Fix acl_set_fd(3) and acl_get_fd(3) for cases where the kernel doesn't know
anything about _PC_ACL_NFS4.
2009-06-25 20:57:53 +00:00