From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] Different results for the same rc script when using listen1
Date: Sun, 24 Apr 2011 23:36:17 -0400 [thread overview]
Message-ID: <84c61fe2a739f0786622f2e27e7a1b82@ladd.quanstro.net> (raw)
In-Reply-To: <2afb8aa9b8f443793d7bf20463b78c1c@ladd.quanstro.net>
; hg diff rfork.c
> hmm. is that right? it's wait3/wait4 that's failing. it shouldn't
> be necesary to catch SIGCHLD for wait to work. but maybe
> it is
i take it back. i'd forgotten how quirky unix is these days.
here's the solution. not rc's fault. recompile lib9 and listen1:
diff -r 5caa04977471 src/lib9/rfork.c
--- a/src/lib9/rfork.c Sun Dec 27 09:22:43 2009 -0800
+++ b/src/lib9/rfork.c Sun Apr 24 23:33:52 2011 -0400
@@ -18,7 +18,9 @@
int n;
char buf[128], *q;
extern char **environ;
+ void *oldchild;
+ oldchild = nil;
if((flags&(RFPROC|RFFDG|RFMEM)) == (RFPROC|RFFDG)){
/* check other flags before we commit */
flags &= ~(RFPROC|RFFDG|RFENVG);
@@ -34,7 +36,7 @@
* NOWAIT once, they're not likely to want child notes
* after that.
*/
- signal(SIGCHLD, nop);
+ oldchild = signal(SIGCHLD, nop);
if(pipe(p) < 0)
return -1;
}
@@ -81,7 +83,10 @@
* Child - fork a new child whose wait message can't
* get back to the parent because we're going to exit!
*/
- signal(SIGCHLD, SIG_IGN);
+ if(oldchild == nil)
+ oldchild = signal(SIGCHLD, SIG_IGN);
+ else
+ signal(SIGCHLD, SIG_IGN);
close(p[0]);
pid = fork();
if(pid){
@@ -95,6 +100,8 @@
}else{
/* Child child - close pipe. */
close(p[1]);
+ if(oldchild)
+ signal(SIGCHLD, oldchild);
}
}
}
- erik
next prev parent reply other threads:[~2011-04-25 3:36 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-24 5:09 Maurício CA
2011-04-24 5:22 ` andrey mirtchovski
2011-04-24 7:30 ` Maurício CA
2011-04-24 14:20 ` smiley
2011-04-24 17:05 ` Maurício CA
2011-04-24 17:17 ` Bakul Shah
2011-04-25 0:16 ` Maurício CA
2011-04-25 2:00 ` Anthony Martin
2011-04-25 3:14 ` Maurício CA
2011-04-25 3:17 ` erik quanstrom
2011-04-25 3:36 ` erik quanstrom [this message]
2011-04-25 3:58 ` Bakul Shah
2011-04-25 4:39 ` erik quanstrom
2011-04-25 5:27 ` Lyndon Nerenberg
2011-04-25 5:53 ` Bakul Shah
2011-04-25 6:59 ` Robert Ransom
2011-04-25 14:56 ` Bakul Shah
2011-04-25 15:00 ` erik quanstrom
2011-04-25 16:17 ` Skip Tavakkolian
2011-04-25 16:27 ` Joseph Stewart
2011-04-25 20:13 ` smiley
2011-04-25 20:16 ` Lyndon Nerenberg
2011-04-25 20:18 ` erik quanstrom
2011-04-25 14:44 ` erik quanstrom
2011-04-25 13:53 ` Maurício CA
2011-04-25 14:42 ` erik quanstrom
2011-04-27 21:57 ` Maurício CA
2011-04-26 9:02 ` dexen deVries
2011-04-26 12:57 ` erik quanstrom
2011-04-25 2:03 ` andrey mirtchovski
2011-04-25 2:14 ` Iruatã Souza
2011-04-25 2:20 ` andrey mirtchovski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=84c61fe2a739f0786622f2e27e7a1b82@ladd.quanstro.net \
--to=quanstro@quanstro.net \
--cc=9fans@9fans.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).