Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Apr 1995 20:33:53 +0400
From:      "Andrey A. Chernov, Black Mage" <ache@astral.msk.su>
To:        Rainer Wittmann UMS <rw@namu01.gwdg.de>, Garrett Wollman <wollman@halloran-eldar.lcs.mit.edu>
Cc:        bugs@FreeBSD.org
Subject:   Re: signal handling bug
Message-ID:  <fInpeblWR9@astral.msk.su>
In-Reply-To: <9504201518.AA05095@halloran-eldar.lcs.mit.edu>; from Garrett Wollman at Thu, 20 Apr 1995 11:18:32 -0400
References:  <9504201250.AA26059@namu01.gwdg.de> <9504201518.AA05095@halloran-eldar.lcs.mit.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
In message <9504201518.AA05095@halloran-eldar.lcs.mit.edu> Garrett
    Wollman writes:

><<On Thu, 20 Apr 95 14:50:45 +0200, rw@namu01.gwdg.de (Rainer Wittmann UMS) said:

>> Any unix system, I know, except FreeBSD 2.0, behaves as follows,
>> [description deleted]

>Then you've never before used a 4BSD system.  This is very
>long-standard BSD behavior (goes back to 1982 or earlier).

>> void	SIGINT_handler(void)

>void SIGINT_handler(int)

>> {
>> 	signal(SIGINT, (void (*)(int))SIGINT_handler);

>Obviously you're used to using System V.  Delete this line.

>> 	fprintf(stdout, "\nSIGINT received\n");
>> }

>> char	chr;

>> void	main(void)
>> {
>> 	signal(SIGINT, (void (*)(int))SIGINT_handler);

>	struct sigaction sa;
>	sa.sa_handler = SIGINT_handler;
>	sigemptyset(&sa.sa_mask);
>	sa.sa_flags = 0;
>	sigaction(SIGINT, &sa, (struct sigaction *)0);

>> 	errno = 0;
>> 	read(0, &chr, 1);
>> 	if( errno == EINTR ) fprintf(stdout, "errno = EINTR\n");
>> }

You even don't need such complex procedure, just use single line

	siginterrupt(SIGINT, 1);


-- 
Andrey A. Chernov        : And I rest so composedly,  /Now, in my bed,
ache@astral.msk.su       : That any beholder  /Might fancy me dead -
FidoNet: 2:5020/230.3    : Might start at beholding me,  /Thinking me dead.
RELCOM Team,FreeBSD Team :         E.A.Poe         From "For Annie" 1849



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