path: root/arch/generic/bits
AgeCommit message (Collapse)AuthorLines
2019-10-17define LONG_MAX via arch alltypes.h, strip down bits/limits.hRich Felker-0/+0
LLONG_MAX is uniform for all archs we support and plenty of header and code level logic assumes it is, so it does not make sense for limits.h bits mechanism to pretend it's variable. LONG_BIT can be defined in terms of LONG_MAX; there's no reason to put it in bits. by moving LONG_MAX definition to __LONG_MAX in alltypes.h and moving LLONG_MAX out of bits, there are now no plain-C limits that are defined in the bits header, so the bits header only needs to be included in the POSIX or extended profiles. this allows the feature test macro logic to be removed from the bits header, facilitating a long-term goal of getting such logic out of bits. having __LONG_MAX in alltypes.h will allow further generalization of headers. archs without a constant PAGESIZE no longer need bits/limits.h at all.
2019-08-02move IPC_STAT definition to a new bits/ipcstat.h fileRich Felker-0/+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-07-30move IPC_64 from public bits/ipc.h to syscall_arch.hRich Felker-2/+0
the definition of the IPC_64 macro controls the interface between libc and the kernel through syscalls; it's not a public API. the meaning is rather obscure. long ago, Linux's sysvipc *id_ds structures used 16-bit uids/gids and wrong types for a few other fields. this was in the libc5 era, before glibc. the IPC_64 flag (64 is a misnomer; it's more like 32) tells the kernel to use the modern[-ish] versions of the structures. the definition of IPC_64 has nothing to do with whether the arch is 32- or 64-bit. rather, due to either historical accident or intentional obnoxiousness, the kernel only accepts and masks off the 0x100 IPC_64 flag conditional on CONFIG_ARCH_WANT_IPC_PARSE_VERSION, i.e. for archs that want to provide, or that accidentally provided, both. for archs which don't define this option, no masking is performed and commands with the 0x100 bit set will fail as invalid. so ultimately, the definition is just a matter of matching an arbitrary switch defined per-arch in the kernel.
2019-07-29use 64-bit msqid_ds layout in the generic version of bits/msg.hRich Felker-3/+0
this layout is more common already than the old generic, and should become even more common in the future with new archs added and with 64-bit time_t on 32-bit archs.
2019-07-29use 64-bit semid_ds layout in the generic version of bits/sem.hRich Felker-2/+0
this layout is slightly less common than the old generic one, but only because x86_64 and x32 wrongly (according to comments in the kernel headers) copied the i386 padding. for future archs, and with 64-bit time_t on 32-bit archs, the new layout here will become the most common, and it makes sense to treat it as the generic.
2019-07-29extricate bits/sem.h from x32 time_t hackRich Felker-6/+6
various padding fields in the generic bits/sem.h were defined in terms of time_t as a cheap hack standing in for "kernel long", to allow x32 to use the generic version of the file. this was a really bad idea, as it ended up getting copied into lots of arch-specific versions of the bits file, and is a blocker to changing time_t to 64-bit on 32-bit archs. this commit adds an x32-specific version of the header, and changes padding type back from time_t to long (currently the same type on all archs but x32) in the generic header and all the others the hack got copied into.
2019-07-29remove trailing newlines from various versions of bits/shm.hRich Felker-1/+0
2019-07-29use 64-bit shmid_ds layout in the generic version of bits/shm.hRich Felker-3/+0
this layout is more common already than the old generic, and should become even more common in the future with new archs added and with 64-bit time_t on 32-bit archs. the duplicate arch-specific copies are not removed yet in this commit, so as to assist git tooling in copy/rename tracking.
2019-03-13bits/ioctl.h: add TIOC{G,S}ISO7816 from linux v4.20Szabolcs Nagy-0/+2
ISO7816 smart cards ioctls. linux commit ad8c0eaa0a418ae8ef3f9217638bb86439399eac the actual kernel definitions are #define TIOCGISO7816 _IOR('T', 0x42, struct serial_iso7816) #define TIOCSISO7816 _IOWR('T', 0x43, struct serial_iso7816) where struct serial_iso7816 is defined in linux/serial.h as struct serial_iso7816 { __u32 flags; __u32 tg; __u32 sc_fi; __u32 sc_di; __u32 clk; __u32 reserved[5]; };
2019-02-07move arch-invariant definitions out of bits/ioctl.hBobby Bingham-98/+0
2018-07-20move inclusion of linux headers for kd.h, soundcard.h, vt.h to bitsmidipix-0/+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-17add support for arch-specific ptrace command macrosSzabolcs Nagy-0/+0
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-03-10fix minor namespace issues in termios.hRich Felker-0/+2
the output delay features (NL*, CR*, TAB*, BS*, and VT*) are XSI-shaded. VT* is in the V* namespace reservation but the rest need to be suppressed in base POSIX namespace. unfortunately this change introduces feature test macro checks into another bits header. at some point these checks should be simplified by having features.h handle the "FTM X implies Y" relationships.
2017-11-05ioctl TIOCGPTPEER from linux v4.13Szabolcs Nagy-0/+1
added for safe opening of peer end of pty in a mount namespace. new in linux commit c6325179238f1d4683edbec53d8322575d76d7e2
2017-08-29add SIOCGSTAMPNS socket ioctl macro to ioctl.hSzabolcs Nagy-0/+1
it is defined in linux asm/sockios.h since commit ae40eb1ef30ab4120bd3c8b7e3da99ee53d27a23 (linux v2.6.22) but was missing from musl by accident. in musl the sockios macros are exposed in sys/ioctl.h together with other ioctl requests instead of in sys/socket.h because of namespace rules. (glibc has them in sys/socket.h under _GNU_SOURCE.)
2016-12-15remove legacy i386 fallback stdarg implementation and frameworkRich Felker-4/+0
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-11-11generalize ELF hash table types not to assume 32-bit entriesRich Felker-0/+1
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-10-20add bits/hwcap.h and include it in sys/auxv.hSzabolcs Nagy-0/+0
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-07-03make brace placement in public header struct definitions consistentRich Felker-12/+6
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-03fix generic termios.h macro exposure/namespace issuesSzabolcs Nagy-9/+14
add EXTA, EXTB, CIBAUD, CMSPAR, XCASE macros and hide them as well as CBAUD, ECHOCTL, ECHOPRT, ECHOKE, FLUSHO, PENDIN in standard mode. the new macros are both in glibc termios.h and in linux asm/termbits.h, the later also contains IBSHIFT and BOTHER, those were not added. these are not standard macros, but some of them are in the reserved namespace so could be exposed, the ones which are not reserved are CIBAUD, CMSPAR and XCASE (which was removed in issue 6), the rest got hidden to be consistent with glibc.
2016-07-03fix FIOQSIZE in arm ioctl.hSzabolcs Nagy-0/+2
arm ioctl.h is the same as the generic one except this macro, so a workaround solution is used to avoid another ioctl.h copy.
2016-07-03add missing TIOC* macros to ioctl.hSzabolcs Nagy-0/+8
these are defined in linux asm/ioctls.h. (powerpc64 and powerpc bits/ioctl.h are now identical)
2016-07-03add missing SIOCSIFNAME from linux/sockios.h to ioctl.hSzabolcs Nagy-0/+1
glibc ioctl.h has it too.
2016-07-03remove ioctl macros that were removed from linux uapiSzabolcs Nagy-4/+0
TIOCTTYGSTRUCT, TIOCGHAYESESP, TIOCSHAYESESP and TIOCM_MODEM_BITS were removed from the linux uapi and not present in glibc ioctl.h
2016-03-18deduplicate bits/mman.hSzabolcs Nagy-0/+0
currently five targets use the same mman.h constants and the rest share most constants too, so move them to sys/mman.h before the bits/mman.h include where the differences can be corrected by redefinition of the macros. this fixes two minor bugs: POSIX_MADV_DONTNEED was wrong on most targets (it should be the same as MADV_DONTNEED), and sh defined the x86-only MAP_32BIT mmap flag.
2016-01-27deduplicate the bulk of the arch bits headersRich Felker-0/+644
all bits headers that were identical for a number of 'clean' archs are moved to the new arch/generic tree. in addition, a few headers that differed only cosmetically from the new generic version are removed. additional deduplication may be possible in mman.h and in several headers (limits.h, posix.h, stdint.h) that mostly depend on whether the arch is 32- or 64-bit, but they are left alone for now because greater gains are likely possible with more invasive changes to header logic, which is beyond the scope of this commit.