From owner-freebsd-hackers Thu Jun 4 16:50:45 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA09722 for freebsd-hackers-outgoing; Thu, 4 Jun 1998 16:50:45 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from gatekeeper.tsc.tdk.com (root@gatekeeper.tsc.tdk.com [207.113.159.21]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA09640 for ; Thu, 4 Jun 1998 16:50:30 -0700 (PDT) (envelope-from gdonl@tsc.tdk.com) Received: from sunrise.gv.tsc.tdk.com (root@sunrise.gv.tsc.tdk.com [192.168.241.191]) by gatekeeper.tsc.tdk.com (8.8.8/8.8.8) with ESMTP id QAA08441; Thu, 4 Jun 1998 16:49:42 -0700 (PDT) (envelope-from gdonl@tsc.tdk.com) Received: from salsa.gv.tsc.tdk.com (salsa.gv.tsc.tdk.com [192.168.241.194]) by sunrise.gv.tsc.tdk.com (8.8.5/8.8.5) with ESMTP id QAA03638; Thu, 4 Jun 1998 16:49:40 -0700 (PDT) Received: (from gdonl@localhost) by salsa.gv.tsc.tdk.com (8.8.5/8.8.5) id QAA08569; Thu, 4 Jun 1998 16:49:39 -0700 (PDT) From: Don Lewis Message-Id: <199806042349.QAA08569@salsa.gv.tsc.tdk.com> Date: Thu, 4 Jun 1998 16:49:38 -0700 In-Reply-To: Terry Lambert "Re: Code Logic Question in 2.2 RELENG" (Jun 4, 6:30pm) X-Mailer: Mail User's Shell (7.2.6 alpha(3) 7/19/95) To: Terry Lambert , Don.Lewis@tsc.tdk.com (Don Lewis) Subject: Re: Code Logic Question in 2.2 RELENG Cc: dk+@ua.net, barry@lustig.com, freebsd-hackers@FreeBSD.ORG, serge@yahoo.com Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Jun 4, 6:30pm, Terry Lambert wrote: } Subject: Re: Code Logic Question in 2.2 RELENG } Which reminds me. Someone needs to fix the "siginterrupt" man page. } } I would, but I think it is FreeBSD that is broken, not the man page, } and that by default, system calls *should* be restarted after a } signal is caught. I find it utterly bogus that I have to springle } the bejesus out of my code for while()'s and tests for "EINTR" and } manually restart all of my system calls. Gruds, if I wanted that, } I load System V on my box instead of BSD. Why not use the POSIX sigaction() call instead of signal(). It seems to be available except for really old systems that you probably don't want to play with anyway. It also works the same everywhere, unlike signal(). By default it keeps the signal handler instead of resetting it to SIG_DFL like the System V signal(), and doesn't interrupt system calls like System V signal(), but you get to pick your poison. } In The Good Old Days(tm), it wasn't an option; if you wanted EINTR } type behaviour, you did a setjmp before the call you wanted the } behaviour on, and like a decent, God-fearing BSD'er, you called } longjmp from the signal handler to prevent the call from being } restarted. Ick! If you leave out a setjmp(), you'll return to the wrong place. This also prevents you from keeping variables in registers, because they won't be restored when you return. In some implementations you have to remember to do a sigrelse() after returning from setjmp() if you ever want to catch the signal again. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message