shithub: mpl

Download patch

ref: d4c4de32ca051a3ccfbeebc07de8f6aba27af960
parent: e809b405457ba3d54b859100fc865d91393b5e15
author: Moody <jsmoody@iastate.edu>
date: Sat Apr 4 20:38:17 EDT 2020

Use postnote in favor of hand rolled 'killgrp'

--- a/dec.c
+++ b/dec.c
@@ -136,7 +136,7 @@
 				break;
 			case CTL:
 				if(msg == NEXT){
-					killgrp(decpid);
+					postnote(PNGROUP, decpid, "kill");
 					decpid = -1;
 					send(pop, nil);
 				}else
@@ -145,7 +145,7 @@
 			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 @@
 
 cleanup:
 	if(decpid != -1)
-		killgrp(decpid);
+		postnote(PNGROUP, decpid, "kill");
 	chanfree(wr.ctl);
 	chanfree(a.cpid);
 	close(p[0]);
@@ -188,4 +188,4 @@
 	chans[2] = *pop;
 
 	procrfork(ctlproc, chans, 8192, RFFDG);
-}
\ No newline at end of file
+}
--- a/fncs.h
+++ b/fncs.h
@@ -9,7 +9,6 @@
 u64int	bebtoi(uchar*,int);
 u64int	lebtoi(uchar*,int);
 void	kill(int);
-void	killgrp(int);
 int		runecstrcmp(Rune*,Rune*);
 
 /* id3.c */
--- a/mpl.c
+++ b/mpl.c
@@ -34,7 +34,7 @@
 int
 cleanup(void*,char*)
 {
-	killgrp(decpid);
+	postnote(PNGROUP, decpid, "kill");
 	closedisplay(display);
 	closemouse(mctl);
 	closekeyboard(kctl);
@@ -80,7 +80,7 @@
 	switch(kbd){
 		case Kbs:
 		case Kdel:
-			killgrp(decpid);
+			postnote(PNGROUP, decpid, "kill");
 			quit(nil);
 			return;
 		case 'w':
--- a/util.c
+++ b/util.c
@@ -58,20 +58,6 @@
 	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 @@
 		if(c1 == 0)
 			return 0;
 	}
-}
\ No newline at end of file
+}