- 24 8月, 2019 1 次提交
-
-
由 Árni Dagur 提交于
-
- 11 3月, 2018 1 次提交
-
-
由 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.
-
- 23 2月, 2018 1 次提交
-
-
由 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.
-
- 21 10月, 2016 2 次提交
-
-
由 Rich Felker 提交于
reported and changes suggested by Daniel Sabogal.
-
由 Daniel Sabogal 提交于
the _CS_V6_ENV and _CS_V7_ENV constants are required to be available for use with confstr. glibc defines these constants with values 1148 and 1149, respectively. the only missing (and required) confstr constants are _CS_POSIX_V7_THREADS_CFLAGS and _CS_POSIX_V7_THREADS_LDFLAGS which remain unavailable in glibc.
-
- 10 7月, 2015 1 次提交
-
-
由 Rich Felker 提交于
being nonstandard, the closest thing to a specification for this function is its man page, which documents it as returning int. it can fail with EBADF if the file descriptor passed is invalid.
-
- 11 9月, 2014 1 次提交
-
-
由 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.
-
- 20 7月, 2014 1 次提交
-
-
由 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.
-
- 20 5月, 2014 1 次提交
-
-
由 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.
-
- 20 4月, 2014 1 次提交
-
-
由 M Farkas-Dyck 提交于
-
- 07 12月, 2013 1 次提交
-
-
由 Rich Felker 提交于
this is purely a wrapper for close since Linux does not support EINTR semantics for the close syscall.
-
- 25 11月, 2013 1 次提交
-
-
由 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.)
-
- 03 8月, 2013 1 次提交
-
-
由 Rich Felker 提交于
-
- 27 7月, 2013 3 次提交
-
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
- 27 6月, 2013 1 次提交
-
-
由 Rich Felker 提交于
-
- 02 4月, 2013 1 次提交
-
- 19 1月, 2013 1 次提交
-
-
由 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.
-
- 11 12月, 2012 1 次提交
-
-
由 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.
-
- 07 12月, 2012 1 次提交
-
-
由 rofl0r 提交于
the prototype is defined with const gid_t* rather than const gid_t[]. it was already correctly defined in grp.h.
-
- 12 11月, 2012 1 次提交
-
-
由 Rich Felker 提交于
also update another newish feature in sysconf, stackaddr
-
- 01 11月, 2012 1 次提交
-
-
由 Rich Felker 提交于
-
- 30 9月, 2012 2 次提交
-
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
they will be in the next version of POSIX
-
- 17 9月, 2012 1 次提交
-
-
由 Rich Felker 提交于
patch by Justin Cormack, with slight modification
-
- 10 9月, 2012 1 次提交
-
-
由 Rich Felker 提交于
-
- 09 9月, 2012 1 次提交
-
-
由 Rich Felker 提交于
based on patch by Justin Cormack
-
- 08 9月, 2012 1 次提交
-
-
由 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.
-
- 07 9月, 2012 2 次提交
-
-
由 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.
-
由 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.
-
- 16 8月, 2012 1 次提交
-
-
由 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.
-
- 24 7月, 2012 1 次提交
-
-
由 Rich Felker 提交于
based on patch by orc and Isaac Dunham, with some details fixed.
-
- 04 6月, 2012 1 次提交
-
-
由 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.
-
- 03 6月, 2012 1 次提交
-
-
由 Rich Felker 提交于
lots of broken programs expect this, and it's gotten to the point of being a troubleshooting FAQ topic. best to just fix it.
-
- 23 5月, 2012 5 次提交
-
-
由 Rich Felker 提交于
i made a best attempt, but the intended semantics of this function are fundamentally contradictory. there is no consistent way to handle ownership of locks when forking a multi-threaded process. the code could have worked by accident for programs that only used normal mutexes and nothing else (since they don't actually store or care about their owner), but that's about it. broken-by-design interfaces that aren't even in glibc (only solaris) don't belong in musl.
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
-
由 Rich Felker 提交于
there is no reason to avoid multiple identical macro definitions; this is perfectly legal C, and even with the maximal warning options enabled, gcc does not issue any warning for it.
-
由 Rich Felker 提交于
patch by Isaac Dunham. matched closely (maybe not exact) to glibc's idea of what _BSD_SOURCE should make visible.
-