/* -----------------------------------------------------------------------------
- * $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>
#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"
#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); }
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;
__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);
}
__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);
}
}
-#ifdef mingw32_TARGET_OS
+#if defined(__MINGW32__)
INLINE long *
__hscore_Time_ghcTimezone( void ) { return &_timezone; }
INLINE HsInt
__hscore_mkdir( HsAddr pathName, HsInt mode )
{
-#if defined(mingw32_TARGET_OS)
+#if defined(__MINGW32__)
return mkdir(pathName);
#else
return mkdir(pathName,mode);