1. 31 5月, 2014 6 次提交
    • S
      fix POSIX namespace pollution in sys/types.h · 5f4c4966
      Szabolcs Nagy 提交于
      int8_t, u_int8_t, etc types are moved under _BSD_SOURCE
      5f4c4966
    • S
      use cleaner code for handling float rounding in vfprintf · bff6095d
      Szabolcs Nagy 提交于
      CONCAT(0x1p,LDBL_MANT_DIG) is not safe outside of libc,
      use 2/LDBL_EPSILON instead.
      
      fix was proposed by Morten Welinder.
      bff6095d
    • S
      update netinet/in.h to match the current kernel uapi · c3504686
      Szabolcs Nagy 提交于
      from linux/in.h and linux/in6.h uapi headers the following
      missing socket options were added:
      
      IP_NODEFRAG - used with customized ipv4 headers
      IPV6_RECVPATHMTU - for ipv6 path mtu
      IPV6_PATHMTU - for ipv6 path mtu
      IPV6_DONTFRAG - for ipv6 path mtu
      IPV6_ADDR_PREFERENCES - RFC5014 Source Address Selection
      IPV6_MINHOPCOUNT - RFC5082 Generalized TTL Security Mechanism
      IPV6_ORIGDSTADDR - used by tproxy
      IPV6_RECVORIGDSTADDR - used by tproxy
      IPV6_TRANSPARENT - used by tproxy
      IPV6_UNICAST_IF - ipv6 version of IP_UNICAST_IF
      
      and socket option values:
      
      IP_PMTUDISC_OMIT - value for IP_MTU_DISCOVER option, new in linux 3.14
      IPV6_PMTUDISC_OMIT - same for IPV6_MTU_DISCOVER
      IPV6_PMTUDISC_INTERFACE - ipv6 version of IP_PMTUDISC_INTERFACE
      IPV6_PREFER_* - flags for IPV6_ADDR_PREFERENCES
      
      not added: ipv6 flow info and flow label related definitions.
      (it's unclear if libc should define these and namespace polluting
      type name is involved so they are not provided for now)
      c3504686
    • S
      add SO_BPF_EXTENSIONS socket option · c8ea2126
      Szabolcs Nagy 提交于
      this was introduced to query BPF extension support with getsockopt
      in linux 3.14, commit ea02f9411d9faa3553ed09ce0ec9f00ceae9885e
      c8ea2126
    • S
      add sched_{get,set}attr syscall numbers and SCHED_DEADLINE macro · fd9571e2
      Szabolcs Nagy 提交于
      linux 3.14 introduced sched_getattr and sched_setattr syscalls in
      commit d50dde5a10f305253cbc3855307f608f8a3c5f73
      
      and the related SCHED_DEADLINE scheduling policy in
      commit aab03e05e8f7e26f51dee792beddcb5cca9215a5
      
      but struct sched_attr "extended scheduling parameters data structure"
      is not yet exported to userspace (necessary for using the syscalls)
      so related uapi definitions are not added yet.
      fd9571e2
    • R
  2. 30 5月, 2014 6 次提交
    • S
      fix for broken kernel side RLIM_INFINITY on mips · 8258014f
      Szabolcs Nagy 提交于
      On 32 bit mips the kernel uses -1UL/2 to mark RLIM_INFINITY (and
      this is the definition in the userspace api), but since it is in
      the middle of the valid range of limits and limits are often
      compared with relational operators, various kernel side logic is
      broken if larger than -1UL/2 limits are used. So we truncate the
      limits to -1UL/2 in get/setrlimit and prlimit.
      
      Even if the kernel side logic consistently treated -1UL/2 as greater
      than any other limit value, there wouldn't be any clean workaround
      that allowed using large limits:
      * using -1UL/2 as RLIM_INFINITY in userspace would mean different
      infinity value for get/setrlimt and prlimit (where infinity is always
      -1ULL) and userspace logic could break easily (just like the kernel
      is broken now) and more special case code would be needed for mips.
      * translating -1UL/2 kernel side value to -1ULL in userspace would
      mean that -1UL/2 limit cannot be set (eg. -1UL/2+1 had to be passed
      to the kernel instead).
      8258014f
    • R
      break down coarse-grained 64-bit-off_t syscall remappings · 106e65d6
      Rich Felker 提交于
      using the existence of SYS_stat64 as the condition for remapping other
      related syscalls is no longer valid, since new archs that omit the old
      syscalls will not have SYS_stat or SYS_stat64, but still potentially
      need SYS_fstat and others remapped. it would probably be possible to
      get by with just one or two extra conditionals, but just breaking them
      all down into separate conditions is robust and not significantly
      heavier for the preprocessor.
      106e65d6
    • R
      5cf9e8f8
    • R
      fix sendfile syscall to use 64-bit off_t · 55f45bc7
      Rich Felker 提交于
      somehow the remapping of this syscall to the 64-bit version was
      overlooked. the issue was found, and patch provided, by Stefan
      Kristiansson. presumably the reason this bug was not caught earlier is
      that the syscall takes a pointer to off_t rather than a value, so on
      little-endian systems, everything appears to work as long as the
      offset value fits in the low 31 bits. on big-endian systems, though,
      sendfile was presumably completely non-functional.
      55f45bc7
    • R
      support linux kernel apis (new archs) with old syscalls removed · dd5f50da
      Rich Felker 提交于
      such archs are expected to omit definitions of the SYS_* macros for
      syscalls their kernels lack from arch/$ARCH/bits/syscall.h. the
      preprocessor is then able to select the an appropriate implementation
      for affected functions. two basic strategies are used on a
      case-by-case basis:
      
      where the old syscalls correspond to deprecated library-level
      functions, the deprecated functions have been converted to wrappers
      for the modern function, and the modern function has fallback code
      (omitted at the preprocessor level on new archs) to make use of the
      old syscalls if the new syscall fails with ENOSYS. this also improves
      functionality on older kernels and eliminates the incentive to program
      with deprecated library-level functions for the sake of compatibility
      with older kernels.
      
      in other situations where the old syscalls correspond to library-level
      functions which are not deprecated but merely lack some new features,
      such as the *at functions, the old syscalls are still used on archs
      which support them. this may change at some point in the future if or
      when fallback code is added to the new functions to make them usable
      (possibly with reduced functionality) on old kernels.
      dd5f50da
    • R
      remove useless synchronization in exit and quick_exit · 2e55da91
      Rich Felker 提交于
      calling exit more than once invokes undefined behavior. in some cases
      it's desirable to detect undefined behavior and diagnose it via a
      predictable crash, but the code here was silently covering up an
      uncommon case (exit from more than one thread) and turning a much more
      common case (recursive calls to exit) into a permanent hang.
      2e55da91
  3. 28 5月, 2014 1 次提交
  4. 27 5月, 2014 4 次提交
  5. 25 5月, 2014 2 次提交
    • R
      support kernels with no SYS_open syscall, only SYS_openat · 594c827a
      Rich Felker 提交于
      open is handled specially because it is used from so many places, in
      so many variants (2 or 3 arguments, setting errno or not, and
      cancellable or not). trying to do it as a function would not only
      increase bloat, but would also risk subtle breakage.
      
      this is the first step towards supporting "new" archs where linux
      lacks "old" syscalls.
      594c827a
    • R
      overhaul siginfo_t definition in signal.h · 44d28e55
      Rich Felker 提交于
      the main motivation for this change is that, with the previous
      definition, it was arguably illegal, in standard C, to initialize both
      si_value and si_pid/si_uid with designated initializers, due to the
      rule that only one member of a union can have an initializer. whether
      or not this affected real-world application code, it affected some
      internal code, and clang was producing warnings (and possibly
      generating incorrect code).
      
      the new definition uses a more complex hierarchy of structs and unions
      to avoid the need to initialize more than one member of a single union
      in usage cases that make sense. further work would be needed to
      eliminate even the ones with no practical applications.
      
      at the same time, some fixes are made to the exposed names for
      nonstandard fields, to match what software using them expects.
      44d28e55
  6. 21 5月, 2014 2 次提交
  7. 20 5月, 2014 2 次提交
    • R
      fix unhandled cases in strptime · dec66750
      Rich Felker 提交于
      %C, %U, %W, and %y handling were completely missing; %C wrongly
      fell-through to unrelated cases, and the rest returned failure. for
      now, they all parse numbers in the proper forms and range-check the
      values, but they do not store the value anywhere.
      
      it's not clear to me whether, as "derived" fields, %U and %W should
      produce any result. they certainly cannot produce a result unless the
      year and weekday are also converted, but in this case it might be
      desirable for them to do so. clarification is needed on the intended
      behavior of strptime in cases like this.
      
      %C and %y have well-defined behavior as long as they are used together
      (and %y is defined by itself but may change in the future).
      implementing them (including their correct interaction) is left as a
      later change to be made.
      
      finally, strptime now rejects unknown/invalid format characters
      instead of ignoring them.
      dec66750
    • R
      remove unsupported nonstandard sysconf macros and their table entries · 93be56ba
      Rich Felker 提交于
      some of these may have been from ancient (pre-SUSv2) POSIX versions;
      more likely, they were from POSIX drafts or glibc interpretations of
      what ancient versions of POSIX should have added (instead they made
      they described functionality mandatory and/or dropped it completely).
      others are purely glibc-isms, many of them ill-thought-out, like
      providing ways to lookup the min/max values of types at runtime
      (despite the impossibility of them changing at runtime and the
      impossibility of representing ULONG_MAX in a return value of type
      long).
      
      since our sysconf implementation does not support or return meaningful
      values for any of these, it's harmful to have the macros around;
      applications' build scripts may detect and attempt to use them, only
      to get -1/EINVAL as a result.
      
      if removing them does break some applications, and it's determined
      that the usage was reasonable, some of these could be added back on an
      as-needed basis, but they should return actual meaningful values, not
      junk like they were returning before.
      93be56ba
  8. 19 5月, 2014 2 次提交
    • R
      rework sysconf table to treat zero entries as invalid · ff78355b
      Rich Felker 提交于
      based on patch by Timo Teräs. previously, the value zero was used as a
      literal zero, meaning that all invalid sysconf "names", which should
      result in sysconf returning -1, had to be explicitly listed. (in
      addition, it was not possible for sysconf to set errno to EINVAL, as
      there was no distinction between -1 as an error and -1 as a valid
      result.)
      
      now, the value 0 is used for invalid/undefined slots in the table and
      a new switch table entry is used for returning literal zeros.
      
      in addition, an off-by-one error in checking against the table size is
      fixed.
      ff78355b
    • R
      add configure check for broken gcc 4.9.0 and possibly other versions · 9ca4dae5
      Rich Felker 提交于
      this is gcc bug #61144. the broken compiler is detected, but the user
      must manually work around it. this is partly to avoid complex logic
      for adding workaround CFLAGS and attempting to recheck with them, and
      partly for the sake of letting the user know the compiler is broken
      (since the workaround will result in less-efficient code production).
      
      some refactoring was also needed to move the check for gcc outside of
      the check for whether to build the compiler wrapper.
      9ca4dae5
  9. 14 5月, 2014 1 次提交
    • R
      add cp437 and cp850 to available iconv conversions · 8a2d8719
      Rich Felker 提交于
      perhaps some additional legacy DOS-era codepages would also be useful
      to have, but these are the ones for which there has been demand. the
      size of the diff is due to the fact that legacychars.h is updated in
      such a way that new characters are inserted into the table in unicode
      codepoint order; thus other mappings in codepages.h have changed to
      reflect the new table indices of their characters.
      8a2d8719
  10. 13 5月, 2014 1 次提交
    • R
      add configure check for working compiler · 8945667f
      Rich Felker 提交于
      without this, broken choices of CC/CPPFLAGS/CFLAGS don't show up until
      late in the configure process where they are confusingly reported as a
      different failure such as incorrect long double type.
      8945667f
  11. 09 5月, 2014 1 次提交
  12. 05 5月, 2014 1 次提交
  13. 01 5月, 2014 2 次提交
  14. 28 4月, 2014 1 次提交
    • B
      fix superh nofpu check on old gcc versions · 23d64182
      Bobby Bingham 提交于
      As far as gcc3 knows, sh4 is the only processor version that can have an
      FPU, so it indicates the FPU's presence by defining __SH4__.  This is not
      defined if there is no FPU, even if the processor really is an SH4.
      
      Starting with gcc4, there is support for the sh2a processor, which has an
      FPU but is not an SH4.  gcc4 therefore additionally defines __SH_FPU_ANY__
      when there is an FPU, but still doesn't define __SH4__ for an FPU-less sh4.
      
      Therefore, to support all gcc versions, we must look at both preprocessor
      symbols.
      23d64182
  15. 23 4月, 2014 2 次提交
    • R
      perform minimal sanity checks on zoneinfo files loaded via TZ variable · c3d9d172
      Rich Felker 提交于
      previously, setting TZ to the pathname of a file which was not a valid
      zoneinfo file would usually cause programs using local time zone based
      operations to crash. the new code checks the file size and magic at
      the beginning of the file, which seems sufficient to prevent
      accidental misconfiguration from causing crashes. attempting to make
      fully-robust validation would be futile unless we wanted to drop use
      of mmap (shared zoneinfo) and instead read it into a local buffer,
      since such validation would be subject to race conditions with
      modification of the file.
      c3d9d172
    • T
  16. 22 4月, 2014 4 次提交
    • R
      make __init_libc static for non-shared libc · 3176b57e
      Rich Felker 提交于
      being static allows it to be inlined in __libc_start_main; inlining
      should take place at all levels since the function is called exactly
      once. this further reduces mandatory startup code size for static
      binaries.
      3176b57e
    • R
      further micro-optimize startup code for size · fbcfed7c
      Rich Felker 提交于
      there is no reason (and seemingly there never was any) for
      __init_security to be its own function. it's linked unconditionally
      so it can just be placed inline in __init_libc.
      fbcfed7c
    • R
      micro-optimize some startup code for size · 9b52ab1c
      Rich Felker 提交于
      moving the call to __init_ssp from __init_security to __init_libc
      makes __init_security a leaf function, which allows the compiler to
      make it smaller. __init_libc is already non-leaf, and the additional
      call makes no difference to the amount of register spillage.
      
      in addition, it really made no sense for the call to __init_ssp to be
      buried inside __init_security rather than parallel with other init
      functions.
      9b52ab1c
    • R
      allow zoneinfo-path-relative filenames with no slashes in TZ variable · 5c4f11d9
      Rich Felker 提交于
      since the form TZ=name is reserved for POSIX-form time zone strings,
      TZ=:name needs to be used when the zoneinfo filename is in the
      top-level zoneinfo directory and therefore does not contain a slash.
      previously the leading colon was merely dropped, making it impossible
      to access such zones without a full absolute pathname.
      
      changes based on patch by Timo Teräs.
      5c4f11d9
  17. 20 4月, 2014 1 次提交
  18. 19 4月, 2014 1 次提交