fix threadsetname usage in few places

This commit is contained in:
ftrvxmtrx 2014-05-03 13:07:52 +02:00
parent 6f58f7fed4
commit d2c3185bfa
7 changed files with 15 additions and 47 deletions

View file

@ -215,11 +215,9 @@ readthread(void *a)
Client *c; Client *c;
Ioproc *io; Ioproc *io;
Msg *m; Msg *m;
char tmp[32];
c = a; c = a;
snprint(tmp, sizeof tmp, "read%d", c->num); threadsetname("read%d", c->num);
threadsetname(tmp);
buf = emalloc(8192); buf = emalloc(8192);
io = c->readerproc; io = c->readerproc;
@ -279,11 +277,9 @@ writethread(void *a)
Ioproc *io; Ioproc *io;
Req *r; Req *r;
Client *c; Client *c;
char tmp[32];
c = a; c = a;
snprint(tmp, sizeof tmp, "write%d", c->num); threadsetname("write%d", c->num);
threadsetname(tmp);
buf = emalloc(8192); buf = emalloc(8192);
io = c->writerproc; io = c->writerproc;
@ -320,11 +316,9 @@ execproc(void *a)
{ {
int i, fd; int i, fd;
Client *c; Client *c;
char tmp[32];
c = a; c = a;
snprint(tmp, sizeof tmp, "execproc%d", c->num); threadsetname("execproc%d", c->num);
threadsetname(tmp);
if(pipe(c->fd) < 0){ if(pipe(c->fd) < 0){
rerrstr(c->err, sizeof c->err); rerrstr(c->err, sizeof c->err);
sendul(c->execpid, -1); sendul(c->execpid, -1);
@ -346,11 +340,9 @@ execthread(void *a)
{ {
Client *c; Client *c;
int p; int p;
char tmp[32];
c = a; c = a;
snprint(tmp, sizeof tmp, "exec%d", c->num); threadsetname("exec%d", c->num);
threadsetname(tmp);
c->execpid = chancreate(sizeof(ulong), 0); c->execpid = chancreate(sizeof(ulong), 0);
proccreate(execproc, c, STACK); proccreate(execproc, c, STACK);
p = recvul(c->execpid); p = recvul(c->execpid);

View file

@ -171,7 +171,7 @@ download(void *aux)
if((c = f->c) == nil) if((c = f->c) == nil)
goto out; goto out;
threadsetname(f->path); threadsetname("%s", f->path);
snprint(buf, sizeof(buf), "%s/udp!*!0", net); snprint(buf, sizeof(buf), "%s/udp!*!0", net);
if((cfd = announce(buf, adir)) < 0){ if((cfd = announce(buf, adir)) < 0){

View file

@ -228,14 +228,6 @@ setproto(KDev *f, int eid)
return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, id, nil, 0); return usbcmd(f->dev, Rh2d|Rclass|Riface, Setproto, proto, id, nil, 0);
} }
static void
kbprocname(KDev *kd, char *name)
{
char buf[128];
snprint(buf, sizeof(buf), "%s %s", name, kd->ep->dir);
threadsetname(buf);
}
static void static void
sethipri(void) sethipri(void)
{ {
@ -324,7 +316,7 @@ joywork(void *a)
Joy p; Joy p;
u64int lastb; u64int lastb;
kbprocname(f, "joy"); threadsetname("joy %s", f->ep->dir);
sethipri(); sethipri();
memset(&p, 0, sizeof(p)); memset(&p, 0, sizeof(p));

View file

@ -336,14 +336,6 @@ kbfatal(KDev *kd, char *sts)
threadexits(sts); threadexits(sts);
} }
static void
kbprocname(KDev *kd, char *name)
{
char buf[128];
snprint(buf, sizeof(buf), "%s %s", name, kd->ep->dir);
threadsetname(buf);
}
static void static void
sethipri(void) sethipri(void)
{ {
@ -465,7 +457,7 @@ ptrwork(void* a)
KDev* f = a; KDev* f = a;
Ptr p; Ptr p;
kbprocname(f, "ptr"); threadsetname("ptr %s", f->ep->dir);
sethipri(); sethipri();
memset(&p, 0, sizeof(p)); memset(&p, 0, sizeof(p));
@ -698,7 +690,7 @@ kbdwork(void *a)
char err[128]; char err[128];
KDev *f = a; KDev *f = a;
kbprocname(f, "kbd"); threadsetname("kbd %s", f->ep->dir);
f->repeatc = chancreate(sizeof(ulong), 0); f->repeatc = chancreate(sizeof(ulong), 0);
if(f->repeatc == nil) if(f->repeatc == nil)

View file

@ -180,12 +180,11 @@ winctl(void *arg)
Stringpair pair; Stringpair pair;
Wctlmesg wcm; Wctlmesg wcm;
Completion *cr; Completion *cr;
char buf[4*12+1], *kbdq[8], *kbds; char *kbdq[8], *kbds;
int kbdqr, kbdqw; int kbdqr, kbdqw;
w = arg; w = arg;
snprint(buf, sizeof buf, "winctl-id%d", w->id); threadsetname("winctl-id%d", w->id);
threadsetname(buf);
mrm.cm = chancreate(sizeof(Mouse), 0); mrm.cm = chancreate(sizeof(Mouse), 0);
krm.ck = chancreate(sizeof(char*), 0); krm.ck = chancreate(sizeof(char*), 0);
@ -540,11 +539,9 @@ completeproc(void *arg)
{ {
Completejob *job; Completejob *job;
Completion *c; Completion *c;
char buf[128];
job = arg; job = arg;
snprint(buf, sizeof(buf), "namecomplete %s", job->dir); threadsetname("namecomplete %s", job->dir);
threadsetname(buf);
c = complete(job->dir, job->str); c = complete(job->dir, job->str);
if(c != nil && sendp(job->win->complete, c) <= 0) if(c != nil && sendp(job->win->complete, c) <= 0)

View file

@ -99,11 +99,9 @@ xfidctl(void *arg)
{ {
Xfid *x; Xfid *x;
void (*f)(Xfid*); void (*f)(Xfid*);
char buf[64];
x = arg; x = arg;
snprint(buf, sizeof buf, "xfid.%p", x); threadsetname("xfid.%p", x);
threadsetname(buf);
for(;;){ for(;;){
f = recvp(x->c); f = recvp(x->c);
if(f){ if(f){

View file

@ -160,12 +160,11 @@ controlsetthread(void *v)
Control *f; Control *f;
int prevbut, n, i; int prevbut, n, i;
Alt alts[NALT+1]; Alt alts[NALT+1];
char tmp[64], *str; char *str;
Rune buf[2][20], *rp; Rune buf[2][20], *rp;
cs = v; cs = v;
snprint(tmp, sizeof tmp, "controlsetthread 0x%p", cs); threadsetname("controlsetthread 0x%p", cs);
threadsetname(tmp);
alts[AKey].c = cs->kbdc; alts[AKey].c = cs->kbdc;
alts[AKey].v = &rp; alts[AKey].v = &rp;
@ -619,12 +618,10 @@ static void
resizethread(void *v) resizethread(void *v)
{ {
Controlset *cs; Controlset *cs;
char buf[64];
Alt alts[3]; Alt alts[3];
cs = v; cs = v;
snprint(buf, sizeof buf, "resizethread0x%p", cs); threadsetname("resizethread 0x%p", cs);
threadsetname(buf);
alts[0].c = cs->resizec; alts[0].c = cs->resizec;
alts[0].v = nil; alts[0].v = nil;