ref: d2c3185bfa486bb3f60d23771c701cfeaa1316db
parent: 6f58f7fed4e6e00e6632ff9fe5bc56e75879424f
author: ftrvxmtrx <devnull@localhost>
date: Sat May 3 09:07:52 EDT 2014
fix threadsetname usage in few places
--- a/sys/src/cmd/execnet/client.c
+++ b/sys/src/cmd/execnet/client.c
@@ -215,11 +215,9 @@
Client *c;
Ioproc *io;
Msg *m;
- char tmp[32];
c = a;
- snprint(tmp, sizeof tmp, "read%d", c->num);
- threadsetname(tmp);
+ threadsetname("read%d", c->num);
buf = emalloc(8192);
io = c->readerproc;
@@ -279,11 +277,9 @@
Ioproc *io;
Req *r;
Client *c;
- char tmp[32];
c = a;
- snprint(tmp, sizeof tmp, "write%d", c->num);
- threadsetname(tmp);
+ threadsetname("write%d", c->num);
buf = emalloc(8192);
io = c->writerproc;
@@ -320,11 +316,9 @@
{
int i, fd;
Client *c;
- char tmp[32];
c = a;
- snprint(tmp, sizeof tmp, "execproc%d", c->num);
- threadsetname(tmp);
+ threadsetname("execproc%d", c->num);
if(pipe(c->fd) < 0){
rerrstr(c->err, sizeof c->err);
sendul(c->execpid, -1);
@@ -346,11 +340,9 @@
{
Client *c;
int p;
- char tmp[32];
c = a;
- snprint(tmp, sizeof tmp, "exec%d", c->num);
- threadsetname(tmp);
+ threadsetname("exec%d", c->num);
c->execpid = chancreate(sizeof(ulong), 0);
proccreate(execproc, c, STACK);
p = recvul(c->execpid);
--- a/sys/src/cmd/ip/tftpfs.c
+++ b/sys/src/cmd/ip/tftpfs.c
@@ -171,7 +171,7 @@
if((c = f->c) == nil)
goto out;
- threadsetname(f->path);
+ threadsetname("%s", f->path);
snprint(buf, sizeof(buf), "%s/udp!*!0", net);
if((cfd = announce(buf, adir)) < 0){
--- a/sys/src/cmd/nusb/joy/joy.c
+++ b/sys/src/cmd/nusb/joy/joy.c
@@ -229,14 +229,6 @@
}
static void
-kbprocname(KDev *kd, char *name)
-{
- char buf[128];
- snprint(buf, sizeof(buf), "%s %s", name, kd->ep->dir);
- threadsetname(buf);
-}
-
-static void
sethipri(void)
{
char fn[64];
@@ -324,7 +316,7 @@
Joy p;
u64int lastb;
- kbprocname(f, "joy");
+ threadsetname("joy %s", f->ep->dir);
sethipri();
memset(&p, 0, sizeof(p));
--- a/sys/src/cmd/nusb/kb/kb.c
+++ b/sys/src/cmd/nusb/kb/kb.c
@@ -337,14 +337,6 @@
}
static void
-kbprocname(KDev *kd, char *name)
-{
- char buf[128];
- snprint(buf, sizeof(buf), "%s %s", name, kd->ep->dir);
- threadsetname(buf);
-}
-
-static void
sethipri(void)
{
char fn[64];
@@ -465,7 +457,7 @@
KDev* f = a;
Ptr p;
- kbprocname(f, "ptr");
+ threadsetname("ptr %s", f->ep->dir);
sethipri();
memset(&p, 0, sizeof(p));
@@ -698,7 +690,7 @@
char err[128];
KDev *f = a;
- kbprocname(f, "kbd");
+ threadsetname("kbd %s", f->ep->dir);
f->repeatc = chancreate(sizeof(ulong), 0);
if(f->repeatc == nil)
--- a/sys/src/cmd/rio/wind.c
+++ b/sys/src/cmd/rio/wind.c
@@ -180,12 +180,11 @@
Stringpair pair;
Wctlmesg wcm;
Completion *cr;
- char buf[4*12+1], *kbdq[8], *kbds;
+ char *kbdq[8], *kbds;
int kbdqr, kbdqw;
w = arg;
- snprint(buf, sizeof buf, "winctl-id%d", w->id);
- threadsetname(buf);
+ threadsetname("winctl-id%d", w->id);
mrm.cm = chancreate(sizeof(Mouse), 0);
krm.ck = chancreate(sizeof(char*), 0);
@@ -540,11 +539,9 @@
{
Completejob *job;
Completion *c;
- char buf[128];
job = arg;
- snprint(buf, sizeof(buf), "namecomplete %s", job->dir);
- threadsetname(buf);
+ threadsetname("namecomplete %s", job->dir);
c = complete(job->dir, job->str);
if(c != nil && sendp(job->win->complete, c) <= 0)
--- a/sys/src/cmd/rio/xfid.c
+++ b/sys/src/cmd/rio/xfid.c
@@ -99,11 +99,9 @@
{
Xfid *x;
void (*f)(Xfid*);
- char buf[64];
x = arg;
- snprint(buf, sizeof buf, "xfid.%p", x);
- threadsetname(buf);
+ threadsetname("xfid.%p", x);
for(;;){
f = recvp(x->c);
if(f){
--- a/sys/src/libcontrol/control.c
+++ b/sys/src/libcontrol/control.c
@@ -160,12 +160,11 @@
Control *f;
int prevbut, n, i;
Alt alts[NALT+1];
- char tmp[64], *str;
+ char *str;
Rune buf[2][20], *rp;
cs = v;
- snprint(tmp, sizeof tmp, "controlsetthread 0x%p", cs);
- threadsetname(tmp);
+ threadsetname("controlsetthread 0x%p", cs);
alts[AKey].c = cs->kbdc;
alts[AKey].v = &rp;
@@ -619,12 +618,10 @@
resizethread(void *v)
{
Controlset *cs;
- char buf[64];
Alt alts[3];
cs = v;
- snprint(buf, sizeof buf, "resizethread0x%p", cs);
- threadsetname(buf);
+ threadsetname("resizethread 0x%p", cs);
alts[0].c = cs->resizec;
alts[0].v = nil;