search for: gotsigchld

Displaying 10 results from an estimated 10 matches for "gotsigchld".

2020 Mar 28
0
[klibc:update-dash] dash: jobs: Only clear gotsigchld when waiting for everything
...libc.git;a=commit;h=93ae53d4cde3d461f987804e9bb3f2291c59c30f Author: Herbert Xu <herbert at gondor.apana.org.au> AuthorDate: Sat, 19 May 2018 02:39:41 +0800 Committer: Ben Hutchings <ben at decadent.org.uk> CommitDate: Sat, 28 Mar 2020 21:42:55 +0000 [klibc] dash: jobs: Only clear gotsigchld when waiting for everything [ dash commit 6c691b3e5099de380a9d2f97d5c72f4a978bb794 ] The gotsigchld flag is always cleared in dowait but not all callers of dowait will wait for everything. In particular, when jp is set we only wait until the set job isn't running anymore. This patch fixes t...
2019 Jan 25
0
[klibc:update-dash] trap: Globally rename pendingsigs to pending_sig
...+++ b/usr/dash/jobs.c @@ -647,7 +647,7 @@ out: return retval; sigout: - retval = 128 + pendingsigs; + retval = 128 + pending_sig; goto out; } @@ -1146,7 +1146,7 @@ waitproc(int block, int *status) sigfillset(&mask); sigprocmask(SIG_SETMASK, &mask, &oldmask); - while (!gotsigchld && !pendingsigs) + while (!gotsigchld && !pending_sig) sigsuspend(&oldmask); sigclearmask(); diff --git a/usr/dash/miscbltin.c b/usr/dash/miscbltin.c index c47fdbf8..fc14dc4b 100644 --- a/usr/dash/miscbltin.c +++ b/usr/dash/miscbltin.c @@ -207,7 +207,7 @@ readcmd(int a...
2020 Mar 28
0
[klibc:update-dash] dash: trap: Globally rename pendingsigs to pending_sig
...+++ b/usr/dash/jobs.c @@ -647,7 +647,7 @@ out: return retval; sigout: - retval = 128 + pendingsigs; + retval = 128 + pending_sig; goto out; } @@ -1146,7 +1146,7 @@ waitproc(int block, int *status) sigfillset(&mask); sigprocmask(SIG_SETMASK, &mask, &oldmask); - while (!gotsigchld && !pendingsigs) + while (!gotsigchld && !pending_sig) sigsuspend(&oldmask); sigclearmask(); diff --git a/usr/dash/miscbltin.c b/usr/dash/miscbltin.c index c47fdbf8..fc14dc4b 100644 --- a/usr/dash/miscbltin.c +++ b/usr/dash/miscbltin.c @@ -207,7 +207,7 @@ readcmd(int a...
2019 Jan 25
0
[klibc:update-dash] jobs - Do not block when waiting on SIGCHLD
...0 [klibc] jobs - Do not block when waiting on SIGCHLD Because of the nature of SIGCHLD, the process may have already been waited on and therefore we must be prepared for the case that wait may block. So ensure that it doesn't by using WNOHANG. Furthermore, multiple jobs may have exited when gotsigchld is set. Therefore we need to wait until there are no zombies left. Lastly, waitforjob needs to be called with interrupts off and the original patch broke that. Fixes: 03876c0743a5 ("eval: Reap zombies after built-in...") Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> S...
2020 Mar 28
0
[klibc:update-dash] dash: jobs - Do not block when waiting on SIGCHLD
...dash commit 9e5cd41d9605e4caaac3aacdc0482f6ee220a298 ] Because of the nature of SIGCHLD, the process may have already been waited on and therefore we must be prepared for the case that wait may block. So ensure that it doesn't by using WNOHANG. Furthermore, multiple jobs may have exited when gotsigchld is set. Therefore we need to wait until there are no zombies left. Lastly, waitforjob needs to be called with interrupts off and the original patch broke that. Fixes: 03876c0743a5 ("eval: Reap zombies after built-in...") Signed-off-by: Herbert Xu <herbert at gondor.apana.org.au> S...
2020 Mar 28
0
[klibc:update-dash] dash: eval: Add vfork support
...et_t oldmask; int flags = block == DOWAIT_BLOCK ? 0 : WNOHANG; int err; @@ -1119,8 +1166,7 @@ waitproc(int block, int *status) if (err || (err = -!block)) break; - sigfillset(&mask); - sigprocmask(SIG_SETMASK, &mask, &oldmask); + sigblockall(&oldmask); while (!gotsigchld && !pending_sig) sigsuspend(&oldmask); diff --git a/usr/dash/jobs.h b/usr/dash/jobs.h index 953ee871..6ac6c56d 100644 --- a/usr/dash/jobs.h +++ b/usr/dash/jobs.h @@ -83,6 +83,8 @@ struct job { struct job *prev_job; /* previous job */ }; +union node; + extern pid_t backgndpid;...
2019 Jan 25
0
[klibc:update-dash] trap: Implement POSIX.1-2008 trap reset behaviour
.../dash/trap.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/usr/dash/trap.c b/usr/dash/trap.c index a6997d4f..89ceff4f 100644 --- a/usr/dash/trap.c +++ b/usr/dash/trap.c @@ -78,6 +78,8 @@ volatile sig_atomic_t pendingsigs; /* received SIGCHLD */ int gotsigchld; +static int decode_signum(const char *); + #ifdef mkinit INCLUDE "trap.h" INIT { @@ -111,7 +113,7 @@ trapcmd(int argc, char **argv) } return 0; } - if (!ap[1]) + if (!ap[1] || decode_signum(*ap) >= 0) action = NULL; else action = *ap++; @@ -399,18 +401,27 @@ out:...
2020 Mar 28
0
[klibc:update-dash] dash: trap: Implement POSIX.1-2008 trap reset behaviour
.../dash/trap.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/usr/dash/trap.c b/usr/dash/trap.c index a6997d4f..89ceff4f 100644 --- a/usr/dash/trap.c +++ b/usr/dash/trap.c @@ -78,6 +78,8 @@ volatile sig_atomic_t pendingsigs; /* received SIGCHLD */ int gotsigchld; +static int decode_signum(const char *); + #ifdef mkinit INCLUDE "trap.h" INIT { @@ -111,7 +113,7 @@ trapcmd(int argc, char **argv) } return 0; } - if (!ap[1]) + if (!ap[1] || decode_signum(*ap) >= 0) action = NULL; else action = *ap++; @@ -399,18 +401,27 @@ out:...
2019 Jan 25
0
[klibc:update-dash] eval: Reap zombies after built-in commands and functions
...in.h" @@ -972,10 +973,11 @@ waitforjob(struct job *jp) { int st; - TRACE(("waitforjob(%%%d) called\n", jobno(jp))); - while (jp->state == JOBRUNNING) { + TRACE(("waitforjob(%%%d) called\n", jp ? jobno(jp) : 0)); + while ((jp && jp->state == JOBRUNNING) || gotsigchld) dowait(DOWAIT_BLOCK, jp); - } + if (!jp) + return exitstatus; st = getstatus(jp); #if JOBS if (jp->jobctl) {
2020 Mar 28
0
[klibc:update-dash] dash: eval: Reap zombies after built-in commands and functions
...in.h" @@ -972,10 +973,11 @@ waitforjob(struct job *jp) { int st; - TRACE(("waitforjob(%%%d) called\n", jobno(jp))); - while (jp->state == JOBRUNNING) { + TRACE(("waitforjob(%%%d) called\n", jp ? jobno(jp) : 0)); + while ((jp && jp->state == JOBRUNNING) || gotsigchld) dowait(DOWAIT_BLOCK, jp); - } + if (!jp) + return exitstatus; st = getstatus(jp); #if JOBS if (jp->jobctl) {