[ create a new paste ] login | about

Link: http://codepad.org/vcHm0qat    [ raw code | output | fork ]

C, pasted on Mar 21:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include<unistd.h>
#include<stdio.h>
int global=6;
int main(int argc,char**argv){
int var=10;
int pid=fork();
if(pid==-1){
printf("error!");
}else if(pid==0){
global++;
var++;
printf("This is the child process!/n");
}else{
printf("This is the parent process! Child processed =%d/n",pid);
}printf("%d,%d,%d/n",getpid(),global,var);
return 1;
}


Output:
1
Disallowed system call: SYS_fork


Create a new paste based on this one


Comments: