oweals/musl.git
13 years agounify lock and owner fields of mutex structure
Rich Felker [Thu, 17 Mar 2011 16:21:32 +0000 (12:21 -0400)]
unify lock and owner fields of mutex structure

this change is necessary to free up one slot in the mutex structure so
that we can use doubly-linked lists in the implementation of robust
mutexes.

13 years agooptimize contended normal mutex case; add int compare-and-swap atomic
Rich Felker [Thu, 17 Mar 2011 16:14:40 +0000 (12:14 -0400)]
optimize contended normal mutex case; add int compare-and-swap atomic

13 years agosimplify logic, slightly optimize contended case for non-default mutex types
Rich Felker [Wed, 16 Mar 2011 20:49:42 +0000 (16:49 -0400)]
simplify logic, slightly optimize contended case for non-default mutex types

13 years agocorrect error returns for error-checking mutexes
Rich Felker [Wed, 16 Mar 2011 20:25:00 +0000 (16:25 -0400)]
correct error returns for error-checking mutexes

13 years agocut out a syscall on thread creation in the case where guard size is 0
Rich Felker [Wed, 16 Mar 2011 15:36:21 +0000 (11:36 -0400)]
cut out a syscall on thread creation in the case where guard size is 0

13 years agodon't expose EAGAIN, etc. from timed futex wait to caller
Rich Felker [Wed, 16 Mar 2011 15:35:46 +0000 (11:35 -0400)]
don't expose EAGAIN, etc. from timed futex wait to caller

13 years agooptimize file locking: avoid cache-polluting writes to global storage
Rich Felker [Wed, 16 Mar 2011 14:39:45 +0000 (10:39 -0400)]
optimize file locking: avoid cache-polluting writes to global storage

13 years agopartially-written draft of fmemopen, still in #if 0
Rich Felker [Mon, 14 Mar 2011 15:49:55 +0000 (11:49 -0400)]
partially-written draft of fmemopen, still in #if 0

13 years agoremove some old cruft from sys/types.h
Rich Felker [Mon, 14 Mar 2011 15:49:17 +0000 (11:49 -0400)]
remove some old cruft from sys/types.h

13 years agomisplaced & in times() made it fail to work, and clobber the stack
Rich Felker [Sun, 13 Mar 2011 03:53:17 +0000 (22:53 -0500)]
misplaced & in times() made it fail to work, and clobber the stack

13 years agoimplement flockfile api, rework stdio locking
Rich Felker [Sun, 13 Mar 2011 02:55:45 +0000 (21:55 -0500)]
implement flockfile api, rework stdio locking

13 years agopthread.h needs clockid_t
Rich Felker [Sun, 13 Mar 2011 02:54:19 +0000 (21:54 -0500)]
pthread.h needs clockid_t

actually it gets this from time.h if _POSIX_C_SOURCE or any other
feature test macros are defined, but it breaks if they're not.

13 years agodocument some additional important changes v0.7.0
Rich Felker [Fri, 11 Mar 2011 19:51:36 +0000 (14:51 -0500)]
document some additional important changes

13 years agoupdate whatsnew file for release of 0.7.0
Rich Felker [Fri, 11 Mar 2011 18:38:09 +0000 (13:38 -0500)]
update whatsnew file for release of 0.7.0

13 years agomatch dimensions so we can use all slots without invoking OOB-array-access
Rich Felker [Fri, 11 Mar 2011 15:02:17 +0000 (10:02 -0500)]
match dimensions so we can use all slots without invoking OOB-array-access

13 years agoimplement dummy pthread_attr_[gs]etschedparam functions
Rich Felker [Fri, 11 Mar 2011 14:51:54 +0000 (09:51 -0500)]
implement dummy pthread_attr_[gs]etschedparam functions

for some reason these functions are not shaded by the PS/TPS option in
POSIX, so presumably they are mandatory, even though the functionality
they offer is optional. for now, provide them in case any programs
depend on their existence, but disallow any priority except the
default.

13 years agofix pthread_attr_* implementations to match corrected prototypes
Rich Felker [Fri, 11 Mar 2011 14:51:14 +0000 (09:51 -0500)]
fix pthread_attr_* implementations to match corrected prototypes

13 years agofix missing ENOTSUP error code
Rich Felker [Fri, 11 Mar 2011 14:50:54 +0000 (09:50 -0500)]
fix missing ENOTSUP error code

13 years agomissing const in some pthread_attr_* prototypes
Rich Felker [Fri, 11 Mar 2011 14:46:31 +0000 (09:46 -0500)]
missing const in some pthread_attr_* prototypes

13 years agoformatting whatsnew file
Rich Felker [Fri, 11 Mar 2011 14:46:12 +0000 (09:46 -0500)]
formatting whatsnew file

13 years agolist major changes in preparation for release
Rich Felker [Fri, 11 Mar 2011 05:48:40 +0000 (00:48 -0500)]
list major changes in preparation for release

13 years agofix failure behavior of sem_open when sem does not exist
Rich Felker [Fri, 11 Mar 2011 03:05:16 +0000 (22:05 -0500)]
fix failure behavior of sem_open when sem does not exist

13 years agofix some semaphore wait semantics (race condition deadlock and error checking)
Rich Felker [Fri, 11 Mar 2011 02:52:18 +0000 (21:52 -0500)]
fix some semaphore wait semantics (race condition deadlock and error checking)

13 years agofix sem_open and sem_close to obey posix semantics
Rich Felker [Fri, 11 Mar 2011 02:34:19 +0000 (21:34 -0500)]
fix sem_open and sem_close to obey posix semantics

multiple opens of the same named semaphore must return the same
pointer, and only the last close can unmap it. thus the ugly global
state keeping track of mappings. the maximum number of distinct named
semaphores that can be opened is limited sufficiently small that the
linear searches take trivial time, especially compared to the syscall
overhead of these functions.

13 years agooptimize pthread termination in the non-detached case
Rich Felker [Thu, 10 Mar 2011 23:31:37 +0000 (18:31 -0500)]
optimize pthread termination in the non-detached case

we can avoid blocking signals by simply using a flag to mark that the
thread has exited and prevent it from getting counted in the rsyscall
signal-pingpong. this restores the original pthread create/join
throughput from before the sigprocmask call was added.

13 years agofix errors in sigqueue (potential information leak, wrong behavior)
Rich Felker [Thu, 10 Mar 2011 23:26:29 +0000 (18:26 -0500)]
fix errors in sigqueue (potential information leak, wrong behavior)

1. any padding in the siginfo struct was not necessarily zero-filled,
so it might have contained private data off the caller's stack.

2. the uid and pid must be filled in from userspace. the previous
rsyscall fix broke rsyscalls because the values were always incorrect.

13 years agosecurity fix: check that cancel/rsyscall signal was sent by the process itself
Rich Felker [Thu, 10 Mar 2011 16:59:39 +0000 (11:59 -0500)]
security fix: check that cancel/rsyscall signal was sent by the process itself

13 years agomore cancellation points: tcdrain, clock_nanosleep
Rich Felker [Thu, 10 Mar 2011 16:06:50 +0000 (11:06 -0500)]
more cancellation points: tcdrain, clock_nanosleep

13 years agoremove useless return value checks for functions that cannot fail
Rich Felker [Thu, 10 Mar 2011 16:02:29 +0000 (11:02 -0500)]
remove useless return value checks for functions that cannot fail

13 years agomake sigsuspend a cancellation point
Rich Felker [Thu, 10 Mar 2011 16:01:11 +0000 (11:01 -0500)]
make sigsuspend a cancellation point

13 years agomake sigtimedwait a cancellation point
Rich Felker [Thu, 10 Mar 2011 15:59:50 +0000 (10:59 -0500)]
make sigtimedwait a cancellation point

13 years agodon't fail with EINTR in sigtimedwait
Rich Felker [Thu, 10 Mar 2011 15:43:09 +0000 (10:43 -0500)]
don't fail with EINTR in sigtimedwait

POSIX allows either behavior, but sigwait is not allowed to fail with
EINTR, so the retry loop would have to be in one or the other anyway.

13 years agofix sigsuspend syscall
Rich Felker [Thu, 10 Mar 2011 15:26:16 +0000 (10:26 -0500)]
fix sigsuspend syscall

13 years agomake sigaltstack work (missing macros in signal.h, error conditions)
Rich Felker [Thu, 10 Mar 2011 15:17:29 +0000 (10:17 -0500)]
make sigaltstack work (missing macros in signal.h, error conditions)

13 years agofix errno behavior in clock_* functions
Rich Felker [Thu, 10 Mar 2011 14:54:23 +0000 (09:54 -0500)]
fix errno behavior in clock_* functions

these functions are specified inconsistent in whether they're
specified to return an error value, or return -1 and set errno.
hopefully now they all match what POSIX requires.

13 years agofix error handling for pthread_sigmask
Rich Felker [Thu, 10 Mar 2011 01:31:06 +0000 (20:31 -0500)]
fix error handling for pthread_sigmask

it must return errno, not -1, and should reject invalud values for how.

13 years agomake fork properly initialize the main thread in the child process
Rich Felker [Thu, 10 Mar 2011 01:23:44 +0000 (20:23 -0500)]
make fork properly initialize the main thread in the child process

13 years agooptimize pthread initialization
Rich Felker [Thu, 10 Mar 2011 01:21:23 +0000 (20:21 -0500)]
optimize pthread initialization

the set_tid_address returns the tid (which is also the pid when called
from the initial thread) so there is no need to make a separate
syscall to get pid/tid.

13 years agofix race condition in raise - just mask signals
Rich Felker [Thu, 10 Mar 2011 01:07:24 +0000 (20:07 -0500)]
fix race condition in raise - just mask signals

a signal handler could fork after the pid/tid were read, causing the
wrong process to be signalled. i'm not sure if this is supposed to
have UB or not, but raise is async-signal-safe, so it probably is
allowed. the current solution is slightly expensive so this
implementation is likely to be changed in the future.

13 years agofix raise semantics with threads.
Rich Felker [Thu, 10 Mar 2011 00:42:06 +0000 (19:42 -0500)]
fix raise semantics with threads.

13 years agofix typos in dirent.h
Rich Felker [Tue, 8 Mar 2011 22:34:26 +0000 (17:34 -0500)]
fix typos in dirent.h

13 years agofcntl.h should make availabel the mode constants from sys/stat.h
Rich Felker [Tue, 8 Mar 2011 17:35:35 +0000 (12:35 -0500)]
fcntl.h should make availabel the mode constants from sys/stat.h

also remove some legacy nonsense that crept in.

13 years agosimplify and optimize pthread_mutex_trylock
Rich Felker [Tue, 8 Mar 2011 17:20:10 +0000 (12:20 -0500)]
simplify and optimize pthread_mutex_trylock

13 years agorwlock trylock functions were wrongly returning EAGAIN instead of EBUSY
Rich Felker [Tue, 8 Mar 2011 17:19:30 +0000 (12:19 -0500)]
rwlock trylock functions were wrongly returning EAGAIN instead of EBUSY

13 years agofix major breakage in pthread_once (it was always deadlocking)
Rich Felker [Tue, 8 Mar 2011 17:08:40 +0000 (12:08 -0500)]
fix major breakage in pthread_once (it was always deadlocking)

the issue was a break statement that was breaking only from the
switch, not the enclosing for loop, and a failure to set the final
success state.

13 years agofix and optimize non-default-type mutex behavior
Rich Felker [Tue, 8 Mar 2011 08:41:05 +0000 (03:41 -0500)]
fix and optimize non-default-type mutex behavior

problem 1: mutex type from the attribute was being ignored by
pthread_mutex_init, so recursive/errorchecking mutexes were never
being used at all.

problem 2: ownership of recursive mutexes was not being enforced at
unlock time.

13 years agoimplement pthread_mutexattr_[gs]etpshared functions
Rich Felker [Tue, 8 Mar 2011 07:33:37 +0000 (02:33 -0500)]
implement pthread_mutexattr_[gs]etpshared functions

13 years agodisallow cpu time clocks as condattr clock values
Rich Felker [Tue, 8 Mar 2011 07:32:42 +0000 (02:32 -0500)]
disallow cpu time clocks as condattr clock values

13 years agoadd macros for use with d_type extension field in dirent
Rich Felker [Mon, 7 Mar 2011 23:32:36 +0000 (18:32 -0500)]
add macros for use with d_type extension field in dirent

13 years agofix off-by-one error in sem_(timed)wait (using old sem value instead of new)
Rich Felker [Mon, 7 Mar 2011 23:09:24 +0000 (18:09 -0500)]
fix off-by-one error in sem_(timed)wait (using old sem value instead of new)

13 years agouse the selected clock from the condattr for pthread_cond_timedwait
Rich Felker [Mon, 7 Mar 2011 22:39:13 +0000 (17:39 -0500)]
use the selected clock from the condattr for pthread_cond_timedwait

13 years agoadd prototypes for pthread_condattr_* and pthread_rwlockattr_*
Rich Felker [Mon, 7 Mar 2011 21:45:48 +0000 (16:45 -0500)]
add prototypes for pthread_condattr_* and pthread_rwlockattr_*

13 years agoimplement pthread_rwlockattr_* (essentially no-ops)
Rich Felker [Mon, 7 Mar 2011 21:43:25 +0000 (16:43 -0500)]
implement pthread_rwlockattr_* (essentially no-ops)

13 years agoimplement pthread_condattr_* interfaces
Rich Felker [Mon, 7 Mar 2011 21:20:12 +0000 (16:20 -0500)]
implement pthread_condattr_* interfaces

note that, while the attributes are stored, they are not used in
pthread_cond_init yet.

13 years agoreject invalid attribute settings
Rich Felker [Mon, 7 Mar 2011 20:46:37 +0000 (15:46 -0500)]
reject invalid attribute settings

note that this is a pedantic conformance issue and waste of code. it
only affects broken code or code that is probing for conformance.

13 years agoimplement barrier attribute functions (essentially no-ops)
Rich Felker [Mon, 7 Mar 2011 20:42:52 +0000 (15:42 -0500)]
implement barrier attribute functions (essentially no-ops)

13 years agoenforce stack size min in pthread_attr_setstacksize
Rich Felker [Fri, 4 Mar 2011 05:59:14 +0000 (00:59 -0500)]
enforce stack size min in pthread_attr_setstacksize

13 years agoimplement POSIX semaphores
Rich Felker [Fri, 4 Mar 2011 05:45:59 +0000 (00:45 -0500)]
implement POSIX semaphores

13 years agopreliminaries to adding POSIX semaphores
Rich Felker [Thu, 3 Mar 2011 23:32:26 +0000 (18:32 -0500)]
preliminaries to adding POSIX semaphores

13 years agooptimize POSIX TSD for fast pthread_getspecific
Rich Felker [Thu, 3 Mar 2011 23:30:44 +0000 (18:30 -0500)]
optimize POSIX TSD for fast pthread_getspecific

13 years agonamespace cleanup in sys/mman.h
Rich Felker [Thu, 3 Mar 2011 05:32:15 +0000 (00:32 -0500)]
namespace cleanup in sys/mman.h

13 years agoimplement POSIX shared memory
Rich Felker [Thu, 3 Mar 2011 05:30:31 +0000 (00:30 -0500)]
implement POSIX shared memory

13 years agouse -L/...../ -lgcc instead of /...../libgcc.a in musl-gcc wrapper
Rich Felker [Tue, 1 Mar 2011 17:04:36 +0000 (12:04 -0500)]
use -L/...../ -lgcc instead of /...../libgcc.a in musl-gcc wrapper

this should avoid warnings about unused libs when not linking, and
might fix some other obscure issues too. i might replace this approach
with a completely different one soon though.

13 years agodepends on settimeofday which needs _GNU_SOURCE feature test
Rich Felker [Tue, 1 Mar 2011 16:57:19 +0000 (11:57 -0500)]
depends on settimeofday which needs _GNU_SOURCE feature test

13 years agoimplement futimens and utimensat
Rich Felker [Sun, 27 Feb 2011 08:48:57 +0000 (03:48 -0500)]
implement futimens and utimensat

13 years agocleanup namespace in sys/time.h
Rich Felker [Sun, 27 Feb 2011 08:48:19 +0000 (03:48 -0500)]
cleanup namespace in sys/time.h

13 years agoimplement fexecve
Rich Felker [Sun, 27 Feb 2011 07:59:23 +0000 (02:59 -0500)]
implement fexecve

13 years agocleanup utf-8 multibyte code, use visibility if possible
Rich Felker [Sun, 27 Feb 2011 05:28:59 +0000 (00:28 -0500)]
cleanup utf-8 multibyte code, use visibility if possible

this code was written independently of musl, with support for a the
backwards, nonstandard "31-bit unicode" some libraries/apps might
want. unfortunately the extra code (inside #ifdef) makes the source
harder to read and makes code that should be simple look complex, so
i'm removing it. anyone who wants to use the old code can find it in
the history or from elsewhere.

also, change the visibility of the __fsmu8 state machine table to
hidden, if supported. this should improve performance slightly in
shared-library builds.

13 years agofix missing prototype for strsignal
Rich Felker [Sun, 27 Feb 2011 04:50:26 +0000 (23:50 -0500)]
fix missing prototype for strsignal

13 years agovarious changes in preparation for dynamic linking support
Rich Felker [Thu, 24 Feb 2011 21:37:21 +0000 (16:37 -0500)]
various changes in preparation for dynamic linking support

prefer using visibility=hidden for __libc internal data, rather than
an accessor function, if the compiler has visibility.

optimize with -O3 for PIC targets (shared library). without heavy
inlining, reloading the GOT register in small functions kills
performance. 20-30% size increase for a single libc.so is not a big
deal, compared to comparaible size increase in every static binaries.

use -Bsymbolic-functions, not -Bsymbolic. global variables are subject
to COPY relocations, and thus binding their addresses in the library
at link time will cause library functions to read the wrong (original)
copies instead of the copies made in the main program's bss section.

add entry point, _start, for dynamic linker.

13 years agoapply feature test protection to memccpy
Rich Felker [Thu, 24 Feb 2011 17:36:04 +0000 (12:36 -0500)]
apply feature test protection to memccpy

13 years agoadd implementation of memccpy function
Rich Felker [Thu, 24 Feb 2011 17:35:42 +0000 (12:35 -0500)]
add implementation of memccpy function

13 years agofix backwards conditional in stpncpy
Rich Felker [Thu, 24 Feb 2011 17:34:31 +0000 (12:34 -0500)]
fix backwards conditional in stpncpy

this only made the function unnecessarily slow on systems with
unaligned access, but would of course crash on systems that can't do
unaligned accesses (none of which have ports yet).

13 years agorewind must clear the error indicator in addition to seeking
Rich Felker [Tue, 22 Feb 2011 22:11:35 +0000 (17:11 -0500)]
rewind must clear the error indicator in addition to seeking

13 years agochange errno to static linkage (improves PIC code generation)
Rich Felker [Tue, 22 Feb 2011 04:00:52 +0000 (23:00 -0500)]
change errno to static linkage (improves PIC code generation)

13 years agocleanup comment cruft in startup code
Rich Felker [Tue, 22 Feb 2011 03:27:35 +0000 (22:27 -0500)]
cleanup comment cruft in startup code

13 years agomake startup code PIE-compatible
Rich Felker [Tue, 22 Feb 2011 03:26:31 +0000 (22:26 -0500)]
make startup code PIE-compatible

13 years agoremove sample utf-8 code that's not part of the standard library
Rich Felker [Mon, 21 Feb 2011 20:43:26 +0000 (15:43 -0500)]
remove sample utf-8 code that's not part of the standard library

13 years agouse an accessor function for __libc data pointer when compiled as PIC
Rich Felker [Mon, 21 Feb 2011 03:30:06 +0000 (22:30 -0500)]
use an accessor function for __libc data pointer when compiled as PIC

prior to this change, a large portion of libc was unusable prior to
relocation by the dynamic linker, due to dependence on the global data
in the __libc structure and the need to obtain its address through the
GOT. with this patch, the accessor function __libc_loc is now able to
obtain the address of __libc via PC-relative addressing without using
the GOT. this means the majority of libc functionality is now
accessible right away.

naturally, the above statements all depend on having an architecture
where PC-relative addressing and jumps/calls are feasible, and a
compiler that generates the appropriate code.

13 years agoavoid referencing address of extern function from vdprintf
Rich Felker [Mon, 21 Feb 2011 03:24:28 +0000 (22:24 -0500)]
avoid referencing address of extern function from vdprintf

this change is in preparation for upcoming PIC/shared library support.
the intent is to avoid going through the GOT, mainly so that dprintf
is operable immediately, prior to processing of relocations. having
dprintf accessible from the dynamic linker will make writing and
debugging the dynamic linker much easier.

13 years agoshave off 2 bytes from crt1.o _start
Rich Felker [Mon, 21 Feb 2011 00:07:19 +0000 (19:07 -0500)]
shave off 2 bytes from crt1.o _start

13 years agocleanup asprintf stuff
Rich Felker [Sun, 20 Feb 2011 22:19:37 +0000 (17:19 -0500)]
cleanup asprintf stuff

13 years agoprototypes for GNU asprintf/vasprintf
Rich Felker [Sun, 20 Feb 2011 22:17:09 +0000 (17:17 -0500)]
prototypes for GNU asprintf/vasprintf

13 years agofix %n specifier, again. this time it was storing the wrong value.
Rich Felker [Sun, 20 Feb 2011 22:10:40 +0000 (17:10 -0500)]
fix %n specifier, again. this time it was storing the wrong value.

13 years agoinclude sys/sysmacros.h from sys/types.h when _GNU_SOURCE is defined
Rich Felker [Sun, 20 Feb 2011 21:34:10 +0000 (16:34 -0500)]
include sys/sysmacros.h from sys/types.h when _GNU_SOURCE is defined

13 years agofix typo in inotify structure
Rich Felker [Sun, 20 Feb 2011 21:21:39 +0000 (16:21 -0500)]
fix typo in inotify structure

13 years agomake malloc(0) return unique pointers rather than NULL
Rich Felker [Sun, 20 Feb 2011 21:16:33 +0000 (16:16 -0500)]
make malloc(0) return unique pointers rather than NULL

this change is made with some reluctance, but i think it's for the
best. correct programs must handle either behavior, so there is little
advantage to having malloc(0) return NULL. and i managed to actually
make the malloc code slightly smaller with this change.

13 years agofix simple_malloc malloc(0) behavior not to return non-unique pointers
Rich Felker [Sun, 20 Feb 2011 21:12:09 +0000 (16:12 -0500)]
fix simple_malloc malloc(0) behavior not to return non-unique pointers

13 years agofix simple_malloc size restrictions
Rich Felker [Sun, 20 Feb 2011 21:10:38 +0000 (16:10 -0500)]
fix simple_malloc size restrictions

do not allow allocations that overflow ptrdiff_t; fix some overflow
checks that were not quite right but didn't matter due to address
layout implementation.

13 years agofix null pointer dereference introduced in last sigprocmask commit
Rich Felker [Sun, 20 Feb 2011 20:16:04 +0000 (15:16 -0500)]
fix null pointer dereference introduced in last sigprocmask commit

13 years agomake real symbols for the legacy (nonstandardized) utmp functions
Rich Felker [Sun, 20 Feb 2011 20:06:26 +0000 (15:06 -0500)]
make real symbols for the legacy (nonstandardized) utmp functions

this is needed in the long term for ABI compatibility anyway, and in
the immediate, it helps with building broken programs like GNU screen
that try to prototype the functions themselves rather than using the
header.

13 years agoresolve some header namespace non-issues
Rich Felker [Sun, 20 Feb 2011 07:44:52 +0000 (02:44 -0500)]
resolve some header namespace non-issues

after re-reading 2.2.2 of POSIX 2008, all of these are in the correct
reserved namespaces and do not need protection.

13 years agomove the GNU siginfo renaming so it doesn't lead to mismatching names
Rich Felker [Sun, 20 Feb 2011 06:48:51 +0000 (01:48 -0500)]
move the GNU siginfo renaming so it doesn't lead to mismatching names

13 years agofill in some missing siginfo stuff in signal.h
Rich Felker [Sun, 20 Feb 2011 06:26:25 +0000 (01:26 -0500)]
fill in some missing siginfo stuff in signal.h

13 years agomake sys/param.h not depend on PATH_MAX and NAME_MAX
Rich Felker [Sun, 20 Feb 2011 05:28:10 +0000 (00:28 -0500)]
make sys/param.h not depend on PATH_MAX and NAME_MAX

this is a nonstandard header used only by backwards programs, but for
some reason it's extremely popular. the recent namespace cleanup fixes
broke it, because PATH_MAX and NAME_MAX will not be defined unless an
approriate feature test macro has been defined. moreover, it's too
late to just #define _GNU_SOURCE in param.h, since limits.h may have
already been included.

let's just hard-code standard values and be done with it.

13 years agoworkaround gcc bug 46926 by providing a dumb sincos implementation
Rich Felker [Sat, 19 Feb 2011 22:56:57 +0000 (17:56 -0500)]
workaround gcc bug 46926 by providing a dumb sincos implementation

note that this library itself is built with -ffreestanding so sincos.c
should not be miscompiled even if the gcc used to compile musl has
this bug.

13 years agouse rt_sigprocmask, not legacy sigprocmask, syscall in pthread exit code
Rich Felker [Sat, 19 Feb 2011 20:21:05 +0000 (15:21 -0500)]
use rt_sigprocmask, not legacy sigprocmask, syscall in pthread exit code

13 years agofix typo in wordexp.h (note that the function is still unimplemented)
Rich Felker [Sat, 19 Feb 2011 17:44:36 +0000 (12:44 -0500)]
fix typo in wordexp.h (note that the function is still unimplemented)

13 years agoimplement the remaining clock_* interfaces
Rich Felker [Sat, 19 Feb 2011 17:43:56 +0000 (12:43 -0500)]
implement the remaining clock_* interfaces

13 years agorace condition fix: block all signals before decrementing thread count
Rich Felker [Sat, 19 Feb 2011 16:04:36 +0000 (11:04 -0500)]
race condition fix: block all signals before decrementing thread count

the existence of a (kernelspace) thread must never have observable
effects after the thread count is decremented. if signals are not
blocked, it could end up handling the signal for rsyscall and
contributing towards the count of threads which have changed ids,
causing a thread to be missed. this could lead to one thread retaining
unwanted privilege level.

this change may also address other subtle race conditions in
application code that uses signals.