1 #include <errno.h> 2 #include <stdio.h> 3 #include <stdlib.h> 4 #include <string.h> 5 #include <unistd.h> 6 7 #include <OS.h> 8 9 #include "user_thread.h" 10 11 int main()12main() 13 { 14 pid_t child = fork(); 15 if (child < 0) { 16 fprintf(stderr, "Error: fork() failed: %s\n", strerror(errno)); 17 exit(1); 18 } 19 20 if (child > 0) { 21 // the parent process -- wait for the child to finish 22 status_t result; 23 wait_for_thread(child, &result); 24 } 25 26 struct user_thread *t = get_user_thread(); 27 printf("defer_signals: %" B_PRId32 "\n", t->defer_signals); 28 29 return 0; 30 } 31