1. 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
  2. 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
  3. 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
  4. 07 12月, 2012 1 次提交
  5. 12 11月, 2012 1 次提交
  6. 01 11月, 2012 1 次提交
  7. 30 9月, 2012 2 次提交
  8. 17 9月, 2012 1 次提交
  9. 10 9月, 2012 1 次提交
  10. 09 9月, 2012 1 次提交
  11. 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
  12. 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
  13. 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
  14. 24 7月, 2012 1 次提交
    • R
      add pipe2 syscall · 42f0e965
      Rich Felker 提交于
      based on patch by orc and Isaac Dunham, with some details fixed.
      42f0e965
  15. 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
  16. 03 6月, 2012 1 次提交
  17. 23 5月, 2012 5 次提交
  18. 21 5月, 2012 1 次提交
  19. 04 5月, 2012 1 次提交
    • R
      add support for ugly *64 functions with _LARGEFILE64_SOURCE · 2dd8d5e1
      Rich Felker 提交于
      musl does not support legacy 32-bit-off_t whatsoever. off_t is always
      64 bit, and correct programs that use off_t and the standard functions
      will just work out of the box. (on glibc, they would require
      -D_FILE_OFFSET_BITS=64 to work.) however, some programs instead define
      _LARGEFILE64_SOURCE and use alternate versions of all the standard
      types and functions with "64" appended to their names.
      
      we do not want code to actually get linked against these functions
      (it's ugly and inconsistent), so macros are used instead of prototypes
      with weak aliases in the library itself. eventually the weak aliases
      may be added at the library level for the sake of using code that was
      originally built against glibc, but the macros will still be the
      desired solution in the headers.
      2dd8d5e1
  20. 23 4月, 2012 2 次提交
  21. 22 4月, 2012 1 次提交
  22. 19 4月, 2012 1 次提交
    • R
      legacy junk compatibility grab-bag · ba6a9e77
      Rich Felker 提交于
      - add the rest of the junk traditionally in sys/param.h
      - add prototypes for some nonstandard functions
      - add _GNU_SOURCE to their source files so the compiler can check proto
      ba6a9e77
  23. 18 2月, 2012 1 次提交
  24. 14 9月, 2011 1 次提交
  25. 12 8月, 2011 1 次提交
    • R
      implement forkall · 4054a135
      Rich Felker 提交于
      this is a "nonstandard" function that was "rejected" by POSIX, but
      nonetheless had its behavior documented in the POSIX rationale for
      fork. it's present on solaris and possibly some other systems, and
      duplicates the whole calling process, not just a single thread. glibc
      does not have this function. it should not be used in programs
      intending to be portable, but may be useful for testing,
      checkpointing, etc. and it's an interesting (and quite small) example
      of the usefulness of the __synccall framework originally written to
      work around deficiencies in linux's setuid syscall.
      4054a135
  26. 28 4月, 2011 1 次提交
  27. 13 4月, 2011 1 次提交
  28. 04 4月, 2011 2 次提交
  29. 02 4月, 2011 1 次提交
  30. 27 2月, 2011 1 次提交
  31. 19 2月, 2011 1 次提交
  32. 16 2月, 2011 1 次提交