.gear/libaio.spec | 102 +++++++++++++++++++++++++++++++++++++++++++ .gear/rules | 5 +++ .gear/tags/list | 1 + .gear/upstream/filter-tag | 1 + .gear/upstream/remotes | 3 ++ .gear/upstream/transform-tag | 1 + Makefile | 5 ++- harness/Makefile | 2 +- harness/main.c | 10 +++++ src/Makefile | 12 ++--- src/compat-0_1.c | 7 ++- src/io_cancel.c | 2 +- src/io_getevents.c | 2 +- src/io_pgetevents.c | 38 +++++++++++++--- src/io_queue_wait.c | 2 +- src/libaio.h | 23 ++++++++-- src/syscall-arm.h | 10 ++--- src/syscall-ia64.h | 11 ++--- src/syscall-m68k.h | 5 +++ src/syscall-mips.h | 54 +++++++++++++++++++++++ src/syscall-parisc.h | 6 +++ src/syscall-sh.h | 6 +++ src/syscall-x86_64.h | 12 +++++ src/syscall.h | 25 ++++++++++- 24 files changed, 308 insertions(+), 37 deletions(-) diff --git a/.gear/libaio.spec b/.gear/libaio.spec new file mode 100644 index 0000000..07ff145 --- /dev/null +++ b/.gear/libaio.spec @@ -0,0 +1,102 @@ +Name: libaio +Version: 0.3.113 +Release: alt1 + +Summary: Linux-native asynchronous I/O access library +License: LGPLv2+ +Group: System/Libraries +Url: https://pagure.io/libaio +Source: %name-%version.tar +Patch: %name-%version.patch + +BuildRequires: /proc + +%description +The Linux-native asynchronous I/O facility ("async I/O", or "aio") has a richer +API and capability set than the simple POSIX async I/O facility. This library, +libaio, provides the Linux-native API for async I/O. The POSIX async I/O +facility requires this library in order to provide kernel-accelerated async I/O +capabilities, as do applications which require the Linux-native async I/O API. + +%package devel +Summary: Development files for Linux-native asynchronous I/O access +Group: Development/C +Requires: libaio = %version-%release + +%description devel +This package provides header files to include and libraries to link with +for the Linux-native asynchronous I/O facility ("async I/O", or "aio"). + +%package devel-static +Summary: Linux-native asynchronous I/O access static library +Group: Development/C +Requires: libaio-devel = %version-%release + +%description devel-static +This package contains static library for +the Linux-native asynchronous I/O facility ("async I/O", or "aio"). + +%prep +%setup +%patch -p1 + +%build +%make_build + +%install +%makeinstall_std \ + prefix=%_prefix libdir=/%_lib usrlibdir=%_libdir + +%check +%make partcheck + +%files +/%_lib/*.so.* + +%files devel +%_libdir/*.so +%_includedir/* + +%files devel-static +%_libdir/*.a + +%changelog +* Fri Mar 24 2023 Alexey Shabalin 0.3.113-alt1 +- new version 0.3.113 + +* Thu Jun 24 2021 Alexey Shabalin 0.3.112-alt1 +- new version 0.3.112 + +* Wed Jun 27 2018 Alexey Shabalin 0.3.111-alt1 +- 0.3.111 +- add package with static library +- add patches from debian for support more arches + +* Sat Jan 28 2017 Michael Shigorin 0.3.110-alt1.1 +- E2K: partially added mcst patch. + +* Tue Aug 19 2014 Gleb F-Malinovskiy 0.3.110-alt1 +- New version. + +* Thu Aug 11 2011 Dmitry V. Levin 0.3.109-alt2 +- Imported manpage fixes from Debian. +- Made %name.so symlink relative. +- Rebuilt for debuginfo. + +* Mon Oct 18 2010 Victor Forsiuk 0.3.109-alt1 +- 0.3.109 + +* Wed Aug 26 2009 Victor Forsyuk 0.3.107-alt2 +- Move library to /lib (close: ALT#21230). + +* Mon Dec 15 2008 Victor Forsyuk 0.3.107-alt1 +- 0.3.107 + +* Mon Apr 07 2008 Victor Forsyuk 0.3.106-alt2 +- One-letter spec fix, library symlink should be owned only by -devel. + +* Mon Apr 10 2006 Victor Forsyuk 0.3.106-alt1 +- 0.3.106 + +* Fri Jul 29 2005 Victor Forsyuk 0.3.104-alt1 +- Initial build. diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..ed8cbb6 --- /dev/null +++ b/.gear/rules @@ -0,0 +1,5 @@ +tar: @name@-@version@:. +diff: @name@-@version@:. . name=@name@-@version@.patch +spec: .gear/libaio.spec + + diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 0000000..8cbb033 --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1 @@ +1b18bfafc6a2f7b9fa2c6be77a95afed8b7be448 libaio-0.3.113 diff --git a/.gear/upstream/filter-tag b/.gear/upstream/filter-tag new file mode 100755 index 0000000..b205ea5 --- /dev/null +++ b/.gear/upstream/filter-tag @@ -0,0 +1 @@ +grep libaio- diff --git a/.gear/upstream/remotes b/.gear/upstream/remotes new file mode 100644 index 0000000..bbfd2bb --- /dev/null +++ b/.gear/upstream/remotes @@ -0,0 +1,3 @@ +[remote "upstream"] + url = https://pagure.io/libaio.git + fetch = +refs/heads/*:refs/remotes/upstream/* diff --git a/.gear/upstream/transform-tag b/.gear/upstream/transform-tag new file mode 100755 index 0000000..2440c5f --- /dev/null +++ b/.gear/upstream/transform-tag @@ -0,0 +1 @@ +sed -e 's,libaio-,,' diff --git a/Makefile b/Makefile index c1fb831..859fc0b 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,12 @@ VERSION=$(shell awk '/Version:/ { print $$2 }' $(SPECFILE)) TAG = $(NAME)-$(VERSION) RPMBUILD=$(shell `which rpmbuild >&/dev/null` && echo "rpmbuild" || echo "rpm") +DESTDIR= prefix=/usr includedir=$(prefix)/include libdir=$(prefix)/lib +libdir=$(prefix)/lib +usrlibdir=$(prefix)/lib default: all @@ -14,7 +17,7 @@ all: @$(MAKE) -C src install: - @$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir) + @$(MAKE) -C src install DESTDIR=$(DESTDIR) prefix=$(prefix) includedir=$(includedir) libdir=$(libdir) usrlibdir=$(usrlibdir) check: @$(MAKE) -C harness check diff --git a/harness/Makefile b/harness/Makefile index 4f225d3..3da39b1 100644 --- a/harness/Makefile +++ b/harness/Makefile @@ -1,6 +1,6 @@ # foo. TEST_SRCS:=$(shell find cases/ -name \*.t | sort -n -t/ -k2) -EXTRAPROGS:=cases/8.p cases/10.p +EXTRAPROGS:=cases/8.p cases/10.p cases/23.p PARTPROGS:=$(filter-out $(EXTRAPROGS), $(patsubst %.t,%.p,$(TEST_SRCS))) PROGS:=$(PARTPROGS) $(EXTRAPROGS) HARNESS_SRCS:=main.c diff --git a/harness/main.c b/harness/main.c index 82e9c69..c521693 100644 --- a/harness/main.c +++ b/harness/main.c @@ -12,7 +12,17 @@ #include #if __LP64__ == 0 +#if defined(__i386__) || defined(__powerpc__) || defined(__mips__) #define KERNEL_RW_POINTER ((void *)0xc0010000) +#elif defined(__arm__) || defined(__m68k__) || defined(__s390__) || defined(__sh__) || defined(__x86_64__) +#define KERNEL_RW_POINTER ((void *)0x00010000) +#elif defined(__hppa__) +#define KERNEL_RW_POINTER ((void *)0x10100000) +#elif defined(__sparc__) +#define KERNEL_RW_POINTER ((void *)0xf0010000) +#else +#error Unknown kernel memory address. +#endif #else //#warning Not really sure where kernel memory is. Guessing. #define KERNEL_RW_POINTER ((void *)0xffffffff81000000) diff --git a/src/Makefile b/src/Makefile index d080a1b..28e2822 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,8 @@ +DESTDIR= prefix=/usr includedir=$(prefix)/include libdir=$(prefix)/lib +usrlibdir=$(prefix)/lib CFLAGS ?= -g -fomit-frame-pointer -O2 CFLAGS += -Wall -I. -fPIC @@ -59,12 +61,12 @@ $(libname): $(libaio_sobjs) libaio.map $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS) install: $(all_targets) - install -D -m 644 libaio.h $(includedir)/libaio.h - install -D -m 644 libaio.a $(libdir)/libaio.a + install -D -m 644 libaio.h $(DESTDIR)$(includedir)/libaio.h + install -D -m 644 libaio.a $(DESTDIR)$(usrlibdir)/libaio.a ifeq ($(ENABLE_SHARED),1) - install -D -m 755 $(libname) $(libdir)/$(libname) - ln -sf $(libname) $(libdir)/$(soname) - ln -sf $(libname) $(libdir)/libaio.so + install -D -m 644 $(libname) $(DESTDIR)$(libdir)/$(libname) + ln -sfr $(DESTDIR)$(libdir)/$(libname) $(DESTDIR)$(libdir)/$(soname) + ln -sfr $(DESTDIR)$(libdir)/$(libname) $(DESTDIR)$(usrlibdir)/libaio.so endif $(libaio_objs): libaio.h diff --git a/src/compat-0_1.c b/src/compat-0_1.c index 722e107..ac40fcc 100644 --- a/src/compat-0_1.c +++ b/src/compat-0_1.c @@ -28,7 +28,6 @@ /* ABI change. Provide partial compatibility on this one for now. */ -SYMVER(compat0_1_io_cancel, io_cancel, 0.1); int compat0_1_io_cancel(io_context_t ctx, struct iocb *iocb) { struct io_event event; @@ -36,8 +35,8 @@ int compat0_1_io_cancel(io_context_t ctx, struct iocb *iocb) /* FIXME: the old ABI would return the event on the completion queue */ return io_cancel(ctx, iocb, &event); } +SYMVER(compat0_1_io_cancel, io_cancel, 0.1); -SYMVER(compat0_1_io_queue_wait, io_queue_wait, 0.1); int compat0_1_io_queue_wait(io_context_t ctx, struct timespec *when) { struct timespec timeout; @@ -45,10 +44,10 @@ int compat0_1_io_queue_wait(io_context_t ctx, struct timespec *when) timeout = *when; return io_getevents(ctx, 0, 0, NULL, when ? &timeout : NULL); } +SYMVER(compat0_1_io_queue_wait, io_queue_wait, 0.1); /* ABI change. Provide backwards compatibility for this one. */ -SYMVER(compat0_1_io_getevents, io_getevents, 0.1); int compat0_1_io_getevents(io_context_t ctx, long nr, struct io_event *events, const struct timespec *const_timeout) @@ -59,4 +58,4 @@ int compat0_1_io_getevents(io_context_t ctx, long nr, return io_getevents(ctx, 1, nr, events, const_timeout ? &timeout : NULL); } - +SYMVER(compat0_1_io_getevents, io_getevents, 0.1); diff --git a/src/io_cancel.c b/src/io_cancel.c index 2f0f5f4..441806d 100644 --- a/src/io_cancel.c +++ b/src/io_cancel.c @@ -20,4 +20,4 @@ #include "syscall.h" io_syscall3(int, io_cancel_0_4, io_cancel, io_context_t, ctx, struct iocb *, iocb, struct io_event *, event) -DEFSYMVER(io_cancel_0_4, io_cancel, 0.4) +DEFSYMVER(io_cancel_0_4, io_cancel, 0.4); diff --git a/src/io_getevents.c b/src/io_getevents.c index 90d6081..88d285a 100644 --- a/src/io_getevents.c +++ b/src/io_getevents.c @@ -32,4 +32,4 @@ int io_getevents_0_4(io_context_t ctx, long min_nr, long nr, struct io_event * e return __io_getevents_0_4(ctx, min_nr, nr, events, timeout); } -DEFSYMVER(io_getevents_0_4, io_getevents, 0.4) +DEFSYMVER(io_getevents_0_4, io_getevents, 0.4); diff --git a/src/io_pgetevents.c b/src/io_pgetevents.c index e6b0614..b2515f2 100644 --- a/src/io_pgetevents.c +++ b/src/io_pgetevents.c @@ -33,17 +33,41 @@ int io_pgetevents(io_context_t ctx, long min_nr, long nr, struct io_event *events, struct timespec *timeout, sigset_t *sigmask) { - struct { - unsigned long ss; - unsigned long ss_len; - } data; + struct io_sigset aio_sigset; +#ifndef __LP64__ + struct io_sigset_compat aio_sigset_compat = { 0 }; +#endif + int ret; if (aio_ring_is_empty(ctx, timeout)) return 0; - data.ss = (unsigned long)sigmask; - data.ss_len = _NSIG / 8; - return __io_pgetevents(ctx, min_nr, nr, events, timeout, &data); + aio_sigset.ss = (unsigned long)sigmask; + aio_sigset.ss_len = _NSIG / 8; + ret = __io_pgetevents(ctx, min_nr, nr, events, timeout, &aio_sigset); + +#ifndef __LP64__ + /* + * The compat kernel syscall got introduced with an broken layout for + * its sigset argument, expecting it to contain a pointer for the + * non-compat pointer size. + * + * To cope with this on unfixed kernels, in case we are built as a + * 32-bit library (which could run on a kernel with compat code) and + * when the syscall returns EINVAL due to the kernel not finding the + * sigset size member when unpacking the structure, we retry with + * the fixed up compat layout, which requires the padding to be + * zero-filled, otherwise the 64-bit pointer will contain garbage. + */ + if (ret != -EINVAL) + return ret; + + aio_sigset_compat.ss = (unsigned long)sigmask; + aio_sigset_compat.ss_len = _NSIG / 8; + ret = __io_pgetevents(ctx, min_nr, nr, events, timeout, &aio_sigset_compat); +#endif + + return ret; } #else int io_pgetevents(io_context_t ctx, long min_nr, long nr, diff --git a/src/io_queue_wait.c b/src/io_queue_wait.c index 538d2f3..6f69a51 100644 --- a/src/io_queue_wait.c +++ b/src/io_queue_wait.c @@ -28,4 +28,4 @@ int io_queue_wait_0_4(io_context_t ctx, struct timespec *timeout) { return io_getevents(ctx, 0, 0, NULL, timeout); } -DEFSYMVER(io_queue_wait_0_4, io_queue_wait, 0.4) +DEFSYMVER(io_queue_wait_0_4, io_queue_wait, 0.4); diff --git a/src/libaio.h b/src/libaio.h index 24b4b8a..28cec59 100644 --- a/src/libaio.h +++ b/src/libaio.h @@ -52,9 +52,10 @@ typedef enum io_iocb_cmd { /* little endian, 32 bits */ #if defined(__i386__) || (defined(__arm__) && !defined(__ARMEB__)) || \ - defined(__sh__) || defined(__bfin__) || defined(__MIPSEL__) || \ - defined(__cris__) || defined(__loongarch32) || \ - (defined(__riscv) && __riscv_xlen == 32) || \ + (defined(__sh__) && defined(__LITTLE_ENDIAN__)) || \ + defined(__bfin__) || \ + (defined(__MIPSEL__) && !defined(__mips64)) || \ + defined(__cris__) || defined(__loongarch32) || (defined(__riscv) && __riscv_xlen == 32) || \ (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 4) #define PADDED(x, y) x; unsigned y @@ -62,7 +63,8 @@ typedef enum io_iocb_cmd { #define PADDEDul(x, y) unsigned long x; unsigned y /* little endian, 64 bits */ -#elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__) || \ +#elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__) || defined(__e2k__) || \ + (defined(__mips64) && defined(__MIPSEL__)) || \ (defined(__aarch64__) && defined(__AARCH64EL__)) || \ defined(__loongarch64) || \ (defined(__riscv) && __riscv_xlen == 64) || \ @@ -74,7 +76,9 @@ typedef enum io_iocb_cmd { /* big endian, 64 bits */ #elif defined(__powerpc64__) || defined(__s390x__) || \ + (defined(__hppa__) && defined(__arch64__)) || \ (defined(__sparc__) && defined(__arch64__)) || \ + (defined(__mips64) && defined(__MIPSEB__)) || \ (defined(__aarch64__) && defined(__AARCH64EB__)) || \ (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ && __SIZEOF_LONG__ == 8) @@ -85,6 +89,7 @@ typedef enum io_iocb_cmd { /* big endian, 32 bits */ #elif defined(__PPC__) || defined(__s390__) || \ (defined(__arm__) && defined(__ARMEB__)) || \ + (defined(__sh__) && defined (__BIG_ENDIAN__)) || \ defined(__sparc__) || defined(__MIPSEB__) || defined(__m68k__) || \ defined(__hppa__) || defined(__frv__) || defined(__avr32__) || \ (defined(__GNUC__) && defined(__BYTE_ORDER__) && \ @@ -146,6 +151,16 @@ struct io_event { PADDEDul(res2, __pad4); }; +struct io_sigset { + unsigned long ss; + unsigned long ss_len; +}; + +struct io_sigset_compat { + PADDEDptr(unsigned long ss, __ss_pad); + unsigned long ss_len; +}; + #undef PADDED #undef PADDEDptr #undef PADDEDul diff --git a/src/syscall-arm.h b/src/syscall-arm.h index 556852b..315a37b 100644 --- a/src/syscall-arm.h +++ b/src/syscall-arm.h @@ -19,8 +19,8 @@ #define __NR_SYSCALL_BASE __NR_OABI_SYSCALL_BASE #endif -#define __NR_io_setup (__NR_SYSCALL_BASE+243) -#define __NR_io_destroy (__NR_SYSCALL_BASE+244) -#define __NR_io_getevents (__NR_SYSCALL_BASE+245) -#define __NR_io_submit (__NR_SYSCALL_BASE+246) -#define __NR_io_cancel (__NR_SYSCALL_BASE+247) +#define __NR_io_setup (__NR_SYSCALL_BASE + 243) +#define __NR_io_destroy (__NR_SYSCALL_BASE + 244) +#define __NR_io_getevents (__NR_SYSCALL_BASE + 245) +#define __NR_io_submit (__NR_SYSCALL_BASE + 246) +#define __NR_io_cancel (__NR_SYSCALL_BASE + 247) diff --git a/src/syscall-ia64.h b/src/syscall-ia64.h index a21e93b..765c423 100644 --- a/src/syscall-ia64.h +++ b/src/syscall-ia64.h @@ -1,5 +1,6 @@ -#define __NR_io_setup 1238 -#define __NR_io_destroy 1239 -#define __NR_io_getevents 1240 -#define __NR_io_submit 1241 -#define __NR_io_cancel 1242 +#define __NR_Linux 1024 +#define __NR_io_setup (__NR_Linux + 214) +#define __NR_io_destroy (__NR_Linux + 215) +#define __NR_io_getevents (__NR_Linux + 216) +#define __NR_io_submit (__NR_Linux + 217) +#define __NR_io_cancel (__NR_Linux + 218) diff --git a/src/syscall-m68k.h b/src/syscall-m68k.h new file mode 100644 index 0000000..2dd4a9b --- /dev/null +++ b/src/syscall-m68k.h @@ -0,0 +1,5 @@ +#define __NR_io_setup 241 +#define __NR_io_destroy 242 +#define __NR_io_getevents 243 +#define __NR_io_submit 244 +#define __NR_io_cancel 245 diff --git a/src/syscall-mips.h b/src/syscall-mips.h new file mode 100644 index 0000000..2c4245e --- /dev/null +++ b/src/syscall-mips.h @@ -0,0 +1,54 @@ +/* + * This file is subject to the terms and conditions of the GNU General Public + * License. See the file "COPYING" in the main directory of this archive + * for more details. + * + * Copyright (C) 1995, 96, 97, 98, 99, 2000 by Ralf Baechle + * Copyright (C) 1999, 2000 Silicon Graphics, Inc. + */ + +#ifndef _MIPS_SIM_ABI32 +#define _MIPS_SIM_ABI32 1 +#define _MIPS_SIM_NABI32 2 +#define _MIPS_SIM_ABI64 3 +#endif + +#if _MIPS_SIM == _MIPS_SIM_ABI32 + +/* + * Linux o32 style syscalls are in the range from 4000 to 4999. + */ +#define __NR_Linux 4000 +#define __NR_io_setup (__NR_Linux + 241) +#define __NR_io_destroy (__NR_Linux + 242) +#define __NR_io_getevents (__NR_Linux + 243) +#define __NR_io_submit (__NR_Linux + 244) +#define __NR_io_cancel (__NR_Linux + 245) + +#endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ + +#if _MIPS_SIM == _MIPS_SIM_ABI64 + +/* + * Linux 64-bit syscalls are in the range from 5000 to 5999. + */ +#define __NR_Linux 5000 +#define __NR_io_setup (__NR_Linux + 200) +#define __NR_io_destroy (__NR_Linux + 201) +#define __NR_io_getevents (__NR_Linux + 202) +#define __NR_io_submit (__NR_Linux + 203) +#define __NR_io_cancel (__NR_Linux + 204) +#endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ + +#if _MIPS_SIM == _MIPS_SIM_NABI32 + +/* + * Linux N32 syscalls are in the range from 6000 to 6999. + */ +#define __NR_Linux 6000 +#define __NR_io_setup (__NR_Linux + 200) +#define __NR_io_destroy (__NR_Linux + 201) +#define __NR_io_getevents (__NR_Linux + 202) +#define __NR_io_submit (__NR_Linux + 203) +#define __NR_io_cancel (__NR_Linux + 204) +#endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ diff --git a/src/syscall-parisc.h b/src/syscall-parisc.h new file mode 100644 index 0000000..252dccb --- /dev/null +++ b/src/syscall-parisc.h @@ -0,0 +1,6 @@ +#define __NR_Linux 0 +#define __NR_io_setup (__NR_Linux + 215) +#define __NR_io_destroy (__NR_Linux + 216) +#define __NR_io_getevents (__NR_Linux + 217) +#define __NR_io_submit (__NR_Linux + 218) +#define __NR_io_cancel (__NR_Linux + 219) diff --git a/src/syscall-sh.h b/src/syscall-sh.h new file mode 100644 index 0000000..6c00573 --- /dev/null +++ b/src/syscall-sh.h @@ -0,0 +1,6 @@ +/* Copy from ./arch/sh/include/asm/unistd_32.h */ +#define __NR_io_setup 245 +#define __NR_io_destroy 246 +#define __NR_io_getevents 247 +#define __NR_io_submit 248 +#define __NR_io_cancel 249 diff --git a/src/syscall-x86_64.h b/src/syscall-x86_64.h index 0eccef3..fc2dd98 100644 --- a/src/syscall-x86_64.h +++ b/src/syscall-x86_64.h @@ -1,6 +1,18 @@ +#ifndef __NR_io_setup #define __NR_io_setup 206 +#endif +#ifndef __NR_io_destroy #define __NR_io_destroy 207 +#endif +#ifndef __NR_io_getevents #define __NR_io_getevents 208 +#endif +#ifndef __NR_io_submit #define __NR_io_submit 209 +#endif +#ifndef __NR_io_cancel #define __NR_io_cancel 210 +#endif +#ifndef __NR_io_pgetevents #define __NR_io_pgetevents 333 +#endif diff --git a/src/syscall.h b/src/syscall.h index d2a117b..57dd1fa 100644 --- a/src/syscall.h +++ b/src/syscall.h @@ -2,14 +2,27 @@ #include #include +#ifndef __has_attribute +#define __has_attribute(x) 0 +#endif + #define _SYMSTR(str) #str #define SYMSTR(str) _SYMSTR(str) +#if __has_attribute(__symver__) +#define SYMVER(compat_sym, orig_sym, ver_sym) \ + extern __typeof(compat_sym) compat_sym \ + __attribute__((__symver__(SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym)))) +#define DEFSYMVER(compat_sym, orig_sym, ver_sym) \ + extern __typeof(compat_sym) compat_sym \ + __attribute__((__symver__(SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym)))) +#else #define SYMVER(compat_sym, orig_sym, ver_sym) \ - __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym)); + __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@LIBAIO_" SYMSTR(ver_sym)) #define DEFSYMVER(compat_sym, orig_sym, ver_sym) \ - __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym)); + __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym)) +#endif #if defined(__i386__) #include "syscall-i386.h" @@ -27,6 +40,14 @@ #include "syscall-arm.h" #elif defined(__sparc__) #include "syscall-sparc.h" +#elif defined(__m68k__) +#include "syscall-m68k.h" +#elif defined(__hppa__) +#include "syscall-parisc.h" +#elif defined(__mips__) +#include "syscall-mips.h" +#elif defined(__sh__) +#include "syscall-sh.h" #elif defined(__aarch64__) || defined(__loongarch__) || defined(__riscv) #include "syscall-generic.h" #else