summaryrefslogtreecommitdiff
path: root/include/sys
AgeCommit message (Collapse)AuthorLines
2024-05-07sys/user.h: derive __WORDSIZE from __LONG_MAXRich Felker-0/+9
previously, only a few archs defined it here. this change makes the presence consistent across all archs, and reduces the amount of header duplication (and potential for future inconsistency) between archs.
2024-05-07sys/reg.h: derive __WORDSIZE from __LONG_MAXRich Felker-0/+9
this removes an otherwise-unnecessary bits header from most archs, replacing it with an empty generic version.
2024-04-24add missing STATX_ATTR_* macros omitted when statx was addedRich Felker-0/+10
commit b817541f1cfd38e4b81257b3215e276ea9d0fc61 added statx and the mask constant macros, but not the stx_attributes[_mask] ones.
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-24add statx interface using syscall, fallback to fstatatDuncan Bellamy-0/+55
2024-01-25add preadv2 and pwritev2 syscall wrappers, flag value macrosRich Felker-0/+7
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-02-08fix integer overflow in WIFSTOPPED macroRich Felker-1/+1
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.
2022-10-19remove LFS64 programming interfaces (macro-only) from _GNU_SOURCERich Felker-8/+8
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-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-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.
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-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.
2021-02-15sys/membarrier.h: add new constants from linux v5.10Szabolcs Nagy-0/+4
can cause rseq restart on another cpu to synchronize with global memory access from rseq critical sections, see linux commit 2a36ab717e8fe678d98f81c14a0b124712719840 rseq/membarrier: Add MEMBARRIER_CMD_PRIVATE_EXPEDITED_RSEQ
2020-11-29sys/fanotify.h: add new FAN_* macros from linux v5.9Szabolcs Nagy-0/+4
Update fanotify.h, see linux commit 929943b38daf817f2e6d303ea04401651fc3bc05 fanotify: add support for FAN_REPORT_NAME linux commit 83b7a59896dd24015a34b7f00027f0ff3747972f fanotify: add basic support for FAN_REPORT_DIR_FID linux commit 08b95c338e0c5a96e47f4ca314ea1e7580ecb5d7 fanotify: remove event FAN_DIR_MODIFY FAN_DIR_MODIFY that was new in v5.7 is now removed from linux uapi, but kept in musl, so we don't break api, linux cannot reuse the value anyway.
2020-11-29add missing personality valuesWilliam Woodruff-0/+3
Adds two missing personality(2) personas: UNAME26 and FDPIC_FUNCPTRS. FDPIC_FUNCPTRS was also missing its corresponding PER_LINUX_FDPIC value.
2020-09-09sys/mman.h: add MREMAP_DONTUNMAP from linux v5.7Szabolcs Nagy-0/+1
it remaps anon mappings without unmapping the original. chromeos plans to use it with userfaultfd, see: linux commit e346b3813067d4b17383f975f197a9aa28a3b077 mm/mremap: add MREMAP_DONTUNMAP to mremap()
2020-09-09sys/fanotify.h: update to linux v5.7Szabolcs Nagy-1/+3
see linux commit 9e2ba2c34f1922ca1e0c7d31b30ace5842c2e7d1 fanotify: send FAN_DIR_MODIFY event flavor with dir inode and name linux commit 44d705b0370b1d581f46ff23e5d33e8b5ff8ec58 fanotify: report name info for FAN_DIR_MODIFY event
2020-09-09sys/random.h: add GRND_INSECURE from linux v5.6Szabolcs Nagy-0/+1
added in linux commit 75551dbf112c992bc6c99a972990b3f272247e23 random: add GRND_INSECURE to return best-effort non-cryptographic bytes
2020-09-09sys/prctl.h: add PR_{SET,GET}_IO_FLUSHER from linux v5.6Szabolcs Nagy-0/+3
needed for storage drivers with userspace component that may run in the IO path, see linux commit 8d19f1c8e1937baf74e1962aae9f90fa3aeab463 prctl: PR_{G,S}ET_IO_FLUSHER to support controlling memory reclaim
2020-08-30fix regression with applications that expect struct winsize in ioctl.hRich Felker-0/+2
putting the (simple) definition in alltypes.h seems like the best solution here. making sys/ioctl.h implicitly include termios.h is probably excess namespace pollution.
2020-08-24add tcgetwinsize and tcsetwinsize functions, move struct winsizeRich Felker-7/+0
these have been adopted for future issue of POSIX as the outcome of Austin Group issue 1151, and are simply functions performing the roles of the historical ioctls. since struct winsize is being standardized along with them, its definition is moved to the appropriate header. there is some chance this will break source files that expect struct winsize to be defined by sys/ioctl.h without including termios.h. if this happens, further changes will be needed to have sys/ioctl.h expose it too.
2020-01-29fix misleading use of _POSIX_VDISABLE in sys/ttydefaults.hRich Felker-5/+0
_POSIX_VDISABLE is only visible if unistd.h has already been included, so conditional use of it here makes no sense. the value is always 0 anyway; it does not vary.
2020-01-29fix unprotected macro argument in sys/ttydefaults.hRich Felker-1/+1
2020-01-11define RLIMIT_RTTIME, bump RLIMIT_NLIMITSLeah Neukirchen-1/+2
This macro exists since Linux 2.6.25 and is defined in glibc since 2011.
2020-01-01remove gratuitous aligned attribute from __ptrace_syscall_infoRich Felker-1/+2
this change was discussed on the mailing list thread for the linux uapi v5.3 patches, and submitted as a v2 patch, but overlooked when I applied the patches much later. revert commit f291c09ec90e2514c954020e9b9bdb30e2adfc7f and apply the v2 as submitted; the net change is just padding. notes by Szabolcs Nagy follow: compared to the linux uapi (and glibc) a padding is used instead of aligned attribute for keeping the layout the same across targets, this means the alignment of the struct may be different on some targets (e.g. m68k where uint64_t is 2 byte aligned) but that should not affect syscalls and this way the abi does not depend on nonstandard extensions.
2019-12-30sys/wait.h: add P_PIDFD from linux v5.4Szabolcs Nagy-1/+2
allows waiting on a pidfd, in the future it might allow retrieving the exit status by a non-parent process, see linux commit 3695eae5fee0605f316fbaad0b9e3de791d7dfaf pidfd: add P_PIDFD to waitid()
2019-12-30sys/prctl.h: add PR_*_TAGGED_ADDR_* from linux v5.4Szabolcs Nagy-0/+4
per thread prctl commands to relax the syscall abi such that top bits of user pointers are ignored in the kernel. this allows the use of those bits by hwasan or by mte to color pointers and memory on aarch64: linux commit 63f0c60379650d82250f22e4cf4137ef3dc4f43d arm64: Introduce prctl() options to control the tagged user addresses ABI
2019-12-30sys/mman.h: add MADV_COLD and MADV_PAGEOUT from linux v5.4Szabolcs Nagy-0/+2
These were mainly introduced so android can optimize the memory usage of unused apps. MADV_COLD hints that the memory range is currently not needed (unlike with MADV_FREE the content is not garbage, it needs to be swapped): linux commit 9c276cc65a58faf98be8e56962745ec99ab87636 mm: introduce MADV_COLD MADV_PAGEOUT hints that the memory range is not needed for a long time so it can be reclaimed immediately independently of memory pressure (unlike with MADV_DONTNEED the content is not garbage): linux commit 1a4e58cce84ee88129d5d49c064bd2852b481357 mm: introduce MADV_PAGEOUT
2019-12-30sys/ptrace.h: add PTRACE_GET_SYSCALL_INFO from linux v5.3Szabolcs Nagy-0/+28
ptrace API to get details of the syscall the tracee is blocked in, see linux commit 201766a20e30f982ccfe36bebfad9602c3ff574a ptrace: add PTRACE_GET_SYSCALL_INFO request the align attribute was used to keep the layout the same across targets e.g. on m68k uint32_t is 2 byte aligned, this helps with compat ptrace.
2019-12-30sys/socket.h: add SO_DETACH_REUSEPORT_BPF from linux v5.3Szabolcs Nagy-0/+1
see linux commit 99f3a064bc2e4bd5fe50218646c5be342f2ad18c bpf: net: Add SO_DETACH_REUSEPORT_BPF
2019-12-22fix elf_prstatus regression on time64, existing wrong definition on x32Rich Felker-4/+3
the elf_prstatus structure is used in core dumps, and the timeval structures in it are longs matching the elf class, *not* the kernel "old timeval" for the arch. this means using timeval here for x32 was always wrong, despite kernel uapi headers and glibc also exposing it this way, and of course it's wrong for any arch with 64-bit time_t. rather than just changing the type on affected archs, use a tagless struct containing long tv_sec and tv_usec members in place of the timevals. this intentionally breaks use of them as timevals (e.g. assignment, passing address, etc.) on 64-bit archs as well so that any usage unsafe for 32-bit archs is caught even in software that only gets tested on 64-bit archs. from what I could gather, there is not any software using these members anyway. the only reason they need to be fixed to begin with is that the only members which are commonly used, the saved registers, follow the time members and have the wrong offset if the time members are sized incorrectly.
2019-12-18fix regression in ioctl definitions provided by arch/generic bitsRich Felker-0/+1
commit b60fdf133c033d4ad6b04a8237f253563fae5928 broke the SIOCGSTAMP[NS] ioctl fallbacks introduced in commit 2e554617e5a6a41bf3f6c6306c753cd53abf728c, as well as use of these ioctls, by creating a situation where bits/ioctl.h could be included without __LONG_MAX being visible.
2019-11-02move time64 socket options from arch bits to top-level sys/socket.hRich Felker-0/+11
now that all 32-bit archs have 64-bit time types, the values for the time-related socket option macros can be treated as universal for 32-bit archs. the sys/socket.h mechanism for this predates arch/generic and is instead in the top-level header. x32, which does not use the new time64 values of the macros, already has its own overrides, so this commit does not affect it.
2019-11-02move msghdr and cmsghdr out of bits/socket.hRich Felker-0/+34
these structures can now be defined generically in terms of endianness and long size. previously, the 32-bit archs all shared a common definition from the generic bits header, and each 64-bit arch had to repeat the 64-bit version, with endian conditionals if the arch had variants of each endianness. I would prefer getting rid of the preprocessor conditionals for padding and instead using unnamed bitfield members, like commit 9b2921bea1d5017832e1b45d1fd64220047a9802 did for struct timespec. however, at present sendmsg, recvmsg, and recvmmsg need access to the padding members by name to zero them. this could perhaps be cleaned up in the future.
2019-11-02make time-related socket options overridable by arch bits filesRich Felker-6/+11
SO_RCVTIMEO and SO_SNDTIMEO already were, but only in aggregate with SO_DEBUG and all of the other low/traditional options that varied per arch. SO_TIMESTAMP* are newly overridable. the two groups have to be done separately since mips64 and powerpc64 will override the former but not the latter. at some point this should be cleaned up to use bits headers more idiomatically.
2019-10-28add time64 symbol name redirects to public headers, under arch controlRich Felker-0/+67
a _REDIR_TIME64 macro is introduced, which the arch's alltypes.h is expected to define, to control redirection of symbol names for interfaces that involve time_t and derived types. this ensures that object files will only be linked to libc interfaces matching the ABI whose headers they were compiled against. along with time32 compat shims, which will be introduced separately, the redirection also makes it possible for a single libc (static or shared) to be used with object files produced with either the old (32-bit time_t) headers or the new ones after 64-bit time_t switchover takes place. mixing of such object files (or shared libraries) in the same program will also be possible, but must be done with care; ABI between libc and a consumer of the libc interfaces is guaranteed to match by the the symbol name redirection, but pairwise ABI between consumers of libc that define interfaces between each other in terms of time_t is not guaranteed to match. this change adds a dependency on an additional "GNU C" feature to the public headers for existing 32-bit archs, which is generally undesirable; however, the feature is one which glibc has depended on for a long time, and thus which any viable alternative compiler is going to need to provide. 64-bit archs are not affected, nor will future 32-bit archs be, regardless of whether they are "new" on the kernel side (e.g. riscv32) or just newly-added (e.g. a new sparc or xtensa port). the same applies to newly-added ABIs for existing machine-level archs.
2019-10-17remove indirect use of endian.h from public headersRich Felker-5/+0
building on commit 97d35a552ec5b6ddf7923dd2f9a8eb973526acea, __BYTE_ORDER is now available wherever alltypes.h is included. endian.h should not be used since, in the future, it will expose identifiers that are not in the reserved namespace for the headers which were previously using it.
2019-08-02move IPC_STAT definition to a new bits/ipcstat.h fileRich Felker-3/+1
otherwise, 32-bit archs that could otherwise share the generic bits/ipc.h would need to duplicate the struct ipc_perm definition, obscuring the fact that it's the same. sysvipc is not widely used and these headers are not commonly included, so there is no performance gain to be had by limiting the number of indirectly included files here. files with the existing time32 definition of IPC_STAT are added to all current 32-bit archs now, so that when it's changed the change will show up as a change rather than addition of a new file where it's less obvious that the value is changing vs the generic one that was used before.
2019-08-02allow archs to define IPC_STAT, propagate time64 bit to other macrosRich Felker-6/+8
to make use of {sem,shm,msg}ctl IPC_STAT functionality to provide 64-bit time_t on 32-bit archs, IPC_STAT and related macros must be defined with bit 8 (0x100) set. allow archs to define IPC_STAT in bits/ipc.h, and define the other macros in terms of it so that they all get the same value of the time64 bit.
2019-07-01sys/socket.h: add SO_BINDTOIFINDEX from linux v5.1Szabolcs Nagy-0/+1
SO_BINDTOIFINDEX behaves similar to SO_BINDTODEVICE, but takes a network interface index as argument, rather than the network interface name. see linux commit f5dd3d0c9638a9d9a02b5964c4ad636f06cf7e2c net: introduce SO_BINDTOIFINDEX sockopt
2019-07-01sys/prctl.h: add PR_SPEC_DISABLE_NOEXEC from linux v5.1Szabolcs Nagy-0/+1
allows specifying that the speculative store bypass disable bit should be cleared on exec. see linux commit 71368af9027f18fe5d1c6f372cfdff7e4bde8b48 x86/speculation: Add PR_SPEC_DISABLE_NOEXEC
2019-07-01sys/fanotify.h: update for linux v5.1Szabolcs Nagy-1/+33
includes changes from linux v5.1 linux commit 235328d1fa4251c6dcb32351219bb553a58838d2 fanotify: add support for create/attrib/move/delete events linux commit 5e469c830fdb5a1ebaa69b375b87f583326fd296 fanotify: copy event fid info to user linux commit e9e0c8903009477b630e37a8b6364b26a00720da fanotify: encode file identifier for FAN_REPORT_FID as well as earlier changes that were missed. sys/statfs.h is included for fsid_t.
2019-06-21remove implicit include of sys/sysmacros.h from sys/types.hRich Felker-1/+0
this reverts commit f552c792c7ce5a560f214e1104d93ee5b0833967, which exposed the sysmacros.h macros (device major/minor calculations) for BSD and GNU profiles to mimic an unintentional glibc behavior some code depended on. glibc has deprecated and since removed them as the resolution to bug #19239, so it makes no sense for us to keep this behavior. affected code should all have been fixed by now, and if it's not yet fixed it needs to be for use with modern glibc anyway.
2019-03-13sys/prctl.h: add PR_PAC_RESET_KEYS from linux v5.0Szabolcs Nagy-0/+7
aarch64 pointer authentication code related prctl that allows reinitializing the key for the thread, added in linux commit ba830885656414101b2f8ca88786524d4bb5e8c1
2019-03-13sys/prctl.h: add PR_SPEC_INDIRECT_BRANCH from linux v4.20Szabolcs Nagy-0/+1
prctls to allow per task control of indirect branch speculation on x86. added in linux commit 9137bb27e60e554dab694eafa4cca241fa3a694f
2019-03-13sys/mman.h: add new hugetlb mmap flags from linux v4.19Szabolcs Nagy-0/+4
aarch64 supports 32MB and 512MB hugetlb page sizes too. added in linux commit 20916d4636a9b3c1bf562b305f91d126771edaf9