Skip to content
Snippets Groups Projects
Commit 71e56488 authored by Julian Ospald's avatar Julian Ospald :tea:
Browse files

Fix detection of statx.stx_mnt_id on buggy glibc

parent 3e7dcbc1
No related branches found
No related tags found
No related merge requests found
......@@ -940,7 +940,7 @@ pattern StatxBtime = StatxMask 0
-- | Want @stx_mnt_id@.
pattern StatxMntId :: StatxMask
#ifdef STATX_MNT_ID
#ifdef HAVE_STATX_MNT_ID
pattern StatxMntId = StatxMask (#const STATX_MNT_ID)
#else
pattern StatxMntId = StatxMask 0
......@@ -1160,11 +1160,11 @@ specialDeviceIDX (ExtendedFileStatus statx) = unsafePerformIO $ do
{-# WARNING specialDeviceIDX "specialDeviceIDX: not available on this platform, will throw error (CPP guard: @#if HAVE_SYS_SYSMACROS_H@)" #-}
specialDeviceIDX _ = error "specialDeviceIDX not available on this platform"
#endif
#ifdef STATX_MNT_ID
#ifdef HAVE_STATX_MNT_ID
mountIDX (ExtendedFileStatus statx) =
unsafePerformIO $ withForeignPtr statx $ (#peek struct statx, stx_mnt_id)
#else
{-# WARNING mountIDX "mountIDX: not available on this platform, will throw error (CPP guard: @#if STATX_MNT_ID@)" #-}
{-# WARNING mountIDX "mountIDX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX_MNT_ID@)" #-}
mountIDX _ = error "mountIDX not available on this platform"
#endif
fileBlockSizeX (ExtendedFileStatus statx) = unsafePerformIO $ do
......
......@@ -3,6 +3,7 @@
## 2.8.4.0 *??? 2023*
* add `haveStatx`
* fix `statx.stx_mnt_id` detection on buggy glibc, see [GHC #24072](https://gitlab.haskell.org/ghc/ghc/-/issues/24072)
## 2.8.3.0 *Oct 2023*
......
......@@ -50,6 +50,23 @@ AC_CHECK_TYPE([struct rlimit],[AC_DEFINE([HAVE_STRUCT_RLIMIT],[1],[HAVE_STRUCT_R
# check for statx
AC_CHECK_FUNC([statx], [AC_DEFINE([HAVE_STATX_FUN],[1],[HAVE_STATX_FUN])],[],[#include <sys/stat.h>])
AC_CHECK_TYPE([struct statx],[AC_DEFINE([HAVE_STRUCT_STATX],[1],[HAVE_STRUCT_STATX])],[],[#include <sys/stat.h>])
AC_MSG_CHECKING(for statx.stx_mnt_id)
AC_LINK_IFELSE([
AC_LANG_PROGRAM([[#include <sys/stat.h>]],
[[
struct statx statxbuf;
statx(0, "", 0, STATX_BASIC_STATS | STATX_MNT_ID, &statxbuf);
return statxbuf.stx_mnt_id;
]])],
[
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_STATX_MNT_ID], [1], [Define to 1 if statx.stx_mnt_id is available.])
],
[
AC_MSG_RESULT(no)
]
)
AC_MSG_CHECKING(for F_GETLK from fcntl.h)
AC_EGREP_CPP(yes,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment