ref: ec628c4dfbf62891e311567034936a0b2cb584c4
parent: 99db038e2825266e84ddb381718f3d047dc6d733
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Tue Aug 22 09:46:14 EDT 2023
bar: smaller buffer for aux proc; exit on eof
--- a/sys/src/cmd/bar.c
+++ b/sys/src/cmd/bar.c
@@ -196,16 +196,16 @@
static void
auxproc(void *c)
{
- Biobuf b;
+ u8int buf[1024];
+ Biobufhdr b;
char *s;
threadsetname("aux");
- Binit(&b, 0, OREAD);
+ Binits(&b, 0, OREAD, buf, sizeof(buf));
for(;;){
- s = Brdstr(&b, '\n', 1);
+ sendp(c, s = Brdstr(&b, '\n', 1));
if(s == nil)
break;
- sendp(c, s);
}
Bterm(&b);
@@ -332,7 +332,7 @@
readbattery();
redraw();
proccreate(timerproc, a[Etimer].c, 4096);
- proccreate(auxproc, a[Eaux].c, 16384);
+ proccreate(auxproc, a[Eaux].c, 4096);
m.buttons = 0;
oldt = nanosec();
@@ -368,6 +368,8 @@
case Eaux:
free(aux);
aux = s;
+ if(aux == nil)
+ threadexitsall(nil);
/* wet floor */
}