about summary refs log tree commit diff
path: root/src/stdio/popen.c
Commit message (Collapse)AuthorAgeFilesLines
* rewrite popen to use posix_spawn instead of fragile vfork hacksRich Felker2013-03-241-41/+41
|
* clean up sloppy nested inclusion from pthread_impl.hRich Felker2012-11-081-0/+3
| | | | | | | | | | | | | | this mirrors the stdio_impl.h cleanup. one header which is not strictly needed, errno.h, is left in pthread_impl.h, because since pthread functions return their error codes rather than using errno, nearly every single pthread function needs the errno constants. in a few places, rather than bringing in string.h to use memset, the memset was replaced by direct assignment. this seems to generate much better code anyway, and makes many functions which were previously non-leaf functions into leaf functions (possibly eliminating a great deal of bloat on some platforms where non-leaf functions require ugly prologue and/or epilogue).
* fix copy/paste error in popen changes that broke signalsRich Felker2012-10-211-1/+1
| | | | signal mask was not being restored after fork, but instead blocked again.
* fix usage of locks with vforkRich Felker2012-10-191-1/+1
| | | | | | __release_ptc() is only valid in the parent; if it's performed in the child, the lock will be unlocked early then double-unlocked later, corrupting the lock state.
* overhaul system() and popen() to use vfork; fix various related bugsRich Felker2012-10-181-24/+44
| | | | | | | | | | | | | | | | since we target systems without overcommit, special care should be taken that system() and popen(), like posix_spawn(), do not fail in processes whose commit charges are too high to allow ordinary forking. this in turn requires special precautions to ensure that the parent process's signal handlers do not end up running in the shared-memory child, where they could corrupt the state of the parent process. popen has also been updated to use pipe2, so it does not have a fd-leak race in multi-threaded programs. since pipe2 is missing on older kernels, (non-atomic) emulation has been added. some silly bugs in the old code should be gone too.
* make popen cancellation-safeRich Felker2012-06-201-0/+7
| | | | | | | close was the only cancellation point called from popen, but it left popen with major resource leaks if any call to close got cancelled. the easiest, cheapest fix is just to use a non-cancellable close function.
* popen: handle issues with fd0/1 being closedRich Felker2012-06-201-3/+3
| | | | | also check for failure of dup2 and abort the child rather than reading/writing the wrong file.
* initial check-in, version 0.5.0 v0.5.0Rich Felker2011-02-121-0/+43