Skip to content

Commit

Permalink
fix sample code
Browse files Browse the repository at this point in the history
  • Loading branch information
R3DNO5E authored Nov 8, 2021
1 parent 9a36255 commit 63b2734
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions 6.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ int main(){
print_pid("parent");
void* stack = mmap(NULL,1024*1024,PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN|MAP_STACK,-1,0);
pid_t c = clone(print_pid,stack,SIGCHLD,"child");
pid_t c = clone((int(*)(void*))print_pid,stack,CLONE_NEWPID|SIGCHLD,"child");
if(c == -1){
puts("clone failed!\n");
return -1;
Expand Down Expand Up @@ -138,7 +138,7 @@ int main(){
print_pid("parent");
void* stack = mmap(NULL,1024*1024,PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS|MAP_GROWSDOWN|MAP_STACK,-1,0);
pid_t c = clone(print_pid,stack,SIGCHLD,"child");
pid_t c = clone((int(*)(void*))print_pid,stack,CLONE_NEWPID|SIGCHLD,"child");
if(c == -1){
puts("clone failed!\n");
return -1;
Expand Down

0 comments on commit 63b2734

Please sign in to comment.