Commit Graph

230 Commits

Author SHA1 Message Date
Rich Felker
8705a0f1af add some ugly byte swapping cruft in endian.h 2012-04-22 11:08:01 -04:00
Rich Felker
b1b3d3525b add getresuid and getresgid syscall wrappers 2012-04-22 10:37:19 -04:00
Rich Felker
769d3d3498 fix header typo 2012-04-18 13:11:35 -04:00
Rich Felker
ba6a9e7734 legacy junk compatibility grab-bag
- add the rest of the junk traditionally in sys/param.h
- add prototypes for some nonstandard functions
- add _GNU_SOURCE to their source files so the compiler can check proto
2012-04-18 12:22:24 -04:00
Rich Felker
ed0e3a357e fix incorrect macro name for MATH_ERREXCEPT in math.h 2012-04-18 11:41:04 -04:00
Rich Felker
67b25fe0a8 move F_DUPFD_CLOEXEC out of bits
fcntl values 1024 and up are universal, arch-independent. later I'll
add some of the other linux-specific ones for notify, leases, pipe
size, etc. here too.
2012-04-15 17:05:10 -04:00
Rich Felker
0115a6ed96 rename __sa_restorer to sa_restorer in struct sigaction
this is legal since sa_* is in the reserved namespace for signal.h,
per posix. note that the sa_restorer field is not used anywhere, so
programs that are trying to use it may still break, but at least
they'll compile. if it turns out such programs actually need to be
able to set their own sa_restorer to function properly, i'll add the
necessary code to sigaction.c later.
2012-04-13 23:06:54 -04:00
Rich Felker
3be616c1df fix alloca issue in stdlib.h too
I forgot _GNU_SOURCE also has it declared here...
2012-04-09 16:22:05 -04:00
Rich Felker
d71d0805f9 alloca cannot be a function. #define it to the gcc builtin if possible
gcc makes this mapping by default anyway, but it will be disabled by
-fno-builtin (and presumably by -std=c99 or similar). for the main
program the error will be reported by the linker, and the issue can
easily be fixed, but for dynamic-loaded so files, the error cannot be
detected until dlopen time, at which point it has become very obscure.
2012-04-09 15:06:58 -04:00
Rich Felker
450f2c4a85 remove useless (at best, harmful) feature test checks in aio.h 2012-04-03 19:16:51 -04:00
Rich Felker
4dbd94112f optimize signbit macro 2012-03-30 23:41:43 -04:00
Rich Felker
93a18a15e4 make math.h more c++-friendly 2012-03-30 23:33:00 -04:00
Rich Felker
494ba80e9a simplify creal and cimag macros 2012-03-22 20:00:58 -04:00
Rich Felker
13e400b355 add creal/cimag macros in complex.h (and use them in the functions defs) 2012-03-22 15:54:55 -04:00
Rich Felker
132f0a0083 tgmath.h: suppress any existing macro definitions before defining macros
this is necessary so that we can freely add macro versions of some of
the math/complex functions without worrying about breaking tgmath.
2012-03-22 15:36:56 -04:00
Rich Felker
47db8903f6 fix DECIMAL_DIG definitions
DECIMAL_DIG is not the same as LDBL_DIG

type_DIG is the maximimum number of decimal digits that can survive a
round trip from decimal to type and back to decimal.

DECIMAL_DIG is the minimum number of decimal digits required in order
for any floating point type to survive the round trip to decimal and
back, and it is generally larger than LDBL_DIG. since the exact
formula is non-trivial, and defining it larger than necessary may be
legal but wasteful, just define the right value in bits/float.h.
2012-03-21 12:42:48 -04:00
Rich Felker
25501c1079 initial, very primitive strfmon 2012-03-21 00:47:37 -04:00
Rich Felker
80949ccdc6 limits.h: support gcc's -funsigned-char
some software apparently uses this and breaks with musl due to
mismatching definitions...
2012-03-20 21:10:06 -04:00
Rich Felker
8e092217dd move nonstandard gamma() etc. to _GNU_SOURCE only
it's not even provided in the library at the moment, but could easily
be provided with weak aliases if desired.
2012-03-17 21:48:48 -04:00
Rich Felker
65db6bf5ea c++ seems to want some casts in the float representation-access macros 2012-03-17 21:40:10 -04:00
nsz
40305f74bd in math.h make lgamma_r and non-double bessel _GNU_SOURCE only
long double and float bessel functions are no longer xsi extensions
2012-03-15 09:29:53 +01:00
nsz
0144b45b71 efficient sincos based on sin and cos 2012-03-15 08:17:28 +01:00
Rich Felker
b69f695ace 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.
2012-03-13 01:17:53 -04:00
Rich Felker
405ce58dcf fix nan/infinity macros in math.h, etc.
the previous version not only failed to work in c++, but also failed
to produce constant expressions, making the macros useless as
initializers for objects of static storage duration.

gcc 3.3 and later have builtins for these, which sadly seem to be the
most "portable" solution. the alternative definitions produce
exceptions (for NAN) and compiler warnings (for INFINITY) on newer
versions of gcc.
2012-03-02 22:35:37 -05:00
Rich Felker
9fcecd7b34 typo in math.h c version check 2012-03-02 11:38:39 -05:00
Rich Felker
db3e78cee5 make math.h compatibe with c89 2012-03-02 00:36:26 -05:00
Rich Felker
e0614f7cd4 add all missing wchar functions except floating point parsers
these are mostly untested and adapted directly from corresponding byte
string functions and similar.
2012-03-01 23:24:45 -05:00
Rich Felker
051175d4fe add memory.h, bogus legacy alias for string.h 2012-03-01 01:34:58 -05:00
Rich Felker
d36751943a use c++-friendly initializers for pthread initializer definitions
these will also avoid obnoxious warnings with gcc -Wbraces.
2012-02-29 22:55:08 -05:00
Rich Felker
4ce6766a32 add <syscall.h> as an alias for <sys/syscall.h>
apparently some broken stuff (libstdc++) needs this.
2012-02-29 22:36:06 -05:00
Rich Felker
06aec8d715 replace prototype for basename in string.h with non-prototype declaration
GNU programs may expect the GNU version of basename, which has a
different prototype (argument is const-qualified) and prototype it
themselves too. of course if they're expecting the GNU behavior for
the function, they'll still run into problems, but at least this
eliminates some compile-time failures.
2012-02-24 23:23:47 -05:00
Rich Felker
1611ab0d9b add get_current_dir_name function 2012-02-17 23:10:00 -05:00
Rich Felker
414a4cdebc add float_t and double_t to math.h 2012-02-15 21:47:55 -05:00
Rich Felker
afc35d5efd replace bad cancellation cleanup abi with a sane one
the old abi was intended to duplicate glibc's abi at the expense of
being ugly and slow, but it turns out glib was not even using that abi
except on non-gcc-compatible compilers (which it doesn't even support)
and was instead using an exceptions-in-c/unwind-based approach whose
abi we could not duplicate anyway without nasty dwarf2/unwind
integration.

the new abi is copied from a very old glibc abi, which seems to still
be supported/present in current glibc. it avoids all unwinding,
whether by sjlj or exceptions, and merely maintains a linked list of
cleanup functions to be called from the context of pthread_exit. i've
made some care to ensure that longjmp out of a cleanup function should
work, even though it is not required to.

this change breaks abi compatibility with programs which were using
pthread cancellation, which is unfortunate, but that's why i'm making
the change now rather than later. considering that most pthread
features have not been usable until recently anyway, i don't see it as
a major issue at this point.
2012-02-09 02:33:08 -05:00
Rich Felker
570edb19d1 fix typo in inotify.h 2012-02-07 22:48:58 -05:00
Rich Felker
1ba28b90d6 declare basename in string.h when _GNU_SOURCE is defined
note that it still will have the standards-conformant behavior, not
the GNU behavior. but at least this prevents broken code from ending
up with truncated pointers due to implicit declarations...
2012-02-07 13:10:30 -05:00
Rich Felker
a591e0383a revert hacks for types of stdint.h integer constant macros
per 7.18.4: Each invocation of one of these macros shall expand to an
integer constant expression suitable for use in #if preprocessing
directives. The type of the expression shall have the same type as
would an expression of the corresponding type converted according to
the integer promotions. The value of the expression shall be that of
the argument.

the key phrase is "converted according to the integer promotions".
thus there is no intent or allowance that the expression have
smaller-than-int types.
2012-02-07 12:08:27 -05:00
Rich Felker
36bf56940a more locale_t interfaces (string stuff) and header updates
this should be everything except for some functions where the non-_l
version isn't even implemented yet (mainly some non-ISO-C wcs*
functions).
2012-02-06 21:51:02 -05:00
Rich Felker
c09b6f8ab6 fix some omissions and mistakes in locale_t interface definitions 2012-02-06 21:33:40 -05:00
Rich Felker
e5a7f14c81 add more of the locale_t interfaces, all dummied out to ignore the locale 2012-02-06 21:29:31 -05:00
Rich Felker
f4ad36c4bf add deprecated (removed from posix) [efg]cvt() functions
these have not been heavily tested, but they should work as described
in the old standards. probably broken for non-finite values...
2012-02-06 01:14:23 -05:00
Rich Felker
147f355cb6 apparently gnu caddr_t is supposed to be char *, not unsigned long
this type should never be used anyway, but some old junk uses it..
2012-02-01 14:12:19 -05:00
Rich Felker
96e0aca4d5 fix utmp.h mess, try 2 2012-02-01 14:10:38 -05:00
Rich Felker
108fdd3318 fix previous utmp.h junk commit 2012-01-31 17:10:02 -05:00
Rich Felker
fa3bbbd453 add some missing junk in utmp.h 2012-01-31 14:39:17 -05:00
Rich Felker
5e9314ff03 add fgetpwent (nonstandard function)
based on patch by Jeremy Huntwork
2012-01-29 11:54:18 -05:00
Rich Felker
4619901ec4 add linux setfs[ug]id syscall wrappers
patch by Jeremy Huntwork
2012-01-28 21:09:50 -05:00
Rich Felker
c3db56c4cb remove useless "extern" keywords in headers 2012-01-26 10:53:37 -05:00
Rich Felker
8eb9a3afba fix typo in FPE_FLTUND definition, signal.h 2012-01-25 15:30:42 -05:00
Rich Felker
6a193804a8 add MIN/MAX macros to sys/param.h
this is a nonstandard junk header anyway, so just do what apps expect..
2012-01-24 22:51:27 -05:00