From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Fri, 13 Oct 1995 15:29:23 -0400 From: beto@plan9.cs.su.oz.au beto@plan9.cs.su.oz.au Subject: Panel + forks + postnote Topicbox-Message-UUID: 2da29bc8-eac8-11e9-9e20-41e7f4b1d025 Message-ID: <19951013192923.p310uFZ5Wv6r5NeNLXsasWYGcHvN0SJTna11eb1iiLI@z> Hi, I'm writing a program which uses the Panel library, starts new processes based on mouse actions and after a while kills those processes, but the interface should not died. Is this possible? Has any one tried? Mothra uses it, put only kills subprocesses in fatal conditions, which do not require the Panel to keep working. I'm having problems after killing processes with the panel library. It looks like there is some kind of sincronization program, I'm not quite sure what's going on. The error is bitblt: bad slave 32 on event pipe: fd out of range or not open Here is an small program with I hope will reproduce the problem. Any help would be appreciated. thanks beto #include #include #include #include Panel *root; void playnetwork(void); void killall(void); void restart(Panel *p, int buttons){ USED(p, buttons); killall(); playnetwork(); } /* * To see the problem just press * retstart */ void main(void){ rfork(RFNOTEG|RFNAMEG); binit(0, 0, 0); einit(Emouse); plinit(screen.ldepth); root=plframe(0, 0); pllabel(root, 0, "Playing....."); plbutton(root, 0, "restart", restart); ereshaped(screen.r); playnetwork(); for(;;) plmouse(root, emouse()); } void ereshaped(Rectangle r){ screen.r=r; plpack(root, r); bitblt(&screen, r.min, &screen, r, Zero); pldraw(root, &screen); } /* from mothra.c */ void filter(char *cmd, int fd, int teefd){ char cmdbuf[512]; if(teefd!=-1) sprint(cmdbuf, "tee -a /fd/%d | %s", teefd, cmd); else strcpy(cmdbuf, cmd); bflush(); switch(rfork(RFFDG|RFPROC|RFNOWAIT)){ case -1: break; case 0: /*close(0); bclose(); dup(fd, 0); close(fd);/**/ execl("/bin/rc", "rc", "-c", cmdbuf, 0); _exits(0); default: break; } close(teefd); close(fd); } void playnetwork(void) { filter("sleep 1000", 0,-1); } void killall(void) { postnote(PNGROUP, getpid(), "kill\n"); }