Path: utzoo!mnetor!uunet!husc6!think!ames!oliveb!sun!gorodish!guy From: guy@gorodish.Sun.COM (Guy Harris) Newsgroups: comp.unix.wizards Subject: Re: Trouble killing processes in SysV/AT Message-ID: <51483@sun.uucp> Date: 1 May 88 21:37:45 GMT References: <3950@killer.UUCP> <3951@killer.UUCP> <468@micropen> <51443@sun.uucp> <11291@mimsy.UUCP> Sender: news@sun.uucp Lines: 29 > >If the sleep priority is above PZERO, the [signalled] sleep() will return > >an error corresponding to "I was interrupted!". > > Unless Sun has made some big kernel changes recently, this is not the > case. See /sys/sys/kern_synch.c, at the label `psig' in sleep(). OK - from the 3.5 version of "kern_synch.c": psig: if (pri & PCATCH) return (1); longjmp(&u.u_qsave); /*NOTREACHED*/ Sun - or, more correctly, AT&T - made a small kernel change a while ago. (AT&T made it either in S5"R1" or S5R2 - I don't have the S5R[12] sources online anymore to check precisely when this was done; Sun picked up AT&T's change in SunOS 3.2.) If the priority field to "sleep" has PCATCH (0400) ORed into it, "sleep" won't "longjmp" if a signal interrupts the sleep, but will return 1. Under any circumstances, it will return 0 if the sleep terminates normally. > Returning an error from sleep would be a viable alternative to `catch' > and `throw' routines, although it would entail more work. The PCATCH bit is required to evoke the new behavior from "sleep", thus reducing the amount of work needed to have "sleep" return an error. Old drivers, etc. don't have to be changed except to cast the result of "sleep" to "void" (yes, we "lint" our kernels before we ship them - "lint"ing kernels has caught a number of bugs before compiling).