[Git][ghc/ghc][master] JS: fix issues with FD api support
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Mon Apr 3 12:17:31 UTC 2023
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
a8e36892 by Sylvain Henry at 2023-04-03T08:17:16-04:00
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.
- - - - -
2 changed files:
- libraries/base/System/Posix/Internals.hs
- libraries/base/jsbits/base.js
Changes:
=====================================
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
=====================================
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`
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a8e36892689bd6b8fb472844f79aeeddeda92e0a
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/a8e36892689bd6b8fb472844f79aeeddeda92e0a
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230403/ffc82b9d/attachment-0001.html>
More information about the ghc-commits
mailing list