1. 09 9月, 2020 1 次提交
  2. 05 2月, 2020 2 次提交
  3. 31 1月, 2020 1 次提交
    • R
      remove legacy clock_gettime and gettimeofday from public syscall.h · 5a105f19
      Rich Felker 提交于
      some nontrivial number of applications have historically performed
      direct syscalls for these operations rather than using the public
      functions. such usage is invalid now that time_t is 64-bit and these
      syscalls no longer match the types they are used with, and it was
      already harmful before (by suppressing use of vdso).
      
      since syscall() has no type safety, incorrect usage of these syscalls
      can't be caught at compile-time. so, without manually inspecting or
      running additional tools to check sources, the risk of such errors
      slipping through is high.
      
      this patch renames the syscalls on 32-bit archs to clock_gettime32 and
      gettimeofday_time32, so that applications using the original names
      will fail to build without being fixed.
      
      note that there are a number of other syscalls that may also be unsafe
      to use directly after the time64 switchover, but (1) these are the
      main two that seem to be in widespread use, and (2) most of the others
      continue to have valid usage with a null timeval/timespec argument, as
      the argument is an optional timeout or similar.
      5a105f19
  4. 31 12月, 2019 1 次提交
  5. 03 11月, 2019 3 次提交
    • R
      move time_t and suseconds_t definitions to common alltypes.h.in · d6dcfe4d
      Rich Felker 提交于
      now that all 32-bit archs have 64-bit time_t (and suseconds_t), the
      arch-provided _Int64 macro (long or long long, as appropriate) can be
      used to define them, and arch-specific definitions are no longer
      needed.
      d6dcfe4d
    • R
      move time64 socket options from arch bits to top-level sys/socket.h · c71dbb24
      Rich Felker 提交于
      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.
      c71dbb24
    • R
      switch all existing 32-bit archs to 64-bit time_t · 38143339
      Rich Felker 提交于
      this commit preserves ABI fully for existing interface boundaries
      between libc and libc consumers (applications or libraries), by
      retaining existing symbol names for the legacy 32-bit interfaces and
      redirecting sources compiled against the new headers to alternate
      symbol names. this does not necessarily, however, preserve the
      pairwise ABI of libc consumers with one another; where they use
      time_t-derived types in their interfaces with one another, it may be
      necessary to synchronize updates with each other.
      
      the intent is that ABI resulting from this commit already be stable
      and permanent, but it will not be officially so until a release is
      made. changes to some header-defined types that do not play any role
      in the ABI between libc and its consumers may still be subject to
      change.
      
      mechanically, the changes made by this commit for each 32-bit arch are
      as follows:
      
      - _REDIR_TIME64 is defined to activate the symbol redirections in
        public headers
      
      - COMPAT_SRC_DIRS is defined in arch.mak to activate build of ABI
        compat shims to serve as definitions for the original symbol names
      
      - time_t and suseconds_t definitions are changed to long long (64-bit)
      
      - IPC_STAT definition is changed to add the IPC_TIME64 bit (0x100),
        triggering conversion of semid_ds, shmid_ds, and msqid_ds split
        low/high time bits into new time_t members
      
      - structs semid_ds, shmid_ds, msqid_ds, and stat are modified to add
        new 64-bit time_t/timespec members at the end, maintaining existing
        layout of other members.
      
      - socket options (SO_*) and ioctl (sockios) command macros are
        redefined to use the kernel's "_NEW" values.
      
      in addition, on archs where vdso clock_gettime is used, the
      VDSO_CGT_SYM macro definition in syscall_arch.h is changed to use a
      new time64 vdso function if available, and a new VDSO_CGT32_SYM macro
      is added for use as fallback on kernels lacking time64.
      38143339
  6. 18 10月, 2019 4 次提交
    • R
      move pthread types out of per-arch alltypes.h · 2d3083e7
      Rich Felker 提交于
      policy has long been that these definitions are purely a function of
      whether long/pointer is 32- or 64-bit, and that they are not allowed
      to vary per-arch. move the definition to the shared alltypes.h.in
      fragment, using integer constant expressions in terms of sizeof to
      vary the array dimensions appropriately. I'm not sure whether this is
      more or less ugly than using preprocessor conditionals and two sets of
      definitions here, but either way is a lot less ugly than repeating the
      same thing for every arch.
      2d3083e7
    • R
      define LONG_MAX via arch alltypes.h, strip down bits/limits.h · 7cc79d10
      Rich Felker 提交于
      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.
      7cc79d10
    • R
      move __BYTE_ORDER definition to alltypes.h · 97d35a55
      Rich Felker 提交于
      this change is motivated by the intersection of several factors.
      presently, despite being a nonstandard header, endian.h is exposing
      the unprefixed byte order macros and functions only if _BSD_SOURCE or
      _GNU_SOURCE is defined. this is to accommodate use of endian.h from
      other headers, including bits headers, which need to define structure
      layout in terms of endianness. with time64 switch-over, even more
      headers will need to do this.
      
      at the same time, the resolution of Austin Group issue 162 makes
      endian.h a standard header for POSIX-future, requiring that it expose
      the unprefixed macros and the functions even in standards-conforming
      profiles. changes to meet this new requirement would break existing
      internal usage of endian.h by causing it to violate namespace where
      it's used.
      
      instead, have the arch's alltypes.h define __BYTE_ORDER, either as a
      fixed constant or depending on the right arch-specific predefined
      macros for determining endianness. explicit literals 1234 and 4321 are
      used instead of __LITTLE_ENDIAN and __BIG_ENDIAN so that there's no
      danger of getting the wrong result if a macro is undefined and
      implicitly evaluates to 0 at the preprocessor level.
      
      the powerpc (32-bit) bits/endian.h being removed had logic for varying
      endianness, but our powerpc arch has never supported that and has
      always been big-endian-only. this logic is not carried over to the new
      __BYTE_ORDER definition in alltypes.h.
      97d35a55
    • R
      remove per-arch definitions for va_list · 00ec11d1
      Rich Felker 提交于
      now that commit f7f10797 removed the
      legacy i386 conditional definition, va_list is in no way
      arch-specific, and has no reason to be in the future. move it to the
      shared part of alltypes.h.in
      00ec11d1
  7. 11 9月, 2019 1 次提交
    • S
      add new syscall numbers from linux v5.2 · b6076309
      Szabolcs Nagy 提交于
      new mount api syscalls were added, same numers on all targets, see
      
        linux commit a07b20004793d8926f78d63eb5980559f7813404
        vfs: syscall: Add open_tree(2) to reference or clone a mount
      
        linux commit 2db154b3ea8e14b04fee23e3fdfd5e9d17fbc6ae
        vfs: syscall: Add move_mount(2) to move mounts around
      
        linux commit 24dcb3d90a1f67fe08c68a004af37df059d74005
        vfs: syscall: Add fsopen() to prepare for superblock creation
      
        linux commit ecdab150fddb42fe6a739335257949220033b782
        vfs: syscall: Add fsconfig() for configuring and managing a context
      
        linux commit 93766fbd2696c2c4453dd8e1070977e9cd4e6b6d
        vfs: syscall: Add fsmount() to create a mount for a superblock
      
        linux commit cf3cba4a429be43e5527a3f78859b1bfd9ebc5fb
        vfs: syscall: Add fspick() to select a superblock for reconfiguration
      
        linux commit 9c8ad7a2ff0bfe58f019ec0abc1fb965114dde7d
        uapi, x86: Fix the syscall numbering of the mount API syscalls [ver #2]
      
        linux commit d8076bdb56af5e5918376cd1573a6b0007fc1a89
        uapi: Wire up the mount API syscalls on non-x86 arches [ver #2]
      b6076309
  8. 09 9月, 2019 1 次提交
    • R
      honor __WCHAR_TYPE__ on archs with legacy long definition of wchar_t · 1f0e9f9c
      Rich Felker 提交于
      historically, a number of 32-bit archs used long rather than int for
      wchar_t, for no good reason. GCC still uses the historical types, but
      clang replaced them all with int, and it seems PCC uses int too.
      mismatching the compiler's type for wchar_t is not an option due to
      wide string literals.
      
      note that the mismatch does not affect C++ ABI since wchar_t is its
      own builtin type/keyword in C++, distinct from both int and long, not
      a typedef.
      
      i386 already worked around this by honoring __WCHAR_TYPE__ if defined
      by the compiler, and only using the official legacy ABI type if not.
      add the same to the other affected archs.
      
      it might make sense at some point to switch to using int as the
      default if __WCHAR_TYPE__ is not defined, if the expectations is that
      new compilers will treat int as the correct choice, but it's unlikely
      that the case where __WCHAR_TYPE__ is undefined will ever be used
      anyway. I actually wanted to move the definition of wchar_t to the
      top-level shared alltypes.h.in, using __WCHAR_TYPE__ and falling back
      to int if not defined, but that can't be done without assuming all
      compilers define __WCHAR_TYPE__ thanks to some pathological archs
      where the ABI has wchar_t as an unsigned type.
      1f0e9f9c
  9. 19 8月, 2019 1 次提交
    • R
      fix clash between sys/user.h and kernel ptrace.h on powerpc[64], sh · 6ad514e4
      Rich Felker 提交于
      due to historical accident/sloppiness in glibc, the powerpc,
      powerpc64, and sh versions of struct user, defined by sys/user.h, used
      struct pt_regs from the kernel asm/ptrace.h for their regs member.
      this made it impossible to define the type in an API-compatible manner
      without either including asm/ptrace.h like glibc does (contrary to our
      policy of not depending on kernel headers), or clashing with
      asm/ptrace.h's definition of struct pt_regs if both headers are
      included (which is almost always the case in software using
      sys/user.h).
      
      for a long time I viewed this problem as having no reasonable fix. I
      even explored the possibility of having the powerpc[64] and sh
      versions of user.h just include the kernel header (breaking with
      policy), but that looked like it might introduce new clashes with
      sys/ptrace.h. and it would also bring in a lot of additional cruft
      that makes no sense for sys/user.h to expose. glibc goes out of its
      way to suppress some of that with #undef, possibly leading to
      different problems. this is a rabbit-hole that should be explored no
      further.
      
      as it turns out, however, nothing actually uses struct user
      sufficiently to care about the type of the regs member; most software
      including sys/user.h does not even use struct user at all. so, the
      problem can be fixed just by doing away with the insistence on strict
      glibc API compatibility for the struct tag of the regs member.
      
      rather than renaming the tag, which might lead to the new name
      entering use as API, simply use an untagged structure inside struct
      user with the same members/layout as struct pt_regs.
      
      for sh, struct pt_dspregs is just removed entirely since it was not
      used.
      6ad514e4
  10. 02 8月, 2019 1 次提交
    • R
      move IPC_STAT definition to a new bits/ipcstat.h file · 006a75a9
      Rich Felker 提交于
      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.
      006a75a9
  11. 30 7月, 2019 2 次提交
  12. 02 7月, 2019 1 次提交
    • S
      add new syscall numbers from linux v5.1 · f3f96f2d
      Szabolcs Nagy 提交于
      syscall numbers are now synced up across targets (starting from 403 the
      numbers are the same on all targets other than an arch specific offset)
      
      IPC syscalls sem*, shm*, msg* got added where they were missing (except
      for semop: only semtimedop got added), the new semctl, shmctl, msgctl
      imply IPC_64, see
      
        linux commit 0d6040d4681735dfc47565de288525de405a5c99
        arch: add split IPC system calls where needed
      
      new 64bit time_t syscall variants got added on 32bit targets, see
      
        linux commit 48166e6ea47d23984f0b481ca199250e1ce0730a
        y2038: add 64-bit time_t syscalls to all 32-bit architectures
      
      new async io syscalls got added, see
      
        linux commit 2b188cc1bb857a9d4701ae59aa7768b5124e262e
        Add io_uring IO interface
      
        linux commit edafccee56ff31678a091ddb7219aba9b28bc3cb
        io_uring: add support for pre-mapped user IO buffers
      
      a new syscall got added that uses the fd of /proc/<pid> as a stable
      handle for processes: allows sending signals without pid reuse issues,
      intended to eventually replace rt_sigqueueinfo, kill, tgkill and
      rt_tgsigqueueinfo, see
      
        linux commit 3eb39f47934f9d5a3027fe00d906a45fe3a15fad
        signal: add pidfd_send_signal() syscall
      
      on some targets (arm, m68k, s390x, sh) some previously missing syscall
      numbers got added as well.
      f3f96f2d
  13. 08 2月, 2019 1 次提交
  14. 21 9月, 2018 1 次提交
  15. 11 3月, 2018 1 次提交
  16. 06 11月, 2017 1 次提交
  17. 30 8月, 2017 1 次提交
    • S
      add SIOCGSTAMPNS socket ioctl macro to ioctl.h · cc086693
      Szabolcs Nagy 提交于
      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.)
      cc086693
  18. 20 10月, 2016 2 次提交
    • S
      add bits/hwcap.h and include it in sys/auxv.h · fe39aaae
      Szabolcs Nagy 提交于
      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.
      fe39aaae
    • S
      add sh syscall numbers from linux v4.8 · 189acc70
      Szabolcs Nagy 提交于
      sh was updated in linux commit 74bdaa611fa69368fb4032ad437af073d31116bd
      to have numbers for new syscalls.
      189acc70
  19. 04 7月, 2016 5 次提交
  20. 12 5月, 2016 1 次提交
  21. 19 3月, 2016 1 次提交
    • S
      deduplicate bits/mman.h · e9f1c798
      Szabolcs Nagy 提交于
      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.
      e9f1c798
  22. 28 1月, 2016 1 次提交
    • R
      deduplicate the bulk of the arch bits headers · 4dfac115
      Rich Felker 提交于
      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.
      4dfac115
  23. 27 1月, 2016 1 次提交
    • S
      add MCL_ONFAULT and MLOCK_ONFAULT mlockall and mlock2 flags · 789ff6a9
      Szabolcs Nagy 提交于
      they lock faulted pages into memory (useful when a small part of a
      large mapped file needs efficient access), new in linux v4.4, commit
      b0f205c2a3082dd9081f9a94e50658c5fa906ff1
      
      MLOCK_* is not in the POSIX reserved namespace for sys/mman.h
      789ff6a9
  24. 28 4月, 2015 1 次提交
    • R
      fix sh jmp_buf size to match ABI · 85d12e02
      Rich Felker 提交于
      while the sh port is still experimental and subject to ABI
      instability, this is not actually an application/libc boundary ABI
      change. it only affects third-party APIs where jmp_buf is used in a
      shared structure at the ABI boundary, because nothing anywhere near
      the end of the jmp_buf object (which includes the oversized sigset_t)
      is accessed by libc.
      
      both glibc and uclibc have 15-slot jmp_buf for sh. presumably the
      smaller version was used in musl because the slots for fpu status
      register and thread pointer register (gbr) were incorrect and must not
      be restored by longjmp, but the size should have been preserved, as
      it's generally treated as a libc-agnostic ABI property for the arch,
      and having extra slots free in case we ever need them for something is
      useful anyway.
      85d12e02
  25. 02 4月, 2015 1 次提交
    • R
      move O_PATH definition back to arch bits · fd427c4e
      Rich Felker 提交于
      while it's the same for all presently supported archs, it differs at
      least on sparc, and conceptually it's no less arch-specific than the
      other O_* macros. O_SEARCH and O_EXEC are still defined in terms of
      O_PATH in the main fcntl.h.
      fd427c4e
  26. 18 3月, 2015 1 次提交
    • R
      fix MINSIGSTKSZ values for archs with large signal contexts · d5a50453
      Rich Felker 提交于
      the previous values (2k min and 8k default) were too small for some
      archs. aarch64 reserves 4k in the signal context for future extensions
      and requires about 4.5k total, and powerpc reportedly uses over 2k.
      the new minimums are chosen to fit the saved context and also allow a
      minimal signal handler to run.
      
      since the default (SIGSTKSZ) has always been 6k larger than the
      minimum, it is also increased to maintain the 6k usable by the signal
      handler. this happens to be able to store one pathname buffer and
      should be sufficient for calling any function in libc that doesn't
      involve conversion between floating point and decimal representations.
      
      x86 (both 32-bit and 64-bit variants) may also need a larger minimum
      (around 2.5k) in the future to support avx-512, but the values on
      these archs are left alone for now pending further analysis.
      
      the value for PTHREAD_STACK_MIN is not increased to match MINSIGSTKSZ
      at this time. this is so as not to preclude applications from using
      extremely small thread stacks when they know they will not be handling
      signals. unfortunately cancellation and multi-threaded set*id() use
      signals as an implementation detail and therefore require a stack
      large enough for a signal context, so applications which use extremely
      small thread stacks may still need to avoid using these features.
      d5a50453
  27. 08 3月, 2015 1 次提交
  28. 05 3月, 2015 1 次提交
    • T
      fix POLLWRNORM and POLLWRBAND on mips · f5011c62
      Trutz Behn 提交于
      these macros have the same distinct definition on blackfin, frv, m68k,
      mips, sparc and xtensa kernels. POLLMSG and POLLRDHUP additionally
      differ on sparc.
      f5011c62