| Commit message (Expand) | Author | Age | Files | Lines |
| * | ditch the priority inheritance locks; use malloc's version of lock•••i did some testing trying to switch malloc to use the new internal
lock with priority inheritance, and my malloc contention test got
20-100 times slower. if priority inheritance futexes are this slow,
it's simply too high a price to pay for avoiding priority inversion.
maybe we can consider them somewhere down the road once the kernel
folks get their act together on this (and perferably don't link it to
glibc's inefficient lock API)...
as such, i've switch __lock to use malloc's implementation of
lightweight locks, and updated all the users of the code to use an
array with a waiter count for their locks. this should give optimal
performance in the vast majority of cases, and it's simple.
malloc is still using its own internal copy of the lock code because
it seems to yield measurably better performance with -O3 when it's
inlined (20% or more difference in the contention stress test).
| Rich Felker | 2012-04-24 | 1 | -3/+3 |
| * | remove debug cruft that was left in getdate | Rich Felker | 2012-03-02 | 1 | -2/+0 |
| * | first try at implementing getdate function | Rich Felker | 2012-03-02 | 1 | -0/+47 |
| * | fix bugs in strptime handling of string day/month names, literals | Rich Felker | 2012-03-02 | 1 | -0/+2 |
| * | implement wcsftime function | Rich Felker | 2012-02-28 | 1 | -0/+32 |
| * | cleanup various minor issues reported by nsz•••the changes to syscall_ret are mostly no-ops in the generated code,
just cleanup of type issues and removal of some implementation-defined
behavior. the one exception is the change in the comparison value,
which is fixed so that 0xf...f000 (which in principle could be a valid
return value for mmap, although probably never in reality) is not
treated as an error return.
| Rich Felker | 2011-09-26 | 1 | -1/+2 |
| * | fix assumptions that char is signed | Rich Felker | 2011-09-16 | 1 | -2/+2 |
| * | remove incorrectly-made-visible internal dst offset variable | Rich Felker | 2011-09-14 | 1 | -1/+0 |
| * | strptime: fix use of uninitialized dest field in converting integer | Rich Felker | 2011-09-05 | 1 | -1/+1 |
| * | partially working strptime•••it's missing at least:
- derived fields
- week numbers
- short year (without century) support
- locale modifiers
| Rich Felker | 2011-08-16 | 1 | -148/+149 |
| * | fix missing include in last commit | Rich Felker | 2011-08-13 | 1 | -0/+1 |
| * | fix clock() function•••it previously was returning the pseudo-monotonic-realtime clock
returned by times() rather than process cputime. it also violated C
namespace by pulling in times().
we now use clock_gettime() if available because times() has
ridiculously bad resolution. still provide a fallback for ancient
kernels without clock_gettime.
| Rich Felker | 2011-08-13 | 1 | -2/+7 |
| * | more efficient signal blocking for timer threads•••due to the barrier, it's safe just to block signals in the new thread,
rather than blocking and unblocking in the parent thread.
| Rich Felker | 2011-08-12 | 1 | -4/+4 |
| * | normal exit from timer thread should run dtors, restore cancel state | Rich Felker | 2011-08-11 | 1 | -1/+1 |
| * | block signals in timer threads•••if a timer thread leaves signals unblocked, any future attempt by the
main thread to prevent the process from being terminated by blocking
signals will fail, since the signal can still be delivered to the
timer thread.
| Rich Felker | 2011-08-11 | 1 | -0/+4 |
| * | use weak aliase rather than weak reference for vdso clock_gettime•••this works around pcc's lack of working support for weak references,
and in principle is nice because it gets us back to the stage where
the only weak symbol feature we use is weak aliases, nothing else.
having fewer dependencies on fancy linker features is a good thing.
| Rich Felker | 2011-08-07 | 1 | -8/+12 |
| * | workaround for gcc's optimizer breaking dynamic symbol resolution | Rich Felker | 2011-07-24 | 1 | -1/+2 |
| * | const correctness on function pointer | Rich Felker | 2011-07-24 | 1 | -1/+1 |
| * | some preliminaries for vdso clock support•••these changes also make it so clock_gettime(CLOCK_REALTIME, &ts) works
even on pre-2.6 kernels, emulated via the gettimeofday syscall. there
is no cost for the fallback check, as it falls under the error case
that already must be checked for storing the error code in errno, but
which would normally be hidden inside __syscall_ret.
| Rich Felker | 2011-07-23 | 3 | -7/+35 |
| * | remove old useless timezone.s file (unused) | Rich Felker | 2011-06-13 | 1 | -27/+0 |
| * | use volatile pointers for intentional-crash code. | Rich Felker | 2011-06-06 | 1 | -1/+1 |
| * | optimize compound-literal sigset_t's not to contain useless hurd bits | Rich Felker | 2011-05-07 | 1 | -1/+1 |
| * | overhaul implementation-internal signal protections•••the new approach relies on the fact that the only ways to create
sigset_t objects without invoking UB are to use the sig*set()
functions, or from the masks returned by sigprocmask, sigaction, etc.
or in the ucontext_t argument to a signal handler. thus, as long as
sigfillset and sigaddset avoid adding the "protected" signals, there
is no way the application will ever obtain a sigset_t including these
bits, and thus no need to add the overhead of checking/clearing them
when sigprocmask or sigaction is called.
note that the old code actually *failed* to remove the bits from
sa_mask when sigaction was called.
the new implementations are also significantly smaller, simpler, and
faster due to ignoring the useless "GNU HURD signals" 65-1024, which
are not used and, if there's any sanity in the world, never will be
used.
| Rich Felker | 2011-05-07 | 1 | -2/+1 |
| * | overhaul pthread cancellation•••this patch improves the correctness, simplicity, and size of
cancellation-related code. modulo any small errors, it should now be
completely conformant, safe, and resource-leak free.
the notion of entering and exiting cancellation-point context has been
completely eliminated and replaced with alternative syscall assembly
code for cancellable syscalls. the assembly is responsible for setting
up execution context information (stack pointer and address of the
syscall instruction) which the cancellation signal handler can use to
determine whether the interrupted code was in a cancellable state.
these changes eliminate race conditions in the previous generation of
cancellation handling code (whereby a cancellation request received
just prior to the syscall would not be processed, leaving the syscall
to block, potentially indefinitely), and remedy an issue where
non-cancellable syscalls made from signal handlers became cancellable
if the signal handler interrupted a cancellation point.
x86_64 asm is untested and may need a second try to get it right.
| Rich Felker | 2011-04-17 | 2 | -11/+2 |
| * | use a separate signal from SIGCANCEL for SIGEV_THREAD timers•••otherwise we cannot support an application's desire to use
asynchronous cancellation within the callback function. this change
also slightly debloats pthread_create.c.
| Rich Felker | 2011-04-14 | 1 | -7/+25 |
| * | run pthread tsd destructors when a timer thread pretends to exit | Rich Felker | 2011-04-09 | 1 | -0/+6 |
| * | greatly improve SIGEV_THREAD timers•••calling pthread_exit from, or pthread_cancel on, the timer callback
thread will no longer destroy the timer.
| Rich Felker | 2011-04-09 | 2 | -15/+20 |
| * | consistency: change all remaining syscalls to use SYS_ rather than __NR_ prefix | Rich Felker | 2011-04-06 | 3 | -3/+3 |
| * | fix signal-based timers with null sigevent argument•••since timer_create is no longer allocating a structure for the timer_t
and simply using the kernel timer id, it was impossible to specify the
timer_t as the argument to the signal handler. the solution is to pass
the null sigevent pointer on to the kernel, rather than filling it in
userspace, so that the kernel does the right thing. however, that
precludes the clever timerid-versus-threadid encoding we were doing.
instead, just assume timerids are below 1M and thread pointers are
above 1M. (in perspective: timerids are sequentially allocated and
seem limited to 32k, and thread pointers are at roughly 3G.)
| Rich Felker | 2011-04-06 | 5 | -28/+19 |
| * | timer threads should sleep and stay asleep... a long time | Rich Felker | 2011-04-03 | 1 | -1/+1 |
| * | revert to deleting kernel-level timer from cancellation handler•••this is necessary in order to avoid breaking timer_getoverrun in the
last run of the timer event handler, if it has not yet finished.
| Rich Felker | 2011-04-03 | 2 | -7/+11 |
| * | simplify calling of timer signal handler | Rich Felker | 2011-04-03 | 1 | -3/+1 |
| * | avoid all malloc/free in timer creation/destruction•••instead of allocating a userspace structure for signal-based timers,
simply use the kernel timer id. we use the fact that thread pointers
will always be zero in the low bit (actually more) to encode integer
timerid values as pointers.
also, this change ensures that the timer_destroy syscall has completed
before the library timer_destroy function returns, in case it matters.
| Rich Felker | 2011-03-30 | 5 | -29/+20 |
| * | optimize timer creation and possibly protect against some minor races•••the major idea of this patch is not to depend on having the timer
pointer delivered to the signal handler, and instead use the thread
pointer to get the callback function address and argument. this way,
the parent thread can make the timer_create syscall while the child
thread is starting, and it should never have to block waiting for the
barrier.
| Rich Felker | 2011-03-30 | 1 | -14/+19 |
| * | reorder timer initialization so that timer_create does not depend on free•••this allows small programs which only create times, but never delete
them, to use simple_malloc instead of the full malloc.
| Rich Felker | 2011-03-29 | 2 | -9/+17 |
| * | implement POSIX timers•••this implementation is superior to the glibc/nptl implementation, in
that it gives true realtime behavior. there is no risk of timer
expiration events being lost due to failed thread creation or failed
malloc, because the thread is created as time creation time, and
reused until the timer is deleted.
| Rich Felker | 2011-03-29 | 5 | -0/+143 |
| * | overhaul cancellation to fix resource leaks and dangerous behavior with signals•••this commit addresses two issues:
1. a race condition, whereby a cancellation request occurring after a
syscall returned from kernelspace but before the subsequent
CANCELPT_END would cause cancellable resource-allocating syscalls
(like open) to leak resources.
2. signal handlers invoked while the thread was blocked at a
cancellation point behaved as if asynchronous cancellation mode wer in
effect, resulting in potentially dangerous state corruption if a
cancellation request occurs.
the glibc/nptl implementation of threads shares both of these issues.
with this commit, both are fixed. however, cancellation points
encountered in a signal handler will not be acted upon if the signal
was received while the thread was already at a cancellation point.
they will of course be acted upon after the signal handler returns, so
in real-world usage where signal handlers quickly return, it should
not be a problem. it's possible to solve this problem too by having
sigaction() wrap all signal handlers with a function that uses a
pthread_cleanup handler to catch cancellation, patch up the saved
context, and return into the cancellable function that will catch and
act upon the cancellation. however that would be a lot of complexity
for minimal if any benefit...
| Rich Felker | 2011-03-24 | 1 | -0/+1 |
| * | global cleanup to use the new syscall interface | Rich Felker | 2011-03-20 | 6 | -11/+6 |
| * | if returning errno value directly from a syscall, we need to negate it. | Rich Felker | 2011-03-19 | 1 | -1/+1 |
| * | syscall overhaul part two - unify public and internal syscall interface•••with this patch, the syscallN() functions are no longer needed; a
variadic syscall() macro allows syscalls with anywhere from 0 to 6
arguments to be made with a single macro name. also, manually casting
each non-integer argument with (long) is no longer necessary; the
casts are hidden in the macros.
some source files which depended on being able to define the old macro
SYSCALL_RETURNS_ERRNO have been modified to directly use __syscall()
instead of syscall(). references to SYSCALL_SIGSET_SIZE and SYSCALL_LL
have also been changed.
x86_64 has not been tested, and may need a follow-up commit to fix any
minor bugs/oversights.
| Rich Felker | 2011-03-19 | 3 | -6/+3 |
| * | misplaced & in times() made it fail to work, and clobber the stack | Rich Felker | 2011-03-12 | 1 | -1/+1 |
| * | more cancellation points: tcdrain, clock_nanosleep | Rich Felker | 2011-03-10 | 1 | -1/+6 |
| * | 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.
| Rich Felker | 2011-03-10 | 3 | -3/+0 |
| * | implement the remaining clock_* interfaces | Rich Felker | 2011-02-19 | 5 | -0/+36 |
| * | initial check-in, version 0.5.0 | Rich Felker | 2011-02-12 | 25 | -0/+874 |