[Git][ghc/ghc][master] base: add missing autoconf checks for waitpid/umask

Marge Bot (@marge-bot) gitlab at gitlab.haskell.org
Sat Dec 17 13:07:32 UTC 2022



Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
d1431cc0 by Cheng Shao at 2022-12-17T08:07:15-05:00
base: add missing autoconf checks for waitpid/umask

These are not present in wasi-libc. Required for fixing #22589

- - - - -


2 changed files:

- libraries/base/System/Posix/Internals.hs
- libraries/base/configure.ac


Changes:

=====================================
libraries/base/System/Posix/Internals.hs
=====================================
@@ -682,8 +682,13 @@ foreign import capi unsafe "HsBase.h read"
 foreign import capi safe "HsBase.h read"
    c_safe_read :: CInt -> Ptr Word8 -> CSize -> IO CSsize
 
+#if defined(HAVE_UMASK)
 foreign import ccall unsafe "HsBase.h umask"
    c_umask :: CMode -> IO CMode
+#else
+c_umask :: CMode -> IO CMode
+c_umask _ = ioError (ioeSetLocation unsupportedOperation "umask")
+#endif
 
 -- See Note: Windows types
 foreign import capi unsafe "HsBase.h write"
@@ -785,8 +790,14 @@ foreign import capi unsafe "HsBase.h tcsetattr"
 
 #endif
 
+#if defined(HAVE_GETPID)
 foreign import ccall unsafe "HsBase.h waitpid"
    c_waitpid :: CPid -> Ptr CInt -> CInt -> IO CPid
+#else
+c_waitpid :: CPid -> Ptr CInt -> CInt -> IO CPid
+c_waitpid _ _ _ = ioError (ioeSetLocation unsupportedOperation "waitpid")
+#endif
+
 #endif
 
 #if !defined(js_HOST_ARCH)


=====================================
libraries/base/configure.ac
=====================================
@@ -90,6 +90,7 @@ AC_CHECK_FUNCS([fork])
 AC_CHECK_FUNCS([getpid])
 AC_CHECK_FUNCS([mkfifo])
 AC_CHECK_FUNCS([pipe])
+AC_CHECK_FUNCS([umask])
 
 AC_CHECK_TYPE([struct rlimit],[AC_DEFINE([HAVE_STRUCT_RLIMIT],[1],[HAVE_STRUCT_RLIMIT])],[],[#include <sys/resource.h>])
 



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d1431cc06597b38d876a518e7769f04dcd2c0f32

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/d1431cc06597b38d876a518e7769f04dcd2c0f32
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/20221217/8e863987/attachment-0001.html>


More information about the ghc-commits mailing list