glibc has the following prototype for ioctl: int ioctl(int fd, unsigned long request, ...)
POSIX (inc. musl) has the following for ioctl: int ioctl(int fd, int request, ...)
Check which prototype is used in <sys/ioctl.h> to avoid a conflict and conditionally
define the right one for the system.
Bug: https://bugs.gentoo.org/914921
Signed-off-by: Sam James <sam@gentoo.org>
),
description: 'Is network address and service translation available'
)
+conf.set(
+ 'HAVE_GLIBC_IOCTL',
+ cc.compiles(
+ '''#include <sys/ioctl.h>
+ int ioctl(int fd, unsigned long request, ...);
+ ''',
+ name: 'ioctl has glibc-style prototype'
+ ),
+ description: 'Is ioctl the glibc interface (rather than POSIX)'
+)
if cc.has_function_attribute('fallthrough')
conf.set('fallthrough', '__attribute__((__fallthrough__))')
} \
})
+#ifdef HAVE_GLIBC_IOCTL
int ioctl(int fd, unsigned long request, ...)
+#else
+int ioctl(int fd, int request, ...)
+#endif
{
struct mock_cmds *mock_cmds;
bool result64;
result64 = true;
break;
default:
- fail("unexpected %s %lu", __func__, request);
+ fail("unexpected %s %lu", __func__, (unsigned long) request);
}
check(mock_cmds->remaining_cmds,
"unexpected %s command", mock_cmds->name);