zCore
zCore copied to clipboard
Parent process can not be waked when vfork() a second process
Hey bros, I am troubled by the waker.
int main(void){
int pid1 = vfork();
if (pid1) {
printf("Process %d try to do something more! \n",pid1);
int pid2 = vfork();
if (pid2) {
printf("Process %d try to do something! \n",pid2);
}else{
execl("/bin/dosomething", "/bin/dosomething", NULL);
}
}else{
execl("/bin/domorething", "/bin/domorething", NULL);
}
return 0;
}
For the above case that parent process first vfork one child, when the child start to execute domorething, the parent successfully awake and leave vfork(). But when the parent process vfork the second child process and child process also start to execute something, it seems that the parent process can not be awaked by the code bellow and go into poll method. So the parent process can not timely leave vfork(). Do you have some ideas about the waker?
https://github.com/rcore-os/zCore/blob/9290158e47db3d811dbdf9e2e6dacfa6650c3d0c/zircon-object/src/object/mod.rs#L317