Rich Felker [Mon, 7 Mar 2011 22:39:13 +0000 (17:39 -0500)]
use the selected clock from the condattr for pthread_cond_timedwait
Rich Felker [Mon, 7 Mar 2011 21:45:48 +0000 (16:45 -0500)]
add prototypes for pthread_condattr_* and pthread_rwlockattr_*
Rich Felker [Mon, 7 Mar 2011 21:43:25 +0000 (16:43 -0500)]
implement pthread_rwlockattr_* (essentially no-ops)
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.
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.
Rich Felker [Mon, 7 Mar 2011 20:42:52 +0000 (15:42 -0500)]
implement barrier attribute functions (essentially no-ops)
Rich Felker [Fri, 4 Mar 2011 05:59:14 +0000 (00:59 -0500)]
enforce stack size min in pthread_attr_setstacksize
Rich Felker [Fri, 4 Mar 2011 05:45:59 +0000 (00:45 -0500)]
implement POSIX semaphores
Rich Felker [Thu, 3 Mar 2011 23:32:26 +0000 (18:32 -0500)]
preliminaries to adding POSIX semaphores
Rich Felker [Thu, 3 Mar 2011 23:30:44 +0000 (18:30 -0500)]
optimize POSIX TSD for fast pthread_getspecific
Rich Felker [Thu, 3 Mar 2011 05:32:15 +0000 (00:32 -0500)]
namespace cleanup in sys/mman.h
Rich Felker [Thu, 3 Mar 2011 05:30:31 +0000 (00:30 -0500)]
implement POSIX shared memory
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.
Rich Felker [Tue, 1 Mar 2011 16:57:19 +0000 (11:57 -0500)]
depends on settimeofday which needs _GNU_SOURCE feature test
Rich Felker [Sun, 27 Feb 2011 08:48:57 +0000 (03:48 -0500)]
implement futimens and utimensat
Rich Felker [Sun, 27 Feb 2011 08:48:19 +0000 (03:48 -0500)]
cleanup namespace in sys/time.h
Rich Felker [Sun, 27 Feb 2011 07:59:23 +0000 (02:59 -0500)]
implement fexecve
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.
Rich Felker [Sun, 27 Feb 2011 04:50:26 +0000 (23:50 -0500)]
fix missing prototype for strsignal
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.
Rich Felker [Thu, 24 Feb 2011 17:36:04 +0000 (12:36 -0500)]
apply feature test protection to memccpy
Rich Felker [Thu, 24 Feb 2011 17:35:42 +0000 (12:35 -0500)]
add implementation of memccpy function
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).
Rich Felker [Tue, 22 Feb 2011 22:11:35 +0000 (17:11 -0500)]
rewind must clear the error indicator in addition to seeking
Rich Felker [Tue, 22 Feb 2011 04:00:52 +0000 (23:00 -0500)]
change errno to static linkage (improves PIC code generation)
Rich Felker [Tue, 22 Feb 2011 03:27:35 +0000 (22:27 -0500)]
cleanup comment cruft in startup code
Rich Felker [Tue, 22 Feb 2011 03:26:31 +0000 (22:26 -0500)]
make startup code PIE-compatible
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
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.
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.
Rich Felker [Mon, 21 Feb 2011 00:07:19 +0000 (19:07 -0500)]
shave off 2 bytes from crt1.o _start
Rich Felker [Sun, 20 Feb 2011 22:19:37 +0000 (17:19 -0500)]
cleanup asprintf stuff
Rich Felker [Sun, 20 Feb 2011 22:17:09 +0000 (17:17 -0500)]
prototypes for GNU asprintf/vasprintf
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.
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
Rich Felker [Sun, 20 Feb 2011 21:21:39 +0000 (16:21 -0500)]
fix typo in inotify structure
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.
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
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.
Rich Felker [Sun, 20 Feb 2011 20:16:04 +0000 (15:16 -0500)]
fix null pointer dereference introduced in last sigprocmask commit
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.
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.
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
Rich Felker [Sun, 20 Feb 2011 06:26:25 +0000 (01:26 -0500)]
fill in some missing siginfo stuff in signal.h
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.
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.
Rich Felker [Sat, 19 Feb 2011 20:21:05 +0000 (15:21 -0500)]
use rt_sigprocmask, not legacy sigprocmask, syscall in pthread exit code
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)
Rich Felker [Sat, 19 Feb 2011 17:43:56 +0000 (12:43 -0500)]
implement the remaining clock_* interfaces
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.
Rich Felker [Sat, 19 Feb 2011 15:51:13 +0000 (10:51 -0500)]
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.
Rich Felker [Sat, 19 Feb 2011 15:38:57 +0000 (10:38 -0500)]
make pthread_exit run dtors for last thread, wait to decrement thread count
Rich Felker [Sat, 19 Feb 2011 14:40:07 +0000 (09:40 -0500)]
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.
Rich Felker [Sat, 19 Feb 2011 14:34:28 +0000 (09:34 -0500)]
fix major bug created from copying mkdtemp logic
Rich Felker [Sat, 19 Feb 2011 07:52:29 +0000 (02:52 -0500)]
add syscall wrappers for inotify
Rich Felker [Sat, 19 Feb 2011 07:28:42 +0000 (02:28 -0500)]
cleanup cruft left from when kernel and user time_t disagreed
Rich Felker [Sat, 19 Feb 2011 07:26:11 +0000 (02:26 -0500)]
prototype wait3 and wait4
Rich Felker [Sat, 19 Feb 2011 07:23:29 +0000 (02:23 -0500)]
add missing WIFCONTINUED macro and improve WIFSIGNALED
Rich Felker [Sat, 19 Feb 2011 06:02:46 +0000 (01:02 -0500)]
prototypes for brk and sbrk
Rich Felker [Sat, 19 Feb 2011 03:03:03 +0000 (22:03 -0500)]
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...
Rich Felker [Sat, 19 Feb 2011 00:52:42 +0000 (19:52 -0500)]
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.
Rich Felker [Fri, 18 Feb 2011 22:04:56 +0000 (17:04 -0500)]
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.
Rich Felker [Fri, 18 Feb 2011 21:32:33 +0000 (16:32 -0500)]
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.
Rich Felker [Fri, 18 Feb 2011 04:13:46 +0000 (23:13 -0500)]
add portable lchown (trivial to support and a few ancient things want it..)
Rich Felker [Fri, 18 Feb 2011 00:15:08 +0000 (19:15 -0500)]
prepare WHATSNEW for release
Rich Felker [Thu, 17 Feb 2011 23:30:41 +0000 (18:30 -0500)]
document in config.mak sample that x86_64 is supported
Rich Felker [Thu, 17 Feb 2011 22:57:50 +0000 (17:57 -0500)]
update WHATSNEW in preparation for release
Rich Felker [Thu, 17 Feb 2011 22:57:26 +0000 (17:57 -0500)]
avoid deleting the lib/empty file
Rich Felker [Thu, 17 Feb 2011 22:16:20 +0000 (17:16 -0500)]
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.
Rich Felker [Thu, 17 Feb 2011 22:12:52 +0000 (17:12 -0500)]
new solution for empty lib dir (old one had some problems)
Rich Felker [Thu, 17 Feb 2011 20:15:03 +0000 (15:15 -0500)]
improve Makefile handling of git checkouts with missing lib/ and config.mak
Rich Felker [Thu, 17 Feb 2011 15:30:00 +0000 (10:30 -0500)]
make daemon try the operations that might fail before fork rather than after
Rich Felker [Thu, 17 Feb 2011 15:28:56 +0000 (10:28 -0500)]
daemon should check for failures and return -1
Rich Felker [Thu, 17 Feb 2011 05:03:24 +0000 (00:03 -0500)]
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...
Rich Felker [Thu, 17 Feb 2011 04:36:26 +0000 (23:36 -0500)]
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...
Rich Felker [Thu, 17 Feb 2011 03:37:26 +0000 (22:37 -0500)]
some gnu software wrongly uses "struct siginfo" instead of siginfo_t...
Rich Felker [Thu, 17 Feb 2011 02:21:26 +0000 (21:21 -0500)]
add to pthread.h: pthread_mutex_timedlock and sched.h, time.h
Rich Felker [Wed, 16 Feb 2011 23:19:46 +0000 (18:19 -0500)]
fix printf %n specifier - missing breaks had it clobbering memory
Rich Felker [Wed, 16 Feb 2011 14:50:57 +0000 (09:50 -0500)]
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.
Rich Felker [Wed, 16 Feb 2011 14:49:54 +0000 (09:49 -0500)]
patch from njk: make x86_64 __uniclone branchless.
Rich Felker [Wed, 16 Feb 2011 14:30:56 +0000 (09:30 -0500)]
fix compile failure: legacy cuserid needs to define feature test
Rich Felker [Wed, 16 Feb 2011 00:47:22 +0000 (19:47 -0500)]
move stdio stuff that's not arch-specific out of bits
Rich Felker [Wed, 16 Feb 2011 00:16:37 +0000 (19:16 -0500)]
protect some limit constants with feature test macros on x86_64
Rich Felker [Wed, 16 Feb 2011 00:15:45 +0000 (19:15 -0500)]
fix the types of some integer constant limits in headers
Rich Felker [Tue, 15 Feb 2011 22:33:52 +0000 (17:33 -0500)]
fix missing EXIT_* in stdlib.h after header cleanup
Rich Felker [Tue, 15 Feb 2011 21:28:36 +0000 (16:28 -0500)]
feature test support in unistd.h
Rich Felker [Tue, 15 Feb 2011 21:08:48 +0000 (16:08 -0500)]
fix directory reading on x86_64
Rich Felker [Tue, 15 Feb 2011 21:08:19 +0000 (16:08 -0500)]
prototype for gnu strcasestr (currently a stub)
Rich Felker [Tue, 15 Feb 2011 20:56:58 +0000 (15:56 -0500)]
fix x86_64 wrongly reporting itself as ILP32 instead of LP64
Rich Felker [Tue, 15 Feb 2011 20:52:26 +0000 (15:52 -0500)]
news for upcoming release
Rich Felker [Tue, 15 Feb 2011 20:25:31 +0000 (15:25 -0500)]
fix another error from header cleanup, missing size_t in time.h
Rich Felker [Tue, 15 Feb 2011 20:10:00 +0000 (15:10 -0500)]
fix broken signal.h from header cleanup
Rich Felker [Tue, 15 Feb 2011 19:52:11 +0000 (14:52 -0500)]
some docs fixes for x86_64
Rich Felker [Tue, 15 Feb 2011 19:39:02 +0000 (14:39 -0500)]
remove standalone syscall cruft
this was originally written for an early draft of the library where
non-standard functions would reside in a static library separate from
the shared libc.so, which would implement a pure standard. the idea
was not to depend on an implementation-dependent __syscall_ret
function in the main libc. but it turned out to be better to put
everything in a single library for both static and dynamic linking
uses, and thus the (incomplete) remnants of this feature were just
enlarging the source and binary.
Rich Felker [Tue, 15 Feb 2011 19:32:46 +0000 (14:32 -0500)]
fix some type leakage (timer_t) from x86_64 commit
Nicholas J. Kain [Tue, 15 Feb 2011 13:26:46 +0000 (08:26 -0500)]
Optimize x86_64 atomics to take advantage of 64-bitness.
Nicholas J. Kain [Tue, 15 Feb 2011 13:21:47 +0000 (08:21 -0500)]
Remove __syscall_lseek from x86_64 syscall.h.
Nicholas J. Kain [Tue, 15 Feb 2011 13:02:33 +0000 (08:02 -0500)]
Update x86_64 bits to mirror (modulo platform differences) the latest changes
to i386.
Nicholas J. Kain [Tue, 15 Feb 2011 12:32:09 +0000 (07:32 -0500)]
Port musl to x86-64. One giant commit!
Rich Felker [Tue, 15 Feb 2011 10:52:27 +0000 (05:52 -0500)]
yet another ugly legacy syscall rename...