Commit Graph

13443 Commits

Author SHA1 Message Date
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
George V. Neville-Neil
51cc3ad710 Fix punctuation and grammar, mostly by ending sentences with a period.
MFC after:	1 day
2010-10-04 14:32:14 +00:00
Dimitry Andric
b3b74eb4e1 Use __FBSDID() instead of RCSID() in most .S files under lib/msun/i386,
and one under lib/msun/amd64.  This avoids adding the identifiers to the
.text section, and moves them to the .comment section instead.

Suggested by:	bde
Approved by:	rpaulo (mentor)
2010-10-01 20:14:36 +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
David Xu
722488013d change code to use unwind.h. 2010-09-30 12:59:56 +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
ec92603cf9 Check invalid mutex in _mutex_cv_unlock. 2010-09-29 06:06:58 +00:00
David Xu
bbb64c2143 In current code, statically initialized and destroyed object have
same null value, the code can not distinguish between them, to
fix the problem, now a destroyed object is assigned to a non-null
value, and it will be rejected by some pthread functions.
PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP is changed to number 1, so that
adaptive mutex can be statically initialized correctly.
2010-09-28 04:57:56 +00:00
Ed Maste
f657d618ce Increase maximum network timeout from 20s to 120s. Given that an ETIMEDOUT
return from sendrecv probably means a failure to boot we might as well be
generous in the timeout period.
2010-09-28 01:30:49 +00:00
David Xu
1d5b5089aa Report death event to debugger before moving to gc list, otherwise
debugger may can not find it on thread list.
2010-09-26 06:45:24 +00:00
David Xu
8be6abcdc6 Only access unwind_disabled when _PTHREAD_FORCED_UNWIND is defined. 2010-09-25 09:43:24 +00:00
David Xu
9f1dc4c107 Add missing field. 2010-09-25 08:36:46 +00:00
David Xu
8690b9f6dd Because old _pthread_cleanup_push/pop do not have frame address,
it is incompatible with stack unwinding code, if they are invoked,
disable stack unwinding for current thread, and when thread is
exiting, print a warning message.
2010-09-25 06:27:09 +00:00
David Xu
6f066bb387 Simplify code, and in while loop, fix operator to match the unwinding
direction.
2010-09-25 04:21:31 +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
David Xu
e5c66a0d9e inline testcancel() into thr_cancel_leave(), because cancel_pending is
almost false, this makes a slight better branch predicting.
2010-09-24 13:01:01 +00:00
David Xu
93ea4a71bf In most cases, cancel_point and cancel_async needn't be checked again,
because cancellation is almostly checked at cancellation points.
2010-09-24 07:52:07 +00:00
Maksim Yevmenkin
ff7e67ac1c Add the following Linux BlueZ compatibility macros: htobs(), htobl(),
btohs() and btohl()

PR:		kern/136386
Submitted by:	Monty Hall < kungfu_disciple at sbcglobal dot net >
MFC after:	1 week
2010-09-22 23:41:02 +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
David Xu
81f3e99c56 If we are at cancellation point, always work as deferred mode despite
whether asynchronous mode is turned on or not, this always gives us a
chance to decide whether thread should be canceled or not in
cancellation points.
2010-09-21 06:47:04 +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
Dimitry Andric
e580952d8a Upgrade our Clang in base to r114020, from upstream's release_28 branch.
Approved-by:	rpaulo (mentor)
2010-09-20 16:43:17 +00:00
Dimitry Andric
3fe0686746 In all Makefiles under lib/clang, consistently use tabs instead of
spaces after the '=' sign in macro assignments.

Approved-by:	rpaulo (mentor)
2010-09-19 10:54:58 +00:00
David Xu
4173ebef4f Because atfork lock is held while forking, a thread cancellation triggered
by atfork handler is unsafe, use intenal flag no_cancel to disable it.
2010-09-19 09:03:11 +00:00
David Xu
7c243121b7 Fix typo. 2010-09-19 08:55:36 +00:00
David Xu
a5793db975 - _Unwind_Resume function is not used, remove it.
- Use a store barrier to make sure uwl_forcedunwind is lastest thing
  other threads can see.
- Add some comments.
2010-09-19 05:42:29 +00:00
David Xu
4da1da4b6e Fix a race condition when finding stack unwinding functions. 2010-09-19 05:19:47 +00:00
Rui Paulo
320807de5e Ignore EINTR when calling waitpid. 2010-09-18 23:38:21 +00:00
Dimitry Andric
3d1dcd9bfd Vendor import of clang r114020 (from the release_28 branch):
http://llvm.org/svn/llvm-project/cfe/branches/release_28@114020

Approved by:	rpaulo (mentor)
2010-09-17 15:54:40 +00:00
Dimitry Andric
d39c594d39 Vendor import of llvm r114020 (from the release_28 branch):
http://llvm.org/svn/llvm-project/llvm/branches/release_28@114020

Approved by:	rpaulo (mentor)
2010-09-17 15:48:55 +00:00
Dimitry Andric
a0482fa4e7 Make vendor/clang/dist exactly the same as upstream's r108428. Some
files and directories were already added/removed in the upstream
repository, but were not added/removed here, when the previous snapshot
was imported.

Note: I did not import the file test/Lexer/conflict-marker.c, because it
contains merge conflict markers on purpose, which upsets our pre-commit
hooks.

Approved by:	rpaulo (mentor)
2010-09-16 21:14:28 +00:00
David Xu
3832fd24f1 add code to support stack unwinding when thread exits. note that only
defer-mode cancellation works, asynchrnous mode does not work because
it lacks of libuwind's support. stack unwinding is not enabled unless
LIBTHR_UNWIND_STACK is defined in Makefile.
2010-09-15 02:56:32 +00:00
David Xu
707ee8154d Move back IN_GCLIST flag into field tlflags, since thread list and gc list
still share same lock.
2010-09-15 01:21:30 +00:00
David Xu
7820a71113 Don't compare thread pointers again. 2010-09-13 11:58:42 +00:00
David Xu
cbadc1d7ad Fix copy&paste problem. 2010-09-13 11:57:46 +00:00
David Xu
fa1efe5efd Update symbol. 2010-09-13 09:23:38 +00:00
David Xu
b749a04db3 PS_DEAD state needs not be checked because _thr_find_thread() has already
checked it.
2010-09-13 07:18:00 +00:00
David Xu
a9b764e218 Convert thread list lock from mutex to rwlock. 2010-09-13 07:03:01 +00:00
Warner Losh
fca5b4f4d9 This is exactly the same as the .else, so remove it. 2010-09-13 04:23:23 +00:00
Warner Losh
165721e3b1 MFtbemd: Move to using MACHINE_CPUARCH, now that it is safe. 2010-09-13 01:44:56 +00:00
Warner Losh
c885004b9e Include FreeBSD svn tag 2010-09-13 01:44:07 +00:00
Warner Losh
10f3ae5899 Merge from tbemd, with a small amount of rework:
For all libthr contexts, use ${MACHINE_CPUARCH}
for all libc contexts, use ${MACHINE_ARCH} if it exists, otherwise use
${MACHINE_CPUARCH}
Move some common code up a layer (the .PATH statement was the same in
all the arch submakefiles).

# Hope she hasn't busted powerpc64 with this...
2010-09-13 01:43:10 +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