Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Do not require doxygen in maintainer mode
[simgrid.git] / acmacro / context.m4
index aa21ee1..f4faefc 100644 (file)
@@ -1,7 +1,7 @@
 dnl AC_CHECK_UCONTEXT: Check whether ucontext are working
 
 dnl Most of the code is stolen from the GNU pth autoconf macros by
-dnl Ralf S. Engelschall. As 
+dnl Ralf S. Engelschall. 
 dnl # ``"Reuse an expert's code" is the right
 dnl #   advice for most people. But it's a useless
 dnl #   advice for the experts writing the code
@@ -134,12 +134,10 @@ AC_TRY_RUN([
 ucontext_t uc_child;
 ucontext_t uc_main;
 
-void child(void *arg)
+void child(void)
 {
-    if (arg != (void *)12345)
-        exit(1);
     if (swapcontext(&uc_child, &uc_main) != 0)
-        exit(1);
+        exit(2);
 }
 
 int main(int argc, char *argv[])
@@ -149,28 +147,28 @@ int main(int argc, char *argv[])
 
     /* the default is that it fails */
     if ((fp = fopen("conftestval", "w")) == NULL)
-        exit(1);
+        exit(3);
     fprintf(fp, "no\n");
     fclose(fp);
 
     /* configure a child user-space context */
     if ((stack = malloc(64*1024)) == NULL)
-        exit(1);
+        exit(4);
     if (getcontext(&uc_child) != 0)
-        exit(1);
+        exit(5);
     uc_child.uc_link = NULL;
     uc_child.uc_stack.ss_sp = (char *)stack+(32*1024);
     uc_child.uc_stack.ss_size = 32*1024;
     uc_child.uc_stack.ss_flags = 0;
-    makecontext(&uc_child, child, 2, (void *)12345);
+    makecontext(&uc_child, child, 0);
 
     /* switch into the user context */
     if (swapcontext(&uc_main, &uc_child) != 0)
-        exit(1);
+        exit(6);
 
     /* Fine, child came home */
     if ((fp = fopen("conftestval", "w")) == NULL)
-        exit(1);
+        exit(7);
     fprintf(fp, "yes\n");
     fclose(fp);
 
@@ -343,7 +341,7 @@ int main(int argc, char *argv[])
         uc_handler.uc_stack.ss_sp    = (void *)(skaddr + sksize);
         uc_handler.uc_stack.ss_size  = sksize;
         uc_handler.uc_stack.ss_flags = 0;
-        makecontext(&uc_handler, handler, 1);
+        makecontext(&uc_handler, handler, 0);
         swapcontext(&uc_main, &uc_handler);
     }
 #endif