From 53c6dbe11903e053d2f947f8baaef535fd54fbd0 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Wed, 25 Sep 2002 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2002-09-25 --- port/dev.c | 2 +- port/devcons.c | 3 ++- port/proc.c | 6 ++++-- port/taslock.c | 2 ++ 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/port/dev.c b/port/dev.c index 9d33988a28a1a46ab8904570fb2dbe6fdb1090b5..3fda0aad34ea256bcbe7e6823a652c7ba56b0560 100644 --- a/port/dev.c +++ b/port/dev.c @@ -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; diff --git a/port/devcons.c b/port/devcons.c index f0506ed6b243b0d5813862a4abf848f7715195ff..42005352572f9c5b16304733ef3aab89e44f178f 100644 --- a/port/devcons.c +++ b/port/devcons.c @@ -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 */ diff --git a/port/proc.c b/port/proc.c index 81cd1c86b40bd1258cd810a8bd12edef8ff8a829..93ee7fa139a80ade0bfea4d1287db225ca34f90d 100644 --- a/port/proc.c +++ b/port/proc.c @@ -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){ diff --git a/port/taslock.c b/port/taslock.c index f6a69ccccddfb1203f1bdd9666d17a695ccc88c4..fd70e120f46d15f406fe0f7eea75549e4fec3c00 100644 --- a/port/taslock.c +++ b/port/taslock.c @@ -185,5 +185,7 @@ iunlock(Lock *l) m->splpc = getcallerpc(&l); m->ilockdepth--; + if(up) + up->lastilock = nil; splxpc(sr); }