16 panic("assert failed: %s", fmt);
22 if(ed >= 0 && up->nerrlab != ed)
23 panic("unbalanced error depth: expected %d got %d\n", ed, up->nerrlab);
30 up = smalloc(sizeof(Proc));
32 strncpy(up->name, name, KNAMELEN-1);
33 up->name[KNAMELEN-1] = '\0';
37 kproc(char *name, void (*f)(void *), void *a)
41 pid = rfork(RFPROC|RFMEM|RFNOWAIT);
44 panic("can't make new thread: %r");
76 o &= ~(OTRUNC|OCEXEC|ORCLOSE);
92 vseprint(buf, buf+sizeof(buf), fmt, va);
94 sprint(buf2, "panic: %s\n", buf);
95 write(2, buf2, strlen(buf2));
107 panic("out of memory");
108 setmalloctag(p, getcallerpc(&n));
121 strncpy(up->error, err, ERRMAX);
128 longjmp(up->errlab[--up->nerrlab], 1);
132 readstr(ulong off, char *buf, ulong n, char *str)
141 memmove(buf, str+off, n);
146 _rendsleep(void* tag)
151 value = rendezvous(tag, (void*)0x22a891b8);
152 if(value == (void*)0x7f7713f9)
155 panic("_rendsleep: rendezvous mismatch");
160 _rendwakeup(void* tag)
165 value = rendezvous(tag, (void*)0x7f7713f9);
166 if(value == (void*)0x22a891b8)
169 panic("_rendwakeup: rendezvous mismatch");
174 rendsleep(Rendez *r, int (*f)(void*), void *arg)
183 * if condition happened, never mind
185 if(up->intr || f(arg)){
191 * now we are committed to
192 * change state and call scheduler
195 panic("double sleep");
213 rendwakeup(Rendez *r)