commit 11ae6de94d664cb94d39a00e98031e1c5e134c21
parent 7414e9996dc38431669b1da77013891e3f8940d6
Author: Russ Cox <rsc@swtch.com>
Date:   Sat, 28 Jun 2008 11:40:50 -0400
9vx/OSX: must wait until after fork to install sigaltstack
Diffstat:
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/9vx/main.c b/src/9vx/main.c
@@ -48,6 +48,8 @@ extern int tracekdev;
 static int singlethread;
 
 static void	bootinit(void);
+static void	siginit(void);
+
 static char*	getuser(void);
 static char*	findroot(void);
 
@@ -154,6 +156,12 @@ main(int argc, char **argv)
 		_exit(0);
 
 	/*
+	 * Have to do this after fork; on OS X child does
+	 * not inherit sigaltstack.
+	 */
+	siginit();
+
+	/*
 	 * Debugging: tell user what options we guessed.
 	 */
 	print("9vx %s-r %s -u %s\n", usetty ? "-t " : "", localroot, username);
@@ -642,12 +650,21 @@ setsigsegv(int vx32)
 void
 mach0init(void)
 {
-	struct sigaction act;
-
 #ifndef TLS
 	machkeyinit();
 #endif
 
+	conf.nmach = 1;
+	machinit();	/* common per-processor init */
+	active.machs = 1;
+	active.exiting = 0;
+}
+
+static void
+siginit(void)
+{
+	struct sigaction act;
+
 	/* Install vx32signal handlers ... */
 	vx32_siginit();
 	
@@ -660,10 +677,6 @@ mach0init(void)
 	sigaction(SIGUSR1, &act, nil);
 	sigaction(SIGURG, &act, nil);
 
-	conf.nmach = 1;
-	machinit();	/* common per-processor init */
-	active.machs = 1;
-	active.exiting = 0;
 }
 
 void