1. 24 8月, 2019 1 次提交
  2. 11 3月, 2018 1 次提交
    • R
      fix minor namespace issue in unistd.h · a3f7bcde
      Rich Felker 提交于
      the F_* macros associated with the lockf function are XSI-shaded (like
      the lockf function itself) and should only be exposed when the
      function is.
      a3f7bcde
  3. 23 2月, 2018 1 次提交
    • R
      add getentropy function · 82f17680
      Rich Felker 提交于
      based loosely on patch by Hauke Mehrtens; converted to wrap the public
      API of the underlying getrandom function rather than direct syscalls,
      so that if/when a fallback implementation of getrandom is added it
      will automatically get picked up by getentropy too.
      82f17680
  4. 21 10月, 2016 2 次提交
  5. 10 7月, 2015 1 次提交
  6. 11 9月, 2014 1 次提交
    • R
      fix places where _BSD_SOURCE failed to yield a superset of _XOPEN_SOURCE · ab8f6a6e
      Rich Felker 提交于
      the vast majority of these failures seem to have been oversights at
      the time _BSD_SOURCE was added, or perhaps shortly afterward. the one
      which may have had some reason behind it is omission of setpgrp from
      the _BSD_SOURCE feature profile, since the standard setpgrp interface
      conflicts with a legacy (pre-POSIX) BSD interface by the same name.
      however, such omission is not aligned with our general policy in this
      area (for example, handling of similar _GNU_SOURCE cases) and should
      not be preserved.
      ab8f6a6e
  7. 20 7月, 2014 1 次提交
    • B
      add issetugid function to check for elevated privilege · ddddec10
      Brent Cook 提交于
      this function provides a way for third-party library code to use the
      same logic that's used internally in libc for suppressing untrusted
      input/state (e.g. the environment) when the application is running
      with privleges elevated by the setuid or setgid bit or some other
      mechanism. its semantics are intended to match the openbsd function by
      the same name.
      
      there was some question as to whether this function is necessary:
      getauxval(AT_SECURE) was proposed as an alternative. however, this has
      several drawbacks. the most obvious is that it asks programmers to be
      aware of an implementation detail of ELF-based systems (the aux
      vector) rather than simply the semantic predicate to be checked. and
      trying to write a safe, reliable version of issetugid in terms of
      getauxval is difficult. for example, early versions of the glibc
      getauxval did not report ENOENT, which could lead to false negatives
      if AT_SECURE was not present in the aux vector (this could probably
      only happen when running on non-linux kernels under linux emulation,
      since glibc does not support linux versions old enough to lack
      AT_SECURE). as for musl, getauxval has always properly reported
      errors, but prior to commit 7bece9c2,
      the musl implementation did not emulate AT_SECURE if missing, which
      would result in a false positive. since musl actually does partially
      support kernels that lack AT_SECURE, this was problematic.
      
      the intent is that library authors will use issetugid if its
      availability is detected at build time, and only fall back to the
      unreliable alternatives on systems that lack it.
      
      patch by Brent Cook. commit message/rationale by Rich Felker.
      ddddec10
  8. 20 5月, 2014 1 次提交
    • 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
  9. 20 4月, 2014 1 次提交
  10. 07 12月, 2013 1 次提交
  11. 25 11月, 2013 1 次提交
    • R
      restore type of NULL to void * except when used in C++ programs · c8a9c221
      Rich Felker 提交于
      unfortunately this eliminates the ability of the compiler to diagnose
      some dangerous/incorrect usage, but POSIX requires (as an extension to
      the C language, i.e. CX shaded) that NULL have type void *. plain C
      allows it to be defined as any null pointer constant.
      
      the definition 0L is preserved for C++ rather than reverting to plain
      0 to avoid dangerous behavior in non-conforming programs which use
      NULL as a variadic sentinel. (it's impossible to use (void *)0 for C++
      since C++ lacks the proper implicit pointer conversions, and other
      popular alternatives like the GCC __null extension seem non-conforming
      to the standard's requirements.)
      c8a9c221
  12. 03 8月, 2013 1 次提交
  13. 27 7月, 2013 3 次提交
  14. 27 6月, 2013 1 次提交
  15. 02 4月, 2013 1 次提交
    • R
      re-add useconds_t · 47cf4919
      rofl0r 提交于
      this type was removed back in 5243e5f1 ,
      because it was removed from the XSI specs.
      however some apps use it.
      since it's in the POSIX reserved namespace, we can expose it
      unconditionally.
      47cf4919
  16. 19 1月, 2013 1 次提交
    • R
      use a common definition of NULL as 0L for C and C++ · 41d7c77d
      Rich Felker 提交于
      the historical mess of having different definitions for C and C++
      comes from the historical C definition as (void *)0 and the fact that
      (void *)0 can't be used in C++ because it does not convert to other
      pointer types implicitly. however, using plain 0 in C++ exposed bugs
      in C++ programs that call variadic functions with NULL as an argument
      and (wrongly; this is UB) expect it to arrive as a null pointer. on
      64-bit machines, the high bits end up containing junk. glibc dodges
      the issue by using a GCC extension __null to define NULL; this is
      observably non-conforming because a conforming application could
      observe the definition of NULL via stringizing and see that it is
      neither an integer constant expression with value zero nor such an
      expression cast to void.
      
      switching to 0L eliminates the issue and provides compatibility with
      broken applications, since on all musl targets, long and pointers have
      the same size, representation, and argument-passing convention. we
      could maintain separate C and C++ definitions of NULL (i.e. just use
      0L on C++ and use (void *)0 on C) but after careful analysis, it seems
      extremely difficult for a C program to even determine whether NULL has
      integer or pointer type, much less depend in subtle, unintentional
      ways, on whether it does. C89 seems to have no way to make the
      distinction. on C99, the fact that (int)(void *)0 is not an integer
      constant expression, along with subtle VLA/sizeof semantics, can be
      used to make the distinction, but many compilers are non-conforming
      and give the wrong result to this test anyway. on C11, _Generic can
      trivially make the distinction, but it seems unlikely that code
      targetting C11 would be so backwards in caring which definition of
      NULL an implementation uses.
      
      as such, the simplest path of using the same definition for NULL in
      both C and C++ was chosen. the #undef directive was also removed so
      that the compiler can catch and give a warning or error on
      redefinition if buggy programs have defined their own versions of
      NULL prior to inclusion of standard headers.
      41d7c77d
  17. 11 12月, 2012 1 次提交
    • R
      syscall() declaration belongs in unistd.h, not sys/syscall.h · baf246e5
      Rich Felker 提交于
      traditionally, both BSD and GNU systems have it this way.
      sys/syscall.h is purely syscall number macros. presently glibc exposes
      the syscall declaration in unistd.h only with _GNU_SOURCE, but that
      does not reflect historical practice.
      baf246e5
  18. 07 12月, 2012 1 次提交
  19. 12 11月, 2012 1 次提交
  20. 01 11月, 2012 1 次提交
  21. 30 9月, 2012 2 次提交
  22. 17 9月, 2012 1 次提交
  23. 10 9月, 2012 1 次提交
  24. 09 9月, 2012 1 次提交
  25. 08 9月, 2012 1 次提交
    • R
      default features: make musl usable without feature test macros · c1a9658b
      Rich Felker 提交于
      the old behavior of exposing nothing except plain ISO C can be
      obtained by defining __STRICT_ANSI__ or using a compiler option (such
      as -std=c99) that predefines it. the new default featureset is POSIX
      with XSI plus _BSD_SOURCE. any explicit feature test macros will
      inhibit the default.
      
      installation docs have also been updated to reflect this change.
      c1a9658b
  26. 07 9月, 2012 2 次提交
    • R
      further use of _Noreturn, for non-plain-C functions · 0c05bd3a
      Rich Felker 提交于
      note that POSIX does not specify these functions as _Noreturn, because
      POSIX is aligned with C99, not the new C11 standard. when POSIX is
      eventually updated to C11, it will almost surely give these functions
      the _Noreturn attribute. for now, the actual _Noreturn keyword is not
      used anyway when compiling with a c99 compiler, which is what POSIX
      requires; the GCC __attribute__ is used instead if it's available,
      however.
      
      in a few places, I've added infinite for loops at the end of _Noreturn
      functions to silence compiler warnings. presumably
      __buildin_unreachable could achieve the same thing, but it would only
      work on newer GCCs and would not be portable. the loops should have
      near-zero code size cost anyway.
      
      like the previous _Noreturn commit, this one is based on patches
      contributed by philomath.
      0c05bd3a
    • R
      use restrict everywhere it's required by c99 and/or posix 2008 · 400c5e5c
      Rich Felker 提交于
      to deal with the fact that the public headers may be used with pre-c99
      compilers, __restrict is used in place of restrict, and defined
      appropriately for any supported compiler. we also avoid the form
      [restrict] since older versions of gcc rejected it due to a bug in the
      original c99 standard, and instead use the form *restrict.
      400c5e5c
  27. 16 8月, 2012 1 次提交
    • R
      improve headers to better deal with removed-in-posix-2008 features · 3f80afc5
      Rich Felker 提交于
      with this patch, setting _POSIX_SOURCE, or setting _POSIX_C_SOURCE or
      _XOPEN_SOURCE to an old version, will bring back the interfaces that
      were removed in POSIX 2008 - at least the ones i've covered so far,
      which are gethostby*, usleep, and ualarm. if there are other functions
      still in widespread use that were removed for which similar changes
      would be beneficial, they can be added just like this.
      3f80afc5
  28. 24 7月, 2012 1 次提交
    • R
      add pipe2 syscall · 42f0e965
      Rich Felker 提交于
      based on patch by orc and Isaac Dunham, with some details fixed.
      42f0e965
  29. 04 6月, 2012 1 次提交
    • R
      _GNU_SOURCE is supposed to imply _LARGEFILE64_SOURCE · 3b94daba
      Rich Felker 提交于
      this is ugly and stupid, but now that the *64 symbol names exist, a
      lot of broken GNU software detects them in configure, then either
      breaks during build due to missing off64_t definition, or attempts to
      compile without function declarations/prototypes. "fixing" it here is
      easier than telling everyone to add yet another feature test macro to
      their builds.
      3b94daba
  30. 03 6月, 2012 1 次提交
  31. 23 5月, 2012 5 次提交