History log of /src/lib/libc/gen/popen.c |
Revision | | Date | Author | Comments |
1.38 |
| 19-Apr-2022 |
rillig | lib: remove CONSTCOND comment
Since 2021-01-31, lint doesn't need it anymore for the common pattern of 'do ... while (0)'.
|
1.37 |
| 29-Oct-2021 |
kre | Add "--" 'options end' parameter to the sh -c call that runs the command, so that the command cannot appear to be more options (which always then fails, as there would be no arg for "-c" to treat as the command string in that case).
For the full (LONG) explanation, see: http://mail-index.netbsd.org/current-users/2021/10/29/msg041629.html
|
1.36 |
| 24-Jan-2019 |
christos | PR/53904: Jintao Zhu: Use a mutex instead of an rwlock to assure thread safety
|
1.35 |
| 02-Feb-2015 |
christos | branches: 1.35.8; 1.35.14; 1.35.16; CID/1267868: Resource leak "cur"
|
1.34 |
| 20-Jan-2015 |
christos | Fix non _REENTRANT build.
|
1.33 |
| 20-Jan-2015 |
christos | Factor out popen() code into separate functions and create popenve() using the new functions, a safer version of popen() that does not involve a shell. Correct manual page inaccuracies.
|
1.32 |
| 25-Jun-2012 |
abs | Update old-style definitions to ANSI, remove a couple of register definitions along the way. Fixed gcc 4.1 build (thank you vax)
|
1.31 |
| 26-Jun-2011 |
christos | branches: 1.31.2; * Arrange for interfaces that create new file descriptors to be able to set close-on-exec on creation (http://udrepper.livejournal.com/20407.html).
- Add F_DUPFD_CLOEXEC to fcntl(2). - Add MSG_CMSG_CLOEXEC to recvmsg(2) for unix file descriptor passing. - Add dup3(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add pipe2(2) syscall with a flags argument for O_CLOEXEC, O_NONBLOCK. - Add flags SOCK_CLOEXEC, SOCK_NONBLOCK to the socket type parameter for socket(2) and socketpair(2). - Add new paccept(2) syscall that takes an additional sigset_t to alter the sigmask temporarily and a flags argument to set SOCK_CLOEXEC, SOCK_NONBLOCK. - Add new mode character 'e' to fopen(3) and popen(3) to open pipes and file descriptors for close on exec. - Add new kqueue1(2) syscall with a new flags argument to open the kqueue file descriptor with O_CLOEXEC, O_NONBLOCK.
* Fix the system calls that take socklen_t arguments to actually do so.
* Don't include userland header files (signal.h) from system header files (rump_syscallargs.h).
* Bump libc version for the new syscalls.
|
1.30 |
| 14-Nov-2010 |
tron | Improve and simplify implementation of *env(3) functions: - Use RB tree to keep track of memory allocated via setenv(3) as suggested by Enami Tsugutomo in private e-mail. This simplifies the code a lot as we no longer need to keep the size of "environ" in sync with an array of allocated environment variables. It also makes it possible to free environment variables in unsetenv(3) if something has changed the order of the "environ" array. - Fix a bug in getenv(3) and getenv_r(3) which would return bogus results e.g. for " getenv("A=B") " if an environment variable "A" with value "B=C" exists. - Clean up the internal functions: - Don't expose the read/write lock for the environment to other parts of "libc". Provide locking functions instead. - Use "bool" to report success or failure. - Use "ssize_t" or "size_t" instead of "int" for indexes. - Provide internal functions with simpler interfaces e.g. don't combine return values and reference arguments. - Don't copy "environ" into an allocated block unless we really need to grow it.
Code reviewed by Joerg Sonnenberger and Christos Zoulas, tested by Joerg Sonnenberger and me. These changes also fix problems in zsh 4.3.* and pam_ssh according to Joerg.
|
1.29 |
| 15-Oct-2006 |
christos | instead of using the (void)&foo kludge to avoid longjmp clobbering of variables make the variables volatile as needed.
|
1.28 |
| 15-Sep-2003 |
cl | make popen/pclose thread safe
|
1.27 |
| 07-Aug-2003 |
agc | Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
|
1.26 |
| 04-Mar-2003 |
nathanw | Don't acquire __environ_lock around exec*() calls; nothing requires that these calls be thread-safe with respect to the environment, and it causes serious problems for threaded applications which call vfork() and exec*() (including indirectly, via popen() or system()).
Acquire and release __environ_lock in the parent in popen() and system() to play safe and provide the child with a stable environment.
__environ_lock should also have an atfork() handler; still under development.
|
1.25 |
| 22-Jan-2000 |
mycroft | Delint. Remove trailing ; from uses of __weak_alias(). The macro inserts this if needed.
|
1.24 |
| 20-Sep-1999 |
lukem | back out the #ifdef _DIAGNOSTIC argument checks; too many people complained. _DIAGASSERT() is still retained.
|
1.23 |
| 16-Sep-1999 |
lukem | * use _DIAGASSERT() to check pointer arguments against NULL and file descriptors against -1 (as appropriate). * add actual checks which to detect stuff that would trigger_DIAGASSERT(), and attempt to return a sane error condition. * knf some code * remove some `register' decls.
the first two items result in the addition of code similar to the following in various functions:
_DIAGASSERT(path != NULL) #ifdef _DIAGNOSTIC if (path == NULL) { errno = EFAULT; return (-1); } #endif
|
1.22 |
| 18-Jul-1998 |
lukem | use AF_LOCAL instead of AF_UNIX
|
1.21 |
| 19-Mar-1998 |
tv | PR 3673: possible to close the wrong fds
|
1.20 |
| 04-Feb-1998 |
tron | Fix a severe bug in popen() which only showed up with NetBSD's true vfork() implementation and close a possible file descriptor leak.
|
1.19 |
| 03-Feb-1998 |
perry | remove obsolete register declarations
|
1.18 |
| 03-Feb-1998 |
perry | force twoway and type out of registers in order to shut up a gcc warning. What a crock!
|
1.17 |
| 02-Feb-1998 |
perry | fix typo from lite-2 commit
|
1.16 |
| 02-Feb-1998 |
perry | merge/update to lite-2
|
1.15 |
| 16-Sep-1997 |
thorpej | Make this safe in environments that have a Real vfork(2). Bug pointed out by Chuck Cranor <chuck@netbsd.org>
|
1.14 |
| 21-Jul-1997 |
jtc | If port provides __weak_alias(), provide an Standard C and POSIX pure identifier namespace by renaming non standard functions and variables such that they have a leading underscore. The library will use those names internally. Weak aliases are used to provide the original names to the API.
This is only the first part of this change. It is most of the functions which are implemented in C for all NetBSD ports. Subsequent changes are to add the same support to the remaining C files, to assembly files, and to the automagically generated assembly source used for system calls. When all of the above is done, ports with weak alias support should add a definition for __weak_alias to <sys/cdefs.h>.
|
1.13 |
| 13-Jul-1997 |
christos | Fix clobbered variable warning Fix RCSID's
|
1.12 |
| 29-Jun-1996 |
jtc | branches: 1.12.2; Changed to conform to POSIX.2 B.3.2.2 "popen() shall ensure that any streams from previous popen() calls that remain open in the parent process are closed in the new child process." Fixes PR #2575.
|
1.11 |
| 16-Jun-1995 |
jtc | Don't cast void functions to void.
|
1.10 |
| 25-Feb-1995 |
cgd | clean up Id's on files previously imported...
|
1.9 |
| 09-May-1994 |
jtc | branches: 1.9.4; merge in our POSIX.2 changes (again)
|
1.8 |
| 07-May-1994 |
cgd | clean up conflicts
|
1.7 |
| 06-May-1994 |
jtc | merge our changes into 4.4lite
|
1.6 |
| 11-Nov-1993 |
jtc | First pass at getting a clean compile with "gcc -Wall", mostly explictly declaring function return values, etc.
|
1.5 |
| 26-Aug-1993 |
jtc | Declare rcsid strings so they are stored in text segment.
|
1.4 |
| 23-Aug-1993 |
jtc | Don't block SIGINT, SIGQUIT, SIGHUP, etc. in pclose()... "Some historical implementations either block or ignore the signals SIGINT, SIGQUIT, and SIGHUP while waiting for the child process to terminate. Since this behavior is not described in POSIX.2, such implementations are not conforming."
|
1.3 |
| 21-Aug-1993 |
jtc | If mode is niether 'r' or 'w', set errno to EINVAL as per 1003.2-92.
|
1.2 |
| 30-Jul-1993 |
mycroft | Add even more RCS frobs.
|
1.1 |
| 21-Mar-1993 |
cgd | branches: 1.1.1; Initial revision
|
1.1.1.3 |
| 02-Feb-1998 |
perry | import lite-2
|
1.1.1.2 |
| 06-May-1994 |
jtc | 44lite code
|
1.1.1.1 |
| 21-Mar-1993 |
cgd | initial import of 386bsd-0.1 sources
|
1.9.4.1 |
| 02-May-1995 |
jtc | #include "namespace.h"
|
1.12.2.1 |
| 19-Sep-1996 |
jtc | snapshot namespace cleanup: gen
|
1.31.2.1 |
| 30-Oct-2012 |
yamt | sync with head
|
1.35.16.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.35.14.1 |
| 26-Jan-2019 |
pgoyette | Sync with HEAD
|
1.35.8.1 |
| 27-Jan-2019 |
martin | Pull up following revision(s) (requested by christos in ticket #1170):
lib/libc/gen/popen.c: revision 1.36
PR/53904: Jintao Zhu: Use a mutex instead of an rwlock to assure thread safety
|