summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)AuthorLines
2024-03-13uio.h: add RWF_NOAPPEND flag for pwritev2Rich Felker-0/+1
added in linux kernel commit 73fa7547c70b32cc69685f79be31135797734eb6. this is added now as a prerequisite for fixing pwrite/pwritev behavior for O_APPEND files.
2024-02-26switch __STDC_UTF_{16,32}__ macro definitions from #undef to #ifndefRich Felker-2/+4
originally, compilers did not provide these macros and we had to provide them ourselves. this meant we were redefining them, which was technically invalid unless the token sequence of the original definition matched exactly. the original patch proposed by Jules Maselbas to fix this made the definitions conditional on them not already being defined; however I suggested using #undef to avoid any possibly-wrong definitions already in place and ensure that the definitions are 1. the version adopted as commit 8b7048680731707d135ea231f81eb3eaf52378ee made this change. unfortunately, gcc is loud about not liking #undef of any __STDC_* macro name, and while warnings are suppressed in the system include path, there is apparently no way to suppress this warning if the system include dir has also been provided via -I. while normally we don't go out of our way to satisfy warnings over style in the public headers, in this case, it seems to be a matter of disagreement over contract of which part of "the implementation" is entitled to define or undefine macros belonging to the implementation, and it's quite reasonable to conclude that the compiler may reject attempts to undefine them. this commit reverts to the originally-submitted version of the patch making the definitions conditional.
2024-02-24add statx interface using syscall, fallback to fstatatDuncan Bellamy-0/+55
2024-02-16add loongarch64 portHongliang Wang-1/+103
Author: Xiaojuan Zhai <zhaixiaojuan@loongson.cn> Author: Meidan Li <limeidan@loongson.cn> Author: Guoqi Chen <chenguoqi@loongson.cn> Author: Xiaolin Zhao <zhaoxiaolin@loongson.cn> Author: Fan peng <fanpeng@loongson.cn> Author: Jiantao Shan <shanjiantao@loongson.cn> Author: Xuhui Qiang <qiangxuhui@loongson.cn> Author: Jingyun Hua <huajingyun@loongson.cn> Author: Liu xue <liuxue@loongson.cn> Author: Hongliang Wang <wanghongliang@loongson.cn>
2024-02-08fix erroneous feature test macro check for ppollRich Felker-2/+2
commit f247462b0831cbf163e976ee9a909748c674b88b incorrectly hid ppoll in the presence of _GNU_SOURCE due to an oversight that defining _BSD_SOURCE does not implicitly define _GNU_SOURCE. at present, headers still have to explicitly check for each feature profile level; this may be changed at some point in the future via features.h, but has not been changed yet.
2024-02-03stdc-predef.h: prevent redefining __STDC_UTF_{16,32}__ macrosJules Maselbas-0/+3
Undefine any previous __STDC_UTF_{16,32}__ macros before defining them to prenvent any warnings of redefining macros. This happens as a result of some compiler versions defining the macros themselves.
2024-02-03elf.h: add NT_RISCV_CSR and NT_RISCV_VECTOR constantsElliott Hughes-0/+2
See Linux commit 9300f00439743c4a34d735e1a27118eb68a1504e ("RISC-V: Add ptrace support for vectors").
2024-02-03elf.h: update RISC-V relocation typesFangrui Song-6/+10
Note: Some relocation types were only used by binutils and accidentally exposed to previous versions of psABI. One of the values has been reused by GOT32_PCREL.
2024-01-25add preadv2 and pwritev2 syscall wrappers, flag value macrosRich Felker-0/+7
2024-01-21expose ppoll in default feature profileRich Felker-2/+2
the ppoll function has been accepted as a future part of the standard as the outcome of Austin Group tracker issue 1263. at some point it should be exposed unconditionally, but for now, expose it in the default feature profile.
2023-11-06remove non-prototype declaration of basename from string.hRich Felker-3/+0
commit 37bb3cce4598c19288628e675eaf1cda6e96958f suppressed the declaration for C++, where it is wrongly interpreted as declaring the function as taking no arguments. with C23 removing non-prototype declarations, that problem is now also relevant to C. the non-prototype declaration for basename originates with commit 06aec8d7152dfb8360cb7ed9b3d7215ca0b0b500, where it was designed to avoid conflicts with programs which declare basename with the GNU signature taking const char *. that change was probably misguided, as it represents not only misaligned expectations with the caller, but also undefined behavior (calling a function that's been declared with the wrong type). we could opt to fix the declaration, but since glibc, with the gratuitously incompatible GNU-basename function, seems to be the only implementation that declares it in string.h, it seems better to just remove the declaration. this provides some warning if applications are being built expecting the GNU behavior but not getting it. if we declared it here, it would only produce a warning if the caller also declares it themselves (rare) or if the caller attempts to pass a const-qualified pointer.
2023-11-06elf.h: add typedefs for Elf64_Relr and Elf32_RelrViolet Purcell-0/+5
These were overlooked when DT_RELR was added in commit d32dadd60efb9d3b255351a3b532f8e4c3dd0db1, potentially breaking software that treats presence of the DT_RELR macro as implying they exist.
2023-08-19statvfs: allocate spare for f_typeнаб-1/+2
This is the only missing part in struct statvfs. The LSB calls [f]statfs() deprecated, and its weird types are definitely off-putting. However, its use is required to get f_type. Instead, allocate one of the six spares to f_type, copied directly from struct statfs. This then becomes a small extension to the standard interface on Linux, instead of two different interfaces, one of which is quite odd due to being an ABI type, and there no longer is any reason to use statfs(). The underlying kernel type is a mess, but all architectures agree on u32 (or more) for the ABI, and all filesystem magicks are 32-bit integers. Since commit 6567db65f495cf7c11f5c1e60a3e54543d5a69bc (prior to 1.0.0), the spare slots have been zero-filled, so on all versions that may be reasonably be encountered in the wild, applications can rely on a nonzero f_type as indication that the new field has been filled in.
2023-05-02move fallocate64 declaration under _LARGEFILE64_SOURCE feature testRich Felker-1/+3
overlooked in commit 25e6fee27f4a293728dd15b659170e7b9c7db9bc, probably because the fallocate function itself is nonstandard and already under _GNU_SOURCE.
2023-02-23fix incorrect unit for CPU_SETSIZE macroRich Felker-1/+1
this macro is supposed to reflect the number of members (bits) in cpu_set_t, not the storage size (bytes).
2023-02-08fix integer overflow in WIFSTOPPED macroRich Felker-2/+2
the result of the 0xffff mask with the exit status could have bit 15 set, in which case multiplying by 0x10001 overflows 32-bit signed int. making the multiply unsigned avoids the overflow. it also changes the sign extension behavior of the subsequent >> operation, but the affected bits are all unwanted anyway and all discarded by the cast to short.
2023-01-06expose memmem under baseline POSIX feature profileRich Felker-1/+1
memmem has been adopted for the next issue of POSIX (outcome of tracker item 1061). since mem* is in the reserved namespace for string.h it's already fully conforming to expose it by default, so just do so.
2022-12-14elf.h: add ELFCOMPRESS_ZSTDFangrui Song-0/+1
2022-10-19remove LFS64 programming interfaces (macro-only) from _GNU_SOURCERich Felker-16/+16
these badly pollute the namespace with macros whenever _GNU_SOURCE is defined, which is always the case with g++, and especially tends to interfere with C++ constructs. as our implementation of these was macro-only, their removal cannot affect any existing binaries. at the source level, portable software should be prepared for them not to exist. for now, they are left in place with explicit _LARGEFILE64_SOURCE. this provides an easy temporary path for integrators/distributions to get packages building again right away if they break while working on a proper, upstreamable fix. the intent is that this be a very short-term measure and that the macros be removed entirely in the next release cycle.
2022-09-22arpa/nameser.h: update RR types listRich Felker-0/+71
our RR type list in arpa/nameser.h was badly outdated, and missing important types for DNSSEC and DANE use, among other things.
2022-09-20getaddrinfo: add EAI_NODATA error code to distinguish NODATA vs NxDomainRich Felker-0/+1
this was apparently omitted long ago out of a lack of understanding of its importance and the fact that POSIX doesn't specify it. despite not being officially standardized, however, it turns out that at least AIX, glibc, NetBSD, OpenBSD, QNX, and Solaris document and support it. in certain usage cases, such as implementing a DNS gateway on top of the stub resolver interfaces, it's necessary to distinguish the case where a name does not exit (NxDomain) from one where it exists but has no addresses (or other records) of the requested type (NODATA). in fact, even the legacy gethostbyname API had this distinction, which we were previously unable to support correctly because the backend lacked it. apart from fixing an important functionality gap, adding this distinction helps clarify to users how search domain fallback works (falling back in cases corresponding to EAI_NONAME, not in ones corresponding to EAI_NODATA), a topic that has been a source of ongoing confusion and frustration. as a result of this change, EAI_NONAME is no longer a valid universal error code for getaddrinfo in the case where AI_ADDRCONFIG has suppressed use of all address families. in order to return an accurate result in this case, getaddrinfo is modified to still perform at least one lookup. this will almost surely fail (with a network error, since there is no v4 or v6 network to query DNS over) unless a result comes from the hosts file or from ip literal parsing, but in case it does succeed, the result is replaced by EAI_NODATA. glibc has a related error code, EAI_ADDRFAMILY, that could be used for the AI_ADDRCONFIG case and certain NODATA cases, but distinguishing them properly in full generality seems to require additional DNS queries that are otherwise not useful. on glibc, it is only used for ip literals with mismatching family, not for DNS or hosts file results where the name has addresses only in the opposite family. since this seems misleading and inconsistent, and since EAI_NODATA already covers the semantic case where the "name" exists but doesn't have any addresses in the requested family, we do not adopt EAI_ADDRFAMILY at this time. this could be changed at some point if desired, but the logic for getting all the corner cases with AI_ADDRCONFIG right is slightly nontrivial.
2022-08-26add sysconf keys/values for signal stack sizeRich Felker-0/+2
as a result of ISA extensions exploding register file sizes on some archs, using a constant for minimum signal stack size no longer seems viably future-proof. add sysconf keys allowing the kernel to provide a machine-dependent minimum applications can query to ensure they allocate sufficient space for stacks. the key names and indices align with the same functionality in glibc. see commit d5a5045382315e36588ca225889baa36ed0ed38f for previous action on this subject. ultimately, the macros MINSIGSTKSZ and SIGSTKSZ probably need to be deprecated, but that is standards-amendment work outside the scope of a single implementation.
2022-08-02ldso: support DT_RELR relative relocation formatFangrui Song-2/+6
this resolves DT_RELR relocations in non-ldso, dynamic-linked objects.
2022-08-01fix strings.h feature test macro usage due to missing features.hMichael Pratt-0/+1
2022-04-20add missing POSIX confstr keys for pthread CFLAGS/LDFLAGSRich Felker-0/+2
_CS_POSIX_V7_THREADS_CFLAGS and _CS_POSIX_V7_THREADS_LDFLAGS have been missing for a long time, which is a conformance defect. we were waiting on glibc to add them or at least agree on the numeric values they will have so as to keep the numbering aligned. it looks like they will be added to glibc with these numbers, and in any case, this list does not have any significant churn that would result in the numbers getting taken.
2022-03-08sys/ptrace.h: add PTRACE_GET_RSEQ_CONFIGURATION from linux v5.13Szabolcs Nagy-0/+9
see linux commit 90f093fa8ea48e5d991332cee160b761423d55c1 rseq, ptrace: Add PTRACE_GET_RSEQ_CONFIGURATION request the struct type got __ prefix to follow existing practice.
2022-03-08sys/prctl.h: add PR_PAC_{SET,GET}_ENABLED_KEYS from linux v5.13Szabolcs Nagy-0/+3
see linux commit 201698626fbca1cf1a3b686ba14cf2a056500716 arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS)
2022-03-08elf.h: add NT_ARM_PAC_ENABLED_KEYS from linux v5.13Szabolcs Nagy-0/+1
see linux commit 201698626fbca1cf1a3b686ba14cf2a056500716 arm64: Introduce prctl(PR_PAC_{SET,GET}_ENABLED_KEYS)
2022-03-08netinet/in.h: add INADDR_DUMMY from linux v5.13Szabolcs Nagy-0/+1
see linux commit 321827477360934dc040e9d3c626bf1de6c3ab3c icmp: don't send out ICMP messages with a source address of 0.0.0.0 "RFC7600 reserves a dummy address to be used as a source for ICMP messages (192.0.0.8/32), so let's teach the kernel to substitute that address as a last resort if the regular source address selection procedure fails."
2022-03-08netinet/tcp.h: add tcp_zerocopy_receive fields from linux v5.12Szabolcs Nagy-0/+4
see linux commit 7eeba1706eba6def15f6cb2fc7b3c3b9a2651edc tcp: Add receive timestamp support for receive zerocopy. linux commit 3c5a2fd042d0bfac71a2dfb99515723d318df47b tcp: Sanitize CMSG flags and reserved args in tcp_zerocopy_receive.
2022-03-08netinet/tcp.h: add TCP_NLA_* values up to linux v5.12Szabolcs Nagy-0/+2
TCP_NLA_EDT was new in v5.9, see linux commit 48040793fa6003d211f021c6ad273477bcd90d91 tcp: add earliest departure time to SCM_TIMESTAMPING_OPT_STATS TCP_NLA_TTL is new in v5.12, see linux commit e7ed11ee945438b737e2ae2370e35591e16ec371 tcp: add TTL to SCM_TIMESTAMPING_OPT_STATS
2022-03-08signal.h: add new sa_flags from linux v5.11Szabolcs Nagy-0/+3
see linux commit a54f0dfda754c5cecc89a14dab68a3edc1e497b5 signal: define the SA_UNSUPPORTED bit in sa_flags linux commit 6ac05e832a9e96f9b1c42a8917cdd317d7b6c8fa signal: define the SA_EXPOSE_TAGBITS bit in sa_flags Note: SA_ is in the posix reserved namespace so these linux specific flags can be exposed when compiling for posix.
2022-03-08signal.h: add SYS_USER_DISPATCH si_code value from linux v5.11Szabolcs Nagy-0/+1
see linux commit 1d7637d89cfce54a4f4a41c2325288c2f47470e8 signal: Expose SYS_USER_DISPATCH si_code type
2022-03-08signal.h: add si_code values for SIGSYSSzabolcs Nagy-0/+2
unlike other si_code defines, SYS_ is not in the posix reserved namespace which is likely the reason why SYS_SECCOMP was previously missing (was new in linux v3.5).
2022-03-08netinet/tcp.h: add tcp zerocopy related changes from linux v5.11Szabolcs Nagy-0/+5
see linux commit 18fb76ed53865c1b5d5f0157b1b825704590beb5 net-zerocopy: Copy straggler unaligned data for TCP Rx. zerocopy. linux commit 94ab9eb9b234ddf23af04a4bc7e8db68e67b8778 net-zerocopy: Defer vm zap unless actually needed.
2022-03-08netinet/if_ether.h: add ETH_P_CFM from linux v5.11Szabolcs Nagy-0/+1
see linux commit fbaedb4129838252570410c65abb2036b5505cbd bridge: uapi: cfm: Added EtherType used by the CFM protocol.
2022-03-08sys/socket.h: add new SO_ socket options from linux v5.11Szabolcs Nagy-0/+2
see linux commit 7fd3253a7de6a317a0683f83739479fb880bffc8 net: Introduce preferred busy-polling linux commit 7c951cafc0cb2e575f1d58677b95ac387ac0a5bd net: Add SO_BUSY_POLL_BUDGET socket option
2022-03-08sys/prctl.h: add PR_SET_SYSCALL_USER_DISPATCH from linux v5.11Szabolcs Nagy-0/+6
see linux commit 1446e1df9eb183fdf81c3f0715402f1d7595d4cb kernel: Implement selective syscall userspace redirection linux commit 36a6c843fd0d8e02506681577e96dabd203dd8e8 entry: Use different define for selector variable in SUD redirect syscalls to a userspace handler via SIGSYS, except for a specific range of code. can be toggled via a memory write to a selector variable. mainly for wine.
2022-01-09add SEEK_DATA and SEEK_HOLE to unistd.hÉrico Nogueira-0/+2
these are linux specific constants. glibc exposes them behind _GNU_SOURCE, but, since SEEK_* is reserved for the implementation, we can simply define them. furthermore, since they can't be used with fseek() and other functions that deal with FILE, we don't add them to stdio.h.
2021-11-29define NULL as nullptr when used in C++11 or laterIsmael Luceno-8/+24
This should be safer for casting and more compatible with existing code bases that wrongly assume it must be defined as a pointer.
2021-09-23add qsort_r and make qsort a wrapper around itÉrico Nogueira-0/+1
we make qsort a wrapper by providing a wrapper_cmp function that uses the extra argument as a function pointer. should be optimized to a tail call on most architectures, as long as it's built with -fomit-frame-pointer, so the performance impact should be minimal. to keep the git history clean, for now qsort_r is implemented in qsort.c and qsort is implemented in qsort_nr.c. qsort.c also received a few trivial cleanups, including replacing (*cmp)() calls with cmp(). qsort_nr.c contains only wrapper_cmp and qsort as a qsort_r wrapper itself.
2021-04-20add pthread_getname_np functionÉrico Rolim-0/+1
based on the pthread_setname_np implementation
2021-04-19define __STDC_UTF_{16,32}__ macrosÉrico Nogueira-0/+3
these macros are used to indicate that the implementation uses, respectively, utf-16 and utf-32 encoding for char16_t and char32_t.
2021-02-25suppress isascii() macro for C++Érico Rolim-0/+2
analogous to commit a60457c84a4b59ab564d7f4abb660a70283ba98d.
2021-02-22guard against compilers failing to handle setjmp specially by defaultRich Felker-3/+11
since 4.1, gcc has had the __returns_twice__ attribute and has required functions which return twice to carry it; however it's always applied it automatically to known setjmp-like function names. clang however does not do this reliably, at least not with -ffreestanding and possibly under other conditions, resulting in silent emission of wrong code. since the symbol name setjmp is in no way special (setjmp is specified as a macro that could expand to use any implementation-specific symbol name or names), a compiler is justified not to do anything special without further hints, and it's reasonable to do what we can to provide such hints. gcc 4.0.x and earlier do not recognize the attribute, so make use conditional on __GNUC__ macros. clang and other gcc-like compilers report (and have always reported) a later "GNUC" version so the preprocessor conditional should function as desired for them as too. undefine the internal macro after use so that nothing abuses it as a public feature.
2021-02-15signal.h: add MTE specific SIGSEGV codes from linux v5.10Szabolcs Nagy-0/+2
add synchronouse and asynchronous tag check failure codes, see linux commit 74f1082487feb90bbf880af14beb8e29c3030c9f arm64: mte: Add specific SIGSEGV codes
2021-02-15sys/prctl.h: add MTE related constants from linux v5.10Szabolcs Nagy-0/+7
these are for the aarch64 MTE (memory tagging extension), see linux commit 1c101da8b971a36695319dce7a24711dc567a0dd arm64: mte: Allow user control of the tag check mode via prctl() linux commit af5ce95282dc99d08a27a407a02c763dde1c5558 arm64: mte: Allow user control of the generated random tags via prctl()
2021-02-15elf.h: add NT_ARM_TAGGED_ADDR_CTRL from linux v5.10Szabolcs Nagy-0/+1
see linux commit 2200aa7154cb7ef76bac93e98326883ba64bfa2e arm64: mte: ptrace: Add NT_ARM_TAGGED_ADDR_CTRL regset
2021-02-15sys/mman.h: add MAP_HUGE_16KB from linux v5.10Szabolcs Nagy-0/+1
see linux commit e47168f3d1b14af5281cf50c59561d59d28201f9 powerpc/8xx: Support 16k hugepages with 4k pages
2021-02-15sys/mount.h: add MS_NOSYMFOLLOW from linux v5.10Szabolcs Nagy-0/+1
path resolution does not follow symlinks on nosymfollow mounts (but readlink still does), see linux commit dab741e0e02bd3c4f5e2e97be74b39df2523fc6e Add a "nosymfollow" mount option.