Allow System.Posix.Internals to compile with nhc98 again.
[ghc-base.git] / include / HsBase.h
index 9bbbdc8..d2c26da 100644 (file)
@@ -268,16 +268,6 @@ INLINE void *
 __hscore_memcpy_src_off( char *dst, char *src, int src_off, size_t sz )
 { return memcpy(dst, src+src_off, sz); }
 
-INLINE HsBool
-__hscore_supportsTextMode()
-{
-#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
-  return HS_BOOL_FALSE;
-#else
-  return HS_BOOL_TRUE;
-#endif
-}
-
 INLINE HsInt
 __hscore_bufsiz()
 {
@@ -688,9 +678,11 @@ INLINE int __hscore_hs_fileno (FILE *f) { return fileno (f); }
 INLINE int __hscore_open(char *file, int how, mode_t mode) {
 #ifdef __MINGW32__
        if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND))
-         return _sopen(file,how,_SH_DENYRW,mode);
+         return _sopen(file,how | _O_NOINHERIT,_SH_DENYRW,mode);
+          // _O_NOINHERIT: see #2650
        else
-         return _sopen(file,how,_SH_DENYWR,mode);
+         return _sopen(file,how | _O_NOINHERIT,_SH_DENYWR,mode);
+          // _O_NOINHERIT: see #2650
 #else
        return open(file,how,mode);
 #endif
@@ -765,5 +757,19 @@ INLINE intptr_t  __hscore_to_intptr   (void *p)     { return (intptr_t)p; }
 void errorBelch2(const char*s, char *t);
 void debugBelch2(const char*s, char *t);
 
+#if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
+
+INLINE int fcntl_read(int fd, int cmd) {
+    return fcntl(fd, cmd);
+}
+INLINE int fcntl_write(int fd, int cmd, long arg) {
+    return fcntl(fd, cmd, arg);
+}
+INLINE int fcntl_lock(int fd, int cmd, struct flock *lock) {
+    return fcntl(fd, cmd, lock);
+}
+
+#endif
+
 #endif /* __HSBASE_H__ */