about summary refs log tree commit diff
path: root/include/stdlib.h
Commit message (Collapse)AuthorAgeFilesLines
* byte-based C locale, phase 3: make MB_CUR_MAX variable to activate codeRich Felker2015-06-161-1/+2
| | | | | | | | this patch activates the new byte-based C locale (high bytes treated as abstract code unit "characters" rather than decoded as multibyte characters) by making the value of MB_CUR_MAX depend on the active locale. for the C locale, the LC_CTYPE category pointer is null, yielding a value of 1. all other locales yield a value of 4.
* fix places where _BSD_SOURCE failed to yield a superset of _XOPEN_SOURCERich Felker2014-09-101-3/+0
| | | | | | | | | | | the vast majority of these failures seem to have been oversights at the time _BSD_SOURCE was added, or perhaps shortly afterward. the one which may have had some reason behind it is omission of setpgrp from the _BSD_SOURCE feature profile, since the standard setpgrp interface conflicts with a legacy (pre-POSIX) BSD interface by the same name. however, such omission is not aligned with our general policy in this area (for example, handling of similar _GNU_SOURCE cases) and should not be preserved.
* make clearenv available with _BSD_SOURCEClément Vasseur2014-08-081-1/+1
| | | | | glibc declares clearenv under _BSD_SOURCE, some applications might depend on it being available this way.
* fix signed and unsigned comparision in macros in public headersSzabolcs Nagy2014-02-111-1/+1
| | | | | | gcc -Wsign-compare warns about expanded macros that were defined in standard headers (before gcc 4.8) which can make builds fail that use -Werror. changed macros: WIFSIGNALED, __CPU_op_S
* restore type of NULL to void * except when used in C++ programsRich Felker2013-11-241-0/+4
| | | | | | | | | | | | | | unfortunately this eliminates the ability of the compiler to diagnose some dangerous/incorrect usage, but POSIX requires (as an extension to the C language, i.e. CX shaded) that NULL have type void *. plain C allows it to be defined as any null pointer constant. the definition 0L is preserved for C++ rather than reverting to plain 0 to avoid dangerous behavior in non-conforming programs which use NULL as a variadic sentinel. (it's impossible to use (void *)0 for C++ since C++ lacks the proper implicit pointer conversions, and other popular alternatives like the GCC __null extension seem non-conforming to the standard's requirements.)
* add legacy getloadavg apiSzabolcs Nagy2013-11-211-0/+1
|
* provide declarations for strtod_l and familyRich Felker2013-08-131-0/+4
| | | | | | | | these aliases were originally intended to be for ABI compatibility only, but their presence caused regressions in broken gnulib-based software whose configure scripts detect the existing of these functions then use them without declarations, resulting in bogus return values.
* fix definitions of WIFSTOPPED and WIFSIGNALED to support up to signal 127Rich Felker2013-08-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | mips has signal numbers up to 127 (formerly, up to 128, but the last one never worked right and caused kernel panic when used), so 127 in the "signal number" field of the wait status is insufficient for determining that the process was stopped. in addition, a nonzero value in the upper bits must be present, indicating the signal number which caused the process to be stopped. details on this issue can be seen in the email with message id CAAG0J9-d4BfEhbQovFqUAJ3QoOuXScrpsY1y95PrEPxA5DWedQ@mail.gmail.com on the linux-mips mailing list, archived at: http://www.linux-mips.org/archives/linux-mips/2013-06/msg00552.html and in the associated thread about fixing the mips kernel bug. commit 4a96b948687166da26a6c327e6c6733ad2336c5c fixed the corresponding issue in uClibc, but introduced a multiple-evaluation issue for the WIFSTOPPED macro. for the most part, none of these issues affected pure musl systems, since musl has up until now (incorrectly) defined SIGRTMAX as 64 on all archs, even mips. however, interpreting status of non-musl programs on mips may have caused problems. with this change, the full range of signal numbers can be made available on mips.
* add mkostemp, mkstemps, and mkostemps functions and reorganize temp internalsRich Felker2013-02-201-0/+8
| | | | | | | | | based on patch contributed by Anthony G. Basile (blueness) some issues remain with the filename generation algorithm and other small bugs, but this patch has been sitting around long enough that I feel it's best to get it committed and then work out any remaining issues.
* use a common definition of NULL as 0L for C and C++Rich Felker2013-01-181-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the historical mess of having different definitions for C and C++ comes from the historical C definition as (void *)0 and the fact that (void *)0 can't be used in C++ because it does not convert to other pointer types implicitly. however, using plain 0 in C++ exposed bugs in C++ programs that call variadic functions with NULL as an argument and (wrongly; this is UB) expect it to arrive as a null pointer. on 64-bit machines, the high bits end up containing junk. glibc dodges the issue by using a GCC extension __null to define NULL; this is observably non-conforming because a conforming application could observe the definition of NULL via stringizing and see that it is neither an integer constant expression with value zero nor such an expression cast to void. switching to 0L eliminates the issue and provides compatibility with broken applications, since on all musl targets, long and pointers have the same size, representation, and argument-passing convention. we could maintain separate C and C++ definitions of NULL (i.e. just use 0L on C++ and use (void *)0 on C) but after careful analysis, it seems extremely difficult for a C program to even determine whether NULL has integer or pointer type, much less depend in subtle, unintentional ways, on whether it does. C89 seems to have no way to make the distinction. on C99, the fact that (int)(void *)0 is not an integer constant expression, along with subtle VLA/sizeof semantics, can be used to make the distinction, but many compilers are non-conforming and give the wrong result to this test anyway. on C11, _Generic can trivially make the distinction, but it seems unlikely that code targetting C11 would be so backwards in caring which definition of NULL an implementation uses. as such, the simplest path of using the same definition for NULL in both C and C++ was chosen. the #undef directive was also removed so that the compiler can catch and give a warning or error on redefinition if buggy programs have defined their own versions of NULL prior to inclusion of standard headers.
* fix issues with wait constants in stdlib.hRich Felker2012-10-211-4/+5
| | | | | | the W* namespace is not reserved, so the nonstandard ones must be moved under extension features. also WNOHANG and WUNTRACED were missing.
* default features: make musl usable without feature test macrosRich Felker2012-09-071-12/+1
| | | | | | | | | | the old behavior of exposing nothing except plain ISO C can be obtained by defining __STRICT_ANSI__ or using a compiler option (such as -std=c99) that predefines it. the new default featureset is POSIX with XSI plus _BSD_SOURCE. any explicit feature test macros will inhibit the default. installation docs have also been updated to reflect this change.
* add _Noreturn function attribute, with fallback for pre-C11 GNUCRich Felker2012-09-061-4/+11
|
* use restrict everywhere it's required by c99 and/or posix 2008Rich Felker2012-09-061-11/+17
| | | | | | | | 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.
* implement "low hanging fruit" from C11Rich Felker2012-08-251-0/+1
| | | | | | | | based on Gregor's patch sent to the list. includes: - stdalign.h - removing gets in C11 mode - adding aligned_alloc and adjusting other functions to use it - adding 'x' flag to fopen for exclusive mode
* add c11 quick_exit and at_quick_exit functionsRich Felker2012-08-251-0/+2
|
* _GNU_SOURCE is supposed to imply _LARGEFILE64_SOURCERich Felker2012-06-041-1/+1
| | | | | | | | | this is ugly and stupid, but now that the *64 symbol names exist, a lot of broken GNU software detects them in configure, then either breaks during build due to missing off64_t definition, or attempts to compile without function declarations/prototypes. "fixing" it here is easier than telling everyone to add yet another feature test macro to their builds.
* support _BSD_SOURCE feature test macroRich Felker2012-05-221-7/+15
| | | | | patch by Isaac Dunham. matched closely (maybe not exact) to glibc's idea of what _BSD_SOURCE should make visible.
* add support for ugly *64 functions with _LARGEFILE64_SOURCERich Felker2012-05-041-0/+3
| | | | | | | | | | | | | | | | musl does not support legacy 32-bit-off_t whatsoever. off_t is always 64 bit, and correct programs that use off_t and the standard functions will just work out of the box. (on glibc, they would require -D_FILE_OFFSET_BITS=64 to work.) however, some programs instead define _LARGEFILE64_SOURCE and use alternate versions of all the standard types and functions with "64" appended to their names. we do not want code to actually get linked against these functions (it's ugly and inconsistent), so macros are used instead of prototypes with weak aliases in the library itself. eventually the weak aliases may be added at the library level for the sake of using code that was originally built against glibc, but the macros will still be the desired solution in the headers.
* fix alloca issue in stdlib.h tooRich Felker2012-04-091-1/+1
| | | | I forgot _GNU_SOURCE also has it declared here...
* add deprecated (removed from posix) [efg]cvt() functionsRich Felker2012-02-061-0/+3
| | | | | these have not been heavily tested, but they should work as described in the old standards. probably broken for non-finite values...
* declare alloca in stdlib.h when _GNU_SOURCE is definedRich Felker2011-09-111-0/+1
|
* move wait.h macros out of bits. they do not vary.Rich Felker2011-04-211-1/+8
|
* add ptsname_r (nonstandard) and split ptsname (standard) to separate fileRich Felker2011-04-131-0/+1
| | | | this eliminates the ugly static buffer in programs that use ptsname_r.
* add some missing prototypes for nonstandard functions (strsep, clearenv)Rich Felker2011-03-301-0/+1
|
* fix the types of some integer constant limits in headersRich Felker2011-02-151-1/+1
|
* fix missing EXIT_* in stdlib.h after header cleanupRich Felker2011-02-151-3/+3
|
* begin namespace-cleanup of standard C headersRich Felker2011-02-141-46/+51
|
* initial check-in, version 0.5.0 v0.5.0Rich Felker2011-02-121-0/+129