Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Jun 1998 16:49:38 -0700
From:      Don Lewis <Don.Lewis@tsc.tdk.com>
To:        Terry Lambert <tlambert@primenet.com>, Don.Lewis@tsc.tdk.com (Don Lewis)
Cc:        dk+@ua.net, barry@lustig.com, freebsd-hackers@FreeBSD.ORG, serge@yahoo.com
Subject:   Re: Code Logic Question in 2.2 RELENG
Message-ID:  <199806042349.QAA08569@salsa.gv.tsc.tdk.com>
In-Reply-To: Terry Lambert <tlambert@primenet.com> "Re: Code Logic Question in 2.2 RELENG" (Jun  4,  6:30pm)

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806042349.QAA08569>