On AIX when compiling coreutils there is the following warning:
$ gmake V=1 lib/libcoreutils_a-mountlist.o
gcc -maix64 -I. -I./lib -Ilib -I./lib -Isrc -I./src -D_THREAD_SAFE
-Wno-cast-qual -Wno-conversion -Wno-float-equal -Wno-sign-compare -Wno-undef
-Wno-unused-function -Wno-unused-parameter -Wno-float-conversion
-Wimplicit-fallthrough -Wno-pedantic -Wno-sign-conversion -Wno-type-limits
-Wno-unused-const-variable -Wno-unsuffixed-float-constants -Wno-error -g -O2
-MT lib/libcoreutils_a-mountlist.o -MD -MP -MF
lib/.deps/libcoreutils_a-mountlist.Tpo -c -o lib/libcoreutils_a-mountlist.o
`test -f 'lib/mountlist.c' || echo './'`lib/mountlist.c
lib/mountlist.c: In function 'read_file_system_list':
lib/mountlist.c:970:45: warning: passing argument 3 of 'mntctl' from
incompatible pointer type [-Wincompatible-pointer-types]
if (mntctl (MCTL_QUERY, sizeof bufsize, &bufsize) != 0)
^~~~~~~~
In file included from /usr/include/acl.h:40,
from /usr/include/sys/vnode.h:54,
from /usr/include/sys/vfs.h:28,
from lib/mountlist.c:111:
/usr/include/sys/vmount.h:269:25: note: expected 'char *' but argument is
of type 'int *'
int mntctl(int, size_t, char *);
^~~~~~
mv -f lib/.deps/libcoreutils_a-mountlist.Tpo
lib/.deps/libcoreutils_a-mountlist.Po
The function is used correctly. Here is the relevant section of the AIX
documentation [1]:
If the Size parameter indicates that the supplied buffer is too
small to hold the vmount structures for all of the current VFSs, the
mntctl subroutine sets the first word of the Buffer parameter to the
required size (in bytes) and returns the value of 0.
I pushed the attached patch adding a cast to the argument in this case.
Collin
[1]
https://www.ibm.com/docs/en/aix/7.1.0?topic=m-mntctl-subroutine#mntctl__a1649c3__title__1
>From be1e56a1b1845698830048a312e82f7a368af242 Mon Sep 17 00:00:00 2001
Message-ID: <be1e56a1b1845698830048a312e82f7a368af242.1768680863.git.collin.fu...@gmail.com>
From: Collin Funk <[email protected]>
Date: Sat, 17 Jan 2026 12:13:42 -0800
Subject: [PATCH] mountlist: Fix a -Wincompatible-pointer-types warning on AIX.
* lib/mountlist.c (read_file_system_list): Cast the buffer size stored
by mntctl to a char pointer.
---
ChangeLog | 6 ++++++
lib/mountlist.c | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index ed9910ce53..188f4558df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-01-17 Collin Funk <[email protected]>
+
+ mountlist: Fix a -Wincompatible-pointer-types warning on AIX.
+ * lib/mountlist.c (read_file_system_list): Cast the buffer size stored
+ by mntctl to a char pointer.
+
2026-01-17 Bruno Haible <[email protected]>
doc: Mention another Haiku bug.
diff --git a/lib/mountlist.c b/lib/mountlist.c
index 66b3f3d57c..c19ce3fa99 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -967,7 +967,7 @@ read_file_system_list (bool need_fs_type)
{
/* Ask how many bytes to allocate for the mounted file system info. */
int bufsize;
- if (mntctl (MCTL_QUERY, sizeof bufsize, &bufsize) != 0)
+ if (mntctl (MCTL_QUERY, sizeof bufsize, (char *) &bufsize) != 0)
return NULL;
void *entries = xmalloc (bufsize);
--
2.52.0