Commit Graph

96 Commits

Author SHA1 Message Date
Rich Felker 8668f033bc fill in some missing siginfo stuff in signal.h 2011-02-20 01:26:25 -05:00
Rich Felker 2b43ef8fc7 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.
2011-02-20 00:28:10 -05:00
Rich Felker 13e8459232 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.
2011-02-19 17:56:57 -05:00
Rich Felker 98e02144da use rt_sigprocmask, not legacy sigprocmask, syscall in pthread exit code 2011-02-19 15:21:05 -05:00
Rich Felker 5316d083ec fix typo in wordexp.h (note that the function is still unimplemented) 2011-02-19 12:44:36 -05:00
Rich Felker 4b1244a0bf implement the remaining clock_* interfaces 2011-02-19 12:43:56 -05:00
Rich Felker 19eb13b9a4 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.
2011-02-19 11:04:36 -05:00
Rich Felker a49c119276 prevent sigprocmask/pthread_sigmask from blocking implementation signals
this code was wrongly disabled because the old version was trying to
be too clever and didn't work. replaced it with a simple version for
now.
2011-02-19 10:51:13 -05:00
Rich Felker fb11b6b85e make pthread_exit run dtors for last thread, wait to decrement thread count 2011-02-19 10:38:57 -05:00
Rich Felker 69ecbd0f31 make mktemp match the historic behavior, and update functions that use it
the historic mktemp is supposed to blank the template string on
failure, rather than returning 0. just zero the first character so
that mkstemp and mkdtemp can still retry with O(1) space requirement.
2011-02-19 09:40:07 -05:00
Rich Felker 2e6239dd06 fix major bug created from copying mkdtemp logic 2011-02-19 09:34:28 -05:00
Rich Felker 095a5ae6f2 add syscall wrappers for inotify 2011-02-19 02:52:29 -05:00
Rich Felker cc2a8228fa cleanup cruft left from when kernel and user time_t disagreed 2011-02-19 02:28:42 -05:00
Rich Felker 52874c82a8 prototype wait3 and wait4 2011-02-19 02:26:11 -05:00
Rich Felker f3ef7a6124 add missing WIFCONTINUED macro and improve WIFSIGNALED 2011-02-19 02:23:29 -05:00
Rich Felker b386d81862 prototypes for brk and sbrk 2011-02-19 01:02:46 -05:00
Rich Felker ad2fe25041 support the ugly and deprecated ucontext and sigcontext header stuff...
only the structures, not the functions from ucontext.h, are supported
at this point. the main goal of this commit is to make modern gcc with
dwarf2 unwinding build without errors.

honestly, it probably doesn't matter how we define these as long as
they have members with the right names to prevent errors while
compiling libgcc. the only time they will be used is for propagating
exceptions across signal-handler boundaries, which invokes undefined
behavior anyway. but as-is, they're probably correct and may be useful
to various low-level applications dealing with virtualization, jit
code generation, and so on...
2011-02-18 22:03:03 -05:00
Rich Felker e9417fffb3 add pthread_atfork interface
note that this presently does not handle consistency of the libc's own
global state during forking. as per POSIX 2008, if the parent process
was threaded, the child process may only call async-signal-safe
functions until one of the exec-family functions is called, so the
current behavior is believed to be conformant even if non-ideal. it
may be improved at some later time.
2011-02-18 19:52:42 -05:00
Rich Felker 446b4207cc major improvements to temp file name generator
use current time in nanoseconds and some potentially-random (if aslr
is enabled) pointer values for the initial tempfile name generation,
and step via a cheap linear prng on collisions. limit the number of
retry attempts to prevent denial of service attacks even if an
attacker can guess the filenames.
2011-02-18 17:04:56 -05:00
Rich Felker 3e9e30166f reformat mkstemp like mkdtemp
this is cleaner and makes it easy to impose a limit on the number of
retries later if it seems desirable to do so.
2011-02-18 16:32:33 -05:00
Rich Felker d5ca067c7b add portable lchown (trivial to support and a few ancient things want it..) 2011-02-17 23:13:46 -05:00
Rich Felker 982a478433 prepare WHATSNEW for release 2011-02-17 19:15:08 -05:00
Rich Felker 6d333355e7 document in config.mak sample that x86_64 is supported 2011-02-17 18:30:41 -05:00
Rich Felker d09d068f9b update WHATSNEW in preparation for release 2011-02-17 17:57:50 -05:00
Rich Felker 127ab575fc avoid deleting the lib/empty file 2011-02-17 17:57:26 -05:00
Rich Felker e882756311 reorganize pthread data structures and move the definitions to alltypes.h
this allows sys/types.h to provide the pthread types, as required by
POSIX. this design also facilitates forcing ABI-compatible sizes in
the arch-specific alltypes.h, while eliminating the need for
developers changing the internals of the pthread types to poke around
with arch-specific headers they may not be able to test.
2011-02-17 17:16:20 -05:00
Rich Felker 4fd159568a new solution for empty lib dir (old one had some problems) 2011-02-17 17:12:52 -05:00
Rich Felker a36164c474 improve Makefile handling of git checkouts with missing lib/ and config.mak 2011-02-17 15:15:03 -05:00
Rich Felker 187fe29d5b make daemon try the operations that might fail before fork rather than after 2011-02-17 10:30:00 -05:00
Rich Felker 19e35c500b daemon should check for failures and return -1 2011-02-17 10:28:56 -05:00
Rich Felker b24bc15f5c don't compare elements with themselves during qsort.
this is actually a workaround for a bug in gcc, whereby it asserts
inequality of the keys being compared...
2011-02-17 00:03:24 -05:00
Rich Felker 798a12ecc4 ucontext is no longer in the standard, so use gnu-friendly struct name
note that this header is still bogus and needs a lot of work and
factoring into arch-dependent parts...
2011-02-16 23:36:26 -05:00
Rich Felker 417dbe92cb some gnu software wrongly uses "struct siginfo" instead of siginfo_t... 2011-02-16 22:37:26 -05:00
Rich Felker 56b784d603 add to pthread.h: pthread_mutex_timedlock and sched.h, time.h 2011-02-16 21:21:26 -05:00
Rich Felker 5cbd76c6b0 fix printf %n specifier - missing breaks had it clobbering memory 2011-02-16 18:19:46 -05:00
Rich Felker e3657ba599 patch by njk, simplifies thread register initialization for x86_64
It's not necessary to save any registers on the stack across syscall in
x86_64 __set_thread_area.  Don't waste cycles or bytes on it.
2011-02-16 09:50:57 -05:00
Rich Felker 22cd9cae81 patch from njk: make x86_64 __uniclone branchless. 2011-02-16 09:49:54 -05:00
Rich Felker bad481266e fix compile failure: legacy cuserid needs to define feature test 2011-02-16 09:30:56 -05:00
Rich Felker 571312de5f move stdio stuff that's not arch-specific out of bits 2011-02-15 19:47:22 -05:00
Rich Felker 8894947ba2 protect some limit constants with feature test macros on x86_64 2011-02-15 19:16:37 -05:00
Rich Felker f451462098 fix the types of some integer constant limits in headers 2011-02-15 19:15:45 -05:00
Rich Felker 6d36c2098b fix missing EXIT_* in stdlib.h after header cleanup 2011-02-15 17:33:52 -05:00
Rich Felker 1d72953787 feature test support in unistd.h 2011-02-15 16:28:36 -05:00
Rich Felker cda892ddbe fix directory reading on x86_64 2011-02-15 16:08:48 -05:00
Rich Felker 26f3551419 prototype for gnu strcasestr (currently a stub) 2011-02-15 16:08:19 -05:00
Rich Felker c0248191bd fix x86_64 wrongly reporting itself as ILP32 instead of LP64 2011-02-15 15:56:58 -05:00
Rich Felker 62275f7876 news for upcoming release 2011-02-15 15:52:26 -05:00
Rich Felker 4e30249643 fix another error from header cleanup, missing size_t in time.h 2011-02-15 15:25:31 -05:00
Rich Felker 3eb9feaa88 fix broken signal.h from header cleanup 2011-02-15 15:10:00 -05:00
Rich Felker 0b9a1ed00c some docs fixes for x86_64 2011-02-15 14:52:11 -05:00