Commit Graph

273 Commits

Author SHA1 Message Date
Rich Felker d200bd727b declare environ in unistd.h when _GNU_SOURCE feature test macro is used
lots of broken programs expect this, and it's gotten to the point of
being a troubleshooting FAQ topic. best to just fix it.
2012-06-02 16:51:04 -04:00
Rich Felker a34b0465ba there is no such GNU function fpurge, only __fpurge.
no idea where I got the idea fpurge should exist...
2012-05-28 22:54:27 -04:00
Rich Felker b63cab76ec add prototype for BSD/GNU stdio *_unlocked extension functions
also fix up distinction of what is GNU-only and what's GNU+BSD
2012-05-28 22:53:24 -04:00
Rich Felker 15c7af3e21 remove duplicate lfs64 cruft in stdio.h 2012-05-28 22:46:28 -04:00
nsz b1cf11c090 math: fix nextafter definition in tgmath.h 2012-05-28 22:55:03 +02:00
Rich Felker 25d575edc4 debloat jmp_buf in _GNU_SOURCE mode
i originally made it the same size as the bloated GNU version, which
contains space for saved signal mask, but this makes some structures
containing jmp_buf become much larger for no benefit. we will never
use the signal mask field with plain setjmp; sigsetjmp serves that
purpose.
2012-05-23 00:10:39 -04:00
Rich Felker 0c29adfe42 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.
2012-05-22 22:43:27 -04:00
Rich Felker af3330d764 some feature test fixes for unistd.h 2012-05-22 22:28:17 -04:00
Rich Felker 96601e3c61 _GNU_SOURCE implies all BSD features except ones GNU rejects 2012-05-22 22:07:42 -04:00
Rich Felker 671ffab776 various header cleanups, some related to _BSD_SOURCE addition
there is no reason to avoid multiple identical macro definitions; this
is perfectly legal C, and even with the maximal warning options
enabled, gcc does not issue any warning for it.
2012-05-22 22:04:55 -04:00
Rich Felker 9f370fa99e bsd_signal is a legacy (removed) XSI function, not needed in _BSD_SOURCE
its only purpose was for use on non-BSD systems that implement sysv
semantics for signal() by default.
2012-05-22 21:54:19 -04:00
Rich Felker 419ae6d5c9 support _BSD_SOURCE feature test macro
patch by Isaac Dunham. matched closely (maybe not exact) to glibc's
idea of what _BSD_SOURCE should make visible.
2012-05-22 21:52:08 -04:00
Rich Felker 3db29f0347 move getpass decl to the right place 2012-05-20 22:56:06 -04:00
Rich Felker b5cbd549fd useless lastlog path just to make some stuff happy 2012-05-14 00:10:28 -04:00
Rich Felker f8ac55516d missing limit LOGIN_NAME_MAX 2012-05-14 00:01:48 -04:00
Rich Felker e68c51ac46 use __h_errno_location for h_errno
we do not bother making h_errno thread-local since the only interfaces
that use it are inherently non-thread-safe. but still use the
potentially-thread-local ABI to access it just to avoid lock-in.
2012-05-12 23:45:07 -04:00
Rich Felker 3777f5b90d susv4 removed gethostbyname, etc. legacy cruft. 2012-05-12 23:38:04 -04:00
Rich Felker 20052b9815 namespace cleanup - NI_* is NOT reserved by netdb.h 2012-05-12 23:34:39 -04:00
Rich Felker 7db6a871ca some gnu junk in netdb.h 2012-05-12 23:31:52 -04:00
Rich Felker c3dbe9b22c fix missing va_list for vsyslog 2012-05-12 22:18:34 -04:00
nsz d197d6421c search: add tdestroy (gnu extension) 2012-05-13 01:34:20 +02:00
Rich Felker b47fdcdef8 add missing IN6_ARE_ADDR_EQUAL
written to avoid multiple conditional jumps and avoid ugly repetitive
lines in the header file.
2012-05-11 11:05:41 -04:00
Rich Felker e700e59a90 add one more bogus legacy header
this one is for program(s|ers) who haven't heard of uint16_t and
uint32_t (which are obviously the correct types for use in such
situations, as they're the argument/return types for ntohs/htons and
ntohl/htonl).
2012-05-10 23:32:28 -04:00
Rich Felker c8b01e73ca move vsyslog out of SYSLOG_NAMES conditional 2012-05-10 22:41:54 -04:00
Rich Felker bfb29b666e fix missing parens in bit op macros (param.h) 2012-05-10 12:10:44 -04:00
Rich Felker 2e41887f54 and another bug in setbit, etc. macros.. 2012-05-10 11:59:07 -04:00
Rich Felker e0ff0d34dc fix typo in sys/param.h that broke setbit, etc. macros
this is all junk, but some programs use it.
2012-05-10 11:55:16 -04:00
Rich Felker 37bb3cce45 omit declaration of basename wrongly interpreted as prototype in C++
the non-prototype declaration of basename in string.h is an ugly
compromise to avoid breaking 2 types of broken software:

1. programs which assume basename is declared in string.h and thus
would suffer from dangerous pointer-truncation if an implicit
declaration were used.

2. programs which include string.h with _GNU_SOURCE defined but then
declare their own prototype for basename using the incorrect GNU
signature for the function (which would clash with a correct
prototype).

however, since C++ does not have non-prototype declarations and
interprets them as prototypes for a function with no arguments, we
must omit it when compiling C++ code. thankfully, all known broken
apps that suffer from the above issues are written in C, not C++.
2012-05-09 11:47:06 -04:00
Rich Felker 4a99440571 some extra legacy header stuff 2012-05-06 16:35:32 -04:00
Rich Felker a3b20f67b3 take byte order from gcc if gcc has defined it
this only works with gcc 4.6 and later, but it allows us to support
non-default endianness on archs like arm, mips, ppc, etc. that can do
both without having separate header sets for both variants, and it
saves one #include even on fixed-endianness archs like x86.
2012-05-06 13:40:19 -04:00
Rich Felker 106e75f712 add isastream (obsolete STREAMS junk)
apparently some packages see stropts.h and want to be able to use
this. the implementation checks that the file descriptor is valid by
using fcntl/F_GETFD so it can report an error if not (as specified).
2012-05-06 09:03:19 -04:00
Rich Felker 98c9af5001 fix definitions of FP_ILOGB constants
two issues: (1) the type was wrong (unsigned instead of signed int),
and (2) the value of FP_ILOGBNAN should be INT_MIN rather than INT_MAX
to match the ABI. this is also much more useful since INT_MAX
corresponds to a valid input (infinity). the standard would allow us
to set FP_ILOGB0 to -INT_MAX instead of INT_MIN, which would give us
distinct values for ilogb(0) and ilogb(NAN), but the benefit seems way
too small to justify ignoring the ABI.

note that the macro is just a "portable" (to any twos complement
system where signed and unsigned int have the same width) way to write
INT_MIN without needing limits.h. it's valid to use this method since
these macros are not required to work in #if directives.
2012-05-05 22:22:46 -04:00
Rich Felker f0b85fd926 add *64 junk for sys/*.h headers 2012-05-04 00:31:25 -04:00
Rich Felker 2dd8d5e1b8 add support for ugly *64 functions with _LARGEFILE64_SOURCE
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.
2012-05-04 00:13:23 -04:00
Rich Felker b959d04644 uglify headers for the sake of junk that compiles with gcc -std=c89/-ansi 2012-05-03 22:27:36 -04:00
Rich Felker ca2d3c6ef4 add additional compatibility union member for ipv6 addresses
in6_* is in the reserved namespace, so this is valid
2012-05-03 22:12:46 -04:00
Rich Felker 6f0cf3061b remove minimal linux kernel headers
these were at best of limited usefulness (for bootstrapping new
systems, mainly) and at worst caused real kernel headers to get
overwritten when upgrading libc.

in case they're needed by anyone, the exact same files are now
available in a new git repository:

git://git.etalabs.net/mini-lkh
2012-05-01 21:20:06 -04:00
Rich Felker a917c03706 support alternate glibc name pow10 for exp10 2012-05-01 00:07:37 -04:00
Rich Felker f681975577 first try at writing an efficient and "correct" exp10
this is a nonstandard function so it's not clear what conditions it
should satisfy. my intent is that it be fast and exact for positive
integral exponents when the result fits in the destination type, and
fast and correctly rounded for small negative integral exponents.
otherwise we aim for at most 1ulp error; it seems to differ from pow
by at most 1ulp and it's often 2-5 times faster than pow.
2012-04-30 03:26:53 -04:00
Rich Felker 50da5c264f add linux-specific unshare syscall wrapper 2012-04-29 19:54:03 -04:00
Rich Felker 90da74ef51 implement getusershell, etc. legacy functions
I actually wrote these a month ago but forgot to integrate them. ugly,
probably-harmful-to-use functions, but some legacy apps want them...
2012-04-22 14:41:54 -04:00
Rich Felker 431a4cd4df getdtablesize is not standard; move it to its correct spot in unistd.h 2012-04-22 14:39:07 -04:00
Rich Felker 3f4de355ba fix breakage in endian.h 2012-04-22 11:19:17 -04:00
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