int main(int argc, char const *argv[]) { int i; extern int num; for (i=0; i < 2; i++) fxn(); printf("num is %i\n",num); return(0); }// end main
pid_t launch_pid(pid_t *p, void (*fxn)(track_t *, unsigned int, struct timespec*), track_t *track, unsigned int tracked, struct timespec *delay) { if (p_me==p_monitor) { fflush(stdout); fflush(stderr); *p=fork(); if (*p<0) die(EXIT_FAILURE,"%s: fork failed: %s, error code %d\n",progname,strerror(errno),errno); else if (*p==0) { p_me = *p = getpid(); fxn(track, tracked, delay); /* Child launches routine; should not return */ } } }