Coda File System

lwp fails on NetBSD

From: Greg Troxel <gdt_at_ir.bbn.com>
Date: Mon, 27 Jun 2005 15:46:38 -0400
lwp head fails to build on NetBSD/i386 1.6.2 because it contains
declarations after code.  Patch appended to fix it.  With this,
lwptest-static runs fine.  But, this is w/o ucontext but w/
sigaltstack.

But, the same static binary copied to a 2.99.15 system and a 2.0
system segfaults, apparently in errno() in libc.

(gcc 3 really needs an option to disallow C99isms; lots of software is
declaring variables after statements these days!)

Index: src/lwp_ucontext.c
===================================================================
RCS file: /coda-src/lwp/src/lwp_ucontext.c,v
retrieving revision 4.1
diff -u -r4.1 lwp_ucontext.c
--- src/lwp_ucontext.c	3 Mar 2005 18:53:51 -0000	4.1
+++ src/lwp_ucontext.c	27 Jun 2005 19:37:32 -0000
@@ -109,6 +109,13 @@
 {
     va_list ap;
     char *stack = ucp->uc_stack.ss_sp;
+
+#ifdef HAVE_SIGALTSTACK
+    struct sigaction action, oldaction;
+    sigset_t sigs, oldsigs;
+    stack_t oldstack;
+#endif
+
     assert(stack != NULL);
 
     child = ucp;
@@ -132,9 +139,6 @@
     savecontext(_thread, &parent, stack);
 
 #else /* HAVE_SIGALTSTACK */
-    struct sigaction action, oldaction;
-    sigset_t sigs, oldsigs;
-    stack_t oldstack;
 
     action.sa_handler = (void(*)(int))_thread;
     action.sa_flags = SA_ONSTACK;
Received on 2005-06-27 15:47:23