Commit Graph

595 Commits

Author SHA1 Message Date
Szabolcs Nagy 6739b13a17 math.h: make __FLOAT_BITS and __DOUBLE_BITS C89
Remove non-constant aggregate initializer. (Still using long long, but
that is supported by ancient compilers without __extension__ anyway).
2014-03-09 19:29:41 +01:00
Rich Felker 73f5b09605 in sys/procfs.h, avoid using __WORDSIZE macro
this was problematic because several archs don't define __WORDSIZE. we
could add it, but I would rather phase this macro out in the long
term. in our version of the headers, UINTPTR_MAX is available here, so
just use it instead.
2014-03-08 00:50:19 -05:00
Szabolcs Nagy d82db8550a in.h: new IP_MTU_DISCOVER mode IP_PMTUDISC_INTERFACE
introduced in linux v3.13, 482fc6094afad572a4ea1fd722e7b11ca72022a0
to mitigate dns cache poisoning via fragmentation
2014-02-25 00:28:31 +01:00
Szabolcs Nagy fb5a2ef8df if_ether.h: new ethernet protocol type
for High-availability Seamless Redundancy (HSR) specified in IEC 62439-3
new in linux v3.13, f421436a591d34fa5279b54a96ac07d70250cc8d
2014-02-25 00:24:05 +01:00
Szabolcs Nagy 099ce3631c sys/socket.h: add the SO_MAX_PACING_RATE SOL_SOCKET option
introduced in linux v3.13, 62748f32d501f5d3712a7c372bbb92abc7c62bc7
2014-02-25 00:22:04 +01:00
Szabolcs Nagy a8a4e5c598 elf.h: add aarch64 relocations 2014-02-25 00:17:29 +01:00
Szabolcs Nagy d99c999322 elf.h: new elf header flag to mark 2008-NaN vs legacy-NaN on mips
see glibc commit 9c21573c02446b3d5cf6a34b67c8545e5be6a600
2014-02-25 00:12:39 +01:00
rofl0r 0f169cbb79 sys/shm.h: move arch specific structs to bits/ 2014-02-23 11:07:18 +01:00
rofl0r 1a2e55b95a sys/sem.h: cheat and make all longs use time_t instead
most of the members should be time_t anyway, and time_t has the
correct semantics for "syscall_long", so it works on all archs, even x32.
2014-02-22 12:25:17 +01:00
Rich Felker fdb3efa5dd add flock64 alias for (struct) flock in fcntl.h
this was a missing part of the LFS64 API; it's "needed" for use with
fcntl and the corresponding lock commands.
2014-02-18 11:04:15 -05:00
Szabolcs Nagy e74f3b0234 add parens when bit and arith ops are mixed in macros in public headers
another commit to silence gcc warnings (-Wparentheses) for standard headers.
changed macros: LOG_UPTO, IN6_ARE_ADDR_EQUAL
2014-02-11 18:02:06 +01:00
Szabolcs Nagy aa6ce3d4e3 fix signed and unsigned comparision in macros in public headers
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
2014-02-11 10:51:16 +01:00
Rich Felker 89511cd943 reduce namespace pollution in netinet/udp.h
the affected part of the header is responsible for providing both GNU
and BSD versions of the udphdr structure. previously, the
namespace-polluting GNU names were always used for the actual struct
members, and the BSD names, which are named in a manner resembling a
sane namespace, were always macros defined to expand to the GNU names.
now, unless _GNU_SOURCE is defined, the BSD names are used as the
actual structure members, and the macros and GNU names only come into
play when the application requests them.
2014-02-05 17:25:39 -05:00
Rich Felker 685b1cd4a0 fix use of legacy u_intN_t types in netinet/tcp.h
policy is to avoid using these types except where they are needed for
namespace conformance. C99-style stdint.h types should be used
instead.
2014-02-05 17:22:26 -05:00
Rich Felker fdaaa68d82 add support for BSD struct tcphdr in netinet/tcp.h
there are two versions of this structure: the BSD version and the GNU
version. previously only the GNU version was supported. the only way
to support both simultaneously is with an anonymous union, which was a
nonstandard extension prior to C11, so some effort is made to avoid
breakage with compilers which do not support anonymous unions.

this commit is based on a patch by Timo Teräs, but with some changes.
in particular, the GNU version of the structure is not exposed unless
_GNU_SOURCE is defined; this both avoids namespace pollution and
dependency on anonymous unions in the default feature profile.
2014-02-05 16:55:30 -05:00
Rich Felker ad87c2eecf add nonstandard timespec/timeval conversion macros in sys/time.h
these are poorly designed (illogical argument order) and even poorly
implemented (brace issues) on glibc, but unfortunately some software
is using them. we could consider removing them again in the future at
some point if they're documented as deprecated, but for now the
simplest thing to do is just to provide them under _GNU_SOURCE.
2014-02-05 16:34:23 -05:00
Timo Teräs a0351ee6a7 add NO_ADDRESS macro to netdb.h as an alias for NO_DATA
some applications expect it to be defined, despite the standard making
it impossible for it to ever be returned as a value distinct from
NO_DATA. since these macros are outside the scope of the current
standards, no special effort is made to hide NO_ADDRESS under
conditions where the others are exposed.
2014-02-05 15:58:11 -05:00
Rich Felker 513136efa4 fix namespace violation in sys/shm.h
in fixing this, I've changed the logic from ugly #if/#else blocks
inside the struct shm_info definition to a fixed struct definition and
optional macros to rename the elements. this will be helpful if we
need to move shm_info to a bits header in the future, as it will keep
the feature test logic out of bits.
2014-01-08 19:39:18 -05:00
Rich Felker a1527a0c3e fix namespace violations in utmpx.h 2014-01-08 19:36:29 -05:00
Rich Felker acde013522 fix remaining known namespace violations for netinet/in.h
the imr_, imsf_, ip6_, ip6m_, ipi_, ipi6_, SCM_, and SOL_ prefixes are
not in the reserved namespace for this header. thus the constants and
structures using them need to be protected under appropriate feature
test macros.

this also affects some headers which are permitted to include
netinet/in.h, particularly netdb.h and arpa/inet.h.

the SOL_ macros are moved to sys/socket.h where they are in the
reserved namespace (SO*). they are still accessible via netinet/in.h
since it includes sys/socket.h implicitly (which is permitted).

the SCM_SRCRT macro is simply removed, since the definition used for
it, IPV6_RXSRCRT is not defined anywhere. it could be re-added, this
time in sys/socket.h, if the appropriate value can be determined;
however, given that the erroneous definition was not caught, it is
unlikely that any software actually attempts to use SCM_SRCRT.
2014-01-08 18:54:33 -05:00
Rich Felker 1d23b3c913 fix const-correctness of argument to stime
it's unclear what the historical signature for this function was, but
semantically, the argument should be a pointer to const, and this is
what glibc uses. correct programs should not be using this function
anyway, so it's unlikely to matter.
2014-01-07 03:02:14 -05:00
Rich Felker 74998fbec1 fix signedness of pgoff argument to remap_file_pages
both the kernel and glibc agree that this argument is unsigned; the
incorrect type ssize_t came from erroneous man pages.
2014-01-07 02:58:28 -05:00
Rich Felker 3500555db3 fix const-correctness in sigandset/sigorset arguments
this change is consistent with the corresponding glibc functions and
is semantically const-correct. the incorrect argument types without
const seem to have been taken from erroneous man pages.
2014-01-07 02:50:34 -05:00
Rich Felker 2c5e756025 remove sys/sysctl.h
this functionality has essentially always been deprecated in linux,
and was never supported by musl. the presence of the header was
reported to cause some software to attempt to use the nonexistant
function, so removing the header is the cleanest solution.
2014-01-07 02:44:47 -05:00
Rich Felker 2750337379 fix incorrect type for wd argument of inotify_rm_watch
this was wrong since the original commit adding inotify, and I don't
see any explanation for it. not even the man pages have it wrong. it
was most likely a copy-and-paste error.
2014-01-07 02:41:27 -05:00
Rich Felker dbe221ecff fix argument types for legacy function inet_makeaddr
the type int was taken from seemingly erroneous man pages. glibc uses
in_addr_t (uint32_t), and semantically, the arguments should be
unsigned.
2014-01-06 22:17:24 -05:00
Rich Felker 839cc4e6da const-qualify the address argument to dladdr
this agrees with implementation practice on glibc and BSD systems, and
is the const-correct way to do things; it eliminates warnings from
passing pointers to const. the prototype without const came from
seemingly erroneous man pages.
2014-01-06 22:03:38 -05:00
Rich Felker 1e7a581ad6 add some missing LFS64 aliases for fadvise/fallocate functions 2014-01-06 21:31:17 -05:00
rofl0r 5c81b8fe45 add fanotify syscall wrapper and header 2014-01-02 22:10:45 +01:00
Timo Teräs 7e10f209fb fix struct signalfd_siginfo
ssi_ptr is really 64-bit in kernel, so fix that. assuming sizeof(void*)
for it also caused incorrect padding for 32-bits, as the following
64-bits are aligned to 64-bits (and the padding was not taken into
account), so fix the padding as well. add addr_lsb field while there.
2013-12-29 21:55:21 -05:00
Rich Felker 18144af297 implement legacy function herror
based on patch by Timo Teräs; greatly simplified to use fprintf.
2013-12-20 11:56:16 -05:00
Rich Felker e36d8a1d74 add sys/quota.h and quotactl syscall wrapper
based on patch by Timo Teräs.
2013-12-20 11:52:10 -05:00
Rich Felker c91ad4f716 add netinet/igmp.h and multicast groups to netinet/in.h
based on patch by Timo Teräs.
2013-12-20 11:42:03 -05:00
Timo Teräs e2b4525e3b add TCP_INFO and TCP_MD5SIG socket option related structures 2013-12-20 11:36:26 -05:00
Rich Felker 8708e137d6 add posix_close, accepted for inclusion in the next issue of POSIX
this is purely a wrapper for close since Linux does not support EINTR
semantics for the close syscall.
2013-12-06 21:59:01 -05:00
Szabolcs Nagy b054137a64 move struct ucred under _GNU_SOURCE in sys/socket.h for clean posix namespace 2013-12-04 21:39:52 +00:00
Szabolcs Nagy 2c2418088d fix SHUT_WR typo in sys/socket.h and duplicate definitions of SHUT_* 2013-12-04 21:38:32 +00:00
Szabolcs Nagy ccbc365543 fix res_mkquery and res_send prototypes in resolv.h
historically these functions appeared in BSD 4.3 without prototypes,
then in the bind project prototypes were added to resolv.h, but those
were incompatible with the definitions of the implementation.
the bind resolv.h became the defacto api most systems use now, but the
old internal definitions found their way into the linux manuals and thus
into musl.
2013-12-04 21:31:39 +00:00
Rich Felker 83c8fe5058 remove duplicate definition of _PATH_LASTLOG in paths.h 2013-12-03 20:34:36 -05:00
Rich Felker a223175704 remove now-unnecessary features.h inclusion from fnmatch.h 2013-12-02 02:06:52 -05:00
Rich Felker bb181ae3b8 expose FNM_* extensions in fnmatch.h without _GNU_SOURCE
at least a couple of these are used on BSD too, and the FNM_*
namespace is reserved in fnmatch.h anyway.
2013-12-02 02:04:58 -05:00
Rich Felker 8c8cf4bbd2 increase TTY_NAME_MAX limit to 32
the old value of 20 was reported by Laurent Bercot as being
insufficient for a reasonable real-world usage case. actual problem
was the internal buffer used by ttyname(), but the implementation of
ttyname uses TTY_NAME_MAX, and for consistency it's best to increase
both. the new value is aligned with glibc.
2013-11-29 12:45:09 -05:00
Rich Felker a663c93019 adjust fallback INFINITY definition for FLT_EVAL_METHOD==2 case
on archs with excess precision, the floating point constant 1e40f may
be evaluated such that it does not actually produce an infinity.
1e5000f is sufficiently large to produce an infinity for all supported
floating point formats. note that this definition of INFINITY is only
used for old or non-GNUC compilers anyway; despite being a portable,
conforming definition, it leads to erroneous warnings on many
compilers and thus using the builtin is preferred.
2013-11-26 23:26:37 -05:00
Rich Felker c8a9c22173 restore type of NULL to void * except when used in C++ programs
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.)
2013-11-24 21:42:55 -05:00
Michael Forney 642936d6dd Fix dn_comp prototype and add stub
This function is used by ping6 from iputils.
2013-11-24 09:39:30 -05:00
Szabolcs Nagy 10c8b7148b use 0 instead of NULL in headers where NULL is not defined
some macros in sys/mtio.h and syslog.h used NULL without defining it
2013-11-24 00:34:07 +00:00
Szabolcs Nagy b0e9d57711 add TCP_NOTSENT_LOWAT tcp socket option, new in linux v3.12 2013-11-23 23:04:55 +00:00
Timo Teräs 4b2c8fee35 add linux tcp state enums 2013-11-23 16:57:53 -05:00
Timo Teräs 7c0ca4d361 add multicast structures from RFC 3678 to netinet/in.h
and use _GNU_SOURCE || _BSD_SOURCE guards for all of the RFC 3678
namespace polluting things like glibc/uclibc does.
2013-11-23 16:56:43 -05:00
rofl0r 8ff810d779 timeradd/timersub: cast result to void to get rid of warnings
previously:
timersub(&now, t, &diff);

warning: value computed is not used [-Wunused-value]
2013-11-23 13:01:53 +01:00