diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | System/Posix/Signals/Exts.hsc | 57 | ||||
-rw-r--r-- | include/HsUnix.h | 13 |
3 files changed, 70 insertions, 2 deletions
@@ -3,7 +3,7 @@ include $(TOP)/mk/boilerplate.mk SUBDIRS = cbits include -ALL_DIRS = System System/Posix System/Posix/DynamicLinker +ALL_DIRS = System System/Posix System/Posix/DynamicLinker System/Posix/Signals PACKAGE = unix PACKAGE_DEPS = base diff --git a/System/Posix/Signals/Exts.hsc b/System/Posix/Signals/Exts.hsc new file mode 100644 index 0000000..55837df --- /dev/null +++ b/System/Posix/Signals/Exts.hsc @@ -0,0 +1,57 @@ +{-# OPTIONS -fffi #-} +----------------------------------------------------------------------------- +-- | +-- Module : System.Posix.Signals.Exts +-- Copyright : (c) The University of Glasgow 2002 +-- License : BSD-style (see the file libraries/base/LICENSE) +-- +-- Maintainer : libraries@haskell.org +-- Stability : provisional +-- Portability : non-portable (requires POSIX, includes Linuxisms/BSDisms) +-- +-- non-POSIX signal support commonly available +-- +----------------------------------------------------------------------------- + +#include "HsUnix.h" + +module System.Posix.Signals.Exts ( + module System.Posix.Signals + +#ifdef SIGINFO + , infoEvent, sigINFO +#endif +#ifdef SIGWINCH + , windowChange, sigWINCH +#endif + + ) where + +import Foreign.C ( CInt ) +import System.Posix.Signals + +#ifdef __HUGS__ +# ifdef SIGINFO +sigINFO = (#const SIGINFO) :: CInt +# endif +# ifdef SIGWINCH +sigWINCH = (#const SIGWINCH) :: CInt +# endif +#else /* !HUGS */ +# ifdef SIGINFO +foreign import ccall unsafe "__hsunix_SIGINFO" sigINFO :: CInt +# endif +# ifdef SIGWINCH +foreign import ccall unsafe "__hsunix_SIGWINCH" sigWINCH :: CInt +# endif +#endif /* !HUGS */ + +#ifdef SIGINFO +infoEvent :: Signal +infoEvent = sigINFO +#endif + +#ifdef SIGWINCH +windowChange :: Signal +windowChange = sigWINCH +#endif diff --git a/include/HsUnix.h b/include/HsUnix.h index fe857ae..49c8a9d 100644 --- a/include/HsUnix.h +++ b/include/HsUnix.h @@ -1,5 +1,5 @@ /* ----------------------------------------------------------------------------- - * $Id: HsUnix.h,v 1.15 2004/09/02 15:18:10 ross Exp $ + * $Id: HsUnix.h,v 1.16 2004/09/15 15:55:46 stolz Exp $ * * (c) The University of Glasgow 2002 * @@ -71,6 +71,10 @@ #include <dlfcn.h> #endif +#ifdef HAVE_SIGNAL_H +#include <signal.h> +#endif + extern int execvpe(char *name, char **argv, char **envp); extern void pPrPr_disableITimers (void); extern char **environ; @@ -100,4 +104,11 @@ fall back to O_FSYNC, which should be the same */ #define O_SYNC O_FSYNC #endif +#ifdef SIGINFO +INLINE int __hsunix_SIGINFO() { return SIGINFO; } +#endif +#ifdef SIGWINCH +INLINE int __hsunix_SIGWINCH() { return SIGWINCH; } +#endif + #endif |