Block* allocb(int size) { Block *b; /* * Check in a process and wait until successful. * Can still error out of here, though. */ if(up == nil) panic("allocb without up: %#p\n", getcallerpc(&size)); if((b = _allocb(size)) == nil){ mallocsummary(); panic("allocb: no memory for %d bytes\n", size); } return b; }
Block* allocb(int size) { Block *b; /* * Check in a process and wait until successful. * Can still error out of here, though. */ if(up == nil) panic("allocb without up: %#p", getcallerpc(&size)); if((b = _allocb(size)) == nil){ splhi(); xsummary(); mallocsummary(); delay(500); panic("allocb: no memory for %d bytes; caller %#p", size, getcallerpc(&size)); } setmalloctag(b, getcallerpc(&size)); return b; }
static void echo(char *buf, int n) { static int ctrlt, pid; char *e, *p; if (n == 0) return; e = buf + n; for (p = buf; p < e; p++) { switch (*p) { #if 0 case 0x10: /* ^P */ if (cpuserver && !kbd.ctlpoff) { active.exiting = 1; return; } break; #endif case 0x14: /* ^T */ ctrlt++; if (ctrlt > 2) ctrlt = 2; continue; } if (ctrlt != 2) continue; /* ^T escapes */ ctrlt = 0; switch (*p) { #if 0 case 'S': { int8_t x = 0; disable_irqsave(&x); dumpstack(); procdump(); enable_irqsave(&x); return; } #endif case 's': dumpstack(); return; #if 0 case 'x': xsummary(); ixsummary(); mallocsummary(); memorysummary(); pagersummary(); return; case 'd': if (consdebug == NULL) consdebug = rdb; else consdebug = NULL; printd("consdebug now %#p\n", consdebug); return; case 'D': if (consdebug == NULL) consdebug = rdb; consdebug(); return; case 'p': x = spllo(); procdump(); splx(x); return; case 'q': scheddump(); return; case 'k': killbig("^t ^t k"); return; #endif case 'r': exit(0); return; } } qproduce(kbdq, buf, n); if (kbd.raw) return; kmesgputs(buf, n); if (screenputs != NULL) echoscreen(buf, n); if (serialoq) echoserialoq(buf, n); }
void echo(char *buf, int n) { static int ctrlt; int x; char *e, *p; if(n == 0) return; e = buf+n; for(p = buf; p < e; p++){ switch(*p){ case 0x10: /* ^P */ if(cpuserver && !kbd.ctlpoff){ active.exiting = 1; return; } break; case 0x14: /* ^T */ ctrlt++; if(ctrlt > 2) ctrlt = 2; continue; } if(ctrlt != 2) continue; /* ^T escapes */ ctrlt = 0; switch(*p){ case 'S': x = splhi(); dumpstack(); procdump(); splx(x); return; case 's': dumpstack(); return; case 'x': xsummary(); ixsummary(); mallocsummary(); // memorysummary(); pagersummary(); return; case 'd': if(consdebug == nil) consdebug = rdb; else consdebug = nil; print("consdebug now 0x%p\n", consdebug); return; case 'D': if(consdebug == nil) consdebug = rdb; consdebug(); return; case 'p': x = spllo(); procdump(); splx(x); return; case 'q': scheddump(); return; case 'k': killbig("^t ^t k"); return; case 'r': exit(0); return; } } qproduce(kbdq, buf, n); if(kbd.raw) return; kmesgputs(buf, n); if(screenputs != nil) echoscreen(buf, n); uartecho(buf, n); // Plan 9 VX }