DF-2828 / trigger_mt.c
/* DF-2828 probe: multi-threaded CKPT_THAW violates vmspace_exec()'s * single-thread requirement (pmap_replacevm: KKASSERT(p->p_nthreads == 1)) */ #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <pthread.h> static void *idle(void *x) { for (;;) sleep(1); return 0; } int main(int argc, char **argv) { pthread_t t; void *img = (argc > 1) ? (void*)argv[1] : (void*)"/root/df2826/clean.ckpt"; int fd; if (pthread_create(&t, NULL, idle, NULL)) { perror("pthread_create"); return 1; } sleep(1); fd = open((char*)img, O_RDONLY); if (fd < 0) { perror("open"); return 1; } printf("trigger-mt: 2 threads, fd=%d, CKPT_THAW...\n", fd); fflush(stdout); printf("trigger-mt: rc=%ld\n", syscall(467, 2, fd, -1, 0)); fflush(stdout); return 0; } |