Commit Graph

755 Commits

Author SHA1 Message Date
Szabolcs Nagy
60c46db80b update tcp_info struct to linux v4.9
export tcp data delivery rate in tcp_info struct.
see linux commit eb8329e0a04db0061f714f033b4454326ba147f4
2016-12-29 22:11:01 -05:00
Szabolcs Nagy
a8a8fdff96 add MS_NOREMOTELOCK mount flag from linux v4.9
for handling file locking on overlayfs.
see linux commit c568d68341be7030f5647def68851e469b21ca11
2016-12-29 22:10:44 -05:00
Quentin Rameau
bfcf5735d0 in public headers, don't assume pre-C99 compilers have __inline keyword 2016-12-16 23:12:32 -05:00
Rich Felker
ffaaa6d230 remove legacy i386 fallback stdarg implementation and framework
this has been slated for removal for a long time. there is
fundamentally no way to implement stdarg without compiler assistance;
any attempt to do so has serious undefined behavior; its working
depends not just (as a common misconception goes) on ABI, but also on
assumptions about compiler code generation internal to a translation
unit, which is not subject to external ABI constraints.
2016-12-15 12:18:24 -05:00
Rich Felker
b418ea1b66 generalize ELF hash table types not to assume 32-bit entries
alpha and s390x gratuitously use 64-bit entries (wasting 2x space and
cache utilization) despite the values always being 32-bit.

based on patch by Bobby Bingham, with changes suggested by Alexander
Monakov to use the public Elf_Symndx type from link.h (and make it
properly variable by arch) rather than adding new internal
infrastructure for handling the type.
2016-11-11 12:46:06 -05:00
Rich Felker
31fb174dd2 add limited pthread_setattr_default_np API to set stack size defaults
based on patch by Timo Teräs:

While generally this is a bad API, it is the only existing API to
affect c++ (std::thread) and c11 (thrd_create) thread stack size.
This patch allows applications only to increate stack and guard
page sizes.
2016-11-08 12:45:03 -05:00
Rich Felker
04983f2272 make netinet/in.h suppress clashing definitions from kernel headers
the linux kernel uapi headers provide their own definitions of the
structures from netinet/in.h, resulting in errors when a program
includes both the standard libc header and one or more of the
networking-related kernel headers that pull in the kernel definitions.

as before, we do not attempt to support the case where kernel headers
are included before the libc ones, since the kernel definitions may
have subtly incorrect types, namespace violations, etc. however, we
can easily support the inclusion of the kernel headers after the libc
ones, since the kernel headers provide a public interface for
suppressing their definitions. this patch adds the necessary macro
definitions for such suppression.
2016-11-07 23:19:19 -05:00
Rich Felker
c8fdcfe550 don't claim support for resolv.h APIs that aren't supported
the value 19991006 for __RES implies availability of res_ninit and
related functions that take a resolver state argument; these are not
supported since our resolver is stateless. instead claim support for
just the older API by defining __RES to 19960801.

based on patch by Dmitrij D. Czarkoff.
2016-11-07 11:55:53 -05:00
Rich Felker
7352b59d68 remove redundant feature test macro checks in sys/time.h
this header is XSI-shaded itself and thus does not need to limit
specific content to _XOPEN_SOURCE.
2016-11-07 11:49:22 -05:00
Rich Felker
7597fc25a2 fix various header namespace issues under feature-test-macro control
reported and changes suggested by Daniel Sabogal.
2016-10-20 17:20:01 -04:00
Rich Felker
2ed4e9d927 remove parameter names from public headers
inclusion of these names was unintentional and in most cases is a
namespace violation. Daniel Sabogal tracked down and reported these.
2016-10-20 17:04:37 -04:00
Rich Felker
4b8f94c250 fix misspelling of a legacy macro name in sys/param.h 2016-10-20 17:01:56 -04:00
Daniel Sabogal
71e8392765 add missing if_ether.h constants
ETH_P_HSR (IEC 62439-3 HSRv1) added in
linux 4.7 commit ee1c27977284907d40f7f72c2d078d709f15811f

ETH_P_TSN (IEEE 1722) added in
linux 4.3 commit 1ab1e895492d8084dfc1c854efacde219e56b8c1
this constant breaks the ascending order to match the kernel header

ETH_P_XDSA (Multiplexed DSA protocol) added in
linux 3.18 commit 3e8a72d1dae374cf6fc1dba97cec663585845ff9
2016-10-20 16:55:57 -04:00
Daniel Sabogal
79c7ded0ed add missing if_arp.h constant
ARPHRD_6LOWPAN (IPv6 over LoWPAN) added in
linux 3.14 commit 0abc652c796dab74d34d60473ec5594cd21620be
2016-10-20 16:55:51 -04:00
Daniel Sabogal
1fa2a32d1e fix typo in utmpx.h 2016-10-20 16:55:32 -04:00
Daniel Sabogal
104e8a0e3b add missing confstr constants
the _CS_V6_ENV and _CS_V7_ENV constants are required to be available for use
with confstr. glibc defines these constants with values 1148 and 1149,
respectively.

the only missing (and required) confstr constants are
_CS_POSIX_V7_THREADS_CFLAGS and _CS_POSIX_V7_THREADS_LDFLAGS which remain
unavailable in glibc.
2016-10-20 16:55:05 -04:00
Felix Janda
8fb28b0b3e add pthread_setname_np
the thread name is displayed by gdb's "info threads".
2016-10-20 01:48:27 -04:00
Szabolcs Nagy
87643335ac update icmphdr struct following linux v4.8
add union field that is used in the kernel for SIT/GRE tunneling ICMPv4
messages. see linux commit 20e1954fe238dbe5f8d3a979e593fe352bd703cf
2016-10-20 01:29:06 -04:00
Szabolcs Nagy
cc7c95e98e add TCP_REPAIR_WINDOW to netinet/tcp.h from linux v4.8
another kernel internal state exposure for checkpoint-restore.
see linux commit b1ed4c4fa9a5ccf325184fd90edc50978ef6e33a
2016-10-20 01:28:44 -04:00
Szabolcs Nagy
fe39aaae0e add bits/hwcap.h and include it in sys/auxv.h
aarch64, arm, mips, mips64, mipsn32, powerpc, powerpc64 and sh have
cpu feature bits defined in linux for AT_HWCAP auxv entry, so expose
those in sys/auxv.h

it seems the mips hwcaps were never exposed to userspace neither
by linux nor by glibc, but that's most likely an oversight.
2016-10-20 01:28:25 -04:00
Szabolcs Nagy
5a05f67599 elf.h: update EM_ elf machine defines and add R_BPF_ defines
sync with gabi: http://www.sco.com/developers/gabi/latest/ch4.eheader.html

EM_BPF is new in linux v4.8 and officially assigned:
https://lists.iovisor.org/pipermail/iovisor-dev/2016-June/000266.html
added related relocs too.
2016-10-20 01:27:46 -04:00
Szabolcs Nagy
9487cc5f22 add ETH_P_NCSI to netinet/if_ether.h from linux v4.8
see linux commit 6389eaa7fa9c3ee6c7d39f6087b86660d17236ac
2016-10-20 01:27:28 -04:00
Rich Felker
66570ec9c4 fix undefined behavior in sched.h cpu_set_t usage
since cpu sets can be dynamically allocated and have variable size,
accessing their contents via ->__bits is not valid; performing pointer
arithmetic outside the range of the size of the declared __bits array
results in undefined beahavior. instead, only use cpu_set_t for
fixed-size cpu set objects (instantiated by the caller) and as an
abstract pointer type for dynamically allocated ones. perform all
accesses simply by casting the abstract pointer type cpuset_t * back
to unsigned long *.
2016-09-19 11:15:51 -04:00
Daniel Sabogal
5505f6afae add missing *_unlocked and wcsftime_l prototypes to wchar.h
these functions had been implemented, but prototypes were not made available
2016-09-16 18:18:34 -04:00
Daniel Sabogal
3848a99f65 fix ifru_data and ifcu_buf types in net/if.h
glibc, freebsd, and openbsd use character pointers (caddr_t) for
these fields. only linux uses void pointer for the ifru_data type.
2016-09-16 17:59:54 -04:00
Rich Felker
e738b8cbe6 restore _Noreturn to __assert_fail
this reverts commit 2c1f8fd5da. without
the _Noreturn attribute, the compiler cannot use asserts to perform
reachability/range analysis. this leads to missed optimizations and
spurious warnings.

the original backtrace problem that prompted the removal of _Noreturn
was not clearly documented at the time, but it seems to happen only
when libc was built without -g, which also breaks many other
backtracing cases.
2016-08-30 16:39:54 -04:00
Duncan Overbruck
c1f4ed1501 fix FFSYNC by changing it to O_SYNC
O_FSYNC was never defined and is legacy/wrong, nothing seems to use it.
2016-08-30 16:01:47 -04:00
Szabolcs Nagy
9680e1d03a add SS_AUTODISARM sigaltstack ss_flags from linux v4.7 to signal.h
only matters if swapcontext is used in a signal handler running on an
altstack, new in linux commit 2a74213838104a41588d86fd5e8d344972891ace
2016-08-30 15:58:25 -04:00
Szabolcs Nagy
c6519d4a71 add UDP_ENCAP_GTP0, UDP_ENCAP_GTP1U from linux v4.7 to netinet/udp.h
for GPRS tunneling protocol, new in linux commit
459aa660eb1d8ce67080da1983bb81d716aa5a69
2016-08-30 15:58:23 -04:00
Szabolcs Nagy
0f8ad40be0 add PF_QIPCRTR, AF_QIPCRTR from linux v4.7 to sys/socket.h
macros for qualcom ip router protocol, new in linux commit
bdabad3e363d825ddf9679dd431cca0b2c30f881
2016-08-30 15:58:20 -04:00
Rich Felker
0f47367751 add stdc-predef.h for library-level predefined macros
modern compilers (for gcc, versions 4.8 and later) automatically
pre-include <stdc-predef.h> to obtain the values of certain predefined
macros specified by ISO C but which reflect properties of the library
implementation, not just the compiler. provide values indicating that
wchar_t is Unicode-encoded and that Annex F (IEEE floating point) is
supported unless the compiler indicates otherwise.

based on patch by Masanori Ogino.
2016-07-03 20:03:30 -04:00
Rich Felker
ee3f0c5516 make brace placement in public header typedef'd structs consistent
commit befa5866ee performed this change
for struct definitions that did not also involve typedef, but omitted
the latter.
2016-07-03 16:19:28 -04:00
Szabolcs Nagy
3c3b09980d add EF_SH_ sh specific macros to elf.h
last time elf.h was thoroughly updated sh was not yet supported
so these processor specific e_flags were missing.
2016-07-03 16:15:13 -04:00
Szabolcs Nagy
84fd4e4ffd add NT_ARM_SYSTEM_CALL to elf.h
new regset in linux v3.18 for ptrace.
2016-07-03 16:15:12 -04:00
Szabolcs Nagy
c3be411df7 add missing x86 relocs to elf.h
see
https://sourceware.org/ml/libc-alpha/2016-01/msg00822.html
2016-07-03 16:15:12 -04:00
Szabolcs Nagy
7c3b67234c add DT_MIPS_RLD_MAP_REL to elf.h
marks different RLD_MAP for debugging PIE binaries.
2016-07-03 16:15:12 -04:00
Szabolcs Nagy
af17dc40dd add SHF_COMPRESSED section flag to elf.h
following
http://www.sco.com/developers/gabi/latest/ch4.sheader.html
2016-07-03 16:15:12 -04:00
Szabolcs Nagy
29a96c1980 add powerpc tls optimization related definitions to elf.h
see
https://sourceware.org/ml/libc-alpha/2015-03/msg00580.html
2016-07-03 16:15:11 -04:00
Szabolcs Nagy
347d0617d1 add nios2 definitions to elf.h 2016-07-03 16:15:11 -04:00
Szabolcs Nagy
abbdf0f51d update elf.h with mips abi flags support
following
https://sourceware.org/ml/libc-alpha/2014-05/msg00332.html
2016-07-03 16:15:11 -04:00
Szabolcs Nagy
49eb322425 update elf.h with new aarch64 relocs
add ilp32 related relocs and alternative names for a few macros following
https://sourceware.org/ml/libc-alpha/2014-11/msg00455.html
2016-07-03 16:15:10 -04:00
Szabolcs Nagy
b921e0fd1f update elf.h with powerpc64 elfv2 abi related macros
see
https://sourceware.org/ml/libc-alpha/2013-11/msg00315.html
https://sourceware.org/ml/libc-alpha/2013-11/msg00314.html
2016-07-03 16:12:12 -04:00
Szabolcs Nagy
35b58194dc add new powerpc64 relocations to elf.h
following the corresponding binutils and glibc changes
https://sourceware.org/ml/binutils/2013-10/msg00372.html
2016-07-03 16:11:12 -04:00
Szabolcs Nagy
308e4bc618 add EM_OPENRISC again to elf.h
it was changed to EM_OR1K in 200d15479c
as that was meant to be the official name, but glibc and the latest
gabi spec still uses the EM_OPENRISC name:
http://www.sco.com/developers/gabi/latest/ch4.eheader.html
binutils defines both macros so we should do the same for backward
compatibility.
2016-07-03 16:11:05 -04:00
Rich Felker
befa5866ee make brace placement in public header struct definitions consistent
placing the opening brace on the same line as the struct keyword/tag
is the style I prefer and seems to be the prevailing practice in more
recent additions.

these changes were generated by the command:

find include/ arch/*/bits -name '*.h' \
-exec sed -i '/^struct [^;{]*$/{N;s/\n/ /;}' {} +

and subsequently checked by hand to ensure that the regex did not pick
up any false positives.
2016-07-03 15:02:25 -04:00
Rich Felker
093288dcb3 fix misplaced indention in sys/procfs.h 2016-07-03 15:02:24 -04:00
Bobby Bingham
3d98146146 pthread: implement try/timed join variants 2016-06-30 21:47:24 -04:00
Rich Felker
5c43e1dbc8 add RUSAGE_THREAD (Linux extension) definition to sys/resource.h 2016-06-29 11:55:41 -04:00
Rich Felker
b3bbc7b160 fix incorrect definition of RUSAGE_CHILDREN in sys/resource.h
the kernel ABI value for RUSAGE_CHILDREN is -1, not 1. the latter is
actually interpreted as RUSAGE_THREAD, to obtain values for just the
calling thread and not the whole process.
2016-06-29 11:54:03 -04:00
Rich Felker
1e6fc0b690 avoid padding gaps in struct sockaddr_storage
compilers are free not to copy, or in some cases to clobber, padding
bytes in a structure. while it's an aliasing violation, and thus
undefined behavior, to copy or manipulate other sockaddr types using
sockaddr_storage, it seems likely that traditional code attempts to do
so, and the original intent of the sockaddr_storage structure was
probably to allow such usage.

in the interest of avoiding silent and potentially dangerous breakage,
ensure that there are no actual padding bytes in sockaddr_storage by
moving and adjusting the size of the __ss_padding member so that it
fits exactly.

this change also removes a silent assumption that the alignment of
long is equal to its size.
2016-06-09 13:42:06 -04:00