9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Panel + forks + postnote
@ 1995-10-16 22:31 beto
  0 siblings, 0 replies; 3+ messages in thread
From: beto @ 1995-10-16 22:31 UTC (permalink / raw)


In <95Oct13.094213edt.78814@colossus.cse.psu.edu>
	td@plan9.att.com wrote:

> plan9.cs.su.oz.au!beto asks:
> >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
> 
> I believe the problem is that when you execute
> 	postnote(PNGROUP, getpid(), "kill\n");
> after having done
> 	einit(Emouse);
> that you're killing the process that's reading the
> mouse.  Ironically, this postnote appears not to
> terminate the processes that you started by calling
> filter.  At least, it didn't work when I tried it on
> my nextstation.
> 

forsyth@plan9.cs.york.ac.uk pointed out the einit's process, so I just put the
child process created in filter in a different note group, then
did a postnote PNGROUP of that. That works fine.

Thanks a lot






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Panel + forks + postnote
@ 1995-10-13 19:29 beto
  0 siblings, 0 replies; 3+ messages in thread
From: beto @ 1995-10-13 19:29 UTC (permalink / raw)


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 <u.h>
#include <libc.h>
#include <libg.h>
#include <panel.h>
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");
}






^ permalink raw reply	[flat|nested] 3+ messages in thread

* Panel + forks + postnote
@ 1995-10-13 13:27 td
  0 siblings, 0 replies; 3+ messages in thread
From: td @ 1995-10-13 13:27 UTC (permalink / raw)


plan9.cs.su.oz.au!beto asks:
>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

I believe the problem is that when you execute
	postnote(PNGROUP, getpid(), "kill\n");
after having done
	einit(Emouse);
that you're killing the process that's reading the
mouse.  Ironically, this postnote appears not to
terminate the processes that you started by calling
filter.  At least, it didn't work when I tried it on
my nextstation.






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1995-10-16 22:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-10-16 22:31 Panel + forks + postnote beto
  -- strict thread matches above, loose matches on Subject: below --
1995-10-13 19:29 beto
1995-10-13 13:27 td

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).