Subject: panic: old sleep...
To: None <current-users@NetBSD.ORG>
From: Darren Reed <darrenr@vitruvius.arbld.unimelb.edu.au>
List: current-users
Date: 02/20/1995 14:29:29
What's the correct usage of sleep() within the kernel ?

I just tried some code of mine which works under SunOS4, but when
I tried it out just now, I got a panic, sleep() had been called with
a value > PZERO (23 I think it was).  Looking at sleep(), it is obvious
what the problem is:
#ifdef DIAGNOSTIC
	if (priority > PZERO) {
		printf("sleep called with priority %d > PZERO, wchan: %x\n",
		    priority, ident);
		panic("old sleep");
	}
#endif
(so I #undef DIAGNOSTIC and no panic but my code is still "buggy").

I call sleep like this:
	sleep(buffer, PZERO+1);
(I'm sleeping on a read of a pseudo device which has no data, currently,
 and I want to block on the operation but be able to interrupt it with
 ^C).

Are there any docs on doing this for NetBSD/4.4BSD ?  Or can anyone
help me out ?

thanks,
Darren

p.s. has anyone thought that perhaps panic messages should go through log()
     rather than printf() in the kernel ?