37bb0dc6620079e6b7b612e673c36e02debb62ae
[c11tester.git] / pipe.cc
1 #include "common.h"
2 #include <unistd.h>
3 #include "model.h"
4 #include <dlfcn.h>
5
6 static int (*pipe_init_p)(int filep[2]) = NULL;
7
8 int pipe(int fildes[2]) {
9   if (!model) {
10     snapshot_system_init(10000, 1024, 1024, 40000);
11     model = new ModelChecker();
12     model->startChecker();
13   }
14   if (!pipe_init_p) {
15     pipe_init_p = (int (*)(int file[2])) dlsym(RTLD_NEXT, "pipe");
16     if ((error = dlerror()) != NULL) {
17       fputs(error, stderr);
18       exit(EXIT_FAILURE);
19     }
20   }
21   pipe_init_p(filedes);
22 }