X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/7eef625065d0b3af4a64b5665009491426db974f..8423595b8bebff110e6d5b5619f7206d6c5f2ceb:/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c diff --git a/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c b/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c index a0a73373c8..1c39b5c0ab 100644 --- a/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c +++ b/buildtools/Cmake/test_prog/prog_AC_CHECK_MCSC.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2010. The SimGrid Team. +/* Copyright (c) 2010, 2014. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -6,8 +6,10 @@ #include #include + #ifdef _XBT_WIN32 -#include +#include "xbt/win32_ucontext.h" +#include "win32_ucontext.c" #else #include #endif @@ -21,43 +23,43 @@ ucontext_t uc_main; void child(void) { - if (swapcontext(&uc_child, &uc_main) != 0) - exit(2); + if (swapcontext(&uc_child, &uc_main) != 0) + exit(2); } int main(int argc, char *argv[]) { - FILE *fp; - void *stack; - - /* the default is that it fails */ - if ((fp = fopen("conftestval", "w")) == NULL) - exit(3); - fprintf(fp, "no\n"); - fclose(fp); - - /* configure a child user-space context */ - if ((stack = malloc(64*1024)) == NULL) - exit(4); - if (getcontext(&uc_child) != 0) - 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, 0); - - /* switch into the user context */ - if (swapcontext(&uc_main, &uc_child) != 0) - exit(6); - - /* Fine, child came home */ - if ((fp = fopen("conftestval", "w")) == NULL) - exit(7); - fprintf(fp, "yes\n"); - fclose(fp); - - /* die successfully */ - exit(0); - return 1; + FILE *fp; + void *stack; + + /* the default is that it fails */ + if ((fp = fopen("conftestval", "w")) == NULL) + exit(3); + fprintf(fp, "no\n"); + fclose(fp); + + /* configure a child user-space context */ + if ((stack = malloc(64 * 1024)) == NULL) + exit(4); + if (getcontext(&uc_child) != 0) + 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, 0); + + /* switch into the user context */ + if (swapcontext(&uc_main, &uc_child) != 0) + exit(6); + + /* Fine, child came home */ + if ((fp = fopen("conftestval", "w")) == NULL) + exit(7); + fprintf(fp, "yes\n"); + fclose(fp); + + /* die successfully */ + exit(0); + return 1; }