search for: ev_exit

Displaying 15 results from an estimated 15 matches for "ev_exit".

2019 Jan 25
0
[klibc:update-dash] [SHELL] Optimize dash -c "command" to avoid a fork
...nd" to avoid a fork On Sun, Apr 10, 2011 at 07:36:49AM +0000, Jonathan Nieder wrote: > From: Jilles Tjoelker <jilles at stack.nl> > Date: Sat, 13 Jun 2009 16:17:45 -0500 > > This change only affects strings passed to -c, when the -s option is > not used. > > Use the EV_EXIT flag to inform the eval machinery that the string > being passed is the entirety of input. This way, a fork may be > omitted in many special cases. > > If there are empty lines after the last command, the evalcmd will not > see the end early enough and forks will not be omitted. The...
2020 Mar 28
0
[klibc:update-dash] dash: [SHELL] Optimize dash -c "command" to avoid a fork
...4d955606288de36c3d4eab ] On Sun, Apr 10, 2011 at 07:36:49AM +0000, Jonathan Nieder wrote: > From: Jilles Tjoelker <jilles at stack.nl> > Date: Sat, 13 Jun 2009 16:17:45 -0500 > > This change only affects strings passed to -c, when the -s option is > not used. > > Use the EV_EXIT flag to inform the eval machinery that the string > being passed is the entirety of input. This way, a fork may be > omitted in many special cases. > > If there are empty lines after the last command, the evalcmd will not > see the end early enough and forks will not be omitted. The...
2012 Jul 02
0
[klibc:master] [EVAL] Remove unused EV_BACKCMD flag
...| 64 ++++++++++++++++-------------------------------------- 1 files changed, 19 insertions(+), 45 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index 26302a7..d675ba7 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -68,7 +68,6 @@ /* flags in argument to evaltree */ #define EV_EXIT 01 /* exit after evaluating tree */ #define EV_TESTED 02 /* exit status is checked; ignore -e flag */ -#define EV_BACKCMD 04 /* command executing within back quotes */ int evalskip; /* set if we are skipping commands */ STATIC int skipcount; /* number of levels to skip */ @@ -594,6 +593,...
2019 Jan 25
0
[klibc:update-dash] eval: Return status in eval functions
...evalbltin(const struct builtincmd *, int, char **, int); STATIC int evalfun(struct funcnode *, int, char **, int); @@ -170,11 +170,13 @@ evalstring(char *s, int flags) setstackmark(&smark); status = 0; - while ((n = parsecmd(0)) != NEOF) { - evaltree(n, flags & ~(parser_eof() ? 0 : EV_EXIT)); + for (; (n = parsecmd(0)) != NEOF; popstackmark(&smark)) { + int i; + + i = evaltree(n, flags & ~(parser_eof() ? 0 : EV_EXIT)); if (n) - status = exitstatus; - popstackmark(&smark); + status = i; + if (evalskip) break; } @@ -192,13 +194,13 @@ evalstring(char *s, i...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Return status in eval functions
...evalbltin(const struct builtincmd *, int, char **, int); STATIC int evalfun(struct funcnode *, int, char **, int); @@ -170,11 +170,13 @@ evalstring(char *s, int flags) setstackmark(&smark); status = 0; - while ((n = parsecmd(0)) != NEOF) { - evaltree(n, flags & ~(parser_eof() ? 0 : EV_EXIT)); + for (; (n = parsecmd(0)) != NEOF; popstackmark(&smark)) { + int i; + + i = evaltree(n, flags & ~(parser_eof() ? 0 : EV_EXIT)); if (n) - status = exitstatus; - popstackmark(&smark); + status = i; + if (evalskip) break; } @@ -192,13 +194,13 @@ evalstring(char *s, i...
2019 Jan 25
0
[klibc:update-dash] [TRAP] Make sure evalskip is zero before running traps
...quot;evaltree(NULL) called\n")); goto out; } + + dotrap(); + #ifndef SMALL displayhist = 1; /* show history substitutions done with fc */ #endif @@ -308,8 +311,7 @@ out: if (checkexit & exitstatus) goto exexit; - if (pendingsigs) - dotrap(); + dotrap(); if (flags & EV_EXIT) { exexit: diff --git a/usr/dash/trap.c b/usr/dash/trap.c index 182fa7ac..3ff45318 100644 --- a/usr/dash/trap.c +++ b/usr/dash/trap.c @@ -315,6 +315,9 @@ void dotrap(void) int i; int savestatus; + if (!pendingsigs) + return; + savestatus = exitstatus; pendingsigs = 0; barrier(); @@ -3...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Fail immediately with redirections errors for simple command
...- exraise(EXERROR); - - goto out; } jp = NULL; /* Execute the command. */ switch (cmdentry.cmdtype) { + case CMDUNKNOWN: + status = 127; +#ifdef FLUSHERR + flushout(&errout); +#endif + goto bail; + default: /* Fork off a child process if necessary. */ if (!(flags & EV_EXIT) || have_traps()) {
2020 Mar 28
0
[klibc:update-dash] dash: eval: make traps work when "set -e" is enabled
...nsertions(+), 2 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index 01bc5234..09a5cbf1 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -307,11 +307,11 @@ setstatus: break; } out: + dotrap(); + if (checkexit & status) goto exexit; - dotrap(); - if (flags & EV_EXIT) { exexit: exraise(EXEXIT);
2019 Jan 25
0
[klibc:update-dash] jobs - Do not block when waiting on SIGCHLD
...--- usr/dash/eval.c | 12 ++++-------- usr/dash/jobs.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index 2f662e3e..56661880 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -859,10 +859,8 @@ bail: if (!(flags & EV_EXIT) || have_traps()) { INTOFF; jp = makejob(cmd, 1); - if (forkshell(jp, cmd, FORK_FG) != 0) { - INTON; + if (forkshell(jp, cmd, FORK_FG) != 0) break; - } FORCEINTON; } listsetvar(varlist.list, VEXPORT|VSTACK); @@ -875,11 +873,8 @@ bail: if (execcmd && argc...
2020 Mar 28
0
[klibc:update-dash] dash: [TRAP] Make sure evalskip is zero before running traps
...quot;evaltree(NULL) called\n")); goto out; } + + dotrap(); + #ifndef SMALL displayhist = 1; /* show history substitutions done with fc */ #endif @@ -308,8 +311,7 @@ out: if (checkexit & exitstatus) goto exexit; - if (pendingsigs) - dotrap(); + dotrap(); if (flags & EV_EXIT) { exexit: diff --git a/usr/dash/trap.c b/usr/dash/trap.c index 182fa7ac..3ff45318 100644 --- a/usr/dash/trap.c +++ b/usr/dash/trap.c @@ -315,6 +315,9 @@ void dotrap(void) int i; int savestatus; + if (!pendingsigs) + return; + savestatus = exitstatus; pendingsigs = 0; barrier(); @@ -3...
2020 Mar 28
0
[klibc:update-dash] dash: jobs - Do not block when waiting on SIGCHLD
...--- usr/dash/eval.c | 12 ++++-------- usr/dash/jobs.c | 13 ++++++++++--- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index 722066e5..13e690e7 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -859,10 +859,8 @@ bail: if (!(flags & EV_EXIT) || have_traps()) { INTOFF; jp = makejob(cmd, 1); - if (forkshell(jp, cmd, FORK_FG) != 0) { - INTON; + if (forkshell(jp, cmd, FORK_FG) != 0) break; - } FORCEINTON; } listsetvar(varlist.list, VEXPORT|VSTACK); @@ -875,11 +873,8 @@ bail: if (execcmd && argc...
2019 Jan 25
0
[klibc:update-dash] eval: Fix exit status when calling eval/dot with no commands
...tions(+), 2 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index db7639a4..ef6ec0ef 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -172,7 +172,8 @@ evalstring(char *s, int flags) status = 0; while ((n = parsecmd(0)) != NEOF) { evaltree(n, flags & ~(parser_eof() ? 0 : EV_EXIT)); - status = exitstatus; + if (n) + status = exitstatus; popstackmark(&smark); if (evalskip) break; diff --git a/usr/dash/main.c b/usr/dash/main.c index bedb6635..497ac160 100644 --- a/usr/dash/main.c +++ b/usr/dash/main.c @@ -228,7 +228,8 @@ cmdloop(int top) job_warning = (j...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Only restore exit status on exit/return
...EXITRESET { - evalskip = 0; - loopnest = 0; if (savestatus >= 0) { - exitstatus = savestatus; + if (exception == EXEXIT || evalskip == SKIPFUNCDEF) + exitstatus = savestatus; savestatus = -1; } + evalskip = 0; + loopnest = 0; } #endif @@ -318,7 +319,7 @@ out: if (flags & EV_EXIT) { exexit: - exraise(EXEXIT); + exraise(EXEND); } popstackmark(&smark); diff --git a/usr/dash/exec.c b/usr/dash/exec.c index 9d0215a6..87354d49 100644 --- a/usr/dash/exec.c +++ b/usr/dash/exec.c @@ -143,7 +143,7 @@ shellexec(char **argv, const char *path, int idx) exitstatus = exerrn...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Fix exit status when calling eval/dot with no commands
...tions(+), 2 deletions(-) diff --git a/usr/dash/eval.c b/usr/dash/eval.c index 3325cb62..0380d1d2 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -172,7 +172,8 @@ evalstring(char *s, int flags) status = 0; while ((n = parsecmd(0)) != NEOF) { evaltree(n, flags & ~(parser_eof() ? 0 : EV_EXIT)); - status = exitstatus; + if (n) + status = exitstatus; popstackmark(&smark); if (evalskip) break; diff --git a/usr/dash/main.c b/usr/dash/main.c index bedb6635..497ac160 100644 --- a/usr/dash/main.c +++ b/usr/dash/main.c @@ -228,7 +228,8 @@ cmdloop(int top) job_warning = (j...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Add vfork support
...); #endif + + if (vforked) + _exit(exitstatus); + INTOFF; exception = e; diff --git a/usr/dash/eval.c b/usr/dash/eval.c index 77a8bded..7bb636e1 100644 --- a/usr/dash/eval.c +++ b/usr/dash/eval.c @@ -892,10 +892,8 @@ bail: /* Fork off a child process if necessary. */ if (!(flags & EV_EXIT) || have_traps()) { INTOFF; - jp = makejob(cmd, 1); - if (forkshell(jp, cmd, FORK_FG) != 0) - break; - FORCEINTON; + jp = vforkexec(cmd, argv, path, cmdentry.u.index); + break; } shellexec(argv, path, cmdentry.u.index); /* NOTREACHED */ diff --git a/usr/dash/exec.h b/usr/d...