Is the fork on mac (OSX-10.9.2) with the default compiler(gcc-4.2) any different from normal fork?
问题 I'm executing this program #include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <unistd.h> int main() { pid_t pid; pid = getpid(); printf("my pid is %d", pid); fork(); pid = getpid(); if(pid < 0) { printf("error creating child process"); exit(1); } if(pid > 0) { printf("\n my child's pid is %d \n", pid); exit(0); } printf("hello from child process, im still running"); return 0; } I expect the result to be : my pid is 5830 my child's pid is 5831 hello from child process, i'm