Commit Graph

6158 Commits

Author SHA1 Message Date
John Baldwin
4e1fc19cea Revert the previous change to pthread_once() stub in libc. It is actually
a feature that libstdc++ depends on to simulate the behavior of libc's
internal '__isthreaded' variable.  One benefit of this is that _libc_once()
is now private to _once_stub.c.

Requested by:	kan
2009-11-20 20:43:34 +00:00
John Baldwin
21b9a000c7 Replace gmt_is_set and the gmt_mutex lock with a pthread_once_t variable and
an init routine run on the first invocation via _once().

MFC after:	1 week
2009-11-20 19:21:33 +00:00
John Baldwin
5bcfe82e47 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.  The libc stub-version of pthread_once() now also uses the
simplified "stub" version as well instead of being a nop.

Reviewed by:	deischen, Matthew Fleming @ Isilon
Suggested by:	alc
MFC after:	1 week
2009-11-20 19:19:51 +00:00
Gabor Kovesdan
50497e556b - Update Hungarian libc catalog 2009-11-17 18:57:44 +00:00
David E. O'Brien
8b49e38f8f Catch up with r130332 which changed the default timezone from GMT to UTC.
Otherwise the tzload() (when called by gmtload()) fails to locate the UTC
file and loads the posixrules.
2009-11-17 16:29:39 +00:00
Jung-uk Kim
853ab1b70d Sync with C.msg r199083. 2009-11-16 19:10:09 +00:00
Christian Brueffer
11ea9440c3 Fix grammar.
PR:		140459
Submitted by:	Jeremy Huddleston <Jeremyhu@apple.com>
MFC after:	1 week
2009-11-16 14:33:31 +00:00
Christian Brueffer
4f6d5fda02 Fix a memory leak in acl_from_text() in case the conversion succeeded.
Submitted by:	Jim Wilcoxson <prirun@gmail.com>
MFC after:	1 week
2009-11-16 09:28:22 +00:00
Colin Percival
8a7f1847b7 Change the utrace log entry for malloc_init from (0, 0, 0) to (-1, 0, 0)
in order to distinguish it from free(NULL), which is logged as (0, 0, 0).

Reviewed by:	jhb
2009-11-14 09:31:47 +00:00
Christian Brueffer
4c1195a4d1 Remove a note about vfork(4) going to be eliminated, it's here to stay.
Submitted by:	kib
MFC after:	1 week
2009-11-13 13:26:27 +00:00
Christian Brueffer
62bf66541e Improved the manpage description. The committed wording
was provided by jhb.

PR:		140528
Submitted by:	Chris Petrik <chris@officialunix.com>
Discussed with:	remko, jhb and the submitter
MFC after:	1 week
2009-11-13 13:13:35 +00:00
Peter Pentchev
753509aeb6 Fix the grammar in the isprint(3) description.
PR:		140456
Submitted by:	Jeremy Huddleston <jeremyhu@apple.com>
2009-11-13 09:07:33 +00:00
Peter Pentchev
94317a7384 Fix the grammar in the isgraph(3) description, almost as per the PR.
PR:		140455
Submitted by:	Jeremy Huddleston <jeremyhu@apple.com>
MFC after:	2 weeks
2009-11-13 09:03:50 +00:00
Hajimu UMEMOTO
823e5e0ebf Add missing IEEE1394 support dropped during merge from NetBSD. 2009-11-12 11:54:12 +00:00
Rene Ladan
6c2af98cee Synchronize with C.msg revision 199083 and improve some existing messages.
Reviewed by:	remko
Approved by:	remko
2009-11-11 18:28:12 +00:00
Hajimu UMEMOTO
a087c7295d ANSIfy.
MFC after:	1 week
2009-11-11 15:21:06 +00:00
Peter Pentchev
82a1bd6a61 Fix the grammar as in the PR, and then some.
PR:		140454
Submitted by:	Jeremy Huddleston <jeremyhu@apple.com>
MFC after:	2 weeks
2009-11-11 11:31:02 +00:00
Hajimu UMEMOTO
1789887000 Add Japanese catalogue entries for newer errnos: EBADMSG, EMULTIHOP,
ENOLINK, EPROTO, ENOTCAPABLE.
2009-11-10 03:56:51 +00:00
Hajimu UMEMOTO
9020e36353 Add gai_strerror() catalog for ja_JP.UTF-8 and ja_JP.eucJP. 2009-11-09 17:26:16 +00:00
Hajimu UMEMOTO
0d384326cd Add NLS catalogs support to gai_strerror(3).
Controlled by NLS define.
2009-11-09 12:46:59 +00:00
Hajimu UMEMOTO
42f4692f52 Fix comment.
Pointed out by:	nyan
MFC after:	1 week
2009-11-09 12:38:13 +00:00
Hajimu UMEMOTO
be77e7423c Add ja_JP.eucJP catalog.
Reviewed by:	hrs, nork, takawata
MFC after:	1 week
2009-11-09 12:33:47 +00:00
Hajimu UMEMOTO
6bf41ac159 Add ja_JP.UTF-8 catalog.
Reviewed by:	hrs, nork, takawata
MFC after:	1 week
2009-11-09 12:28:59 +00:00
Christian Brueffer
36ba9f409d Fix a copy+paste error by checking the correct variable against MM_NULLACT.
PR:		140386
Submitted by:	soulcatcher <soulcatcher13@gmail.com
MFC after:	1 week
2009-11-08 14:02:54 +00:00
Gabor Kovesdan
f93a16d57d - Strip trailing CRs
Requested by:	Alex Kozlov <spam@rm-rf.kiev.ua> (via private mail)
2009-11-08 11:55:03 +00:00
Gabor Kovesdan
88260ae614 - Update Ukranian catalog
Submitted by:	Alex Kozlov <spam@rm-rf.kiev.ua> (via private mail)
2009-11-08 11:32:39 +00:00
Ed Schouten
54a1c2b5aa Add MAP_ANONYMOUS.
Many operating systems also provide MAP_ANONYMOUS. It's not hard to
support this ourselves, we'd better add it to make it more likely for
applications to work out of the box.

Reviewed by:	alc (mman.h)
2009-11-06 07:17:31 +00:00
Christian Brueffer
cf6c5eebe7 Use our canonical .Dd format.
Submitted by:	Ulrich Spoerlein
2009-11-02 12:35:38 +00:00
Colin Percival
4054af4fb0 Attempt to reduce accidental foot-shooting by pointing out that
accept(2)ed sockets do not necessarily inherit O_NONBLOCK from
listening sockets on non-FreeBSD platforms.

Feet shot:	cperciva
MFC after:	1 month
2009-11-02 07:21:13 +00:00
Konstantin Belousov
9a714660ef Move pselect(3) man page to section 2.
Noted by:	jhb
MFC after:	1 month
2009-10-28 11:14:32 +00:00
Konstantin Belousov
6de630f925 Commit libc files missed in r198508 2009-10-27 10:57:53 +00:00
Konstantin Belousov
066d836b02 Current pselect(3) is implemented in usermode and thus vulnerable to
well-known race condition, which elimination was the reason for the
function appearance in first place. If sigmask supplied as argument to
pselect() enables a signal, the signal might be delivered before thread
called select(2), causing lost wakeup. Reimplement pselect() in kernel,
making change of sigmask and sleep atomic.

Since signal shall be delivered to the usermode, but sigmask restored,
set TDP_OLDMASK and save old mask in td_oldsigmask. The TDP_OLDMASK
should be cleared by ast() in case signal was not gelivered during
syscall execution.

Reviewed by:	davidxu
Tested by:	pho
MFC after:	1 month
2009-10-27 10:55:34 +00:00
Jilles Tjoelker
364e9ccb9c 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
MFC after:	1 month
2009-10-23 14:50:11 +00:00
Jilles Tjoelker
680db4952e Make getcwd(3) faster, simpler and more compliant using *at syscalls.
It is no longer necessary to construct long paths consisting of repeated
"../" which may be slow to process and may exceed PATH_MAX.
2009-10-13 20:58:22 +00:00
Robert Watson
8c8ee3d3b8 Add C message catalogue entries for newer errnos: EBADMSG, EMULTIHOP,
ENOLINK, EPROTO, ENOTCAPABLE.

Submitted by:	Alan R. S. Bueno <alan.bsd at gmail.com>
MFC after:	3 days (most)
2009-10-13 17:57:06 +00:00
Jilles Tjoelker
29670497af Make openat(2) a cancellation point.
This is required by POSIX and matches open(2).

Reviewed by:	kib, jhb
MFC after:	1 month
2009-10-11 20:19:45 +00:00
Konstantin Belousov
0a747fb23c 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.
2009-10-11 16:23:11 +00:00
David Schultz
6cc40ae58b Document errno codes added in r144530. 2009-10-11 00:08:55 +00:00
Robert Watson
44a43f00ed 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.

MFC after:	1 month
Sponsored by:	Google
2009-10-07 20:20:51 +00:00
Robert Watson
a502a84d5a Add basename_r(3) to complement basename(3). basename_r(3) which accepts
a caller-allocated buffer of at least MAXPATHLEN, rather than using a
global buffer.

MFC after:	1 month
Sponsored by:	Google
2009-10-06 14:05:57 +00:00
Xin LI
8b8a820ded fts_open() requires that the list passed as argument to contain at least
one path.  When the list is empty (contain only a NULL pointer), return
EINVAL instead of pretending to succeed, which will cause a NULL pointer
deference in a later fts_read() call.

Noticed by:	Christoph Mallon (via rdivacky@)
MFC after:	2 weeks
2009-10-05 21:11:04 +00:00
Edwin Groothuis
28c42042d8 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.

MFC after:      1 week
2009-10-05 07:13:15 +00:00
David Schultz
7e817e2a03 Better glibc compatibility for getline/getdelim:
- Tolerate applications that pass a NULL pointer for the buffer and
  claim that the capacity of the buffer is nonzero.

- If an application passes in a non-NULL buffer pointer and claims the
  buffer has zero capacity, we should free (well, realloc) it
  anyway. It could have been obtained from malloc(0), so failing to
  free it would be a small memory leak.

MFC After:	2 weeks
Reported by:	naddy
PR:		ports/138320
2009-10-04 19:43:36 +00:00
Joe Marcus Clarke
ad1e5416ab 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:	kib
		deischen (threads)
MFC after:	3 days
2009-10-01 18:23:50 +00:00
Xin LI
82aebf697c 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.

Submitted by:	Igor Sysoev <is rambler-co ru>
Reviewed by:	kib@
MFC after:	1 month
2009-09-28 16:59:47 +00:00
Gabor Kovesdan
bc65e45307 - Add Galician NLS catalog 2009-09-27 13:16:38 +00:00
Alan Cox
b8947edcb6 Make malloc(3) superpage aware. Specifically, if getpagesizes(3) returns
a large page size that is greater than malloc(3)'s default chunk size but
less than or equal to 4 MB, then increase the chunk size to match the large
page size.

Most often, using a chunk size that is less than the large page size is not
a problem.  However, consider a long-running application that allocates and
frees significant amounts of memory.  In particular, it frees enough memory
at times that some of that memory is munmap()ed.  Up until the first
munmap(), a 1MB chunk size is just fine; it's not a problem for the virtual
memory system.  Two adjacent 1MB chunks that are aligned on a 2MB boundary
will be promoted automatically to a superpage even though they were
allocated at different times.  The trouble begins with the munmap(),
releasing a 1MB chunk will trigger the demotion of the containing superpage,
leaving behind a half-used 2MB reservation.  Now comes the real problem.
Unfortunately, when the application needs to allocate more memory, and it
recycles the previously munmap()ed address range, the implementation of
mmap() won't be able to reuse the reservation.  Basically, the coalescing
rules in the virtual memory system don't allow this new range to combine
with its neighbor.  The effect being that superpage promotion will not
reoccur for this range of addresses until both 1MB chunks are freed at some
point in the future.

Reviewed by:	jasone
MFC after:	3 weeks
2009-09-26 18:20:40 +00:00
Alan Cox
403109055f Correct a section name; specifically, "AUTHOR" should be "AUTHORS". [1]
Turn the "AUTHORS" section into a full sentence.

Pointed out by: ru [1]
2009-09-21 18:02:02 +00:00
Alan Cox
aa35c4db08 Add getpagesizes(3). This functions either the number of supported page
sizes or some number of the sizes themselves.  It is functionally
compatible with a function by the same name under Solaris.

Reviewed by:	jhb
2009-09-19 18:01:32 +00:00
Christian Brueffer
8fba046b09 Fix setfib(1) section number.
PR:		133765
Submitted by:	Konstantin Zolotukhin <erebus@gorodok.net>
MFC after:	3 days
2009-09-18 14:17:00 +00:00