Subject: standards/22149: definition of SIGBUS is too tightly constrained
To: None <gnats-bugs@gnats.netbsd.org>
From: None <nathanw@wasabisystems.com>
List: netbsd-bugs
Date: 07/15/2003 19:51:59
>Number:         22149
>Category:       standards
>Synopsis:       definition of SIGBUS is too tightly constrained
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jul 15 23:53:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Nathan J. Williams
>Release:        NetBSD 1.6U
>Organization:
	Wasabi Systems, Inc.
>Environment:
System: NetBSD marvin-the-martian.stuartst.com 1.6U NetBSD 1.6U (MARVIN) #59: Wed Jul 2 16:18:03 EDT 2003 nathanw@marvin-the-martian.stuartst.com:/nbsd/src/sys/arch/i386/compile/MARVIN i386
Architecture: i386
Machine: i386
>Description:
	The header <sys/signal.h> has the following conditional
definition for SIGBUS:

#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
#define	SIGBUS		10	/* bus error */
#endif

which does not define SIGBUS if the controlling feature test macro is
_POSIX_SOURCE or _POSIX_C_SOURCE. However, SIGBUS is defined at least
in ISO/IEC 9945-1:1996 (the earliest version I have handy), so this is
incorrect at least for _POSIX_C_SOURCE >= 199506L.

(It is defined in Table 3-3 in section 3.3.1.1, and the text states
that symbols in that table must be defined, even if the implementation
does not support generating the signal).

>How-To-Repeat:

	Try to build a program that defines _POSIX_C_SOURCE as 199506L
and then uses SIGBUS; peruse standards to determine that the program
is actually correct (unlike almost every other program that uses
_POSIX feature test macros).

>Fix:

Find out how far back SIGBUS is defined in POSIX.1, and change the
definition to something like:

#if ((_POSIX_C_SOURCE - 0) >= 199506L) || defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
#define	SIGBUS		10	/* bus error */
#endif

(for appropriate values of 199506L).
>Release-Note:
>Audit-Trail:
>Unformatted: