Date: Sat, 17 Apr 1999 15:35:10 -0400 (EDT) From: John Baldwin <jobaldwi@vt.edu> To: freebsd-questions@freebsd.org Subject: Is it ok to include sys/signal.h directly? Message-ID: <XFMail.990417153510.jobaldwi@vt.edu>
next in thread | raw e-mail | index | archive | help
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 <sys/signal.h> #include <stdio.h> 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 <sys/cdefs.h> #include <sys/_posix.h> #include <machine/signal.h> /* sig_atomic_t; trap codes; sigcontext */ +#include <machine/ansi.h> #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) #define NSIG 32 /* counting 0; could be 33 (mask is 1-32) */ --- John Baldwin <jobaldwi@vt.edu> -- 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-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.990417153510.jobaldwi>