[project @ 2002-07-04 12:57:39 by simonmar]
[ghc-base.git] / include / HsBase.h
index 1a73ebb..1070aac 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: HsBase.h,v 1.4 2002/03/19 11:24:52 simonmar Exp $
+ * $Id: HsBase.h,v 1.8 2002/07/04 12:57:39 simonmar Exp $
  *
  * (c) The University of Glasgow 2001-2002
  *
 #include "config.h"
 #include "HsFFI.h"
 
+// The following is required on Solaris to force the POSIX versions of
+// the various _r functions instead of the Solaris versions.
+#ifdef solaris_TARGET_OS
+#define _POSIX_PTHREAD_SEMANTICS
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 
@@ -68,7 +74,7 @@
 #ifdef HAVE_SYS_TIMES_H
 #include <sys/times.h>
 #endif
-#ifdef HAVE_WINSOCK_H
+#if defined(HAVE_WINSOCK_H) && defined(__MINGW32__)
 #include <winsock.h>
 #endif
 #ifdef HAVE_LIMITS_H
 #include "dirUtils.h"
 #include "errUtils.h"
 
-#ifdef _WIN32
+#if defined(__MINGW32__)
 #include <io.h>
 #include <fcntl.h>
 #include "timeUtils.h"
@@ -179,6 +185,12 @@ StgWord64 stg_integerToWord64 (StgInt sa, StgByteArray /* Really: mp_limb_t* */
 #define INLINE extern inline
 #endif
 
+#if !defined(mingw32_TARGET_OS)
+INLINE int
+__hscore_sigaddset( sigset_t * set, int s )
+{ return sigaddset(set,s); }
+#endif
+
 INLINE int __hscore_s_isreg(m)  { return S_ISREG(m);  }
 INLINE int __hscore_s_isdir(m)  { return S_ISDIR(m);  }
 INLINE int __hscore_s_isfifo(m) { return S_ISFIFO(m); }
@@ -339,7 +351,7 @@ __hscore_seek_end( void )
 INLINE HsInt
 __hscore_setmode( HsInt fd, HsBool toBin )
 {
-#ifdef _WIN32
+#if defined(__MINGW32__)
   return setmode(fd,(toBin == HS_BOOL_TRUE) ? _O_BINARY : _O_TEXT);
 #else
   return 0;
@@ -350,7 +362,7 @@ INLINE HsInt
 __hscore_PrelHandle_write( HsInt fd, HsBool isSock, HsAddr ptr, 
                           HsInt off, int sz )
 {
-#ifdef _WIN32
+#if defined(__MINGW32__)
   if (isSock) {
     return send(fd,ptr + off, sz, 0);
   }
@@ -362,7 +374,7 @@ INLINE HsInt
 __hscore_PrelHandle_read( HsInt fd, HsBool isSock, HsAddr ptr, 
                          HsInt off, int sz )
 {
-#ifdef _WIN32
+#if defined(__MINGW32__)
   if (isSock) {
     return recv(fd,ptr + off, sz, 0);
   }
@@ -371,7 +383,7 @@ __hscore_PrelHandle_read( HsInt fd, HsBool isSock, HsAddr ptr,
 
 }
 
-#ifdef mingw32_TARGET_OS
+#if defined(__MINGW32__)
 INLINE long *
 __hscore_Time_ghcTimezone( void ) { return &_timezone; }
 
@@ -382,7 +394,7 @@ __hscore_Time_ghcTzname( void ) { return _tzname; }
 INLINE HsInt
 __hscore_mkdir( HsAddr pathName, HsInt mode )
 {
-#if defined(mingw32_TARGET_OS)
+#if defined(__MINGW32__)
   return mkdir(pathName);
 #else
   return mkdir(pathName,mode);