Home | History | Annotate | Download | only in stdlib
History log of /src/lib/libc/stdlib/system.c
RevisionDateAuthorComments
 1.28  14-Mar-2022  riastradh system(3): Simplify initialization of argp.
 1.27  14-Mar-2022  riastradh system(3): Switch from vfork/execve to posix_spawn.

Changes by me:
- Minor style nits.
- Set errno on posix_spawn failure.
- Handle edge cases of SIGINT/SIGQUIT set to SIG_IGN by caller.


Author: Nikita Ronja Gillmann <nikita@NetBSD.org>
Committer: Taylor R Campbell <riastradh@NetBSD.org>
 1.26  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.25  20-Jan-2015  christos Fix non _REENTRANT build.
 1.24  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.23  14-Nov-2010  tron branches: 1.23.6;
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.22  27-Aug-2008  christos branches: 1.22.6;
system(NULL) should return if the command interpreter is there or not.
Andy Shevchenko
 1.21  07-Oct-2006  elad branches: 1.21.18;
Correctly recover signal state if failed trying to set it.

Patch from David A. Holland in #NetBSD-code, thanks!
 1.20  29-Nov-2005  christos WARNS=4
 1.19  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.18  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.17  31-Oct-2001  kleink Inspired by Stevens' APUE and the implementation example in XSH:
* Don't return if wait()ing for the child is interrupted.
* Fix a race condition for the parent's SIG{INT,QUIT} disposition.
* While we're here, convert from using signal(3) to sigaction(2).
 1.16  15-Nov-1998  christos branches: 1.16.10; 1.16.12;
delint
 1.15  26-Sep-1998  christos Adapt to posix signal system calls.
 1.14  30-Jan-1998  perry update to lite-2
 1.13  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.12  13-Jul-1997  christos Add local.h for local prototypes.
Fix namespace issues for strtoq and strtouq
Fix gcc warnings.
Fix RCSID's
 1.11  28-Dec-1995  thorpej branches: 1.11.2;
New-style RCS ids.
 1.10  14-Jun-1995  jtc add explicit return type
 1.9  28-Feb-1995  jtc remove unneeded "#include <stddef.h>"
 1.8  28-Feb-1995  jtc Changed <sys/signal.h> to <signal.h>
 1.7  26-Aug-1993  jtc branches: 1.7.4;
Declare rcsid strings so they are stored in text segment.
 1.6  20-Aug-1993  jtc cast away compiler warning message.
 1.5  20-Aug-1993  jtc Upgraded to be 1003.2-92 compliant. The only functional change is
that -1 is returned when the fork fails. Updated implementation to
use int rather than deprecated "union wait". Updated documentation
to describe error / return values.
 1.4  01-Aug-1993  mycroft Add RCS identifiers.
 1.3  30-Jul-1993  mycroft system.c
 1.2  29-Jul-1993  mycroft Use execve() rather than execl(). This is faster and doesn't use malloc()
(and thus avoids an annoying problem which only seems to manifest itself
in KCL).
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  30-Jan-1998  perry import lite-2
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.7.4.1  02-May-1995  jtc #include "namespace.h"
 1.11.2.1  18-Sep-1996  jtc snapshot namespace cleanup: stdlib
 1.16.12.1  14-Nov-2001  nathanw Catch up to -current.
 1.16.10.1  09-Dec-2001  he Pull up revision 1.17 (requested by kleink):
Don't return if wait()ing for the child is interrupted; fix a
race condition for the parent's SIG{INT,QUIT} disposition.
 1.21.18.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.22.6.2  27-Aug-2008  christos system(NULL) should return if the command interpreter is there or not.
Andy Shevchenko
 1.22.6.1  27-Aug-2008  christos file system.c was added on branch christos-time_t on 2008-08-27 06:45:03 +0000
 1.23.6.1  30-Oct-2012  yamt sync with head

RSS XML Feed