Hi, Maybe this is a little bit stupid from me but it appears I got some problem killing an innocent child process (I show the code below ...)
Got Cygwin from cygwin.com about 15 days ago...running on Windows2000 If I call from my parent process a simple kill(pid) then it doesn't stop the child process at all, or maybe after more than one minute but I don't think so... If I send from my parent process a kill(pid,x) where x is 1 or 9, then when I wait after in parent for child termination with waitfunction I have a segmentation fault during wait... PS if parent is killed with Ctrl-C, I can kill child then from shell with kill pid Thanks for your help Pierre #include <unistd.h> #include <sys\types.h> #include <stdio.h> #include <stdlib.h> #include <time.h> int main(int argc,char ** argv){ pid_t pid; int times = 10; int i; pid=fork(); if (pid < 0){ return 1; } else if (pid == 0){ //Child while(1){ sleep(5); printf("Child\n");fflush(stdout); } return 0; } else{//Parent for(i=1;i<=times;i++){ sleep(1); printf("Parent\n");fflush(stdout); } printf("Killing Child (pid %d)\n",pid); kill(pid); //Or kill(pid,1) printf("Waiting for child to terminate\n"); wait(); //Seg Fault if kill(pid,1) //Wait till tomorrow if kill(pid) printf("Exiting\n");fflush(stdout); return 0; } } ===== Pierre Mallard 4 rue Auguste Marin 94100 Saint Maur des Fossés tel : (0033) 148838749 (0033) 666351977 _________________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/