summaryrefslogtreecommitdiff
path: root/include/sys
AgeCommit message (Collapse)AuthorLines
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
2019-03-13sys/inotify.h: add IN_MASK_CREATE from linux v4.19Szabolcs Nagy-0/+1
inotify_add_watch flag to prevent modifying existing watch descriptors, when used on an already watched inode it fails with EEXIST. added in linux commit 4d97f7d53da7dc830dbf416a3d2a6778d267ae68
2019-03-13sys/socket.h: add SO_TXTIME from linux v4.19Szabolcs Nagy-0/+2
added in linux commit 80b14dee2bea128928537d61c333f24cb8cbb62f
2019-02-22add membarrier syscall wrapper, refactor dynamic tls install to use itRich Felker-0/+17
the motivation for this change is twofold. first, it gets the fallback logic out of the dynamic linker, improving code readability and organization. second, it provides application code that wants to use the membarrier syscall, which depends on preregistration of intent before the process becomes multithreaded unless unbounded latency is acceptable, with a symbol that, when linked, ensures that this registration happens.
2019-02-07update line discipline constantsBobby Bingham-0/+12
2019-02-07move arch-invariant definitions out of bits/ioctl.hBobby Bingham-0/+98
2018-12-09add SIGSYS support to sys/signalfd.h from linux v4.18Szabolcs Nagy-1/+5
new in linux commit 76b7f670730e87974f71df9f6129811e2769666e in struct signalfd_siginfo the pad member is changed to __pad to keep the namespace clean, it's not part of the public api.
2018-12-09add AF_XDP to sys/socket.h from linux v4.18Szabolcs Nagy-1/+4
new address family and related macros were added in linux commit 68e8b849b221b37a78a110a0307717d45e3593a0
2018-07-20move inclusion of linux headers for kd.h, soundcard.h, vt.h to bitsmidipix-3/+3
maintainer's note: while musl does not use the linux kernel headers, it does provide these three sys/* headers which do nothing but include the corresponding linux/* headers, since the sys/* versions are the ones documented for application use (and they arguably provide interfaces that are not linux-specific but common to other unices). these headers should probably not be provided by libc (rather by a separate package), but as long as they are, use the bits header framework as an aid to out-of-tree ports of musl for non-linux systems that want to implement them in some other way.
2018-07-20remove inclusion guard hacks for sys/kd.hmidipix-7/+0
maintainer's note: at some point, probably long before linux separated the uapi headers, it was the case, or at least I believed it was the case, that linux/types.h was unsafe to include from userspace. thus, the inclusion guard macro _LINUX_TYPES_H was defined in sys/kd.h to prevent linux/kd.h from including linux/types.h (which it spuriously includes but does not use). as far as I can tell, whatever problem this was meant to solve does not seem to have been present for a long time, and the hack was not done correctly anyway, so removing it is the right thing to do.
2018-07-17add support for arch-specific ptrace command macrosSzabolcs Nagy-0/+2
sys/ptrace.h is target specific, use bits/ptrace.h to add target specific macro definitions. these macros are kept in the generic sys/ptrace.h even though some targets don't support them: PTRACE_GETREGS PTRACE_SETREGS PTRACE_GETFPREGS PTRACE_SETFPREGS PTRACE_GETFPXREGS PTRACE_SETFPXREGS so no macro definition got removed in this patch on any target. only s390x has a numerically conflicting macro definition (PTRACE_SINGLEBLOCK). the PT_ aliases follow glibc headers, otherwise the definitions come from linux uapi headers except ones that are skipped in glibc and there is no real kernel support (s390x PTRACE_*_AREA) or need special type definitions (mips PTRACE_*_WATCH_*) or only relevant for linux 2.4 compatibility (PTRACE_OLDSETOPTIONS).
2018-07-17sys/ptrace.h: add missing PTRACE_EVENT_STOPSzabolcs Nagy-0/+1
new in linux v3.1 commit 3544d72a0e10d0aa1c1bd59ed77a53a59cdc12f7 changed in linux v3.4 commit 5cdf389aee90109e2e3d88085dea4dd5508a3be7 A tracer recieves this event in the waitpid status of a PTRACED_SEIZED process.
2018-07-12add ST_RELATIME to statvfs.hRich Felker-0/+1
2018-06-26fix value of SO_PEERSEC on mips archsRich Felker-1/+1
adapted from patch by Matthias Schiffer.
2018-06-20add memfd_create syscall wrapperSzabolcs Nagy-0/+5
memfd_create was added in linux v3.17 and glibc has api for it.
2018-06-20add mlock2 linux syscall wrapperSzabolcs Nagy-3/+8
mlock2 syscall was added in linux v4.4 and glibc has api for it. It falls back to mlock in case of flags==0, so that case works even on older kernels. MLOCK_ONFAULT is moved under _GNU_SOURCE following glibc.
2018-06-19add speculation control prctls from linux v4.17Szabolcs Nagy-0/+9
PR_{SET,GET}_SPECULATION_CTRL controls speculation related vulnerability mitigations, new in commits b617cfc858161140d69cc0b5cc211996b557a1c7 356e4bfff2c5489e016fdb925adbf12a1e3950ee
2018-06-19add {MSG,SEM,SHM}_STAT_ANY from linux v4.17Szabolcs Nagy-0/+3
introduced to stat ipc objects without permission checks since the info is available in /proc/sysvipc anyway, new in linux commits 23c8cec8cf679b10997a512abb1e86f0cedc42ba a280d6dc77eb6002f269d58cd47c7c7e69b617b6 c21a6970ae727839a2f300cd8dd957de0d0238c3
2018-06-19add MAP_FIXED_NOREPLACE from linux v4.17Szabolcs Nagy-0/+1
to map at a fixed address without unmapping underlying mappings (fails with EEXIST unlike MAP_FIXED), new in linux commits 4ed28639519c7bad5f518e70b3284c6e0763e650 and a4ff8e8620d3f4f50ac4b41e8067b7d395056843.
2018-06-19sys/ptrace.h: add PTRACE_SECCOMP_GET_METADATA from linux v4.16Szabolcs Nagy-1/+7
to get seccomp state for checkpoint restore. added in linux commit 26500475ac1b499d8636ff281311d633909f5d20 struct tag follows the glibc api and ptrace_peeksiginfo_args got changed too accordingly.
2018-06-19sys/epoll.h: add EPOLLNVAL from linux v4.16Szabolcs Nagy-0/+1
added to uapi in commit 65aaf87b3aa2d049c6b9fd85221858a895df3393 used since commit a9a08845e9acbd224e4ee466f5c1275ed50054e8, which renamed POLL* to EPOLL* in the kernel.
2018-02-22add getrandom syscall wrapperHauke Mehrtens-0/+19
This syscall is available since Linux 3.17 and was also implemented in glibc in version 2.25 using the same interfaces.
2018-02-22sys/prctl.h: add new PR_SVE_* macros from linux v4.15Szabolcs Nagy-0/+6
PR_SVE_SET_VL and PR_SVE_GET_VL controls are new in linux commit 2d2123bc7c7f843aa9db87720de159a049839862 related PR_SVE_* macros were added in 7582e22038a266444eb87bc07c372592ad647439
2018-02-22add MAP_SYNC and MAP_SHARED_VALIDATE from linux v4.15Szabolcs Nagy-0/+2
for synchronous page faults, new in linux commit 1c9725974074a047f6080eecc62c50a8e840d050 and b6fb293f2497a9841d94f6b57bd2bb2cd222da43 note that only targets that use asm-generic/mman.h have this new flag defined, so undef it on other targets (mips*, powerpc*).
2018-02-22sys/{mman,shm}.h: add {MAP,SHM}_HUGE_ macros from linux uapiSzabolcs Nagy-0/+26
*_HUGE_SHIFT, *_HUGE_2MB, *_HUGE_1GB are documented in the man page, so add all of the *_HUGE_* macros from linux uapi. if MAP_HUGETLB is set, top bits of the mmap flags encode the page size. see the linux commit aafd4562dfee81a40ba21b5ea3cf5e06664bc7f6 if SHM_HUGETLB is set, top bits of the shmget flags encode the page size. see the linux commit 4da243ac1cf6aeb30b7c555d56208982d66d6d33 *_HUGE_16GB is defined unsigned to avoid signed left shift ub.
2018-02-22sys/mman.h: add MADV_WIPEONFORK from linux v4.14Szabolcs Nagy-0/+2
allows zeroing anonymous private pages inherited by a child process. new in linux commit d2cd9ede6e193dd7d88b6d27399e96229a551b19
2018-02-22sys/socket.h: add MSG_ZEROCOPY from linux v4.14Szabolcs Nagy-0/+2
MSG_ZEROCOPY socket send flag avoids copy in the kernel new in linux commit 52267790ef52d7513879238ca9fac22c1733e0e3 SO_ZEROCOPY socket option enables MSG_ZEROCOPY if availale new in linux commit 76851d1212c11365362525e1e2c0a18c97478e6b
2018-02-22sys/socket.h: add SOL_TLS from linux v4.13Szabolcs Nagy-0/+1
socket option for kernel TLS support new in linux commit 3c4d7559159bfe1e3b94df3a657b2cda3a34e218
2018-02-22sys/socket.h: add PF_SMC from linux v4.11Szabolcs Nagy-1/+3
add AF_SMC and PF_SMC for the IBM shared memory communication protocol. new in linux commit ac7138746e14137a451f8539614cdd349153e0c0 (linux socket.h is not in uapi so this update was missed earlier)