extern void runtime·exits(int8* msg);
 extern int32 runtime·brk_(void*);
 
+/* open */
+enum
+{
+       OREAD                   = 0,
+       OWRITE                  = 1,
+       ORDWR                   = 2
+};
+
 /* rfork */
 enum
 {
        RFREND          = (1<<13),
        RFNOMNT         = (1<<14)
 };
+
+typedef struct Tos Tos;
+typedef intptr Plink;
+
+struct Tos {
+       struct                  /* Per process profiling */
+       {
+               Plink   *pp;    /* known to be 0(ptr) */
+               Plink   *next;  /* known to be 4(ptr) */
+               Plink   *last;
+               Plink   *first;
+               uint32  pid;
+               uint32  what;
+       } prof;
+       uint64  cyclefreq;      /* cycle clock frequency if there is one, 0 otherwise */
+       int64   kcycles;        /* cycles spent in kernel */
+       int64   pcycles;        /* cycles spent in process (kernel + user) */
+       uint32  pid;            /* might as well put the pid here */
+       uint32  clock;
+       /* top of stack is here */
+};
+
 extern int32 runtime·rfork(int32 flags, void *stk, M *m, G *g, void (*fn)(void));
 extern int32 runtime·plan9_semacquire(uint32 *addr, int32 block);
 extern int32 runtime·plan9_semrelease(uint32 *addr, int32 count);
 
 {
 }
 
+extern Tos *_tos;
 void
 runtime·exit(int32)
 {
+       int32 fd;
+       uint8 buf[128];
+       uint8 tmp[16];
+       uint8 *p, *q;
+       int32 pid;
+       
+       runtime·memclr(buf, sizeof buf);
+       runtime·memclr(tmp, sizeof tmp);
+       pid = _tos->pid;
+
+       /* build path string /proc/pid/notepg */
+       for(q=tmp; pid > 0;) {
+               *q++ = '0' + (pid%10);
+               pid = pid/10;
+       }
+       p = buf;
+       runtime·mcpy((void*)p, (void*)"/proc/", 6);
+       p += 6;
+       for(q--; q >= tmp;)
+               *p++ = *q--;
+       runtime·mcpy((void*)p, (void*)"/notepg", 7);
+       
+       /* post interrupt note */
+       fd = runtime·open(buf, OWRITE);
+       runtime·write(fd, "interrupt", 9);
        runtime·exits(nil);
 }
 
 void
 runtime·newosproc(M *m, G *g, void *stk, void (*fn)(void))
 {
-       USED(m, g, stk, fn);
-       
        m->tls[0] = m->id;      // so 386 asm can find it
        if(0){
                runtime·printf("newosproc stk=%p m=%p g=%p fn=%p rfork=%p id=%d/%d ostk=%p\n",
                        stk, m, g, fn, runtime·rfork, m->id, m->tls[0], &m);
        }        
        
-       if (runtime·rfork(RFPROC | RFMEM, stk, m, g, fn) < 0 )
+       if (runtime·rfork(RFPROC|RFMEM|RFNOWAIT, stk, m, g, fn) < 0 )
                runtime·throw("newosproc: rfork failed");
 }