summaryrefslogtreecommitdiff
path: root/libraries/base/include/HsBase.h
diff options
context:
space:
mode:
authorKavon Farvardin <kavon@farvard.in>2018-09-23 15:29:37 -0500
committerKavon Farvardin <kavon@farvard.in>2018-09-23 15:29:37 -0500
commit84c2ad99582391005b5e873198b15e9e9eb4f78d (patch)
treecaa8c2f2ec7e97fbb4977263c6817c9af5025cf4 /libraries/base/include/HsBase.h
parent8ddb47cfcf5776e9a3c55fd37947c8a95e00fa12 (diff)
parente68b439fe5de61b9a2ca51af472185c62ccb8b46 (diff)
downloadhaskell-84c2ad99582391005b5e873198b15e9e9eb4f78d.tar.gz
update to current master againwip/T13904
Diffstat (limited to 'libraries/base/include/HsBase.h')
-rw-r--r--libraries/base/include/HsBase.h21
1 files changed, 17 insertions, 4 deletions
diff --git a/libraries/base/include/HsBase.h b/libraries/base/include/HsBase.h
index 0fe5805a64..d5884473ca 100644
--- a/libraries/base/include/HsBase.h
+++ b/libraries/base/include/HsBase.h
@@ -24,6 +24,7 @@
#include "HsFFI.h"
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
@@ -152,7 +153,7 @@ extern HsWord64 getMonotonicUSec(void);
#endif
/* in inputReady.c */
-extern int fdReady(int fd, int write, int msecs, int isSock);
+extern int fdReady(int fd, bool write, int64_t msecs, bool isSock);
/* -----------------------------------------------------------------------------
INLINE functions.
@@ -288,7 +289,7 @@ __hscore_ftruncate( int fd, off_t where )
return _chsize(fd,where);
#else
// ToDo: we should use _chsize_s() on Windows which allows a 64-bit
-// offset, but it doesn't seem to be available from mingw at this time
+// offset, but it doesn't seem to be available from mingw at this time
// --SDM (01/2008)
#error at least ftruncate or _chsize functions are required to build
#endif
@@ -519,13 +520,25 @@ extern void* __hscore_get_saved_termios(int fd);
extern void __hscore_set_saved_termios(int fd, void* ts);
#if defined(_WIN32)
+/* Defined in fs.c. */
+extern int __hs_swopen (const wchar_t* filename, int oflag, int shflag,
+ int pmode);
+
INLINE int __hscore_open(wchar_t *file, int how, mode_t mode) {
+ int result = -1;
if ((how & O_WRONLY) || (how & O_RDWR) || (how & O_APPEND))
- return _wsopen(file,how | _O_NOINHERIT,_SH_DENYNO,mode);
+ result = __hs_swopen(file,how | _O_NOINHERIT,_SH_DENYNO,mode);
// _O_NOINHERIT: see #2650
else
- return _wsopen(file,how | _O_NOINHERIT,_SH_DENYNO,mode);
+ result = __hs_swopen(file,how | _O_NOINHERIT,_SH_DENYNO,mode);
// _O_NOINHERIT: see #2650
+
+ /* This call is very important, otherwise the I/O system will not propagate
+ the correct error for why it failed. */
+ if (result == -1)
+ maperrno ();
+
+ return result;
}
#else
INLINE int __hscore_open(char *file, int how, mode_t mode) {