NetBSD Problem Report #3633
Received: (qmail 1044 invoked from network); 16 May 1997 21:44:55 -0000
Message-Id: <199705162144.OAA10565@atomic.clock.org>
Date: Fri, 16 May 1997 14:44:47 -0700 (PDT)
From: "Erik E. Fair" <fair@atomic.clock.org>
Reply-To: fair@atomic.clock.org
To: gnats-bugs@gnats.netbsd.org
Subject: inconsistent declaration of "struct sigaction" in sys/signal.h
X-Send-Pr-Version: 3.95
>Number: 3633
>Category: lib
>Synopsis: inconsistent declaration of "struct sigaction" in sys/signal.h
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: lib-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri May 16 14:50:01 +0000 1997
>Closed-Date: Fri Jun 28 21:34:05 +0000 2002
>Last-Modified: Fri Jun 28 21:34:05 +0000 2002
>Originator: Erik E. Fair
>Release: NetBSD-current, May 16, 1997
>Organization:
International Organization of Internet Clock Watchers
>Environment:
System: NetBSD atomic.clock.org 1.2E NetBSD 1.2E (GENERIC) #59: Sun May 11 12:38:57 PDT 1997 root@atomic.clock.org:/usr/src/sys/arch/sparc/compile/GENERIC sparc
>Description:
The declaration of struct sigaction in sys/signal.h is
struct sigaction {
void (*sa_handler) __P((int));
sigset_t sa_mask;
int sa_flags;
};
However, sigaction(2) says:
EXAMPLE
The handler routine can be declared:
void
handler(sig, code, scp)
int sig, code;
struct sigcontext *scp;
An attempt to properly prototype this declaration, e.g.
static void sighandler __P((int, int, struct sigcontext *));
as opposed to
static void sighandler __P((int));
leads to cc -Wall complaining
===> usr.sbin/screenblank
cc -O -Werror -c screenblank.c
cc1: warnings being treated as errors
screenblank.c: In function `main':
screenblank.c:160: warning: assignment from incompatible
pointer type
*** Error code 1
Stop.
When the prototyped function is assigned to "sa_handler" as declared
above. See also PR# lib/2718
>How-To-Repeat:
Attempt to compile code as described above.
>Fix:
1. fix /usr/include/sys/signal.h
2. clean up all code that uses sigaction(2) to declare a handler.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: jdolecek
State-Changed-When: Fri Jun 28 14:32:14 PDT 2002
State-Changed-Why:
The 'official' version is 'void (*)(int)', the sigcontext thing
is BSD extension. The EXAMPLES section now contains note that
the function has to be cast to the 'official' prototype.
So, the manpage is updated and this problem is fixed.
Thanks for report.
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.