Skip to content

Commit 71e5648

Browse files
committed
1 parent 3e7dcbc commit 71e5648

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

System/Posix/Files/Common.hsc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ pattern StatxBtime = StatxMask 0
940940

941941
-- | Want @stx_mnt_id@.
942942
pattern StatxMntId :: StatxMask
943-
#ifdef STATX_MNT_ID
943+
#ifdef HAVE_STATX_MNT_ID
944944
pattern StatxMntId = StatxMask (#const STATX_MNT_ID)
945945
#else
946946
pattern StatxMntId = StatxMask 0
@@ -1160,11 +1160,11 @@ specialDeviceIDX (ExtendedFileStatus statx) = unsafePerformIO $ do
11601160
{-# WARNING specialDeviceIDX "specialDeviceIDX: not available on this platform, will throw error (CPP guard: @#if HAVE_SYS_SYSMACROS_H@)" #-}
11611161
specialDeviceIDX _ = error "specialDeviceIDX not available on this platform"
11621162
#endif
1163-
#ifdef STATX_MNT_ID
1163+
#ifdef HAVE_STATX_MNT_ID
11641164
mountIDX (ExtendedFileStatus statx) =
11651165
unsafePerformIO $ withForeignPtr statx $ (#peek struct statx, stx_mnt_id)
11661166
#else
1167-
{-# WARNING mountIDX "mountIDX: not available on this platform, will throw error (CPP guard: @#if STATX_MNT_ID@)" #-}
1167+
{-# WARNING mountIDX "mountIDX: not available on this platform, will throw error (CPP guard: @#if HAVE_STATX_MNT_ID@)" #-}
11681168
mountIDX _ = error "mountIDX not available on this platform"
11691169
#endif
11701170
fileBlockSizeX (ExtendedFileStatus statx) = unsafePerformIO $ do

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 2.8.4.0 *??? 2023*
44

55
* add `haveStatx`
6+
* fix `statx.stx_mnt_id` detection on buggy glibc, see [GHC #24072](https://gitlab.haskell.org/ghc/ghc/-/issues/24072)
67

78
## 2.8.3.0 *Oct 2023*
89

configure.ac

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@ AC_CHECK_TYPE([struct rlimit],[AC_DEFINE([HAVE_STRUCT_RLIMIT],[1],[HAVE_STRUCT_R
5050
# check for statx
5151
AC_CHECK_FUNC([statx], [AC_DEFINE([HAVE_STATX_FUN],[1],[HAVE_STATX_FUN])],[],[#include <sys/stat.h>])
5252
AC_CHECK_TYPE([struct statx],[AC_DEFINE([HAVE_STRUCT_STATX],[1],[HAVE_STRUCT_STATX])],[],[#include <sys/stat.h>])
53+
AC_MSG_CHECKING(for statx.stx_mnt_id)
54+
AC_LINK_IFELSE([
55+
AC_LANG_PROGRAM([[#include <sys/stat.h>]],
56+
[[
57+
struct statx statxbuf;
58+
statx(0, "", 0, STATX_BASIC_STATS | STATX_MNT_ID, &statxbuf);
59+
return statxbuf.stx_mnt_id;
60+
]])],
61+
[
62+
AC_MSG_RESULT(yes)
63+
AC_DEFINE([HAVE_STATX_MNT_ID], [1], [Define to 1 if statx.stx_mnt_id is available.])
64+
],
65+
[
66+
AC_MSG_RESULT(no)
67+
]
68+
)
69+
5370

5471
AC_MSG_CHECKING(for F_GETLK from fcntl.h)
5572
AC_EGREP_CPP(yes,

0 commit comments

Comments
 (0)