ref: ee60859199f151377a32b6932bde88cc6fe6007a
parent: 1c5f593c22a22f0cc35d5c8c0476e4d7007d208a
author: aap <[email protected]>
date: Sat Jan 28 16:37:24 EST 2023
stuff
--- a/fs.c
+++ b/fs.c
@@ -103,6 +103,7 @@
Xreq *xr = a;
XreqMsg xm;
+ threadsetname("xreg.%p", xr);
for(;;){
recv(xr->xc, &xm);
xr->req = xm.r;
@@ -875,9 +876,26 @@
return BIT32SZ+m;
}
+/*
+ * Build pipe with OCEXEC set on second fd.
+ * Can't put it on both because we want to post one in /srv.
+ */
+int
+cexecpipe(int *p0, int *p1)
+{
+ /* pipe the hard way to get close on exec */
+ if(bind("#|", "/mnt/temp", MREPL) == -1)
+ return -1;
+ *p0 = open("/mnt/temp/data", ORDWR);
+ *p1 = open("/mnt/temp/data1", ORDWR|OCEXEC);
+ unmount(nil, "/mnt/temp");
+ if(*p0<0 || *p1<0)
+ return -1;
+ return 0;
+}
+
int fsysfd;
-char srvpipe[64];
-//char srvwctl[64];
+char srvpipe[64];
void
fs(void)
@@ -884,13 +902,11 @@
{
io9p = ioproc();
- int fd[2];
- if(pipe(fd) < 0)
+ if(cexecpipe(&fsysfd, &fsys.infd) < 0)
panic("pipe");
- fsysfd = fd[0]; /* don't close for children */
- fsys.infd = fsys.outfd = fd[1];
+ fsys.outfd = fsys.infd;
snprint(srvpipe, sizeof(srvpipe), "lola.%s.%lud", getuser(), (ulong)getpid());
- post(srvpipe, fd[0]);
+ post(srvpipe, fsysfd);
// chatty9p++;
srv(&fsys);
}
--- a/main.c
+++ b/main.c
@@ -544,6 +544,7 @@
Window *w;
int inside;
+ threadsetname("mousethread");
while(readmouse(mctl) != -1){
w = wpointto(mctl->xy);
again:
@@ -597,6 +598,7 @@
Rectangle or, nr;
Point delta;
+ threadsetname("resizethread");
for(;;){
recvul(mctl->resizec);
or = screen->clipr;
@@ -774,6 +776,7 @@
return nil;
}
+/* BUG: there's a deadlock somewhere sometimes when you delete a ktrans window */
void
keyboardtap(void*)
{
@@ -854,17 +857,17 @@
case Ato:
recv(fschan, &pair);
n = strlen(s)+1;
- memmove(pair.s, s, min(n, pair.ns));
+ pair.ns = min(n, pair.ns);
+ memmove(pair.s, s, pair.ns);
free(s);
- pair.ns = n;
send(fschan, &pair);
goto Reset;
case Awatch:
recv(fschan, &pair);
n = strlen(watched)+1;
- memmove(pair.s, watched, min(n, pair.ns));
+ pair.ns = min(n, pair.ns);
+ memmove(pair.s, watched, pair.ns);
free(watched);
- pair.ns = n;
send(fschan, &pair);
alts[Awatch].op = CHANNOP;
break;
--- a/wind.c
+++ b/wind.c
@@ -736,6 +736,7 @@
Completion *comp;
w = arg;
+ threadsetname("winthread-%d", w->id);
x = &w->text;
nr = 0;
memset(&cnv, 0, sizeof(cnv));