Commit Graph

13410 Commits

Author SHA1 Message Date
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
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
Kai Wang
ea22f625a7 libelf is overly strict about the type and alignment of Elf_Data
objects inside one ELF section, which prevents the creation of a ELF
section with mixed data types. For example, gcc LTO use libelf to
create a .gnu_lto_XXX section that contains integers and a string
table, which doesn't work with our libelf implementation.

The changes made in this commit include:
* Allow Elf_Data type to be different than section type.
* Relax Elf_Data alignment check.
* Align each Elf_Data by their own alignment instead of section alignment.

MFC after:   1 month
2010-09-09 18:51:50 +00:00
David Xu
17dce7e108 To avoid possible race condition, SIGCANCEL is always sent except the
thread is dead.
2010-09-08 02:18:20 +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
David Xu
cb4a1047ce Fix off-by-one error in function _thr_sigact_unload, also disable the
function, it seems some gnome application tends to crash if we
unregister sigaction automatically.
2010-09-06 03:00:54 +00:00
Jilles Tjoelker
b3c63ff614 libedit: Try to map <Delete> to ed-delete-next-char.
This adds a new "arrow" key "delete" corresponding to the kD termcap value.
It only works if that is a sequence such as "\033[3~"; if it is "\177", the
em-delete-prev-char or ed-delete-prev-char from the single-character
mappings remains. It turns out that most terminals (xterm and alikes,
syscons in xterm mode) produce "\033[3~" by default so <Delete> has the
expected effect.

This also means that things need to be considerably misconfigured for
<Backspace> to perform a <Delete> action.
2010-09-05 16:12:10 +00:00
Fabien Thomas
2aef9dd6d3 Fix invalid class removal when IAF is not the last class.
Keep IAF class with 0 PMC and change the alias in libpmc to IAP.

MFC after:	1 week
2010-09-05 13:31:14 +00:00
Jilles Tjoelker
96e75396e1 libedit: Do not move the cursor for ed-delete-next-char in emacs mode.
This makes ed-delete-next-char suitable for mapping to the <Delete> key.

Behaviour in vi mode is unchanged (for 'x').
2010-09-03 22:24:26 +00:00
Rick Macklem
de5f647070 Modify lib/libstand/nfs.c to use NFSv3 instead of NFSv2.
This allows the nfs_getrootfh() function to return the
correct file handle size to pxe.c for pxeboot. It also
results in NFSv2 no longer being used by default anywhere
in FreeBSD. If built with OLD_NFSV2 defined, the old
code that predated this patch will be built and NFSv2
will be used.

Tested by:	danny at cs.huji.ac.il
MFC after:	2 weeks
2010-09-02 01:00:13 +00:00
David Xu
21a9296f63 Remove incorrect comments, also make sure signal is
disabled when unregistering sigaction.
2010-09-01 13:22:55 +00:00
David Xu
12c61c22ce In function __pthread_cxa_finalize(), also make code for removing
atfork handler be async-signal safe.
2010-09-01 07:09:46 +00:00
David Xu
a523216bc6 pthread_atfork should acquire writer lock and protect the code
with critical region.
2010-09-01 03:55:10 +00:00
David Xu
ada33a6e36 Change atfork lock from mutex to rwlock, also make mutexes used by malloc()
module private type, when private type mutex is locked/unlocked, thread
critical region is entered or leaved. These changes makes fork()
async-signal safe which required by POSIX. Note that user's atfork handler
still needs to be async-signal safe, but it is not problem of libthr, it
is user's responsiblity.
2010-09-01 03:11:21 +00:00
David Xu
02c3c85869 Add signal handler wrapper, the reason to add it becauses there are
some cases we want to improve:
  1) if a thread signal got a signal while in cancellation point,
     it is possible the TDP_WAKEUP may be eaten by signal handler
     if the handler called some interruptibly system calls.
  2) In signal handler, we want to disable cancellation.
  3) When thread holding some low level locks, it is better to
     disable signal, those code need not to worry reentrancy,
     sigprocmask system call is avoided because it is a bit expensive.
The signal handler wrapper works in this way:
  1) libthr installs its signal handler if user code invokes sigaction
     to install its handler, the user handler is recorded in internal
     array.
  2) when a signal is delivered, libthr's signal handler is invoke,
     libthr checks if thread holds some low level lock or is in critical
     region, if it is true, the signal is buffered, and all signals are
     masked, once the thread leaves critical region, correct signal
     mask is restored and buffered signal is processed.
  3) before user signal handler is invoked, cancellation is temporarily
     disabled, after user signal handler is returned, cancellation state
     is restored, and pending cancellation is rescheduled.
2010-09-01 02:18:33 +00:00
Jamie Gritton
881f6af44b Whitespace and comment fixes.
MFC after:	3 days
2010-08-31 23:14:03 +00:00
Jamie Gritton
4d02a3e762 Don't over-allocate array values in jailparam_export.
Fix a little comment typo.

MFC after:	3 days
2010-08-31 21:50:09 +00:00
Jamie Gritton
fa04d5d393 Make it clear in the example that jailparam_export's return value
should be freed.

MFC after:	3 days
2010-08-31 21:48:45 +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
Nathan Whitehorn
b12277d1d4 Repair some build breakage introduced in r211725 and garbage collect some
code made obsolete in the same commit.
2010-08-28 15:03:11 +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
David Xu
ed0ee6af2e Unregister thread specific data destructor when a corresponding dso
is unloaded.
2010-08-27 05:20:22 +00:00
David Xu
8e60ce996b clear lock to zero state if it is destroyed. 2010-08-27 03:23:07 +00:00
David Xu
1ac3d5022c eliminate unused code. 2010-08-26 09:04:27 +00:00
David Xu
6b932eca79 Decrease rdlock count only when thread unlocked a reader lock.
MFC after:	3 days
2010-08-26 07:09:48 +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
Nathan Whitehorn
f4fbf9c859 Unify 32-bit and 64-bit PowerPC libthr support. This reduces code
duplication, and simplifies the TBEMD import.

Requested by:	imp
2010-08-24 20:50:08 +00:00
Warner Losh
2bef81cf3a Change the logic here to match Makefile.inc1. Having it in two places
suggests an opportunity for refactoring :)

Submitted by:	nathanw@
2010-08-24 16:35:26 +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