X-Git-Url: http://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fconfigurator%2Fconfigurator.c;h=e322c76c72254f2f6089e0e5173978eaededd24d;hp=021fc0f9f183a711f67231625dc04da3c615440d;hb=891b43ea4b6d09db68ee83f7086b5673e2806733;hpb=434fcf81cb19472a05d58a35333d4f9d68ea52b9 diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index 021fc0f9..e322c76c 100644 --- a/tools/configurator/configurator.c +++ b/tools/configurator/configurator.c @@ -319,6 +319,52 @@ static struct test tests[] = { "-Werror -fopenmp" }, { "HAVE_VALGRIND_MEMCHECK_H", OUTSIDE_MAIN, NULL, NULL, "#include \n" }, + { "HAVE_UCONTEXT", DEFINES_EVERYTHING|EXECUTE, + NULL, NULL, + "#include \n" + "static int x = 0;\n" + "static char stack[2048];\n" + "static ucontext_t a, b;\n" + "static void fn(void) {\n" + " x |= 2;\n" + " setcontext(&b);\n" + " x |= 4;\n" + "}\n" + "int main(void) {\n" + " x |= 1;\n" + " getcontext(&a);\n" + " a.uc_stack.ss_sp = stack;\n" + " a.uc_stack.ss_size = sizeof(stack);\n" + " makecontext(&a, fn, 0);\n" + " swapcontext(&b, &a);\n" + " return (x == 3) ? 0 : 1;\n" + "}\n" + }, + { "HAVE_POINTER_SAFE_MAKECONTEXT", DEFINES_EVERYTHING|EXECUTE, + "HAVE_UCONTEXT", NULL, + "#include \n" + "#include \n" + "static int worked = 0;\n" + "static char stack[1024];\n" + "static ucontext_t a, b;\n" + "static void fn(void *p, void *q) {\n" + " void *cp = &worked;\n" + " void *cq = (void *)(~((ptrdiff_t)cp));\n" + " if ((p == cp) && (q == cq))\n" + " worked = 1;\n" + " setcontext(&b);\n" + "}\n" + "int main(void) {\n" + " void *ap = &worked;\n" + " void *aq = (void *)(~((ptrdiff_t)ap));\n" + " getcontext(&a);\n" + " a.uc_stack.ss_sp = stack;\n" + " a.uc_stack.ss_size = sizeof(stack);\n" + " makecontext(&a, (void (*)(void))fn, 2, ap, aq);\n" + " swapcontext(&b, &a);\n" + " return worked ? 0 : 1;\n" + "}\n" + }, }; static char *grab_fd(int fd) @@ -593,8 +639,8 @@ int main(int argc, const char *argv[]) run_test(cmd, &tests[i]); free(cmd); - unlink(OUTPUT_FILE); - unlink(INPUT_FILE); + remove(OUTPUT_FILE); + remove(INPUT_FILE); printf("/* Generated by CCAN configurator */\n" "#ifndef CCAN_CONFIG_H\n"