M port/dev.c => port/dev.c +1 -1
@@ 283,7 283,7 @@ devdirread(Chan *c, char *d, long n, Dirtab *tab, int ntab, Devgen *gen)
dsz = convD2M(&dir, (uchar*)d, n-m);
if(dsz <= BIT16SZ){ /* <= not < because this isn't stat; read is stuck */
if(m == 0)
- return -1;
+ error(Eshort);
return m;
}
m += dsz;
M port/devcons.c => port/devcons.c +2 -1
@@ 17,6 17,8 @@ Queue* kprintoq; /* console output, for /dev/kprint */
ulong kprintinuse; /* test and set whether /dev/kprint is open */
int iprintscreenputs = 1;
+int panicking;
+
static struct
{
QLock;
@@ 198,7 200,6 @@ panic(char *fmt, ...)
int n;
va_list arg;
char buf[PRINTSIZE];
- static int panicking;
kprintoq = nil; /* don't try to write to /dev/kprint */
M port/proc.c => port/proc.c +4 -2
@@ 91,10 91,12 @@ schedinit(void) /* never returns */
void
sched(void)
{
+ int x[1];
+
if(m->ilockdepth)
- panic("ilockdepth %d, last lock 0x%p at 0x%lux",
+ panic("ilockdepth %d, last lock 0x%p at 0x%lux, sched called from 0x%lux",
m->ilockdepth, up?up->lastilock:nil,
- (up && up->lastilock)?up->lastilock->pc:0);
+ (up && up->lastilock)?up->lastilock->pc:0, getcallerpc(x+3));
if(up){
if(up->nlocks && up->state != Moribund){
M port/taslock.c => port/taslock.c +2 -0
@@ 185,5 185,7 @@ iunlock(Lock *l)
m->splpc = getcallerpc(&l);
m->ilockdepth--;
+ if(up)
+ up->lastilock = nil;
splxpc(sr);
}