14 if (swapcontext(&uc_child, &uc_main) != 0)
18 int main(int argc, char *argv[])
23 /* the default is that it fails */
24 if ((fp = fopen("conftestval", "w")) == NULL)
29 /* configure a child user-space context */
30 if ((stack = malloc(64*1024)) == NULL)
32 if (getcontext(&uc_child) != 0)
34 uc_child.uc_link = NULL;
35 uc_child.uc_stack.ss_sp = (char *)stack+(32*1024);
36 uc_child.uc_stack.ss_size = 32*1024;
37 uc_child.uc_stack.ss_flags = 0;
38 makecontext(&uc_child, child, 0);
40 /* switch into the user context */
41 if (swapcontext(&uc_main, &uc_child) != 0)
44 /* Fine, child came home */
45 if ((fp = fopen("conftestval", "w")) == NULL)
50 /* die successfully */