Last active
August 29, 2015 14:00
-
-
Save mkusher/e91f6778f03e59201f07 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pid_t create_child(const char* pathname, const int uniq, const int time, const int times) { | |
pid_t pid = fork(); | |
int error; | |
if(!pid) { | |
printf("Child\n"); | |
error = execl("bin/child", "bin/child", | |
pathname, | |
(char *) &uniq, | |
(char *) &time, | |
(char *) ×, | |
0 | |
); | |
if(error == -1) | |
printf("Exec Error: %s\n", strerror(errno)); | |
exit(-1); | |
} | |
else if(pid < 0){ | |
printf("Fork Error: %s\n", strerror(errno)); | |
exit(-1); | |
} | |
return pid; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment