Subject: lib/3633: inconsistent declaration of "struct sigaction" in sys/signal.h
To: None <gnats-bugs@gnats.netbsd.org>
From: Erik E. Fair <fair@atomic.clock.org>
List: netbsd-bugs
Date: 05/16/1997 14:44:47
>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 (Library Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri May 16 14:50:01 1997
>Last-Modified:
>Originator:     Erik E. Fair
>Organization:
International Organization of Internet Clock Watchers
>Release:        NetBSD-current, May 16, 1997
>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.
>Audit-Trail:
>Unformatted: