How to Include Headers for siginterrupt() and vsnprintf()

Gary Jennejohn gljennjohn at googlemail.com
Wed May 19 13:40:14 UTC 2010


On Wed, 19 May 2010 12:52:04 +0200
Gabor PALI <pgj at FreeBSD.org> wrote:

> Hello there,
> 
> I have some sources developed on non-FreeBSD systems (the sources of
> the run-time system for the Glasgow Haskell Compiler [1]) which try to
> #include signal.h to use siginterrupt() and stdio.h to use
> vsnprintf().  The problem is that they #define (or not) some constants
> which makes them hidden so the prototypes are not seen by the
> compiler.  How to cope with this kind of sources?  My naive solution
> is to do something like that (rts/posix/Signals.c):
> 
> #if defined(HAVE_SIGNAL_H)
> # if defined(freebsd_HOST_OS)
> extern int siginterrupt(int,int);
> # endif
> # include <signal.h>
> #endif
> 
> and that (rts/eventlog/EventLog.c):
> 
> #ifdef freebsd_HOST_OS
> int vsnprintf(char * __restrict, size_t, const char *
> __restrict,__va_list) __printflike(3, 0);
> #endif
> 
> 
> Thank you for the hints in advance.
> 

Try moving stdlib.h and string.h up near the top.  stdlib.h includes
sys/cdefs.h which defines (most) of these macros, like __XSI_VISIBLE.

--
Gary Jennejohn


More information about the freebsd-hackers mailing list