Files
gentoo/dev-libs/libaio/files/libaio-0.3.113-x32.patch
Sam James 7bb683da9d dev-libs/libaio: fix tests on x32
This uses Andrii's patch but tweaked to accommodate GCC's r11-257-g13a46321516e2e
where __ILP32__ started to be defined even for -m32. Instead, we check for
x32 specifically (x86-64 and not LP64) because of x32's syscall convention.

Closes: https://bugs.gentoo.org/722672
Thanks-to: Andrii Batyiev <batyiev@gmail.com>
Signed-off-by: Sam James <sam@gentoo.org>
2025-08-26 04:55:52 +01:00

49 lines
1.2 KiB
Diff

https://bugs.gentoo.org/722672#c4
--- a/src/syscall-x86_64.h
+++ b/src/syscall-x86_64.h
@@ -1,6 +1,16 @@
+#if ! defined(__ILP32__)
#define __NR_io_setup 206
#define __NR_io_destroy 207
#define __NR_io_getevents 208
#define __NR_io_submit 209
#define __NR_io_cancel 210
#define __NR_io_pgetevents 333
+#else
+#define __X32_SYSCALL_BIT 0x40000000
+#define __NR_io_setup (__X32_SYSCALL_BIT + 543)
+#define __NR_io_destroy (__X32_SYSCALL_BIT + 207)
+#define __NR_io_getevents (__X32_SYSCALL_BIT + 208)
+#define __NR_io_submit (__X32_SYSCALL_BIT + 544)
+#define __NR_io_cancel (__X32_SYSCALL_BIT + 210)
+#define __NR_io_pgetevents (__X32_SYSCALL_BIT + 333)
+#endif
--- a/src/io_pgetevents.c
+++ b/src/io_pgetevents.c
@@ -21,6 +21,7 @@
#include <stdlib.h>
#include <time.h>
#include <signal.h>
+#include <stdint.h>
#include "syscall.h"
#include "aio_ring.h"
@@ -33,10 +34,17 @@
struct io_event *events, struct timespec *timeout,
sigset_t *sigmask)
{
+#if (defined(__x86_64__) && ! defined(__ILP32__)) || ! defined(__x86_64__)
struct {
unsigned long ss;
unsigned long ss_len;
} data;
+#else
+ struct {
+ uint64_t ss;
+ uint64_t ss_len;
+ } data;
+#endif
if (aio_ring_is_empty(ctx, timeout))
return 0;