summaryrefslogtreecommitdiff
path: root/libraries
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2023-03-31 12:32:26 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2023-04-03 08:17:16 -0400
commita8e36892689bd6b8fb472844f79aeeddeda92e0a (patch)
treefdeaed283bbf804c3d32488cc1229c958c3b1c11 /libraries
parent53e4d513a55df3c13424e7b649ce85b8113fa4c2 (diff)
downloadhaskell-a8e36892689bd6b8fb472844f79aeeddeda92e0a.tar.gz
JS: fix issues with FD api support
- Add missing implementations for fcntl_read/write/lock - Fix fdGetMode These were found while implementing TH in !9779. These functions must be used somehow by the external interpreter code.
Diffstat (limited to 'libraries')
-rw-r--r--libraries/base/System/Posix/Internals.hs4
-rw-r--r--libraries/base/jsbits/base.js9
2 files changed, 11 insertions, 2 deletions
diff --git a/libraries/base/System/Posix/Internals.hs b/libraries/base/System/Posix/Internals.hs
index 89fa80672f..244e46f496 100644
--- a/libraries/base/System/Posix/Internals.hs
+++ b/libraries/base/System/Posix/Internals.hs
@@ -139,10 +139,10 @@ ioe_unknownfiletype = IOError Nothing UnsupportedOperation "fdType"
Nothing
fdGetMode :: FD -> IO IOMode
-#if defined(mingw32_HOST_OS)
+#if defined(mingw32_HOST_OS) || defined(javascript_HOST_ARCH)
fdGetMode _ = do
-- We don't have a way of finding out which flags are set on FDs
- -- on Windows, so make a handle that thinks that anything goes.
+ -- on Windows/JS, so make a handle that thinks that anything goes.
let flags = o_RDWR
#else
fdGetMode fd = do
diff --git a/libraries/base/jsbits/base.js b/libraries/base/jsbits/base.js
index 1a2dc3495a..b9e0b84ce1 100644
--- a/libraries/base/jsbits/base.js
+++ b/libraries/base/jsbits/base.js
@@ -450,6 +450,15 @@ function h$base_c_s_isdir(mode) {
function h$base_c_s_isfifo(mode) {
return 0;
}
+function h$base_c_fcntl_read(fd,cmd) {
+ return -1;
+}
+function h$base_c_fcntl_write(fd,cmd,value) {
+ return -1;
+}
+function h$base_c_fcntl_lock(fd,cmd,ptr,ptr_o) {
+ return -1;
+}
#ifndef GHCJS_BROWSER
// The `fileStat` is filled according to the layout of Emscripten's `stat`