Create a gist now

Instantly share code, notes, and snippets.

@ywkw1717 /fork-test.c Secret
Created May 28, 2017

What would you like to do?
seccamp A-4 fork
#include <stdio.h>
#include <unistd.h>
#include <errno.h>
int main(){
pid_t pid;
pid = fork();
if(pid == -1){
printf(“failed. errorno:%d\n”, errno);
return 1;
} else if(pid == 0){
printf(“child\n”);
printf("%d\n", pid);
} else{
printf(“parent\n”);
printf("%d\n", pid);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment