From: Samuel Thibault Date: Sun, 15 Sep 2024 13:57:52 +0000 (+0200) Subject: [PATCH] GNU/Hurd: Add getExecutablePath support X-Git-Tag: archive/raspbian/9.10.3-3+rpi1^2~4 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=16fff8a0e34fd7496ef230bafe22423d614f1b3d;p=ghc.git [PATCH] GNU/Hurd: Add getExecutablePath support GNU/Hurd exposes it as /proc/self/exe just like on Linux. Gbp-Pq: Name gnu-hurd --- diff --git a/libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc b/libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc index a06b39f8..6eb40c85 100644 --- a/libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc +++ b/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