| Commit message (Expand) | Author | Age | Files | Lines |
| * | fix breakage from last commit: forgot to include ksigaction.h•••this file can be overridden by a same-named file in an arch dir.
| Rich Felker | 2012-07-11 | 1 | -0/+6 |
| * | remove flush hook cruft that was never used from stdio•••there is no need/use for a flush hook. the write function serves this
purpose already. i originally created the hook for implementing mem
streams based on a mistaken reading of posix, and later realized it
wasn't useful but never removed it until now.
| Rich Felker | 2012-06-19 | 1 | -1/+1 |
| * | add pthread_attr_setstack interface (and get)•••i originally omitted these (optional, per POSIX) interfaces because i
considered them backwards implementation details. however, someone
later brought to my attention a fairly legitimate use case: allocating
thread stacks in memory that's setup for sharing and/or fast transfer
between CPU and GPU so that the thread can move data to a GPU directly
from automatic-storage buffers without having to go through additional
buffer copies.
perhaps there are other situations in which these interfaces are
useful too.
| Rich Felker | 2012-06-09 | 1 | -1/+2 |
| * | fix scanning of "-0x" pseudo-hex float (must give negative zero) | Rich Felker | 2012-06-08 | 1 | -1/+1 |
| * | increase default thread stack size to 80k•••I've been looking for data that would suggest a good default, and
since little has shown up, i'm doing this based on the limited data I
have. the value 80k is chosen to accommodate 64k of application data
(which happens to be the size of the buffer in git that made it crash
without a patch to call pthread_attr_setstacksize) plus the max stack
usage of most libc functions (with a few exceptions like crypt, which
will be fixed soon to avoid excessive stack usage, and [n]ftw, which
inherently uses a fair bit in recursive directory searching).
if further evidence emerges suggesting that the default should be
larger, I'll consider changing it again, but I'd like to avoid it
getting too large to avoid the issues of large commit charge and rapid
address space exhaustion on 32-bit machines.
| Rich Felker | 2012-06-02 | 1 | -1/+1 |
| * | enable LARGEFILE64 aliases•••these will NOT be used when compiling with -D_LARGEFILE64_SOURCE on
musl; instead, they exist in the hopes of eventually being able to run
some glibc-linked apps with musl sitting in place of glibc.
also remove the (apparently incorrect) fcntl alias.
| Rich Felker | 2012-05-31 | 1 | -2/+1 |
| * | remove cruft from pthread structure (old cancellation stuff) | Rich Felker | 2012-05-25 | 1 | -2/+0 |
| * | remove everything related to forkall•••i made a best attempt, but the intended semantics of this function are
fundamentally contradictory. there is no consistent way to handle
ownership of locks when forking a multi-threaded process. the code
could have worked by accident for programs that only used normal
mutexes and nothing else (since they don't actually store or care
about their owner), but that's about it. broken-by-design interfaces
that aren't even in glibc (only solaris) don't belong in musl.
| Rich Felker | 2012-05-22 | 1 | -1/+0 |
| * | fix out-of-bounds array access in pthread barriers on 64-bit•••it's ok to overlap with integer slot 3 on 32-bit because only slots
0-2 are used on process-local barriers.
| Rich Felker | 2012-05-21 | 1 | -1/+1 |
| * | add FORCE_EVAL macro to evaluate float expr for their side effect•••updated nextafter* to use FORCE_EVAL, it can be used in many other
places in the math code to improve readability.
| nsz | 2012-05-06 | 1 | -0/+13 |
| * | overhaul SSP support to use a real canary•••pthread structure has been adjusted to match the glibc/GCC abi for
where the canary is stored on i386 and x86_64. it will need variants
for other archs to provide the added security of the canary's entropy,
but even without that it still works as well as the old "minimal" ssp
support. eventually such changes will be made anyway, since they are
also needed for GCC/C11 thread-local storage support (not yet
implemented).
care is taken not to attempt initializing the thread pointer unless
the program actually uses SSP (by reference to __stack_chk_fail).
| Rich Felker | 2012-05-03 | 1 | -0/+4 |
| * | fix off-by-one error that caused uninitialized memory read in floatscan•••this caused misreading of certain floating point values that are exact
multiples of large powers of ten, unpredictable depending on prior
stack contents.
| Rich Felker | 2012-04-30 | 1 | -1/+1 |
| * | 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 | 2 | -3/+3 |
| * | new internal locking primitive; drop spinlocks•••we use priority inheritance futexes if possible so that the library
cannot hit internal priority inversion deadlocks in the presence of
realtime priority scheduling (full support to be added later).
| Rich Felker | 2012-04-24 | 1 | -1/+2 |
| * | remove redundant (unmaintained) check in floatscan•••also be extra careful to avoid wrapping the circular buffer early
| Rich Felker | 2012-04-22 | 1 | -3/+3 |
| * | make floatscan correctly set errno for overflow/underflow•••care is taken that the setting of errno correctly reflects underflow
condition. scanning exact denormal values does not result in ERANGE,
nor does scanning values (such as the usual string definition of
FLT_MIN) which are actually less than the smallest normal number but
which round to a normal result.
only the decimal case is handled so far; hex float require a separate
fix to come later.
| Rich Felker | 2012-04-21 | 1 | -4/+16 |
| * | skip leading zeros even after decimal point in floatscan•••in principle this should just be an optimization, but it happens to
also fix a nasty bug where values like 0.00000000001 were getting
caught by the early zero detection path and wrongly scanned as zero.
| Rich Felker | 2012-04-21 | 1 | -4/+9 |
| * | fix overread (consuming an extra byte) scanning NAN•••bug detected by glib test suite
| Rich Felker | 2012-04-21 | 1 | -1/+1 |
| * | fix really bad breakage in strtol, etc.: failure to accept leading spaces | Rich Felker | 2012-04-19 | 3 | -4/+5 |
| * | fix typo in exponent reading code or floats•••this was basically harmless, but could have resulted in misreading
inputs with more than a few gigabytes worth of digits..
| Rich Felker | 2012-04-18 | 1 | -1/+1 |
| * | fix failure to read infinity in scanf•••this code worked in strtod, but not in scanf. more evidence that i
should design a better interface for discarding multiple tail
characters than just calling unget repeatedly...
| Rich Felker | 2012-04-17 | 1 | -3/+4 |
| * | fix failure of int parser to unget an initial mismatching character | Rich Felker | 2012-04-17 | 1 | -0/+1 |
| * | use the new integer parser (FILE/shgetc based) for strtol, wcstol, etc. | Rich Felker | 2012-04-16 | 2 | -127/+0 |
| * | new scanf implementation and corresponding integer parser/converter•••advantages over the old code:
- correct results for floating point (old code was bogus)
- wide/regular scanf separated so scanf does not pull in wide code
- well-defined behavior on integers that overflow dest type
- support for %[a-b] ranges with %[ (impl-defined by widely used)
- no intermediate conversion of fmt string to wide string
- cleaner, easier to share code with strto* functions
- better standards conformance for corner cases
the old code remains in the source tree, as the wide versions of the
scanf-family functions are still using it. it will be removed when no
longer needed.
| Rich Felker | 2012-04-16 | 3 | -0/+107 |
| * | fix buggy limiter handling in shgetc•••this is needed for upcoming new scanf
| Rich Felker | 2012-04-16 | 1 | -4/+3 |
| * | fix broken shgetc limiter logic (wasn't working) | Rich Felker | 2012-04-16 | 2 | -2/+5 |
| * | floatscan: fix incorrect count of leading nonzero digits•••this off-by-one error was causing values with just one digit past the
decimal point to be treated by the integer case. in many cases it
would yield the correct result, but if expressions are evaluated in
excess precision, double rounding may occur.
| Rich Felker | 2012-04-16 | 1 | -1/+1 |
| * | use fast version of the int reading code for the high-order digits too•••this increases code size slightly, but it's considerably faster,
especially for power-of-2 bases.
| Rich Felker | 2012-04-13 | 1 | -3/+13 |
| * | use macros instead of inline functions in shgetc.h•••at -Os optimization level, gcc refuses to inline these functions even
though the inlined code would roughly the same size as the function
call, and much faster. the easy solution is to make them into macros.
| Rich Felker | 2012-04-13 | 1 | -20/+4 |
| * | fix spurious overflows in strtoull with small bases•••whenever the base was small enough that more than one digit could
still fit after UINTMAX_MAX/36-1 was reached, only the first would be
allowed; subsequent digits would trigger spurious overflow, making it
impossible to read the largest values in low bases.
| Rich Felker | 2012-04-13 | 1 | -7/+3 |
| * | remove magic numbers from floatscan | Rich Felker | 2012-04-12 | 1 | -5/+5 |
| * | optimize more integer cases in floatscan; comment the whole procedure | Rich Felker | 2012-04-12 | 1 | -8/+27 |
| * | revert invalid optimization in floatscan | Rich Felker | 2012-04-11 | 1 | -2/+2 |
| * | fix stupid typo in floatscan that caused excess rounding of some values | Rich Felker | 2012-04-11 | 1 | -1/+1 |
| * | optimize floatscan downscaler to skip results that won't be needed•••when upscaling, even the very last digit is needed in cases where the
input is exact; no digits can be discarded. but when downscaling, any
digits less significant than the mantissa bits are destined for the
great bitbucket; the only influence they can have is their presence
(being nonzero). thus, we simply throw them away early. the result is
nearly a 4x performance improvement for processing huge values.
the particular threshold LD_B1B_DIG+3 is not chosen sharply; it's
simply a "safe" distance past the significant bits. it would be nice
to replace it with a sharp bound, but i suspect performance will be
comparable (within a few percent) anyway.
| Rich Felker | 2012-04-11 | 1 | -2/+3 |
| * | simplify/debloat radix point alignment code in floatscan•••now that this is the first operation, it can rely on the circular
buffer contents not being wrapped when it begins. we limit the number
of digits read slightly in the initial parsing loops too so that this
code does not have to consider the case where it might cause the
circular buffer to wrap; this is perfectly fine because KMAX is chosen
as a power of two for circular-buffer purposes and is much larger than
it otherwise needs to be, anyway.
these changes should not affect performance at all.
| Rich Felker | 2012-04-11 | 1 | -9/+4 |
| * | optimize floatscan: avoid excessive upscaling•••upscaling by even one step too much creates 3-29 extra iterations for
the next loop. this is still suboptimal since it always goes by 2^29
rather than using a smaller upscale factor when nearing the target,
but performance on common, small-magnitude, few-digit values has
already more than doubled with this change.
more optimizations on the way...
| Rich Felker | 2012-04-11 | 1 | -27/+27 |
| * | fix incorrect initial count in shgetc when data is already buffered | Rich Felker | 2012-04-11 | 1 | -1/+1 |
| * | fix bug parsing lone zero followed by junk, and hex float over-reading | Rich Felker | 2012-04-11 | 1 | -6/+5 |
| * | fix float scanning of certain values ending in zeros•••for example, "1000000000" was being read as "1" due to this loop
exiting early. it's necessary to actually update z and zero the
entries so that the subsequent rounding code does not get confused;
before i did that, spurious inexact exceptions were being raised.
| Rich Felker | 2012-04-10 | 1 | -1/+3 |
| * | fix potential overflow in exponent reading•••note that there's no need for a precise cutoff, because exponents this
large will always result in overflow or underflow (it's impossible to
read enough digits to compensate for the exponent magnitude; even at a
few nanoseconds per digit it would take hundreds of years).
| Rich Felker | 2012-04-10 | 1 | -1/+1 |
| * | set errno properly when parsing floating point | Rich Felker | 2012-04-10 | 1 | -4/+21 |
| * | add "scan helper getc" and rework strtod, etc. to use it•••the immediate benefit is a significant debloating of the float parsing
code by moving the responsibility for keeping track of the number of
characters read to a different module.
by linking shgetc with the stdio buffer logic, counting logic is
defered to buffer refill time, keeping the calls to shgetc fast and
light.
in the future, shgetc will also be useful for integrating the new
float code with scanf, which needs to not only count the characters
consumed, but also limit the number of characters read based on field
width specifiers.
shgetc may also become a useful tool for simplifying the integer
parsing code.
| Rich Felker | 2012-04-10 | 5 | -73/+111 |
| * | new floating point parser/converter•••this version is intended to be fully conformant to the ISO C, POSIX,
and IEEE standards for conversion of decimal/hex floating point
strings to float, double, and long double (ld64 or ld80 only at
present) values. in particular, all results are intended to be rounded
correctly according to the current rounding mode. further, this
implementation aims to set the floating point underflow, overflow, and
inexact flags to reflect the conversion performed.
a moderate amount of testing has been performed (by nsz and myself)
prior to integration of the code in musl, but it still may have bugs.
so far, only strto(d|ld|f) use the new code. scanf integration will be
done as a separate commit, and i will add implementations of the wide
character functions later.
| Rich Felker | 2012-04-10 | 2 | -0/+446 |
| * | add creal/cimag macros in complex.h (and use them in the functions defs) | Rich Felker | 2012-03-22 | 1 | -8/+0 |
| * | don't inline __rem_pio2l so the code size is smaller | nsz | 2012-03-19 | 1 | -0/+1 |
| * | fix loads of missing const in new libm, and some global vars (?!) in powl | Rich Felker | 2012-03-18 | 1 | -2/+2 |
| * | fix namespace issues for lgamma, etc.•••standard functions cannot depend on nonstandard symbols
| Rich Felker | 2012-03-16 | 1 | -0/+2 |
| * | first commit of the new libm!•••thanks to the hard work of Szabolcs Nagy (nsz), identifying the best
(from correctness and license standpoint) implementations from freebsd
and openbsd and cleaning them up! musl should now fully support c99
float and long double math functions, and has near-complete complex
math support. tgmath should also work (fully on gcc-compatible
compilers, and mostly on any c99 compiler).
based largely on commit 0376d44a890fea261506f1fc63833e7a686dca19 from
nsz's libm git repo, with some additions (dummy versions of a few
missing long double complex functions, etc.) by me.
various cleanups still need to be made, including re-adding (if
they're correct) some asm functions that were dropped.
| Rich Felker | 2012-03-13 | 2 | -0/+323 |
| * | fix obscure bug in strtoull reading the highest 16 possible values | Rich Felker | 2012-03-02 | 1 | -1/+1 |