From owner-freebsd-hackers Mon Apr 19 20:45: 3 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from quackerjack.cc.vt.edu (quackerjack.cc.vt.edu [198.82.160.250]) by hub.freebsd.org (Postfix) with ESMTP id EDA6815628 for ; Mon, 19 Apr 1999 20:44:57 -0700 (PDT) (envelope-from jobaldwi@vt.edu) Received: from sable.cc.vt.edu (sable.cc.vt.edu [128.173.16.30]) by quackerjack.cc.vt.edu (8.8.8/8.8.8) with ESMTP id XAA17314 for ; Mon, 19 Apr 1999 23:42:24 -0400 (EDT) Received: from john.baldwin.cx (jobaldwi.campus.vt.edu [198.82.67.63]) by sable.cc.vt.edu (8.8.8/8.8.8) with ESMTP id XAA31076 for ; Mon, 19 Apr 1999 23:42:23 -0400 (EDT) Message-ID: X-Mailer: XFMail 1.3 [p0] on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 Date: Mon, 19 Apr 1999 23:42:19 -0400 (EDT) From: John Baldwin To: freebsd-hackers@freebsd.org Subject: Is it ok to include sys/signal.h directly? Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Well, no response on -questions, so I figured I'd try -hackers. :) -----FW: Is it ok to include sys/signal.h directly?----- I've a question, should programs always include /usr/include/signal.h or is it ok for them to include /usr/include/sys/signal.h directly? Currently on 3.0+ programs that include sys/signal.h fail to compile. I.e.: > cat temp.c #include #include void main() { printf("foobar\n"); } > make temp.o cc -O -pipe -c temp.c In file included from temp.c:1: /usr/include/sys/signal.h:163: parse error before `size_t' /usr/include/sys/signal.h:163: warning: no semicolon at end of struct or union /usr/include/sys/signal.h:165: parse error before `}' *** Error code 1 Stop. They die because size_t is not defined when the sigaltstack struct is defined. In /usr/include/signal.h, machine/ansi.h is #include'd before sys/signal.h so that this problem is avoided. If it is desirable for programs to include just sys/signal.h by itself, then this patch would fix the problem: --- signal.h.orig Sat Apr 17 15:33:02 1999 +++ signal.h Sat Apr 17 15:33:37 1999 @@ -45,6 +45,7 @@ #include #include #include /* sig_atomic_t; trap codes; sigcontext */ +#include #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) #define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */ Note that these programs worked fine on 2.2.x, AFAIK. At least, one of the ports (devel/cccc) #include'd sys/signal.h, and it was broken in 3.0 but worked in 2.2. --- John Baldwin -- http://members.freedomnet.com/~jbaldwin/ PGP Key: http://members.freedomnet.com/~jbaldwin/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.freebsd.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message