4 #include "threadimpl.h"
10 return _threadgetproc()->thread->id;
23 return _threadgetproc()->pid;
24 lock(&_threadpq.lock);
25 for (p = _threadpq.head; p; p = p->next){
27 for (t = p->threads.head; t; t = t->nextt)
31 unlock(&_threadpq.lock);
36 unlock(&_threadpq.lock);
46 t = _threadgetproc()->thread;
55 return _threadgetproc()->thread->grp;
59 threadsetname(char *fmt, ...)
72 t->cmdname = vsmprint(fmt, arg);
74 if(t->cmdname && p->nthreads == 1){
75 snprint(buf, sizeof buf, "#p/%lud/args", _tos->pid); //getpid());
76 if((fd = open(buf, OWRITE)) >= 0){
77 write(fd, t->cmdname, strlen(t->cmdname)+1);
86 return _threadgetproc()->thread->cmdname;
92 return &_threadgetproc()->thread->udata[0];
98 return &_threadgetproc()->wdata;
104 return &_threadgetproc()->udata;
107 static Lock privlock;
108 static int privmask = 1;
116 for(i=0; i<NPRIV; i++)
117 if(!(privmask&(1<<i))){
129 if(i < 0 || i >= NPRIV)
138 return &_threadgetproc()->thread->udata[i];