| Commit message (Expand) | Author | Age | Files | Lines |
| * | add getopt reset support•••based on proposed patches by Daniel Cegiełka, with minor changes:
- use a weak symbol for optreset so it doesn't clash with namespace
- also reset optpos (position in multi-option arg like -lR)
- also make getopt_long support reset
| Rich Felker | 2012-09-30 | 2 | -2/+18 |
| * | fix some more O_CLOEXEC/SOCK_CLOEXEC issues | Rich Felker | 2012-09-29 | 1 | -1/+1 |
| * | emulate SOCK_CLOEXEC and SOCK_NONBLOCK for old (pre-2.6.27) kernels•••also update syslog to use SOCK_CLOEXEC rather than separate fcntl
step, to make it safe in multithreaded programs that run external
programs.
emulation is not atomic; it could be made atomic by holding a lock on
forking during the operation, but this seems like overkill. my goal is
not to achieve perfect behavior on old kernels (which have plenty of
other imperfect behavior already) but to avoid catastrophic breakage
in (1) syslog, which would give no output on old kernels with the
change to use SOCK_CLOEXEC, and (2) programs built on a new kernel
where configure scripts detected a working SOCK_CLOEXEC, which later
get run on older kernels (they may otherwise fail to work completely).
| Rich Felker | 2012-09-29 | 1 | -2/+1 |
| * | fix dirname to handle input of form "foo/" correctly•••also optimized a bit.
| Rich Felker | 2012-09-26 | 1 | -6/+5 |
| * | add setdomainname syscall, fix getdomainname (previously a stub) | Rich Felker | 2012-09-09 | 2 | -1/+17 |
| * | cleanup src/linux and src/misc trees, etc.•••previously, it was pretty much random which one of these trees a given
function appeared in. they have now been organized into:
src/linux: non-POSIX linux syscalls (possibly shard with other nixen)
src/legacy: various obsolete/legacy functions, mostly wrappers
src/misc: still mostly uncategorized; some misc POSIX, some nonstd
src/crypt: crypt hash functions
further cleanup will be done later.
| Rich Felker | 2012-09-07 | 20 | -2697/+158 |
| * | fix constraint violation in ftw•••void* does not implicitly convert to function pointer types.
| Rich Felker | 2012-09-06 | 1 | -1/+4 |
| * | use restrict everywhere it's required by c99 and/or posix 2008•••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.
| Rich Felker | 2012-09-06 | 2 | -2/+2 |
| * | fix missing statics in crypt_sha256 code | Rich Felker | 2012-08-30 | 1 | -3/+3 |
| * | anti-DoS rounds count limits for blowfish and des crypt•••all of the limits could use review, but err on the side of avoiding
excessive rounds for now.
| Rich Felker | 2012-08-29 | 2 | -2/+2 |
| * | limit sha512 rounds to similar runtime to sha256 limit•••these limits could definitely use review, but for now, i feel
consistency and erring on the side of preventing servers from getting
bogged down by excessively-slow user-provided settings (think
.htpasswd) are the best policy. blowfish should be updated to match.
| Rich Felker | 2012-08-29 | 1 | -1/+1 |
| * | add sha256/sha512 crypt•••based on versions sent to the list by nsz, with some simplification
and debloating. i'd still like to get them a bit smaller, or ideally
merge them into a single file with most of the code being shared, but
that can be done later.
| Rich Felker | 2012-08-29 | 4 | -1/+700 |
| * | optimize legacy ffs function | Rich Felker | 2012-08-23 | 1 | -4/+2 |
| * | add blowfish hash support to crypt•••there are still some discussions going on about tweaking the code, but
at least thing brings us to the point of having something working in
the repository. hopefully the remaining major hashes (md5,sha) will
follow soon.
| Rich Felker | 2012-08-10 | 3 | -8/+806 |
| * | make crypt return an unmatchable hash rather than NULL on failure•••unfortunately, a large portion of programs which call crypt are not
prepared for its failure and do not check that the return value is
non-null before using it. thus, always "succeeding" but giving an
unmatchable hash is reportedly a better behavior than failing on
error.
it was suggested that we could do this the same way as other
implementations and put the null-to-unmatchable translation in the
wrapper rather than the individual crypt modules like crypt_des, but
when i tried to do it, i found it was making the logic in __crypt_r
for keeping track of which hash type we're working with and whether it
succeeded or failed much more complex, and potentially error-prone.
the way i'm doing it now seems to have essentially zero cost, anyway.
| Rich Felker | 2012-08-09 | 1 | -5/+2 |
| * | fix missing static in getusershell (namespace pollution) | Rich Felker | 2012-08-02 | 1 | -1/+1 |
| * | replace old and ugly crypt implementation•••the new version is largely the work of Solar Designer, with minor
changes for integration with musl. compared to the old code, text size
is reduced by about 7k, stack space usage by about 70k, and
performance is greatly improved by avoiding expensive calculation of
constant tables on each run.
this version also adds support for extended des-based password hashes,
which allow for unlimited key (password) length and configurable
iteration counts.
i've also published the interface for crypt_r in a new crypt.h header.
especially since this is not a standard interface, i did not feel
compelled to match the glibc abi for the crypt_data structure. the
glibc structure is way too big to allocate on the stack; in fact it's
so big that the first usage may cause the main thread to exceed its
pre-committed stack size of 128k and thus could cause the program to
crash even on systems with overcommit disabled. the only legitimate
use of crypt_data for crypt_r is to store the hash string to return,
so i've reserved 256 bytes, which should be more than sufficient
(longest known password hashes are ~60 characters, and beyond that is
possibly even exceeding some implementations' passwd file field size
limit).
| Rich Felker | 2012-06-29 | 3 | -2574/+1055 |
| * | fix ptsname_r to conform to the upcoming posix requirements•••it should return the error code rather than 0/-1 and setting errno.
| Rich Felker | 2012-06-20 | 2 | -4/+13 |
| * | add isastream (obsolete STREAMS junk)•••apparently some packages see stropts.h and want to be able to use
this. the implementation checks that the file descriptor is valid by
using fcntl/F_GETFD so it can report an error if not (as specified).
| Rich Felker | 2012-05-06 | 1 | -0/+7 |
| * | implement stub versions of sched_*•••these actually work, but for now they prohibit actually setting
priority levels and report min/max priority as 0.
| Rich Felker | 2012-05-03 | 1 | -10/+0 |
| * | ditch the priority inheritance locks; use malloc's version of lock•••i did some testing trying to switch malloc to use the new internal
lock with priority inheritance, and my malloc contention test got
20-100 times slower. if priority inheritance futexes are this slow,
it's simply too high a price to pay for avoiding priority inversion.
maybe we can consider them somewhere down the road once the kernel
folks get their act together on this (and perferably don't link it to
glibc's inefficient lock API)...
as such, i've switch __lock to use malloc's implementation of
lightweight locks, and updated all the users of the code to use an
array with a waiter count for their locks. this should give optimal
performance in the vast majority of cases, and it's simple.
malloc is still using its own internal copy of the lock code because
it seems to yield measurably better performance with -O3 when it's
inlined (20% or more difference in the contention stress test).
| Rich Felker | 2012-04-24 | 1 | -9/+9 |
| * | implement getusershell, etc. legacy functions•••I actually wrote these a month ago but forgot to integrate them. ugly,
probably-harmful-to-use functions, but some legacy apps want them...
| Rich Felker | 2012-04-22 | 1 | -0/+33 |
| * | add getresuid and getresgid syscall wrappers | Rich Felker | 2012-04-22 | 2 | -0/+16 |
| * | wordexp must set the we_offs entries of we_wordv to null pointers | Rich Felker | 2012-04-16 | 1 | -0/+4 |
| * | fix crash in wordfree if we_offs is not initialized by the caller•••I'm not sure if it's legal for wordexp to modify this field, but this
is the only easy/straightforward fix, and applications should not
care. if it's an issue, i can work out a different (but more complex)
solution later.
| Rich Felker | 2012-04-16 | 1 | -0/+2 |
| * | implement a64l and l64a (legacy xsi stuff) | Rich Felker | 2012-03-01 | 1 | -0/+26 |
| * | fix (hopefully) PTRACE_TRACEME (command 0) argument handling | Rich Felker | 2012-02-23 | 1 | -2/+2 |
| * | fix get_current_dir_name behavior | Rich Felker | 2012-02-17 | 1 | -2/+6 |
| * | add get_current_dir_name function | Rich Felker | 2012-02-17 | 1 | -0/+12 |
| * | add legacy futimes and lutimes functions•••based on patch by sh4rm4. these functions are deprecated; futimens and
utimensat should be used instead in new programs.
| Rich Felker | 2012-01-24 | 2 | -0/+26 |
| * | use prlimit syscall for getrlimit/setrlimit•••this allows the full range of 64-bit limit arguments even on 32-bit
systems. fallback to the old syscalls on old kernels that don't
support prlimit.
| Rich Felker | 2012-01-20 | 2 | -4/+14 |
| * | add prlimit syscall wrapper | Rich Felker | 2012-01-20 | 1 | -0/+8 |
| * | alias basename to glibc name for it, to meet abi goals•••note that regardless of the name used, basename is always conformant.
it never takes on the bogus gnu behavior, unlike glibc where basename
is nonconformant when declared manually without including libgen.h.
| Rich Felker | 2012-01-18 | 1 | -0/+3 |
| * | fix ptrace (maybe) | Rich Felker | 2011-09-16 | 1 | -1/+8 |
| * | implement ptrace syscall wrapper (untested) | Rich Felker | 2011-09-15 | 1 | -0/+18 |
| * | remove some stray trailing space characters | Rich Felker | 2011-09-13 | 1 | -1/+1 |
| * | fix some bugs in setxid and update setrlimit to use __synccall•••setrlimit is supposed to be per-process, not per-thread, but again
linux gets it wrong. work around this in userspace. not only is it
needed for correctness; setxid also depends on the resource limits for
all threads being the same to avoid situations where temporarily
unlimiting the limit succeeds in some threads but fails in others.
| Rich Felker | 2011-07-30 | 1 | -2/+27 |
| * | check for fd exhaustion in forkpty•••we cannot report failure after forking, so the idea is to ensure prior
to fork that fd 0,1,2 exist. this will prevent dup2 from possibly
hitting a resource limit and failing in the child process. fcntl
rather than dup2 is used prior to forking to avoid race conditions.
| Rich Felker | 2011-07-22 | 1 | -2/+15 |
| * | incorrect check for open failure in openpty function•••-1, not 0, indicates failure
| Rich Felker | 2011-07-22 | 1 | -1/+1 |
| * | wordexp cannot use we_offs unless WRDE_DOOFFS flag is set•••previously, a potentially-indeterminate value from we_offs was being
used, resulting in wrong we_wordc and subsequent crashes in the
caller.
| Rich Felker | 2011-06-25 | 1 | -1/+2 |
| * | fix memory leak on failure in realpath | Rich Felker | 2011-06-18 | 1 | -4/+4 |
| * | add useless, obsolescent function ulimit | Rich Felker | 2011-05-29 | 1 | -0/+19 |
| * | properly create new session/controlling terminal in forkpty | Rich Felker | 2011-04-20 | 1 | -1/+4 |
| * | implement (nonstandard) forkpty | Rich Felker | 2011-04-20 | 1 | -0/+22 |
| * | block cancellation in wordexp, handle more errors | Rich Felker | 2011-04-19 | 1 | -2/+17 |
| * | avoid malloc of potentially-large string in wordexp | Rich Felker | 2011-04-19 | 1 | -10/+28 |
| * | protect ftw and nftw against cancellation | Rich Felker | 2011-04-18 | 1 | -1/+6 |
| * | protect syslog against cancellation•••these functions are allowed to be cancellation points, but then we
would have to install cleanup handlers to avoid termination with locks
held.
| Rich Felker | 2011-04-18 | 1 | -5/+19 |
| * | minimal realpath implementation using /proc•••clean and simple, but fails when the caller does not have permissions
to open the file for reading or when /proc is not available. i may
replace this with a full implementation later, possibly leaving this
version as an optimization to use when it works.
| Rich Felker | 2011-04-17 | 1 | -0/+43 |
| * | remove stupid debug code in wordexp | Rich Felker | 2011-04-15 | 1 | -1/+0 |