1. 02 7月, 2021 1 次提交
  2. 11 3月, 2021 1 次提交
  3. 09 9月, 2020 1 次提交
  4. 18 12月, 2019 1 次提交
    • R
      signal to kernel headers that time_t is 64-bit · f12bd8e0
      Rich Felker 提交于
      linux/input.h and perhaps others use this macro to determine whether
      the userspace time_t is 64-bit when potentially defining types in
      terms of time_t and derived structures. the name __USE_TIME_BITS64 is
      unfortunate; it really should have been in the __UAPI namespace. but
      this is what was chosen back in v4.16 when first preparing input.h for
      time64 userspace, presumably based on expectations about what the
      glibc-internal features.h macro for time64 would be, and changing it
      now would just put a new minimum version requirement on kernel
      headers.
      
      the __USE_TIME_BITS64 macro is not intended as a public interface. it
      is purely an internal contract between libc and Linux uapi headers.
      f12bd8e0
  5. 03 11月, 2019 1 次提交
  6. 20 10月, 2019 1 次提交
    • R
      adjust struct timespec definition to be time64-ready · 9b2921be
      Rich Felker 提交于
      for time64 support on 32-bit archs, the kernel interfaces use a
      timespec layout padded to match the representation of a pair of 64-bit
      values, which requires endian-specific padding.
      
      use of an ordinary, non-bitfield, named member for the padding is
      undesirable because, on big endian archs, it would alter the
      interpretation of traditional (non-designated) initializers of the
      form {s,ns}, initializing the padding instead of the tv_nsec member.
      unnamed bitfield members solve this problem by not taking part in
      initialization, and were the expected solution when the kernel
      interfaces were designed. however, they also have further advantages
      which we take advantage of here:
      
      positioning of the padding could be controlled by having a
      preprocessor conditional with separate definitions of struct timespec
      for little and big endian, but whether padding should appear at all is
      a function of whether time_t is larger than long. this condition is
      not something the preprocessor can determine unless we were to define
      a new macro specifically for that purpose.
      
      by using unnamed bitfield members instead of ordinary named members,
      we can arrange for the size of the padding to collapse to zero when it
      should not be present, just by using sizeof(time_t) and sizeof(long)
      in the bitfield width expression, which can be any integer constant
      expression.
      9b2921be
  7. 18 10月, 2019 3 次提交
    • 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
      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
  8. 13 3月, 2019 1 次提交
    • R
      make FILE a complete type for pre-C11 standard profiles · f368d9fd
      Rich Felker 提交于
      C11 removed the requirement that FILE be a complete type, which was
      deemed erroneous, as part of the changes introduced by N1439 regarding
      completeness of types (see footnote 6 for specific mention of FILE).
      however the current version of POSIX is still based on C99 and
      incorporates the old requirement that FILE be a complete type.
      
      expose an arbitrary, useless complete type definition because the
      actual object used to represent FILE streams cannot be public/ABI.
      
      thanks to commit 13d1afa4, we now have
      a framework for suppressing the public complete-type definition of FILE
      when stdio.h is included internally, so that a different internal
      definition can be provided. this is perfectly well-defined, since the
      same struct tag can refer to different types in different translation
      units. it would be a problem if the implementation were accessing the
      application's FILE objects or vice versa, but either would be
      undefined behavior.
      f368d9fd
  9. 13 3月, 2018 1 次提交
    • R
      explicitly use signed keyword to define intNN_t and derivative types · 919ad8d5
      Rich Felker 提交于
      standing alone, both the signed and int keywords identify the same
      type, a (signed) int. however the C language has an exception where,
      when the lone keyword int is used to declare a bitfield, it's
      implementation-defined whether the bitfield is signed or unsigned. C11
      footnote 125 extends this implementation-definedness to typedefs, and
      DR#315 extends it to other integer types (for which support with
      bitfields is implementation-defined).
      
      while reasonable ABIs (all the ones we support) define bitfields as
      signed by default, GCC and compatible compilers offer an option
      -funsigned-bitfields to change the default. while any signed types
      defined without explicit use of the signed keyword are affected, the
      stdint.h types, especially intNN_t, have a natural use in bitfields.
      ensure that bitfields defined with these types always have the correct
      signedness regardless of compiler & flags used.
      
      see also GCC PR 83294.
      919ad8d5
  10. 21 12月, 2014 1 次提交
  11. 14 10月, 2014 1 次提交
  12. 23 7月, 2013 6 次提交
    • R
      undefine internal-use type macros at the end of alltypes.h · 9578f053
      Rich Felker 提交于
      this patch is something of a compromise for a compatibility
      regression discovered after the header refactoring: libtiff uses
      _Int64 for its own use. this is absolutely wrong, invalid C, and
      should not be supported, but it's also frustrating for users when code
      that used to work suddenly breaks.
      
      rather than leave the breakage in place or change musl internals to
      accommodate broken software, I've found a change that makes the
      problem go away and improves musl. by undefining these macros at the
      end of alltypes.h, the temptation to use them in other headers is
      removed. (for example, I almost used _Int64 in sys/types.h to define
      u_int64_t rather than adding it back to alltypes.h.) by confining use
      of these macros to alltypes.h, we keep it easy to go back and change
      the implementation of alltypes later, if needed.
      9578f053
    • R
      move register_t and u_int64_t (back) to alltypes · 009f1868
      Rich Felker 提交于
      during the header refactoring, I had moved u_int64_t out of alltypes
      under the assumption that we could just use long long everywhere.
      however, it seems some broken applications make inconsistent mixed use
      of u_int64_t and uint64_t, resulting in build errors when the
      underlying type differs.
      009f1868
    • R
      fix regression in size of nlink_t (broken stat struct) on x86_64 · 1c6cace0
      Rich Felker 提交于
      rather than moving nlink_t back to the arch-specific file, I've added
      a macro _Reg defined to the canonical type for register-size values on
      the arch. this is not the same as _Addr for (not-yet-supported)
      32-on-64 pseudo-archs like x32 and mips n32, so a new macro was
      needed.
      1c6cace0
    • R
      make regoff_t and regex_t match C++ ABI · 8327ae0c
      Rich Felker 提交于
      for regoff_t, it's impossible to match on 64-bit archs because glibc
      defined the type in a non-conforming way. however this change makes
      the type match on 32-bit archs.
      8327ae0c
    • R
      make pthread_key_t unsigned to match ABI · 4e3c6b43
      Rich Felker 提交于
      4e3c6b43
    • R
      make pthread attribute types structs, even when they just have one field · 0109d950
      Rich Felker 提交于
      this change is to get the right tags for C++ ABI matching. it should
      have no other effects.
      0109d950
  13. 22 7月, 2013 1 次提交
    • R
      refactor headers, especially alltypes.h, and improve C++ ABI compat · 9448b051
      Rich Felker 提交于
      the arch-specific bits/alltypes.h.sh has been replaced with a generic
      alltypes.h.in and minimal arch-specific bits/alltypes.h.in.
      
      this commit is intended to have no functional changes except:
      - exposing additional symbols that POSIX allows but does not require
      - changing the C++ name mangling for some types
      - fixing the signedness of blksize_t on powerpc (POSIX requires signed)
      - fixing the limit macros for sig_atomic_t on x86_64
      - making dev_t an unsigned type (ABI matching goal, and more logical)
      
      in addition, some types that were wrongly defined with long on 32-bit
      archs were changed to int, and vice versa; this change is
      non-functional except for the possibility of making pointer types
      mismatch, and only affects programs that were using them incorrectly,
      and only at build-time, not runtime.
      
      the following changes were made in the interest of moving
      non-arch-specific types out of the alltypes system and into the
      headers they're associated with, and also will tend to improve
      application compatibility:
      - netdb.h now includes netinet/in.h (for socklen_t and uint32_t)
      - netinet/in.h now includes sys/socket.h and inttypes.h
      - sys/resource.h now includes sys/time.h (for struct timeval)
      - sys/wait.h now includes signal.h (for siginfo_t)
      - langinfo.h now includes nl_types.h (for nl_item)
      
      for the types in stdint.h:
      - types which are of no interest to other headers were moved out of
        the alltypes system.
      - fast types for 8- and 64-bit are hard-coded (at least for now); only
        the 16- and 32-bit ones have reason to vary by arch.
      
      and the following types have been changed for C++ ABI purposes;
      - mbstate_t now has a struct tag, __mbstate_t
      - FILE's struct tag has been changed to _IO_FILE
      - DIR's struct tag has been changed to __dirstream
      - locale_t's struct tag has been changed to __locale_struct
      - pthread_t is defined as unsigned long in C++ mode only
      - fpos_t now has a struct tag, _G_fpos64_t
      - fsid_t's struct tag has been changed to __fsid_t
      - idtype_t has been made an enum type (also required by POSIX)
      - nl_catd has been changed from long to void *
      - siginfo_t's struct tag has been removed
      - sigset_t's has been given a struct tag, __sigset_t
      - stack_t has been given a struct tag, sigaltstack
      - suseconds_t has been changed to long on 32-bit archs
      - [u]intptr_t have been changed from long to int rank on 32-bit archs
      - dev_t has been made unsigned
      
      summary of tests that have been performed against these changes:
      - nsz's libc-test (diff -u before and after)
      - C++ ABI check symbol dump (diff -u before, after, glibc)
      - grepped for __NEED, made sure types needed are still in alltypes
      - built gcc 3.4.6
      9448b051