[Git][ghc/ghc][master] GNU/Hurd: Add getExecutablePath support
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Mon Sep 16 14:34:04 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
3939a8bf by Samuel Thibault at 2024-09-16T10:33:44-04:00
GNU/Hurd: Add getExecutablePath support
GNU/Hurd exposes it as /proc/self/exe just like on Linux.
- - - - -
1 changed file:
- libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc
Changes:
=====================================
libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc
=====================================
@@ -200,9 +200,9 @@ executablePath = Just (fmap Just getExecutablePath `catch` f)
| otherwise = throw e
--------------------------------------------------------------------------------
--- Linux / Solaris
+-- Linux / Solaris / Hurd
-#elif defined(linux_HOST_OS) || defined(solaris2_HOST_OS)
+#elif defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(gnu_HOST_OS)
foreign import ccall unsafe "readlink"
c_readlink :: CString -> CString -> CSize -> IO CInt
@@ -219,7 +219,7 @@ readSymbolicLink file =
c_readlink s buf 4096
peekFilePathLen (buf,fromIntegral len)
-# if defined(linux_HOST_OS)
+# if defined(linux_HOST_OS) || defined(gnu_HOST_OS)
getExecutablePath = readSymbolicLink $ "/proc/self/exe"
executablePath = Just (check <$> getExecutablePath) where
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3939a8bf93e27d8151aa1d92bf3ce10bbbc96a72
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/3939a8bf93e27d8151aa1d92bf3ce10bbbc96a72
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/20240916/155d22cc/attachment-0001.html>
More information about the ghc-commits
mailing list