~moody/mpl

d4c4de32ca051a3ccfbeebc07de8f6aba27af960 — Moody 1 year, 5 months ago e809b40
Use postnote in favor of hand rolled 'killgrp'
4 files changed, 7 insertions(+), 22 deletions(-)

M dec.c
M fncs.h
M mpl.c
M util.c
M dec.c => dec.c +4 -4
@@ 136,7 136,7 @@ ctlproc(void *arg)
				break;
			case CTL:
				if(msg == NEXT){
					killgrp(decpid);
					postnote(PNGROUP, decpid, "kill");
					decpid = -1;
					send(pop, nil);
				}else


@@ 145,7 145,7 @@ ctlproc(void *arg)
			case QUEUE:
				a.file = path;
				if(decpid != -1)
					killgrp(decpid);
					postnote(PNGROUP, decpid, "kill");
				procrfork(decodeproc, &a, 8192, RFFDG);
				recv(a.cpid, &decpid);
				break;


@@ 157,7 157,7 @@ ctlproc(void *arg)

cleanup:
	if(decpid != -1)
		killgrp(decpid);
		postnote(PNGROUP, decpid, "kill");
	chanfree(wr.ctl);
	chanfree(a.cpid);
	close(p[0]);


@@ 188,4 188,4 @@ spawndec(Channel **q, Channel **c, Channel **pop)
	chans[2] = *pop;

	procrfork(ctlproc, chans, 8192, RFFDG);
}
\ No newline at end of file
}

M fncs.h => fncs.h +0 -1
@@ 9,7 9,6 @@ void*	emalloc(vlong);
u64int	bebtoi(uchar*,int);
u64int	lebtoi(uchar*,int);
void	kill(int);
void	killgrp(int);
int		runecstrcmp(Rune*,Rune*);

/* id3.c */

M mpl.c => mpl.c +2 -2
@@ 34,7 34,7 @@ Image *listbackground;
int
cleanup(void*,char*)
{
	killgrp(decpid);
	postnote(PNGROUP, decpid, "kill");
	closedisplay(display);
	closemouse(mctl);
	closekeyboard(kctl);


@@ 80,7 80,7 @@ handleaction(Rune kbd)
	switch(kbd){
		case Kbs:
		case Kdel:
			killgrp(decpid);
			postnote(PNGROUP, decpid, "kill");
			quit(nil);
			return;
		case 'w':

M util.c => util.c +1 -15
@@ 58,20 58,6 @@ kill(int pid)
	free(note);
}

void
killgrp(int pid)
{
	int nfd;
	char *note = smprint( "/proc/%d/notepg", pid);
	nfd = open(note, OWRITE);
	if(nfd<0)
		sysfatal("proc doesn't exist");
	if(write(nfd, "kill", 4)!=4)
		sysfatal("could not write to note");
	close(nfd);
	free(note);
}

int
runecstrcmp(Rune *s1, Rune *s2)
{


@@ 88,4 74,4 @@ runecstrcmp(Rune *s1, Rune *s2)
		if(c1 == 0)
			return 0;
	}
}
\ No newline at end of file
}