| Commit message (Expand) | Author | Age | Files | Lines |
| * | have new timer threads unblock their own SIGTIMER•••unblocking it in the pthread_once init function is not sufficient,
since multiple threads, some of them with the signal blocked, could
already exist before this is called; timers started from such threads
would be non-functional.
| Rich Felker | 2013-08-03 | 1 | -2/+2 |
| * | add system for resetting TLS to initial values•••this is needed for reused threads in the SIGEV_THREAD timer
notification system, and could be reused elsewhere in the future if
needed, though it should be refactored for such use.
for static linking, __init_tls.c is simply modified to export the TLS
info in a structure with external linkage, rather than using statics.
this perhaps makes the code more clear, since the statics were poorly
named for statics. the new __reset_tls.c is only linked if it is used.
for dynamic linking, the code is in dynlink.c. sharing code with
__copy_tls is not practical since __reset_tls must also re-zero
thread-local bss.
| Rich Felker | 2013-08-03 | 1 | -0/+3 |
| * | fix multiple bugs in SIGEV_THREAD timers•••1. the thread result field was reused for storing a kernel timer id,
but would be overwritten if the application code exited or cancelled
the thread.
2. low pointer values were used as the indicator that the timer id is
a kernel timer id rather than a thread id. this is not portable, as
mmap may return low pointers on some conditions. instead, use the fact
that pointers must be aligned and kernel timer ids must be
non-negative to map pointers into the negative integer space.
3. signals were not blocked until after the timer thread started, so a
race condition could allow a signal handler to run in the timer thread
when it's not supposed to exist. this is mainly problematic if the
calling thread was the only thread where the signal was unblocked and
the signal handler assumes it runs in that thread.
| Rich Felker | 2013-08-03 | 5 | -21/+35 |
| * | add wcsftime_t alias•••this is a nonstandard extension.
| Rich Felker | 2013-08-02 | 1 | -0/+3 |
| * | fix semantically incorrect use of LC_GLOBAL_LOCALE•••LC_GLOBAL_LOCALE refers to the global locale, controlled by setlocale,
not the thread-local locale in effect which these functions should be
using. neither LC_GLOBAL_LOCALE nor 0 has an argument to the *_l
functions has behavior defined by the standard, but 0 is a more
logical choice for requesting the callee to lookup the current locale.
in the future I may move the current locale lookup the the caller (the
non-_l-suffixed wrapper).
at this point, all of the locale logic is dummied out, so no harm was
done, but it should at least avoid misleading usage.
| Rich Felker | 2013-07-28 | 2 | -2/+2 |
| * | reorder strftime to eliminate the incorrect indention level•••this change is in preparation for possibly adding support for the
field width and padding specifiers added in POSIX 2008.
| Rich Felker | 2013-07-27 | 1 | -5/+5 |
| * | rework langinfo code for ABI compat and for use by time code | Rich Felker | 2013-07-24 | 2 | -8/+9 |
| * | add __wcsftime_l symbol•••unlike the strftime commit, this one is purely an ABI compatibility
issue. the previous version of the code would have worked just as well
with LC_TIME once LC_TIME support is added.
| Rich Felker | 2013-07-24 | 1 | -3/+9 |
| * | move strftime_l into strftime.c and add __-prefixed version•••the latter is both for ABI purposes, and to facilitate eventually
adding LC_TIME support. it's also nice to eliminate an extra source
file.
| Rich Felker | 2013-07-24 | 1 | -1/+10 |
| * | fix error code on time conversion overflows•••POSIX mandates EOVERFLOW for this condition.
| Rich Felker | 2013-07-17 | 4 | -4/+4 |
| * | fix fd leak in file mapping code used in new zoneinfo support | Rich Felker | 2013-07-17 | 1 | -1/+1 |
| * | the big time handling overhaul•••this commit has two major user-visible parts: zoneinfo-format time
zones are now supported, and overflow handling is intended to be
complete in the sense that all functions return a correct result if
and only if the result fits in the destination type, and otherwise
return an error. also, some noticable bugs in the way DST detection
and normalization worked have been fixed, and performance may be
better than before, but it has not been tested.
| Rich Felker | 2013-07-17 | 18 | -348/+649 |
| * | implement week-based-year year numbers in strftime•••in the process, I refactored the week-number code so it can be used by
the week-based-year formats to determine year adjustments at the
boundary values. this also improves indention/code readability.
| Rich Felker | 2013-06-28 | 1 | -27/+34 |
| * | fix breakage in last commit to strftime due to missing INT_MAX•••that's what I get for changing a hard-coded threshold to a proper
non-magic-number without testing.
| Rich Felker | 2013-06-28 | 1 | -0/+1 |
| * | implement week numbers and half of the week-based-year logic for strftime•••output for plain week numbers (%U and %W) has been sanity-checked, and
output for the week-based-year week numbers (%V) has been checked
extensively against known-good data for the full non-negative range of
32-bit time_t.
year numbers for week-based years (%g and %G) are not yet implemented.
| Rich Felker | 2013-06-28 | 1 | -3/+38 |
| * | support cputime clocks for processes/threads other than self•••apparently these features have been in Linux for a while now, so it
makes sense to support them. the bit twiddling seems utterly illogical
and wasteful, especially the negation, but that's how the kernel folks
chose to encode pids/tids into the clock id.
| Rich Felker | 2013-06-08 | 1 | -2/+5 |
| * | fix overflow behavior of clock() function•••per Austin Group interpretation for issue #686, which cites the
requirements of ISO C, clock() cannot wrap. if the result is not
representable, it must return (clock_t)-1. in addition, the old code
was performing wrapping via signed overflow and thus invoking
undefined behavior.
since it seems impossible to accurately check for overflow with the
old times()-based fallback code, I have simply dropped the fallback
code for now, thus always returning -1 on ancient systems. if there's
a demand for making it work and somebody comes up with a way, it could
be reinstated, but the clock() function is essentially useless on
32-bit system anyway (it overflows in less than an hour).
it should be noted that I used LONG_MAX rather than ULONG_MAX, despite
32-bit archs using an unsigned type for clock_t. this discrepency with
the glibc/LSB type definitions will be fixed now; since wrapping of
clock_t is no longer supported, there's no use in it being unsigned.
| Rich Felker | 2013-05-23 | 1 | -7/+10 |
| * | fix incorrect clock tick scaling in fallback case of clock()•••since CLOCKS_PER_SEC is 1000000 (required by XSI) and the times
syscall reports values in 1/100 second units (Linux), the correct
scaling factor is 10000, not 100. note that only ancient kernels which
lack clock_gettime are affected.
| Rich Felker | 2013-05-05 | 1 | -1/+1 |
| * | do not interpret errors in return value of times() syscall•••all return values are valid, and on 32-bit systems, values that look
like errors can and will occur. since the only actual error this
function could return is EFAULT, and it is only returnable when the
application has invoked undefined behavior, simply ignore the
possibility that the return value is actually an error code.
| Rich Felker | 2013-05-05 | 1 | -1/+1 |
| * | silence nonsensical warnings in timer_create | Rich Felker | 2013-04-06 | 1 | -2/+2 |
| * | __time_to_tm: initialize tm_zone and tm_gmtoff | rofl0r | 2013-04-02 | 1 | -0/+2 |
| * | remove __SYSCALL_SSLEN arch macro in favor of using public _NSIG•••the issue at hand is that many syscalls require as an argument the
kernel-ABI size of sigset_t, intended to allow the kernel to switch to
a larger sigset_t in the future. previously, each arch was defining
this size in syscall_arch.h, which was redundant with the definition
of _NSIG in bits/signal.h. as it's used in some not-quite-portable
application code as well, _NSIG is much more likely to be recognized
and understood immediately by someone reading the code, and it's also
shorter and less cluttered.
note that _NSIG is actually 65/129, not 64/128, but the division takes
care of throwing away the off-by-one part.
| Rich Felker | 2013-03-26 | 1 | -1/+1 |
| * | make some arrays const•••this way they'll go into .rodata, decreasing memory pressure.
| rofl0r | 2013-02-02 | 1 | -1/+1 |
| * | fix tm_to_time logic for number of days in november•••report/patch by Hiltjo Posthuma <hiltjo@codemadness.org>
| Rich Felker | 2013-01-26 | 1 | -1/+1 |
| * | clean up sloppy nested inclusion from pthread_impl.h•••this mirrors the stdio_impl.h cleanup. one header which is not
strictly needed, errno.h, is left in pthread_impl.h, because since
pthread functions return their error codes rather than using errno,
nearly every single pthread function needs the errno constants.
in a few places, rather than bringing in string.h to use memset, the
memset was replaced by direct assignment. this seems to generate much
better code anyway, and makes many functions which were previously
non-leaf functions into leaf functions (possibly eliminating a great
deal of bloat on some platforms where non-leaf functions require ugly
prologue and/or epilogue).
| Rich Felker | 2012-11-08 | 1 | -0/+1 |
| * | more close-on-exec fixes, mostly using new "e" flag to fopen | Rich Felker | 2012-09-29 | 1 | -1/+1 |
| * | use restrict everywhere it's required by c99 and/or posix 2008•••to deal with the fact that the public headers may be used with pre-c99
compilers, __restrict is used in place of restrict, and defined
appropriately for any supported compiler. we also avoid the form
[restrict] since older versions of gcc rejected it due to a bug in the
original c99 standard, and instead use the form *restrict.
| Rich Felker | 2012-09-06 | 10 | -11/+11 |
| * | fix (hopefully) all hard-coded 8's for kernel sigset_t size•••some minor changes to how hard-coded sets for thread-related purposes
are handled were also needed, since the old object sizes were not
necessarily sufficient. things have gotten a bit ugly in this area,
and i think a cleanup is in order at some point, but for now the goal
is just to get the code working on all supported archs including mips,
which was badly broken by linux rejecting syscalls with the wrong
sigset_t size.
| Rich Felker | 2012-08-09 | 1 | -1/+2 |
| * | add timegm function (inverse of gmtime), nonstandard | Rich Felker | 2012-06-13 | 1 | -0/+9 |
| * | linux deprecated SYS_utime on some archs, so use SYS_utimes instead•••the old code could be kept for cases where SYS_utime is available, but
it's not really worth the ifdef ugliness. and better to avoid
deprecated stuff just in case the kernel devs ever get crazy enough to
start removing it from archs where it was part of the ABI and breaking
static bins...
| Rich Felker | 2012-05-24 | 1 | -1/+8 |
| * | 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 |