From 508b53a29a74d2ded6b15ffc8be0a182b258869a Mon Sep 17 00:00:00 2001 From: cinap_lenrek Date: Tue, 13 Aug 2013 21:46:13 +0200 Subject: [PATCH] libdraw: fix leftover processes or programs failing to restore window labels when receiving interrupt note fix the default note handler for event programs. only handle non system notes or notes in the slave processes. for interrupt in the main process, just call exits() which will do the cleanup and restore window label properly. this makes completely overriding the note handler in gping and stats uneccesary. --- sys/src/cmd/ip/gping.c | 11 ----------- sys/src/cmd/stats.c | 9 ++++----- sys/src/libdraw/event.c | 40 +++++++++++++++++----------------------- 3 files changed, 21 insertions(+), 39 deletions(-) diff --git a/sys/src/cmd/ip/gping.c b/sys/src/cmd/ip/gping.c index ad5d89172..ebc8d57ac 100644 --- a/sys/src/cmd/ip/gping.c +++ b/sys/src/cmd/ip/gping.c @@ -630,16 +630,6 @@ lostval(Machine *m, long *v, long *vmax, long *mark) *vmax = 100; } -jmp_buf catchalarm; - -void -alarmed(void *a, char *s) -{ - if(strcmp(s, "alarm") == 0) - notejmp(a, catchalarm, 1); - noted(NDFLT); -} - void usage(void) { @@ -1030,7 +1020,6 @@ main(int argc, char *argv[]) } colinit(); einit(Emouse); - notify(nil); startproc(mouseproc, 0); display->locking = 1; /* tell library we're using the display lock */ diff --git a/sys/src/cmd/stats.c b/sys/src/cmd/stats.c index fec34af03..2b70c8ad2 100644 --- a/sys/src/cmd/stats.c +++ b/sys/src/cmd/stats.c @@ -710,12 +710,12 @@ initmach(Machine *m, char *name) jmp_buf catchalarm; -void +int alarmed(void *a, char *s) { if(strcmp(s, "alarm") == 0) notejmp(a, catchalarm, 1); - noted(NDFLT); + return 0; } int @@ -781,7 +781,7 @@ readmach(Machine *m, int init) eresized(0); } if(m->remote){ - notify(alarmed); + atnotify(alarmed, 1); alarm(5000); } if(needswap(init) && loadbuf(m, &m->swapfd) && readswap(m, a)) @@ -809,7 +809,7 @@ readmach(Machine *m, int init) m->temp[n] = a[0]; if(m->remote){ alarm(0); - notify(nil); + atnotify(alarmed, 0); } } @@ -1410,7 +1410,6 @@ main(int argc, char *argv[]) } colinit(); einit(Emouse); - notify(nil); startproc(mouseproc, Mouseproc); pids[Mainproc] = getpid(); display->locking = 1; /* tell library we're using the display lock */ diff --git a/sys/src/libdraw/event.c b/sys/src/libdraw/event.c index bb4b60179..8b0ad5e64 100644 --- a/sys/src/libdraw/event.c +++ b/sys/src/libdraw/event.c @@ -346,39 +346,33 @@ eforkslave(ulong key) } static int -enote(void *v, char *s) +enote(void*, char *s) { - char t[1]; int i, pid; - USED(v, s); - pid = getpid(); - if(pid != parentpid){ - for(i=0; i