about summary refs log tree commit diff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* fix CPU_EQUAL macro in sched.hSzabolcs Nagy2014-08-131-1/+1
|
* add inline isspace in ctype.h as an optimizationSzabolcs Nagy2014-08-131-1/+6
| | | | | | | | | | | | | | | | | | | | | isspace can be a bottleneck in a simple parser, inlining it gives slightly smaller and faster code src/locale/pleval.o already had this optimization, the size change for other libc functions for i386 is src/internal/intscan.o 2134 2118 -16 src/locale/dcngettext.o 1562 1552 -10 src/network/res_msend.o 1961 1940 -21 src/network/lookup_name.o 2627 2608 -19 src/network/getnameinfo.o 1814 1811 -3 src/network/lookup_serv.o 643 624 -19 src/stdio/vfscanf.o 2675 2663 -12 src/stdlib/atoll.o 117 107 -10 src/stdlib/atoi.o 95 91 -4 src/stdlib/atol.o 95 91 -4 src/time/strptime.o 1515 1503 -12 (TOTALS) 432451 432321 -130
* 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.
* implement ffsl and ffsll functionsRich Felker2014-07-311-0/+2
| | | | | | per the resolution of Austin Group issue #617, these are accepted for XSI option in POSIX future and thus I'm treating them as standard functions.
* limit visibility of ffs function declaration to _XOPEN_SOURCERich Felker2014-07-311-0/+2
| | | | | per the standard, ffs is XSI shaded, whereas the other functions in this header are in the base.
* add new PR_SET_THP_DISABLE and PR_GET_THP_DISABLE prctl flagsSzabolcs Nagy2014-07-201-0/+3
| | | | | they can be used to set or query if transparent huge pages are disabled. introduced in linux 3.15 commit a0715cc22601e8830ace98366c0c2bd8da52af52
* add pacing rate information to the tcp_info struct in tcp.hSzabolcs Nagy2014-07-201-0/+2
| | | | | used by monitoring applications such as ss from iproute2 introduced in linux 3.15 commit 977cb0ecf82eb6d15562573c31edebf90db35163
* add new ethernet packet types ETH_P_80221, ETH_P_LOOPBACKSzabolcs Nagy2014-07-201-2/+4
| | | | | | | | | | ETH_P_80221 is ethertype for IEEE Std 802.21 - Media Independent Handover Protocol introduced in linux 3.15 commit b62faf3cdc875a1ac5a10696cf6ea0b12bab1596 ETH_P_LOOPBACK is the correct packet type for loopback in IEEE 802.3* introduced in linux 3.15 commit 61ccbb684421d374fdcd7cf5d6b024b06f03ce4e some defines were shuffled to be in ascending order and match the kernel header
* add issetugid function to check for elevated privilegeBrent Cook2014-07-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | this function provides a way for third-party library code to use the same logic that's used internally in libc for suppressing untrusted input/state (e.g. the environment) when the application is running with privleges elevated by the setuid or setgid bit or some other mechanism. its semantics are intended to match the openbsd function by the same name. there was some question as to whether this function is necessary: getauxval(AT_SECURE) was proposed as an alternative. however, this has several drawbacks. the most obvious is that it asks programmers to be aware of an implementation detail of ELF-based systems (the aux vector) rather than simply the semantic predicate to be checked. and trying to write a safe, reliable version of issetugid in terms of getauxval is difficult. for example, early versions of the glibc getauxval did not report ENOENT, which could lead to false negatives if AT_SECURE was not present in the aux vector (this could probably only happen when running on non-linux kernels under linux emulation, since glibc does not support linux versions old enough to lack AT_SECURE). as for musl, getauxval has always properly reported errors, but prior to commit 7bece9c2095ee81f14b1088f6b0ba2f37fecb283, the musl implementation did not emulate AT_SECURE if missing, which would result in a false positive. since musl actually does partially support kernels that lack AT_SECURE, this was problematic. the intent is that library authors will use issetugid if its availability is detected at build time, and only fall back to the unreliable alternatives on systems that lack it. patch by Brent Cook. commit message/rationale by Rich Felker.
* add or1k (OpenRISC 1000) architecture portStefan Kristiansson2014-07-181-1/+37
| | | | | | | | | | | | | | | With the exception of a fenv implementation, the port is fully featured. The port has been tested in or1ksim, the golden reference functional simulator for OpenRISC 1000. It passes all libc-test tests (except the math tests that requires a fenv implementation). The port assumes an or1k implementation that has support for atomic instructions (l.lwa/l.swa). Although it passes all the libc-test tests, the port is still in an experimental state, and has yet experienced very little 'real-world' use.
* implement fmtmsg functionRich Felker2014-06-211-0/+47
| | | | | contributed by Isaac Dunham. this seems to be the last interface that was missing for complete POSIX 2008 base + XSI coverage.
* remove hack in syslog.h that resulted in aliasing violationsRich Felker2014-06-211-6/+2
| | | | | | | | | | | this issue affected the prioritynames and facilitynames arrays which are only provided when requested (usually by syslogd implementations) and which are presently defined as compound literals. the aliasing violation seems to have been introduced as a workaround for bad behavior by gcc's -Wwrite-strings option, but it caused compilers to completely optimize out the contents of prioritynames and facilitynames since, under many usage cases, the aliasing rules prove that the contents are never accessed.
* implement sendmmsg and recvmmsgRich Felker2014-06-191-0/+11
| | | | | | | these are not pure syscall wrappers because they have to work around kernel API bugs on 64-bit archs. the workarounds could probably be made somewhat more efficient, but at the cost of more complexity. this may be revisited later.
* add support for ipv6 scope_id to getaddrinfo and getnameinfoRich Felker2014-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | for all address types, a scope_id specified as a decimal value is accepted. for addresses with link-local scope, a string containing the interface name is also accepted. some changes are made to error handling to avoid unwanted fallbacks in the case where the scope_id is invalid: if an earlier name lookup backend fails with an error rather than simply "0 results", this failure now suppresses any later attempts with other backends. in getnameinfo, a light "itoa" type function is added for generating decimal scope_id results, and decimal port strings for services are also generated using this function now so as not to pull in the dependency on snprintf. in netdb.h, a definition for the NI_NUMERICSCOPE flag is added. this is required by POSIX (it was previously missing) and needed to allow callers to suppress interface-name lookups.
* fix POSIX namespace pollution in sys/types.hSzabolcs Nagy2014-05-301-10/+6
| | | | int8_t, u_int8_t, etc types are moved under _BSD_SOURCE
* update netinet/in.h to match the current kernel uapiSzabolcs Nagy2014-05-301-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | from linux/in.h and linux/in6.h uapi headers the following missing socket options were added: IP_NODEFRAG - used with customized ipv4 headers IPV6_RECVPATHMTU - for ipv6 path mtu IPV6_PATHMTU - for ipv6 path mtu IPV6_DONTFRAG - for ipv6 path mtu IPV6_ADDR_PREFERENCES - RFC5014 Source Address Selection IPV6_MINHOPCOUNT - RFC5082 Generalized TTL Security Mechanism IPV6_ORIGDSTADDR - used by tproxy IPV6_RECVORIGDSTADDR - used by tproxy IPV6_TRANSPARENT - used by tproxy IPV6_UNICAST_IF - ipv6 version of IP_UNICAST_IF and socket option values: IP_PMTUDISC_OMIT - value for IP_MTU_DISCOVER option, new in linux 3.14 IPV6_PMTUDISC_OMIT - same for IPV6_MTU_DISCOVER IPV6_PMTUDISC_INTERFACE - ipv6 version of IP_PMTUDISC_INTERFACE IPV6_PREFER_* - flags for IPV6_ADDR_PREFERENCES not added: ipv6 flow info and flow label related definitions. (it's unclear if libc should define these and namespace polluting type name is involved so they are not provided for now)
* add SO_BPF_EXTENSIONS socket optionSzabolcs Nagy2014-05-301-0/+1
| | | | | this was introduced to query BPF extension support with getsockopt in linux 3.14, commit ea02f9411d9faa3553ed09ce0ec9f00ceae9885e
* add sched_{get,set}attr syscall numbers and SCHED_DEADLINE macroSzabolcs Nagy2014-05-301-0/+1
| | | | | | | | | | | | linux 3.14 introduced sched_getattr and sched_setattr syscalls in commit d50dde5a10f305253cbc3855307f608f8a3c5f73 and the related SCHED_DEADLINE scheduling policy in commit aab03e05e8f7e26f51dee792beddcb5cca9215a5 but struct sched_attr "extended scheduling parameters data structure" is not yet exported to userspace (necessary for using the syscalls) so related uapi definitions are not added yet.
* overhaul siginfo_t definition in signal.hRich Felker2014-05-241-23/+28
| | | | | | | | | | | | | | | | | | the main motivation for this change is that, with the previous definition, it was arguably illegal, in standard C, to initialize both si_value and si_pid/si_uid with designated initializers, due to the rule that only one member of a union can have an initializer. whether or not this affected real-world application code, it affected some internal code, and clang was producing warnings (and possibly generating incorrect code). the new definition uses a more complex hierarchy of structs and unions to avoid the need to initialize more than one member of a single union in usage cases that make sense. further work would be needed to eliminate even the ones with no practical applications. at the same time, some fixes are made to the exposed names for nonstandard fields, to match what software using them expects.
* remove unsupported nonstandard sysconf macros and their table entriesRich Felker2014-05-191-60/+0
| | | | | | | | | | | | | | | | | | | | | | some of these may have been from ancient (pre-SUSv2) POSIX versions; more likely, they were from POSIX drafts or glibc interpretations of what ancient versions of POSIX should have added (instead they made they described functionality mandatory and/or dropped it completely). others are purely glibc-isms, many of them ill-thought-out, like providing ways to lookup the min/max values of types at runtime (despite the impossibility of them changing at runtime and the impossibility of representing ULONG_MAX in a return value of type long). since our sysconf implementation does not support or return meaningful values for any of these, it's harmful to have the macros around; applications' build scripts may detect and attempt to use them, only to get -1/EINVAL as a result. if removing them does break some applications, and it's determined that the usage was reasonable, some of these could be added back on an as-needed basis, but they should return actual meaningful values, not junk like they were returning before.
* expose public execvpe interfaceM Farkas-Dyck2014-04-201-0/+1
|
* fix RLIMIT_ constants for mipsSzabolcs Nagy2014-04-151-2/+5
| | | | | | | The mips arch is special in that it uses different RLIMIT_ numbers than other archs, so allow bits/resource.h to override the default RLIMIT_ numbers (empty on all archs except mips). Reported by orc.
* add getauxval functionRich Felker2014-04-071-0/+16
| | | | | | | in a sense this implementation is incomplete since it doesn't provide the HWCAP_* macros for use with AT_HWCAP, which is perhaps the most important intended usage case for getauxval. they will be added at a later time.
* implement hcreate_r, hdestroy_r and hsearch_rsin2014-04-021-0/+12
| | | | | | | | | | the size and alignment of struct hsearch_data are matched to the glibc definition for binary compatibility. the members of the structure do not match, which should not be a problem as long as applications correctly treat the structure as opaque. unlike the glibc implementation, this version of hcreate_r does not require the caller to zero-fill the structure before use.
* fix signal.h breakage from moving stack_t to arch-specific bitsRich Felker2014-03-181-0/+2
| | | | | | in the previous changes, I missed the fact that both the prototype of the sigaltstack function and the definition of ucontext_t depend on stack_t.
* move signal.h definition of stack_t to arch-specific bitsRich Felker2014-03-181-6/+0
| | | | | it's different at least on mips. mips version will be fixed in a separate commit to show the change.
* move struct semid_ds to from shared sys/sem.h to bitsRich Felker2014-03-111-16/+1
| | | | | | | | | | | | the definition was found to be incorrect at least for powerpc, and fixing this cleanly requires making the definition arch-specific. this will allow cleaning up the definition for other archs to make it more specific, and reversing some of the ugliness (time_t hacks) introduced with the x32 port. this first commit simply copies the existing definition to each arch without any changes. this is intentional, to make it easier to review changes made on a per-arch basis.
* math.h: make __FLOAT_BITS and __DOUBLE_BITS C89Szabolcs Nagy2014-03-091-2/+4
| | | | | Remove non-constant aggregate initializer. (Still using long long, but that is supported by ancient compilers without __extension__ anyway).
* in sys/procfs.h, avoid using __WORDSIZE macroRich Felker2014-03-081-1/+1
| | | | | | | 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.
* in.h: new IP_MTU_DISCOVER mode IP_PMTUDISC_INTERFACESzabolcs Nagy2014-02-251-0/+1
| | | | | introduced in linux v3.13, 482fc6094afad572a4ea1fd722e7b11ca72022a0 to mitigate dns cache poisoning via fragmentation
* if_ether.h: new ethernet protocol typeSzabolcs Nagy2014-02-251-0/+1
| | | | | for High-availability Seamless Redundancy (HSR) specified in IEC 62439-3 new in linux v3.13, f421436a591d34fa5279b54a96ac07d70250cc8d
* sys/socket.h: add the SO_MAX_PACING_RATE SOL_SOCKET optionSzabolcs Nagy2014-02-251-0/+1
| | | | introduced in linux v3.13, 62748f32d501f5d3712a7c372bbb92abc7c62bc7
* elf.h: add aarch64 relocationsSzabolcs Nagy2014-02-251-0/+111
|
* elf.h: new elf header flag to mark 2008-NaN vs legacy-NaN on mipsSzabolcs Nagy2014-02-251-0/+1
| | | | see glibc commit 9c21573c02446b3d5cf6a34b67c8545e5be6a600
* sys/shm.h: move arch specific structs to bits/rofl0r2014-02-231-16/+7
|
* sys/sem.h: cheat and make all longs use time_t insteadrofl0r2014-02-221-8/+8
| | | | | 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.
* add flock64 alias for (struct) flock in fcntl.hRich Felker2014-02-181-0/+1
| | | | | this was a missing part of the LFS64 API; it's "needed" for use with fcntl and the corresponding lock commands.
* add parens when bit and arith ops are mixed in macros in public headersSzabolcs Nagy2014-02-112-2/+2
| | | | | another commit to silence gcc warnings (-Wparentheses) for standard headers. changed macros: LOG_UPTO, IN6_ARE_ADDR_EQUAL
* fix signed and unsigned comparision in macros in public headersSzabolcs Nagy2014-02-113-3/+3
| | | | | | 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
* reduce namespace pollution in netinet/udp.hRich Felker2014-02-051-7/+10
| | | | | | | | | | | 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.
* fix use of legacy u_intN_t types in netinet/tcp.hRich Felker2014-02-051-73/+74
| | | | | | policy is to avoid using these types except where they are needed for namespace conformance. C99-style stdint.h types should be used instead.
* add support for BSD struct tcphdr in netinet/tcp.hRich Felker2014-02-051-4/+41
| | | | | | | | | | | | | 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.
* add nonstandard timespec/timeval conversion macros in sys/time.hRich Felker2014-02-051-0/+11
| | | | | | | | 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.
* add NO_ADDRESS macro to netdb.h as an alias for NO_DATATimo Teräs2014-02-051-0/+1
| | | | | | | | 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.
* fix namespace violation in sys/shm.hRich Felker2014-01-081-6/+8
| | | | | | | | 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.
* fix namespace violations in utmpx.hRich Felker2014-01-082-5/+12
|
* fix remaining known namespace violations for netinet/in.hRich Felker2014-01-082-22/+18
| | | | | | | | | | | | | | | | | | | | 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.
* fix const-correctness of argument to stimeRich Felker2014-01-071-1/+1
| | | | | | | 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.
* fix signedness of pgoff argument to remap_file_pagesRich Felker2014-01-071-1/+1
| | | | | both the kernel and glibc agree that this argument is unsigned; the incorrect type ssize_t came from erroneous man pages.
* fix const-correctness in sigandset/sigorset argumentsRich Felker2014-01-071-2/+2
| | | | | | 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.