diff options
author | Jacob Moody <moody@posixcafe.org> | 2022-09-11 01:49:01 +0000 |
---|---|---|
committer | Jacob Moody <moody@posixcafe.org> | 2022-09-11 01:49:01 +0000 |
commit | 87160cbfcf926fd0a9f04e8113a16c2a0c7e252d (patch) | |
tree | f1920169843f7887717549c811d9e3ba6ddf8b72 /sys/src/cmd/rio/wctl.c | |
parent | 63f10d4c945e3e692b589175508b95ce8dd9b50d (diff) |
rio: add 'none' attach option to wsys
This allows users to mount wsys without having
a valid window or creating a new one. In this
mode wsys only servs 'global' files, those that
apply to all windows. Providing this mount to
riostart's namespace gives us two things:
* Allows kbdtap programs(ktrans) to run in riostart
* Obsoletes $wctl and the associated named pipe by providing /dev/wctl in riostart
As such, the wctl pipe and environment variable are removed as well.
Diffstat (limited to 'sys/src/cmd/rio/wctl.c')
-rw-r--r-- | sys/src/cmd/rio/wctl.c | 63 |
1 files changed, 9 insertions, 54 deletions
diff --git a/sys/src/cmd/rio/wctl.c b/sys/src/cmd/rio/wctl.c index eeb2a5fec..d37ca21ee 100644 --- a/sys/src/cmd/rio/wctl.c +++ b/sys/src/cmd/rio/wctl.c @@ -462,7 +462,10 @@ writewctl(Xfid *x, char *err) x->data[cnt] = '\0'; id = 0; - r = rectsubpt(w->screenr, screen->r.min); + if(w == nil) + r = ZR; + else + r = rectsubpt(w->screenr, screen->r.min); cmd = parsewctl(&arg, r, &r, &pid, &id, &hideit, &scrollit, &dir, x->data, err); if(cmd < 0) return -1; @@ -475,6 +478,11 @@ writewctl(Xfid *x, char *err) } } + if(w == nil && cmd != New){ + strcpy(err, "command needs to be run within a window"); + return -1; + } + switch(cmd){ case New: return wctlnew(r, arg, pid, hideit, scrollit, dir, err); @@ -490,56 +498,3 @@ writewctl(Xfid *x, char *err) return id; } - -void -wctlthread(void *v) -{ - char *buf, *arg, *dir; - int cmd, id, pid, hideit, scrollit; - Rectangle rect; - char err[ERRMAX]; - Channel *c; - - c = v; - - threadsetname("WCTLTHREAD"); - - for(;;){ - buf = recvp(c); - cmd = parsewctl(&arg, ZR, &rect, &pid, &id, &hideit, &scrollit, &dir, buf, err); - - switch(cmd){ - case New: - wctlnew(rect, arg, pid, hideit, scrollit, dir, err); - } - free(buf); - } -} - -void -wctlproc(void *v) -{ - char *buf; - int n, eofs; - Channel *c; - - threadsetname("WCTLPROC"); - c = v; - - eofs = 0; - for(;;){ - buf = emalloc(messagesize); - n = read(wctlfd, buf, messagesize-1); /* room for \0 */ - if(n < 0) - break; - if(n == 0){ - if(++eofs > 20) - break; - continue; - } - eofs = 0; - - buf[n] = '\0'; - sendp(c, buf); - } -} |