* Remove «Rules-Requires-Root: no», which is the current default.
* Remove «Priority: optional», which is the current default.
* Remove versioned Build-Depends on dpkg-dev, satisfied since Debian trixie.
* Remove lintian overrides that no longer get emitted.
* Add spaces around make assignment operators to distinguish from shell ones.
* Finish multi-line commands in debian/rules with a comment marker.
* Switch to debian/watch version 5.
* Switch to Standards-Version 4.7.3 (no changes needed).
[dgit import unpatched libaio 0.3.113-9]
--- /dev/null
--- /dev/null
++libaio (0.3.113-9) unstable; urgency=medium
++
++ * Remove «Rules-Requires-Root: no», which is the current default.
++ * Remove «Priority: optional», which is the current default.
++ * Remove versioned Build-Depends on dpkg-dev, satisfied since Debian trixie.
++ * Remove lintian overrides that no longer get emitted.
++ * Add spaces around make assignment operators to distinguish from shell ones.
++ * Finish multi-line commands in debian/rules with a comment marker.
++ * Switch to debian/watch version 5.
++ * Switch to Standards-Version 4.7.3 (no changes needed).
++
++ -- Guillem Jover <guillem@debian.org> Sun, 22 Mar 2026 04:45:17 +0100
++
++libaio (0.3.113-8) unstable; urgency=medium
++
++ * Add a backwards compatibility symlink for the libaio.so.1 SONAME in the
++ udeb, as the SONAME bump we did was ABI compatible, but just done to
++ avoid stomping over upstream interface, where this is not a concern
++ for the d-i system. (Closes: #1067831)
++
++ -- Guillem Jover <guillem@debian.org> Thu, 28 Mar 2024 01:01:37 +0100
++
++libaio (0.3.113-7) unstable; urgency=medium
++
++ * Do not mark test suite as flaky on riscv64 and x32, these ports now work
++ as expected.
++ * Hardcode list of ports that cannot check for a readable PROT_WRITE, and
++ instead expect the return value to be SIZE. This includes hppa, sparc
++ and loong64.
++
++ -- Guillem Jover <guillem@debian.org> Wed, 06 Mar 2024 13:20:49 +0100
++
++libaio (0.3.113-6) unstable; urgency=medium
++
++ * Switch from future=+lfs to abi=+lfs build flags feature, and Build-Depends
++ on dpkg-dev >= 1.22.0.
++ * Add time64 support:
++ - Remove dead code for syscall handling.
++ - Refactor code to use an internal implementation for public functions
++ that handle timespec, by switching them to always use __kernel_timespec,
++ and add conversion functions to map from 'struct timespec' to
++ 'struct __kernel_timespec', and from 'struct __kernel_timespec' to
++ 'struct __kernel_old_timespec'.
++ - Add support for io_pgetevents_time64() Linux syscall, but disable it
++ for now as it only works on 32-bit kernels, but not on the compat
++ mode in 64-bit kernels running 32-bit userland, will be fixed in Linux
++ in parallel, as the timeouts used are supposed to be relative anyway,
++ and this does not and will not break ABI.
++ - Add dual time32/time64 ABI support by adding io_getevents_time64() and
++ io_pgetevents_time64() library functions on 32-bit architectures, that
++ get redirected from the io_getevents() and io_pgetevents() functions
++ when the user sets _TIME_BITS=64.
++ - Perform a SONAME bump to avoid stomping on upstream SONAME. Once and if
++ the new symbols are accepted by upstream then we can merge that back
++ into libaio.so.1 and drop the t64 packages and temporarily provide
++ a compat symlink for the t64 SONAME for a smooth transition back. This
++ should also be an easier way to revert this transition when there are
++ no file conflicts involved, and does not block on upstream support.
++ - Do not rename the udeb from libaio1-udeb, as d-i does not care, and
++ that would require a pointless trip through NEW. But update the shlibs
++ references for the libaio1t64 rename.
++ - We do not need a dependency on a newer dpkg-dev nor gcc as we are
++ explicitly handling the time64 dual-ABI independently of the toolchain.
++ Closes: #1062218
++
++ -- Guillem Jover <guillem@debian.org> Tue, 05 Mar 2024 11:33:54 +0100
++
++libaio (0.3.113-5) unstable; urgency=medium
++
++ * Wrap fields in debian/tests/control.
++ * Fix upstream build system to remove all test artifacts on clean.
++ Reported by Lucas Nussbaum <lucas@debian.org>.
++
++ -- Guillem Jover <guillem@debian.org> Sun, 06 Aug 2023 21:12:34 +0200
++
++libaio (0.3.113-4) unstable; urgency=medium
++
++ * Switch to Standards-Version 4.6.2 (no changes needed).
++ * Do not trim debian/changelog.
++ * Update debian/patches metadata.
++
++ -- Guillem Jover <guillem@debian.org> Wed, 18 Jan 2023 01:35:12 +0100
++
++libaio (0.3.113-3) unstable; urgency=medium
++
++ * Add upstream/metadata fields for bug submitting and database.
++ * Update lintian overrides.
++ * Switch to Standards-Version 4.6.1 (no changes needed).
++ * Move debian/copyright Source field immediately after Format field.
++ * Export DEB_BUILD_MAINT_OPTIONS and DEB_CFLAGS_MAINT_PREPEND.
++ * Switch from hardening=+bindnow to hardening=+all.
++ * Enable future=+lfs build feature as it does not affect the shared library
++ ABI, but affects the test harness.
++
++ -- Guillem Jover <guillem@debian.org> Sun, 04 Dec 2022 18:06:09 +0100
++
++libaio (0.3.113-2) unstable; urgency=medium
++
++ * Skip new test case 23, which was added upstream for a kernel regression,
++ so we are not worse off than before. Its failure was known and being
++ looked at upstream.
++
++ -- Guillem Jover <guillem@debian.org> Tue, 19 Apr 2022 15:57:07 +0200
++
++libaio (0.3.113-1) unstable; urgency=medium
++
++ * New upstream release.
++ - Remove patches taken from upstream, now unneeded.
++ - Remove -Werror removal patch, as we override CFLAGS.
++ - Refresh patches.
++ - Update copyright years.
++ * Add support for the noudeb build profile.
++
++ -- Guillem Jover <guillem@debian.org> Tue, 19 Apr 2022 03:22:49 +0200
++
++libaio (0.3.112-13) unstable; urgency=medium
++
++ * Pass CPPFLAGS to linker command, which as a side effect makes the
++ build reproducible on differing build pathnames.
++
++ -- Guillem Jover <guillem@debian.org> Thu, 11 Nov 2021 04:56:01 +0100
++
++libaio (0.3.112-12) unstable; urgency=medium
++
++ * Add patch from upstream to fix test suite warning with gcc-11.
++ * Fix LTO build by using symver function attribute instead of .symver
++ __asm__ statement. (Closes: #998309)
++
++ -- Guillem Jover <guillem@debian.org> Wed, 03 Nov 2021 00:56:45 +0100
++
++libaio (0.3.112-11) unstable; urgency=medium
++
++ * Use CC as a shell variable instead of a make one in autopkgtests.
++ * Fix typos in io(3) man page.
++
++ -- Guillem Jover <guillem@debian.org> Sun, 10 Oct 2021 06:34:12 +0200
++
++libaio (0.3.112-10) unstable; urgency=medium
++
++ * Add autopkgtests.
++ * Switch to Standards-Version 4.6.0 (no changes needed).
++ * Ship all man pages again, now that the redundant ones are no longer
++ present, and the ones that describe the interfaces in the library live
++ in section 3 which do not conflict with the ones in manpages-dev.
++ (Closes: #995110)
++ * Stop shipping upstream TODO file in libaio-dev.
++ * List pathnames explicitly in debhelper .install fragment files, instead
++ of using over matching globs.
++
++ -- Guillem Jover <guillem@debian.org> Sat, 09 Oct 2021 17:31:09 +0200
++
++libaio (0.3.112-9) unstable; urgency=medium
++
++ * Remove Build-Depends on dpkg-dev, satisfied in stable.
++ * Switch to debhelper compatibility level 13.
++ * Do not pass ChangeLog to dh_installchangelogs, now handled by default.
++ * Switch to Standards-Version 4.5.1 (no changes needed).
++ * Switch to the dh sequencer.
++ * Add debian/upstream/metadata file.
++
++ -- Guillem Jover <guillem@debian.org> Thu, 24 Dec 2020 15:41:17 +0100
++
++libaio (0.3.112-8) unstable; urgency=medium
++
++ * Add a comment with the reason for each architecture being in the flaky
++ test suite mode.
++ * Remove temporary forced flaky test suite run on architectures built under
++ an emulator, and move them to the permanent flaky list.
++ * Add x32 to the flaky test suite mode list, it's still failing on the build
++ daemons, even though it worked locally.
++ * Remove no longer needed TESTS_RUN logic, and inline the nocheck condition.
++
++ -- Guillem Jover <guillem@debian.org> Mon, 13 Apr 2020 02:58:47 +0200
++
++libaio (0.3.112-7) unstable; urgency=medium
++
++ * Cleanup patches:
++ - Move upstream patches under debian/patches/upstream/.
++ - Fix syscall definitions for ARM and ia64 to match the kernel exactly.
++ Otherwise the preprocessor emits warnings about redefinitions.
++ - Split the architecture support patches into one per arch support.
++ - Fix syscall definitions for hppa to match the kernel exactly.
++ - Make __X32_SYSCALL_BIT an unsigned long constant to match the kernel.
++ - Fix x32 structures padding.
++ - Rework build system patches to ready them for upstream submission,
++ and drop libdevdir support which we do not use anymore.
++ * Fix logic inversion in test suite flaky handling.
++ * Remove trailing closing parenthesis from TESTS_RUN conditional.
++ * Print a message when we run the test suite in flaky mode.
++ * Remove armhf from the test suite flaky mode.
++
++ -- Guillem Jover <guillem@debian.org> Sun, 12 Apr 2020 04:49:39 +0200
++
++libaio (0.3.112-6) unstable; urgency=medium
++
++ * Sync with upstream commits:
++ - Rebase against latest upstream git master.
++ - Skip the test if io_pgetevents() is not implemented.
++ * Switch to Standards-Version 4.5.0 (no changes needed).
++ * Do not pass --add-udeb to dh_makeshlibs anymore, it's autodetected since
++ debhelper 12.3, for which we add an explicit versioned Build-Depends.
++ * Use correct syscall numbers for x32 port.
++ * Make the testsuite fatal on architectures known to pass it, to avoid
++ future regressions.
++ * Temporarily force a flaky test suite run on architectures built under
++ and emulator, to get test results.
++
++ -- Guillem Jover <guillem@debian.org> Sat, 11 Apr 2020 19:06:49 +0200
++
++libaio (0.3.112-5) unstable; urgency=medium
++
++ * Sync with upstream commits:
++ - Make test suite failures fatal, so we ignore errors for now, until it
++ passes at least in all release architectures.
++ - Add support for SKIPable tests.
++ - Allow running tests against the installed library, which will make
++ possible to add autopkgtests.
++ - Fix test case 5.t, by using a write() instead of a read() to force the
++ kernel to read from the unreadable buffer.
++ * Add a workaround to io_pgetevents() for 32-bit userland running on
++ 64-bit kernels to cope with the broken compat kernel syscall, which uses
++ a 64-bit pointer instead of a 32-bit one, and eats the sigset_t size
++ member which makes it then fail a consistency check and return -EINVAL.
++ This fixes test case 22.t. The kernel fix is being prepared as well.
++ * Add more detailed error messages to test case 22.t.
++
++ -- Guillem Jover <guillem@debian.org> Fri, 16 Aug 2019 05:11:10 +0200
++
++libaio (0.3.112-4) unstable; urgency=medium
++
++ * Switch to Standards-Version 4.4.0 (no changes needed).
++ * Switch to debhelper compatibility level 12.
++ * Switch from debian/compat to debhelper-compat in Build-Depends.
++ * Test suite fixes:
++ - Fix the attempt_rw READ call to be arch-dependent instead of making
++ it the WRITE call. Thanks to Jeff Moyer <jmoyer@redhat.com>.
++
++ -- Guillem Jover <guillem@debian.org> Fri, 02 Aug 2019 05:33:44 +0200
++
++libaio (0.3.112-3) unstable; urgency=medium
++
++ * Test suite fixes:
++ - Fix logic inversion in EINVAL check.
++ - Revert making the test suite fatal on failures, as the Debian buildd
++ setup is peculiar enough to make at least two tests fail. This will
++ need further work.
++
++ -- Guillem Jover <guillem@debian.org> Tue, 26 Feb 2019 05:26:21 +0100
++
++libaio (0.3.112-2) unstable; urgency=medium
++
++ * Test suite fixes:
++ - Make RISC-V use SYS_eventfd2 instead of unavailable SYS_eventfd.
++ - Add fallback code for filesystems not supporting O_DIRECT.
++ - Handle -ENOTSUP in addition to -EINVAL from io_submit() with RWF_NOWAIT.
++ - The WRITE call does not change across different arches anymore.
++ - Make the test exit with a code matching the pass/fail state.
++ This will turn test suite errors into fatal build problems.
++
++ -- Guillem Jover <guillem@debian.org> Tue, 26 Feb 2019 03:14:38 +0100
++
++libaio (0.3.112-1) unstable; urgency=medium
++
++ * New upstream release.
++ - Refresh patches.
++ - Remove patches merged upstream.
++ - Add new patch to fix error due to -Werror=sizeof-pointer-memaccess.
++ - Split man page cleanup into logic changes, and further improve the
++ formatting, markup, typo fixes, etc.
++ * Use expanded symbol file instead of matching on symver. Even though
++ upstream manages versioned symbols correctly, being explicit makes it
++ safer against accidental changes.
++ * Add a Build-Depends-Package field to the symbols file.
++ * Only install upstream TODO into libaio-dev.
++ * Remove support for old debug symbol package migration.
++ * Add comment for dpkg-dev versioned Build-Depends.
++ * Perform a proper and correct /usr-merge transition by moving the package
++ contents from / to /usr.
++ * Now using Standards-Version 4.3.0 (no changes needed).
++ * Remove unused make variables from debian/rules.
++
++ -- Guillem Jover <guillem@debian.org> Mon, 25 Feb 2019 02:56:55 +0100
++
++libaio (0.3.111-1) unstable; urgency=medium
++
++ * New upstream release.
++ - Refresh patches.
++ - Fix x32 support. (Closes: #883904)
++ - Add riscv64 support. (Closes: #893003)
++ * Fix cross-building by not invoking getconf for PAGESIZE, and instead
++ getting the value at run-time.
++ * Do not pass -fomit-frame-pointer as part of the required compiler flags.
++ * Remove now always unused lintian override, as upstream requires linking
++ against libc everywhere for its syscall(3) usage.
++ * Mark libaio-dev as Multi-Arch same.
++ * Now using Standards-Version 4.1.3 (no changes needed).
++ * Switch to debhelper compatibility level 11.
++
++ -- Guillem Jover <guillem@debian.org> Sun, 18 Mar 2018 02:58:44 +0100
++
++libaio (0.3.110-5) unstable; urgency=medium
++
++ * Line-wrap and sort debian/control fields.
++ * Now using Standards-Version 4.1.1 (no changes needed).
++ * Use dpkg buildtools.mk fragment to set a correct CC.
++ * Set Rules-Requires-Root to no.
++ * Switch to debian/watch format version 4.
++ * Fix regex in debian/watch file to not include extension in the version.
++
++ -- Guillem Jover <guillem@debian.org> Sun, 05 Nov 2017 16:26:47 +0100
++
++libaio (0.3.110-4) unstable; urgency=medium
++
++ * Update upstream URLs to point to pagure.io instead of obsolete
++ fedorahosted.org site.
++ * Switch to debhelper compatibility level 10.
++ * Now using Standards-Version 4.0.1 (no changes needed).
++ * Move location of LGPL in Debian systems into a Comment field in
++ debian/copyright.
++ * Use -a instead of deprecated -s in debhelper commands.
++
++ -- Guillem Jover <guillem@debian.org> Tue, 08 Aug 2017 00:29:32 +0200
++
++libaio (0.3.110-3) unstable; urgency=medium
++
++ * Use https for hadrons.org and debian.org URLs.
++ * Switch debug package to a ddeb.
++ * Switch to the dpkg makefile fragments in debian/rules.
++ * Enable hardening bindnow feature.
++ * Update URL in debian/watch.
++ * Fix typos in man pages, reported by lintian.
++ * Now using Standards-Version 3.9.8 (no changes needed).
++
++ -- Guillem Jover <guillem@debian.org> Tue, 31 May 2016 20:38:08 +0200
++
++libaio (0.3.110-2) unstable; urgency=medium
++
++ * Use https for the debian/copyright Format URL.
++ * Switch Vcs-Browser to a cgit URL.
++ * Update Homepage URL to new release site.
++ Prompted by Sedat Dilek <sedat.dilek@gmail.com>.
++ * Use https in debian/watch URL.
++ * Add a small note on each long package description explaining what is
++ contained on each package.
++ * Document each patch.
++
++ -- Guillem Jover <guillem@debian.org> Tue, 29 Sep 2015 16:48:30 +0200
++
++libaio (0.3.110-1) unstable; urgency=low
++
++ * New upstream release.
++ - Refresh patches.
++ * Link against -lc and -Wl,--as-needed so that we pull the required
++ fortified functions from the internal libc_nonshared.a, but do not link
++ against the shared library because we do not use any of its symbols.
++ (Closes: #764509)
++ * Switch debian/copyright to machine-readable format 1.0.
++ * Now using Standards-Version 3.9.6 (no changes needed).
++ * Switch to debhelper compatibility level 9.
++ * Fix mips/mipsel syscall wrappers to return correct error values.
++ Thanks to Jurica Stanojkovic <Jurica.Stanojkovic@rt-rk.com>.
++ * Add mips64 support. Reported by Jeremy Fitzhardinge <jeremy@exablox.com>.
++
++ -- Guillem Jover <guillem@debian.org> Thu, 09 Oct 2014 05:44:48 +0200
++
++libaio (0.3.109-4) unstable; urgency=low
++
++ * Now using Standards-Version 3.9.4 (no changes needed).
++ * Remove package creation information from debian/copyright.
++ * Update upstream git URL in debian/copyright.
++ * Add support for x32 (from the Yocto project). (Closes: #702183)
++ Thanks to Daniel Schepler <dschepler@gmail.com>.
++ * Add support for arm64 (stolen from upstream). (Closes: #702409)
++ Thanks to Ian Campbell <ijc@hellion.org.uk>.
++ * Add cross-compilation support.
++ Based on a patch by Ian Campbell <ijc@hellion.org.uk>.
++ * Update debian/watch file to a working URL.
++
++ -- Guillem Jover <guillem@debian.org> Mon, 06 May 2013 18:56:19 +0200
++
++libaio (0.3.109-3) unstable; urgency=low
++
++ * Escape backslash in man pages. (Closes: #651833)
++ Thanks to Stephan Springl <springl-libaio@bfw-online.de>.
++ * Do not install man pages now provided by manpages-dev. (Closes: #650108)
++ * Use dpkg-buildflags to set CPPFLAGS, CFLAGS and LDFLAGS.
++ * Now using Standards-Version 3.9.3 (no changes needed).
++
++ -- Guillem Jover <guillem@debian.org> Thu, 21 Jun 2012 09:21:59 +0200
++
++libaio (0.3.109-2) unstable; urgency=low
++
++ * Add a symbols file for libaio1.
++ * Remove heading ‘./’ from lintian-override tag.
++ * Fix FTBFS with newer gcc 4.6: (Closes: #638848)
++ - Do not build the test-suite with -Werror.
++ - Use unused waitpid() return code variables to assert valid values.
++ * Make shared library packages multiarch:
++ - Build-Depend on debhelper 8.1.3.
++ - Add misc:Pre-Depends substvar to Pre-Depends field in libaio1.
++ - Add “Multi-Arch: same” field to libaio1 and libaio1-dbg.
++ - Change paths from lib/ to lib/* in install and lintian-override files.
++ - Define DEB_HOST_MULTIARCH and use it to set libdir and libdevdir.
++ * Install all libaio io*.3 man pages. (Closes: #418048)
++ * Do not install man pages for functions coming from libc, the aio*
++ and lio_listio* man pages are already shipped by manpages-dev.
++ * Merge adapted changes from Ubuntu. (Closes: #588112)
++ - Change Priority from extra to optional.
++ - Add support for sparc64 and hppa 64-bit architectures.
++ * Set libaio1-dbg Priority back to extra.
++ * Now using Standards-Version 3.9.2 (no changes needed).
++
++ -- Guillem Jover <guillem@debian.org> Tue, 30 Aug 2011 16:54:22 +0200
++
++libaio (0.3.109-1) unstable; urgency=low
++
++ * New upstream release.
++ - Refresh patches.
++ * Switch to source format “3.0 (quilt)”:
++ - Remove quilt from Build-Depends.
++ - Remove quilt.make include from debian/rules.
++ - Remove patch and unpatch targets from debian/rules.
++ - Remove now unneeded debian/README.source.
++ * Update watch file to point to the new upstream URL at kernel.org.
++ * Now using Standards-Version 3.9.1 (no changes needed).
++ * Add missing ${misc:Depends} to eveyr package Depends fields.
++ * Switch Architecture field list to just linux-any, and although the
++ code will not automatically support new Linux architectures, as it
++ will miss the syscall-<arch>.h header support among others, it just
++ needs to be ported, and this way it's easier to spot. This implicitly
++ adds amrhf support. (Closes: #596996)
++ * Add a Homepage field. (Closes: #566338)
++
++ -- Guillem Jover <guillem@debian.org> Sun, 27 Feb 2011 05:22:27 +0100
++
++libaio (0.3.107-7) unstable; urgency=low
++
++ * Add support for sh3 and sh4. (Closes: #535288)
++ Thanks to Nobuhiro Iwamatsu <iwamatsu@nigauri.org>.
++ * Now using Standards-Version 3.8.3 (no changes needed).
++
++ -- Guillem Jover <guillem@debian.org> Thu, 10 Sep 2009 13:02:34 +0200
++
++libaio (0.3.107-6) unstable; urgency=low
++
++ * Workaround debhelper compat v7 bug (#534565) in dh_install which makes
++ files end up under /debian/tmp/ in the binary package, by not passing
++ --sourcedir to dh_install. (Closes: #533359, #532644)
++ * Pass -s to arch dependent debhelper commands.
++ * Now using Standards-Version 3.8.2 (no changes needed).
++
++ -- Guillem Jover <guillem@debian.org> Thu, 25 Jun 2009 14:11:25 +0200
++
++libaio (0.3.107-5) unstable; urgency=low
++
++ * Change libaio1-dbg section to debug.
++ * Fix build failure in test suite on non-i386 32 bit architectures.
++ * Fix man pages errors and warnings.
++
++ -- Guillem Jover <guillem@debian.org> Wed, 10 Jun 2009 06:09:52 +0200
++
++libaio (0.3.107-4) unstable; urgency=low
++
++ * Switch to debhelper compatibility level 7.
++ * Use dh_prep instead of “dh_clean -k”.
++ * Remove libaio1.dirs, unneeded due to dh_lintian taking care of it.
++ * Run the test suite on all architectures and not only on i386.
++ * Now using Standards-Version 3.8.1 (no changes needed).
++ * Switch the upstream repository reference from CVS to git.
++
++ -- Guillem Jover <guillem@debian.org> Mon, 08 Jun 2009 19:40:54 +0200
++
++libaio (0.3.107-3) unstable; urgency=low
++
++ * Fix the Vcs-Git URL.
++ * Remove XB- from the Package-Type field.
++ * Fix watch file URL. (Closes: #502884)
++ Thanks to Jiří Paleček <jpalecek@web.de>.
++
++ -- Guillem Jover <guillem@debian.org> Mon, 20 Oct 2008 20:36:43 +0300
++
++libaio (0.3.107-2) unstable; urgency=low
++
++ * Only run the test suite on i386 as it has not been ported for other
++ architectures. (Closes: #488812)
++ * Use $(filter ...) instead of $(findstring ...) to extract space separated
++ options from DEB_BUILD_OPTIONS in debian/rules.
++ * Do not check for the existence of the Makefile on clean, it's always
++ there.
++ * Switch to use dh_lintian instead of manually installing the overrides.
++ - Bump the versioned debhelper Build-Depends to 6.0.7.
++
++ -- Guillem Jover <guillem@debian.org> Wed, 09 Jul 2008 05:32:30 +0300
++
++libaio (0.3.107-1) unstable; urgency=low
++
++ * New upstream release.
++ * Run the test suite on install, and support nocheck DEB_BUILD_OPTIONS
++ to disable it.
++
++ -- Guillem Jover <guillem@debian.org> Tue, 24 Jun 2008 09:03:54 +0300
++
++libaio (0.3.106-9) unstable; urgency=low
++
++ * Fix misspelled words (linux -> Linux and aio -> AIO).
++ * Update packaging Vcs fields to the new URL.
++ * Improve debian/copyright:
++ - Change 'Copyright Holder' to 'Copyright Holders'.
++ - Use UTF-8 copyright sign.
++ - Update upstream download url.
++ - Refer to LGPL-2.1 from common-licenses instead of just LGPL.
++ * Add a debian/README.source file.
++ * Now using Standards-Version 3.8.0.
++ * Refresh patches with -pab. (Closes: #484962)
++ * Update watch file URL. (Closes: #450017)
++
++ -- Guillem Jover <guillem@debian.org> Sun, 22 Jun 2008 07:42:52 +0300
++
++libaio (0.3.106-8) unstable; urgency=low
++
++ * Install shared library under /lib, needed by multipath binaries which
++ reside under /sbin. (Closes: #441244)
++ - debian/patches/02_libdevdir.patch: New file.
++ * Add a debugging symbols library package.
++ * Add Vcs-Browser and Vcs-Git fields.
++
++ -- Guillem Jover <guillem@debian.org> Tue, 11 Sep 2007 04:29:22 +0300
++
++libaio (0.3.106-7) unstable; urgency=low
++
++ * Add a new library udeb needed for multipath support. (Closes: #440320)
++
++ -- Guillem Jover <guillem@debian.org> Thu, 06 Sep 2007 03:11:08 +0300
++
++libaio (0.3.106-6) unstable; urgency=low
++
++ * Link against libgcc to avoid unresolved symbols on at least hppa.
++ - debian/01_link_libgcc.patch: New file.
++ Thanks to Steve Langasek <vorlon@debian.org> for the analysis.
++ * Add shlibs:Depends substvar back into libaio1 Depends, since we link
++ against an external library now (although it might not be used on any
++ architecture).
++
++ -- Guillem Jover <guillem@debian.org> Mon, 06 Aug 2007 04:50:18 +0300
++
++libaio (0.3.106-5) unstable; urgency=low
++
++ * Do not ignore 'make clean' errors on clean.
++ * Support build-arch and build-indep in debian/rules:
++ - Rename install to install-arch.
++ - Rename build to build-arch.
++ - Add an empty build target that depends on build-arch and build-indep.
++ * Switch directory variables to simply expanded ones in debian/rules.
++ * Use binary:Version instead of the deprecated Source-Version substvar.
++ * Remove Tag field as it does not seem to make much sense to include it
++ in the packages.
++
++ -- Guillem Jover <guillem@debian.org> Tue, 17 Jul 2007 09:19:26 +0300
++
++libaio (0.3.106-4) unstable; urgency=low
++
++ * Add armeb and armel to the Architecture fields.
++
++ -- Guillem Jover <guillem@debian.org> Fri, 19 Jan 2007 06:48:26 +0200
++
++libaio (0.3.106-3) unstable; urgency=low
++
++ * Fix a typo in the arm io_syscall5 macro, making the library end up
++ with unresolvable symbols. (Closes: #393156)
++ Thanks to Marcin Juszkiewicz <debian-bugs@hrw.one.pl>.
++
++ -- Guillem Jover <guillem@debian.org> Mon, 16 Oct 2006 10:44:02 +0300
++
++libaio (0.3.106-2) unstable; urgency=low
++
++ * Use quilt for patching:
++ - Add new debian/patches/series file.
++ - Add Build-Depends on 'quilt (>= 0.40)'.
++ - Include quilt.make from debian/rules.
++ * Add support for arm, hppa, m68k, mips, mipsel and sparc. Those have yet
++ to be tested with the harness test suite and pass it.
++ * Add a Tag: field to all binary packages.
++
++ -- Guillem Jover <guillem@debian.org> Tue, 19 Sep 2006 00:48:10 +0300
++
++libaio (0.3.106-1) unstable; urgency=low
++
++ * New Upstream Release. (Closes: #384268)
++ - Fix .endp being outside of procedure on ia64 with new binutils.
++ (Closes: #385373)
++
++ -- Guillem Jover <guillem@debian.org> Fri, 1 Sep 2006 05:51:36 +0300
++
++libaio (0.3.104-2) unstable; urgency=low
++
++ * New Maintainer.
++ * Provide a new binary package libaio-dev, with the static library
++ the .so symlink and the manpages. (Closes: #318795)
++ * Add debian/libaio-dev.install.
++ * Add debian/libaio-dev.manpages.
++ * Rename the binary package libaio to libaio1 to match the soname, no
++ transition package as no one depends on it.
++ * Rename debian/lintian.override to debian/libaio1.lintian.
++ * Remove shlib-missing-in-control-file lintian override as we provide
++ now the shlibs file.
++ * Only put "usr/share/lintian/override" in libaio1.dirs.
++ * Remove temporal debhelper leftover files:
++ - debian/libaio-0.3.104.postinst.debhelper
++ - debian/libaio-0.3.104.postrm.debhelper
++ * Add amd64 to the Architecture fields. (Closes: #335352)
++ * Switch to debhelper compat level 5.
++ * Now using Standards-Version 3.7.2.
++ * Change Priority from optional to extra.
++ * Specify in the package description that this library is for Linux.
++ * Remove unneeded debian/dirs file.
++ * Remove debian/debianize.patch, we actually want the .so symlink
++ and the .a library when doing "make install".
++ * Clean up debian/rules:
++ - Do not use stamp files.
++ - Remove unused comments.
++ - Remove unused configure target.
++ - Do not pass DESTDIR to make as it is not using it.
++ * Complete debian/copyright:
++ - Add copyright holder information.
++ - Add the LGPL license snippet.
++ - Specify a download url which actually works.
++ * Add a watch file.
++
++ -- Guillem Jover <guillem@debian.org> Thu, 24 Aug 2006 05:45:36 +0300
++
++libaio (0.3.104-1) unstable; urgency=low
++
++ * Initial Release.
++
++ -- William Lee Irwin III <wli@holomorphy.com> Fri, 22 Apr 2005 14:49:28 -0700
--- /dev/null
--- /dev/null
++Source: libaio
++Maintainer: Guillem Jover <guillem@debian.org>
++Section: libs
++Vcs-Browser: https://git.hadrons.org/cgit/debian/pkgs/libaio.git
++Vcs-Git: https://git.hadrons.org/git/debian/pkgs/libaio.git
++Homepage: https://pagure.io/libaio
++Standards-Version: 4.7.3
++Build-Depends:
++ debhelper-compat (= 13),
++ debhelper (>= 13.10),
++
++Package: libaio1t64
++Architecture: linux-any
++Multi-Arch: same
++Pre-Depends:
++ ${misc:Pre-Depends},
++Depends:
++ ${misc:Depends},
++ ${shlibs:Depends},
++Description: Linux kernel AIO access library - shared library
++ This library enables userspace to use Linux kernel asynchronous I/O
++ system calls, important for the performance of databases and other
++ advanced applications.
++ .
++ This package contains the shared library.
++
++Package: libaio1-udeb
++Package-Type: udeb
++Section: debian-installer
++Architecture: linux-any
++Build-Profiles: <!noudeb>
++Depends:
++ ${misc:Depends},
++ ${shlibs:Depends},
++Description: Linux kernel AIO access library - shared library
++ This library enables userspace to use Linux kernel asynchronous I/O
++ system calls, important for the performance of databases and other
++ advanced applications.
++ .
++ This package contains the udeb shared library.
++
++Package: libaio-dev
++Section: libdevel
++Architecture: linux-any
++Multi-Arch: same
++Depends:
++ ${misc:Depends},
++ libaio1t64 (= ${binary:Version}),
++Description: Linux kernel AIO access library - development files
++ This library enables userspace to use Linux kernel asynchronous I/O
++ system calls, important for the performance of databases and other
++ advanced applications.
++ .
++ This package contains the static library and the header files.
--- /dev/null
--- /dev/null
++Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
++Source: https://pagure.io/libaio.git
++Upstream-Name: libaio
++Upstream-Contact: Jeff Moyer <jmoyer@redhat.com>
++
++Files: *
++Copyright:
++ Copyright © 2002-2003 Benjamin LaHaise <bcrl@redhat.com>
++ Copyright © 2003-2022 Jeff Moyer <jmoyer@redhat.com>
++License: LGPL-2.1+
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++ License as published by the Free Software Foundation; either
++ version 2.1 of the License, or (at your option) any later version.
++ .
++ This library is distributed in the hope that it will be useful,
++ but WITHOUT ANY WARRANTY; without even the implied warranty of
++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++ Lesser General Public License for more details.
++ .
++ You should have received a copy of the GNU Lesser General Public License
++ along with this library. If not, see <https://www.gnu.org/licenses/>.
++Comment:
++ On Debian systems, the complete text of the GNU Lesser General
++ Public License can be found in '/usr/share/common-licenses/LGPL-2.1'.
--- /dev/null
--- /dev/null
++usr/include
++usr/lib/*/libaio.so
++usr/lib/*/libaio.a
--- /dev/null
--- /dev/null
++man/io.3
++man/io_cancel.3
++man/io_fsync.3
++man/io_getevents.3
++man/io_prep_fsync.3
++man/io_prep_pread.3
++man/io_prep_pwrite.3
++man/io_queue_init.3
++man/io_queue_release.3
++man/io_queue_run.3
++man/io_queue_wait.3
++man/io_set_callback.3
++man/io_submit.3
--- /dev/null
--- /dev/null
++usr/lib/*/libaio.so.1t64
++usr/lib/*/libaio.so.1t64.*
--- /dev/null
--- /dev/null
++usr/lib/${env:DEB_HOST_MULTIARCH}/libaio.so.1t64 usr/lib/${env:DEB_HOST_MULTIARCH}/libaio.so.1
--- /dev/null
--- /dev/null
++usr/lib/*/libaio.so.1t64
++usr/lib/*/libaio.so.1t64.*
--- /dev/null
--- /dev/null
++libaio.so.1t64 libaio1t64 #MINVER#
++* Build-Depends-Package: libaio-dev
++ LIBAIO_0.1@LIBAIO_0.1 0.3.9
++ LIBAIO_0.4@LIBAIO_0.4 0.3.93
++ LIBAIO_0.5@LIBAIO_0.5 0.3.112
++ LIBAIO_0.6@LIBAIO_0.6 0.3.113
++ io_cancel@LIBAIO_0.1 0.3.9
++ io_cancel@LIBAIO_0.4 0.3.93
++ io_destroy@LIBAIO_0.4 0.3.93
++ io_getevents@LIBAIO_0.1 0.3.9
++ io_getevents@LIBAIO_0.4 0.3.93
++ (arch-bits=32)io_getevents_time64@LIBAIO_0.6 0.3.113
++ io_pgetevents@LIBAIO_0.5 0.3.112
++ (arch-bits=32)io_pgetevents_time64@LIBAIO_0.6 0.3.113
++ io_queue_init@LIBAIO_0.1 0.3.9
++ io_queue_release@LIBAIO_0.1 0.3.9
++ io_queue_run@LIBAIO_0.1 0.3.9
++ io_queue_wait@LIBAIO_0.1 0.3.9
++ io_queue_wait@LIBAIO_0.4 0.3.93
++ io_setup@LIBAIO_0.4 0.3.93
++ io_submit@LIBAIO_0.1 0.3.9
--- /dev/null
--- /dev/null
++From afa90d85822f61da49a5bcddb74fc89ac314fb8a Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Wed, 6 Mar 2024 03:08:15 +0100
++Subject: [PATCH libaio] harness: Hardcode list of ports that cannot check
++ PROT_WRITE is readable
++
++On these ports, the write() check does not work, so we need to hardcode
++the list.
++---
++ harness/cases/5.t | 9 ++++++++-
++ 1 file changed, 8 insertions(+), 1 deletion(-)
++
++diff --git a/harness/cases/5.t b/harness/cases/5.t
++index b0a7c56..ae8b57a 100644
++--- a/harness/cases/5.t
+++++ b/harness/cases/5.t
++@@ -41,10 +41,17 @@ int test_main(void)
++ assert(buf != (char *)-1);
++
++ /* Whether PROT_WRITE is readable is arch-dependent. So compare
++- * against write() result (to make the kernel read from buf). */
+++ * against write() result (to make the kernel read from buf), and
+++ * use a hard-coded list for the systems where this does not work. */
+++#if defined(__hppa__) || \
+++ defined(__loongarch__) || \
+++ defined(__sparc__)
+++ res = SIZE;
+++#else
++ res = write(rwfd, buf, SIZE);
++ if (res < 0)
++ res = -errno;
+++#endif
++ status |= attempt_rw(rwfd, buf, SIZE, 0, READ, SIZE);
++ status |= attempt_rw(rwfd, buf, SIZE, 0, WRITE, res);
++
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From b8eadc9f89e8f7ab0338eacda9f98a6caea76883 Mon Sep 17 00:00:00 2001
++From: Andreas Baumann <mail@andreasbaumann.cc>
++Date: Thu, 2 Jun 2022 13:33:11 +0200
++Subject: [PATCH libaio 01/26] harness: use off64_t instead of off_t in test
++ 23.t (EINVAL on 32-bit)
++
++---
++ harness/cases/23.t | 4 ++--
++ 1 file changed, 2 insertions(+), 2 deletions(-)
++
++diff --git a/harness/cases/23.t b/harness/cases/23.t
++index cc5a8a1..9bbb05c 100644
++--- a/harness/cases/23.t
+++++ b/harness/cases/23.t
++@@ -72,7 +72,7 @@ static void fail_errno(const char *format, ...)
++ static void *thrproc2(void *arg)
++ {
++ for (;;) {
++- off_t offset = 0;
+++ off64_t offset = 0;
++
++ pthread_barrier_wait(&barrier);
++ if (exiting)
++@@ -92,7 +92,7 @@ static void *thrproc3(void *arg)
++ {
++ for (;;) {
++ char c;
++- off_t offset = 0;
+++ off64_t offset = 0;
++
++ pthread_barrier_wait(&barrier);
++ if (exiting)
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 4de9a0278b94b7fc2755368e7554af78f5df87a1 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Sun, 10 Oct 2021 06:14:51 +0200
++Subject: [PATCH libaio 02/26] man: Fix typos
++
++Origin: vendor
++Forwarded: https://marc.info/?l=linux-aio&m=164999309220532
++Warned-by: lintian
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ man/io.3 | 4 ++--
++ 1 file changed, 2 insertions(+), 2 deletions(-)
++
++diff --git a/man/io.3 b/man/io.3
++index bfa9836..c4554a5 100644
++--- a/man/io.3
+++++ b/man/io.3
++@@ -147,7 +147,7 @@ This is experimental.
++ * 3. When write completes decrement counter and free resources
++ *
++ *
++- * Usage: aiocp file(s) desination
+++ * Usage: aiocp file(s) destination
++ */
++
++ #include <unistd.h>
++@@ -271,7 +271,7 @@ int main(int argc, char *const *argv)
++
++ while (tocopy > 0) {
++ int i, rc;
++- /* Submit as many reads as once as possible upto AIO_MAXIO */
+++ /* Submit as many reads as once as possible up to AIO_MAXIO */
++ int n = MIN(MIN(AIO_MAXIO - busy, AIO_MAXIO / 2),
++ howmany(length - offset, AIO_BLKSIZE));
++ if (n > 0) {
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From b6927a26ce1524a583139ef2e9e414ce5a700e27 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Tue, 5 Mar 2024 10:12:32 +0100
++Subject: [PATCH libaio 03/26] build: Update .gitignore for the harness
++ artifacts
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ .gitignore | 5 +++++
++ 1 file changed, 5 insertions(+)
++
++diff --git a/.gitignore b/.gitignore
++index d4a4309..8e2d7ba 100644
++--- a/.gitignore
+++++ b/.gitignore
++@@ -8,3 +8,8 @@
++
++ /src/libaio.a
++ /src/libaio.so*
+++
+++/harness/cases/*.p
+++/harness/tempfile
+++/harness/testdir/
+++/harness/testfile
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From dd9f5dedcf99ea734500cddb1925bc1cdea097d0 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Sun, 12 Apr 2020 03:58:12 +0200
++Subject: [PATCH libaio 04/26] build: Fix DESTDIR and pathname variables
++ handling
++
++The convention for DESTDIR is that it is only prefixed during the
++install target. In this case we postpone that to the inner Makefile
++so that it can be invoked directly while preserving the expected
++semantics. We should also prefer the user specified pathname variables
++if already set in any way, and do not need to pass them explicitly
++to the sub-make.
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ Makefile | 6 +-----
++ src/Makefile | 16 ++++++++--------
++ 2 files changed, 9 insertions(+), 13 deletions(-)
++
++diff --git a/Makefile b/Makefile
++index c1fb831..c194d9e 100644
++--- a/Makefile
+++++ b/Makefile
++@@ -4,17 +4,13 @@ VERSION=$(shell awk '/Version:/ { print $$2 }' $(SPECFILE))
++ TAG = $(NAME)-$(VERSION)
++ RPMBUILD=$(shell `which rpmbuild >&/dev/null` && echo "rpmbuild" || echo "rpm")
++
++-prefix=/usr
++-includedir=$(prefix)/include
++-libdir=$(prefix)/lib
++-
++ default: all
++
++ all:
++ @$(MAKE) -C src
++
++ install:
++- @$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir)
+++ @$(MAKE) -C src install
++
++ check:
++ @$(MAKE) -C harness check
++diff --git a/src/Makefile b/src/Makefile
++index d080a1b..9a36d0d 100644
++--- a/src/Makefile
+++++ b/src/Makefile
++@@ -1,6 +1,6 @@
++-prefix=/usr
++-includedir=$(prefix)/include
++-libdir=$(prefix)/lib
+++prefix ?= /usr
+++includedir ?= $(prefix)/include
+++libdir ?= $(prefix)/lib
++
++ CFLAGS ?= -g -fomit-frame-pointer -O2
++ CFLAGS += -Wall -I. -fPIC
++@@ -59,12 +59,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)$(libdir)/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 755 $(libname) $(DESTDIR)$(libdir)/$(libname)
+++ ln -sf $(libname) $(DESTDIR)$(libdir)/$(soname)
+++ ln -sf $(libname) $(DESTDIR)$(libdir)/libaio.so
++ endif
++
++ $(libaio_objs): libaio.h
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 8fcd6ce582be188c068751f5133c511a341b2819 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Sun, 12 Apr 2020 04:01:27 +0200
++Subject: [PATCH libaio 05/26] build: Honor user build flags
++MIME-Version: 1.0
++Content-Type: text/plain; charset=UTF-8
++Content-Transfer-Encoding: 8bit
++
++CPPFLAGS, CFLAGS and LDFLAGS are user flags, which we need to preserve,
++regardless of the user passing them over the environment or the
++command-line. Any required flag that the build system needs, has to be
++set in some other flag (which we will namespace with «MK_») so that the
++build will use even if the user flags are passed, even though the user
++should be able to override by appending after them. We pass CPPFLAGS to
++any compilation command that missed them.
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ harness/Makefile | 9 ++++++---
++ src/Makefile | 20 ++++++++++----------
++ 2 files changed, 16 insertions(+), 13 deletions(-)
++
++diff --git a/harness/Makefile b/harness/Makefile
++index 4f225d3..8cb27fa 100644
++--- a/harness/Makefile
+++++ b/harness/Makefile
++@@ -6,13 +6,16 @@ PROGS:=$(PARTPROGS) $(EXTRAPROGS)
++ HARNESS_SRCS:=main.c
++ # io_queue.c
++
++-CFLAGS+=-Wall -Werror -I../src -g -O2
+++MK_CPPFLAGS = -I../src $(CPPFLAGS)
+++CFLAGS ?= -Wall -Werror -g -O2
+++MK_CFLAGS = $(CFLAGS)
++ #-lpthread -lrt
+++MK_LDFLAGS = main.c $(LIBAIO) -lpthread $(LDFLAGS)
++
++ # gcc-11 does not like the test case in 3.t that
++ # passes an invalid pointer (-1) to the kernel, so
++ # tell the compiler we do not need a warning here
++-cases/3.p: CFLAGS+=-Wno-stringop-overflow
+++cases/3.p: MK_CFLAGS+=-Wno-stringop-overflow
++
++ # Change this on the build line to run tests against the installed libraries:
++ # make LIBAIO=-laio partcheck
++@@ -21,7 +24,7 @@ LIBAIO?=../src/libaio.a
++ all: $(PROGS)
++
++ $(PROGS): %.p: %.t $(HARNESS_SRCS)
++- $(CC) $(CFLAGS) -DTEST_NAME=\"$<\" -o $@ main.c $(LIBAIO) -lpthread
+++ $(CC) $(MK_CPPFLAGS) $(MK_CFLAGS) -DTEST_NAME=\"$<\" -o $@ $(MK_LDFLAGS)
++
++ clean:
++ rm -f $(PROGS) *.o runtests.out rofile wofile rwfile
++diff --git a/src/Makefile b/src/Makefile
++index 9a36d0d..9a1ba51 100644
++--- a/src/Makefile
+++++ b/src/Makefile
++@@ -2,12 +2,12 @@ prefix ?= /usr
++ includedir ?= $(prefix)/include
++ libdir ?= $(prefix)/lib
++
++-CFLAGS ?= -g -fomit-frame-pointer -O2
++-CFLAGS += -Wall -I. -fPIC
++-SO_CFLAGS=-shared $(CFLAGS)
++-L_CFLAGS=$(CFLAGS)
++-LINK_FLAGS=
++-LINK_FLAGS+=$(LDFLAGS)
+++MK_CPPFLAGS = -I. $(CPPFLAGS)
+++CFLAGS ?= -Wall -g -fomit-frame-pointer -O2
+++MK_CFLAGS = -fPIC $(CFLAGS)
+++SO_CFLAGS = -shared $(MK_CFLAGS)
+++L_CFLAGS = $(MK_CFLAGS)
+++MK_LDFLAGS = $(LDFLAGS)
++ ENABLE_SHARED ?= 1
++
++ soname=libaio.so.1
++@@ -42,10 +42,10 @@ libaio_sobjs := $(patsubst %.c,%.os,$(libaio_srcs))
++ $(libaio_objs) $(libaio_sobjs): libaio.h vsys_def.h
++
++ %.os: %.c
++- $(CC) $(SO_CFLAGS) -c -o $@ $<
+++ $(CC) $(MK_CPPFLAGS) $(SO_CFLAGS) -c -o $@ $<
++
++ %.ol: %.c
++- $(CC) $(L_CFLAGS) -c -o $@ $<
+++ $(CC) $(MK_CPPFLAGS) $(L_CFLAGS) -c -o $@ $<
++
++ AR ?= ar
++ RANLIB ?= ranlib
++@@ -55,8 +55,8 @@ libaio.a: $(libaio_objs)
++ $(RANLIB) libaio.a
++
++ $(libname): $(libaio_sobjs) libaio.map
++- $(CC) $(CFLAGS) -c struct_offsets.c
++- $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS)
+++ $(CC) $(MK_CPPFLAGS) $(MK_CFLAGS) -c struct_offsets.c
+++ $(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(MK_LDFLAGS)
++
++ install: $(all_targets)
++ install -D -m 644 libaio.h $(DESTDIR)$(includedir)/libaio.h
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 1859031a47b56a13db2e181902e53691edd4d08b Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Sun, 6 Aug 2023 20:56:10 +0200
++Subject: [PATCH libaio 06/26] build: Remove all test artifacts on clean
++
++We create these artifacts when running the test suite, so should remove
++them when running the clean target.
++
++Reported-by: Lucas Nussbaum <lucas@debian.org>
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ harness/Makefile | 4 +++-
++ 1 file changed, 3 insertions(+), 1 deletion(-)
++
++diff --git a/harness/Makefile b/harness/Makefile
++index 8cb27fa..ae4e45e 100644
++--- a/harness/Makefile
+++++ b/harness/Makefile
++@@ -27,7 +27,9 @@ $(PROGS): %.p: %.t $(HARNESS_SRCS)
++ $(CC) $(MK_CPPFLAGS) $(MK_CFLAGS) -DTEST_NAME=\"$<\" -o $@ $(MK_LDFLAGS)
++
++ clean:
++- rm -f $(PROGS) *.o runtests.out rofile wofile rwfile
+++ rm -f $(PROGS) *.o runtests.out tempfile testfile
+++ rm -f testdir/rofile testdir/wofile testdir/rwfile
+++ rmdir testdir || true
++
++ .PHONY:
++
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 3f16a6024bcf95f63c80340b5d518727af93d946 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Wed, 3 Nov 2021 00:20:50 +0100
++Subject: [PATCH libaio 07/26] Move semicolon to SYMVER and DEFSYMVER call
++ sites
++
++These look like function macros, so let's unify their call sites to use
++function syntax with a final semicolon.
++
++Origin: vendor
++Forwarded: https://marc.info/?l=linux-aio&m=164999309420541
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/io_cancel.c | 2 +-
++ src/io_getevents.c | 2 +-
++ src/io_queue_wait.c | 2 +-
++ src/syscall.h | 4 ++--
++ 4 files changed, 5 insertions(+), 5 deletions(-)
++
++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_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/syscall.h b/src/syscall.h
++index d2a117b..f7ce979 100644
++--- a/src/syscall.h
+++++ b/src/syscall.h
++@@ -6,10 +6,10 @@
++ #define SYMSTR(str) _SYMSTR(str)
++
++ #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))
++
++ #if defined(__i386__)
++ #include "syscall-i386.h"
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From cd2e1fdcf6a3474ac874303989e05e8333c7d2a2 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Tue, 2 Nov 2021 22:37:32 +0100
++Subject: [PATCH libaio 08/26] Use new symver function attribute to support LTO
++ builds
++
++The LTO support cannot work properly when there are versioned symbols
++via asm statements, as those are not seen by the compiler. Use the new
++function attributes if supported instead of the asm statements.
++
++We need to move the SYMVER calls after the function definitions
++otherwise it will reference symbols not yet seen.
++
++Origin: vendor
++Forwarded: https://marc.info/?l=linux-aio&m=164999309520544
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/compat-0_1.c | 7 +++----
++ src/syscall.h | 13 +++++++++++++
++ 2 files changed, 16 insertions(+), 4 deletions(-)
++
++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/syscall.h b/src/syscall.h
++index f7ce979..59e0bb3 100644
++--- a/src/syscall.h
+++++ b/src/syscall.h
++@@ -2,14 +2,27 @@
++ #include <unistd.h>
++ #include <errno.h>
++
+++#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))
++
++ #define DEFSYMVER(compat_sym, orig_sym, ver_sym) \
++ __asm__(".symver " SYMSTR(compat_sym) "," SYMSTR(orig_sym) "@@LIBAIO_" SYMSTR(ver_sym))
+++#endif
++
++ #if defined(__i386__)
++ #include "syscall-i386.h"
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From d3e886e649c9d8f32f71acf21605f245788a4592 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Fri, 1 Mar 2024 00:08:18 +0100
++Subject: [PATCH libaio 09/26] Remove unused vsys_def.h
++
++This was an old header to handle the syscalls, which is not used anymore
++since commit 34c539fcb98c4397b9f04e93f8a475a9e445cf33.
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/Makefile | 2 +-
++ src/compat-0_1.c | 1 -
++ src/vsys_def.h | 24 ------------------------
++ 3 files changed, 1 insertion(+), 26 deletions(-)
++ delete mode 100644 src/vsys_def.h
++
++diff --git a/src/Makefile b/src/Makefile
++index 9a1ba51..8a9bfb4 100644
++--- a/src/Makefile
+++++ b/src/Makefile
++@@ -39,7 +39,7 @@ libaio_srcs += compat-0_1.c
++ libaio_objs := $(patsubst %.c,%.ol,$(libaio_srcs))
++ libaio_sobjs := $(patsubst %.c,%.os,$(libaio_srcs))
++
++-$(libaio_objs) $(libaio_sobjs): libaio.h vsys_def.h
+++$(libaio_objs) $(libaio_sobjs): libaio.h
++
++ %.os: %.c
++ $(CC) $(MK_CPPFLAGS) $(SO_CFLAGS) -c -o $@ $<
++diff --git a/src/compat-0_1.c b/src/compat-0_1.c
++index ac40fcc..459586c 100644
++--- a/src/compat-0_1.c
+++++ b/src/compat-0_1.c
++@@ -22,7 +22,6 @@
++ #include <asm/errno.h>
++
++ #include "libaio.h"
++-#include "vsys_def.h"
++
++ #include "syscall.h"
++
++diff --git a/src/vsys_def.h b/src/vsys_def.h
++deleted file mode 100644
++index dd711dc..0000000
++--- a/src/vsys_def.h
+++++ /dev/null
++@@ -1,24 +0,0 @@
++-/* libaio Linux async I/O interface
++- Copyright 2002 Red Hat, Inc.
++-
++- This library is free software; you can redistribute it and/or
++- modify it under the terms of the GNU Lesser General Public
++- License as published by the Free Software Foundation; either
++- version 2 of the License, or (at your option) any later version.
++-
++- This library is distributed in the hope that it will be useful,
++- but WITHOUT ANY WARRANTY; without even the implied warranty of
++- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
++- Lesser General Public License for more details.
++-
++- You should have received a copy of the GNU Lesser General Public
++- License along with this library; if not, write to the Free Software
++- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++- */
++-extern int vsys_io_setup(unsigned nr_reqs, io_context_t *ctxp);
++-extern int vsys_io_destroy(io_context_t ctx);
++-extern int vsys_io_submit(io_context_t ctx, long nr, struct iocb *iocbs[]);
++-extern int vsys_io_cancel(io_context_t ctx, struct iocb *iocb);
++-extern int vsys_io_wait(io_context_t ctx, struct iocb *iocb, const struct timespec *when);
++-extern int vsys_io_getevents(io_context_t ctx, long nr, struct io_event *events, const struct timespec *timeout);
++-
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 6fd294018bbeac241274b7645498e619e598ce3c Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Fri, 1 Mar 2024 00:18:42 +0100
++Subject: [PATCH libaio 10/26] Remove unused raw_syscall.c
++
++The ia64_aio_raw_syscall assembler function was replaced by the
++__ia64_raw_syscall in commit a4984400f1d40c3cd9353ee2d817271c0fa3b4bd.
++
++The hand-crafted syscalls for all architectures then got removed
++in commit 97fd3fc0195500e616e34047cba4846164c411d9.
++
++This file has not actually been used for a while, so we can drop it.
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/Makefile | 3 ---
++ src/raw_syscall.c | 19 -------------------
++ 2 files changed, 22 deletions(-)
++ delete mode 100644 src/raw_syscall.c
++
++diff --git a/src/Makefile b/src/Makefile
++index 8a9bfb4..387b57f 100644
++--- a/src/Makefile
+++++ b/src/Makefile
++@@ -30,9 +30,6 @@ libaio_srcs += io_queue_wait.c io_queue_run.c
++ libaio_srcs += io_getevents.c io_submit.c io_cancel.c
++ libaio_srcs += io_setup.c io_destroy.c io_pgetevents.c
++
++-# internal functions
++-libaio_srcs += raw_syscall.c
++-
++ # old symbols
++ libaio_srcs += compat-0_1.c
++
++diff --git a/src/raw_syscall.c b/src/raw_syscall.c
++deleted file mode 100644
++index c3fe4b8..0000000
++--- a/src/raw_syscall.c
+++++ /dev/null
++@@ -1,19 +0,0 @@
++-#include "syscall.h"
++-
++-#if defined(__ia64__)
++-/* based on code from glibc by Jes Sorensen */
++-__asm__(".text\n"
++- ".globl __ia64_aio_raw_syscall\n"
++- ".proc __ia64_aio_raw_syscall\n"
++- "__ia64_aio_raw_syscall:\n"
++- "alloc r2=ar.pfs,1,0,8,0\n"
++- "mov r15=r32\n"
++- "break 0x100000\n"
++- ";;"
++- "br.ret.sptk.few b0\n"
++- ".size __ia64_aio_raw_syscall, . - __ia64_aio_raw_syscall\n"
++- ".endp __ia64_aio_raw_syscall"
++-);
++-#endif
++-
++-;
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 25ef7b3de18a3a6948ffe7d93b8f8cafe9c8b0bd Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Sun, 3 Mar 2024 20:28:30 +0100
++Subject: [PATCH libaio 11/26] Wrap long declarations exceeding 80 columns
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/io_cancel.c | 3 ++-
++ src/io_getevents.c | 7 +++++--
++ src/io_pgetevents.c | 4 ++--
++ src/io_submit.c | 3 ++-
++ src/libaio.h | 35 ++++++++++++++++++++++++-----------
++ 5 files changed, 35 insertions(+), 17 deletions(-)
++
++diff --git a/src/io_cancel.c b/src/io_cancel.c
++index 441806d..8f69d71 100644
++--- a/src/io_cancel.c
+++++ b/src/io_cancel.c
++@@ -19,5 +19,6 @@
++ #include <libaio.h>
++ #include "syscall.h"
++
++-io_syscall3(int, io_cancel_0_4, io_cancel, io_context_t, ctx, struct iocb *, iocb, struct io_event *, event)
+++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);
++diff --git a/src/io_getevents.c b/src/io_getevents.c
++index 88d285a..f39d1af 100644
++--- a/src/io_getevents.c
+++++ b/src/io_getevents.c
++@@ -23,9 +23,12 @@
++ #include "syscall.h"
++ #include "aio_ring.h"
++
++-io_syscall5(int, __io_getevents_0_4, io_getevents, io_context_t, ctx, long, min_nr, long, nr, struct io_event *, events, struct timespec *, timeout)
+++io_syscall5(int, __io_getevents_0_4, io_getevents, io_context_t, ctx,
+++ long, min_nr, long, nr, struct io_event *, events,
+++ struct timespec *, timeout)
++
++-int io_getevents_0_4(io_context_t ctx, long min_nr, long nr, struct io_event * events, struct timespec * timeout)
+++int io_getevents_0_4(io_context_t ctx, long min_nr, long nr,
+++ struct io_event * events, struct timespec * timeout)
++ {
++ if (aio_ring_is_empty(ctx, timeout))
++ return 0;
++diff --git a/src/io_pgetevents.c b/src/io_pgetevents.c
++index e6b0614..9d66dc8 100644
++--- a/src/io_pgetevents.c
+++++ b/src/io_pgetevents.c
++@@ -25,8 +25,8 @@
++ #include "aio_ring.h"
++
++ #ifdef __NR_io_pgetevents
++-io_syscall6(int, __io_pgetevents, io_pgetevents, io_context_t, ctx, long,
++- min_nr, long, nr, struct io_event *, events,
+++io_syscall6(int, __io_pgetevents, io_pgetevents, io_context_t, ctx,
+++ long, min_nr, long, nr, struct io_event *, events,
++ struct timespec *, timeout, void *, sigmask);
++
++ int io_pgetevents(io_context_t ctx, long min_nr, long nr,
++diff --git a/src/io_submit.c b/src/io_submit.c
++index e22ba54..dd04361 100644
++--- a/src/io_submit.c
+++++ b/src/io_submit.c
++@@ -20,4 +20,5 @@
++ #include <libaio.h>
++ #include "syscall.h"
++
++-io_syscall3(int, io_submit, io_submit, io_context_t, ctx, long, nr, struct iocb **, iocbs)
+++io_syscall3(int, io_submit, io_submit, io_context_t, ctx, long, nr,
+++ struct iocb **, iocbs)
++diff --git a/src/libaio.h b/src/libaio.h
++index 24b4b8a..f247c96 100644
++--- a/src/libaio.h
+++++ b/src/libaio.h
++@@ -163,8 +163,10 @@ extern int io_queue_run(io_context_t ctx);
++ extern int io_setup(int maxevents, io_context_t *ctxp);
++ extern int io_destroy(io_context_t ctx);
++ extern int io_submit(io_context_t ctx, long nr, struct iocb *ios[]);
++-extern int io_cancel(io_context_t ctx, struct iocb *iocb, struct io_event *evt);
++-extern int io_getevents(io_context_t ctx, long min_nr, long nr, struct io_event *events, struct timespec *timeout);
+++extern int io_cancel(io_context_t ctx, struct iocb *iocb,
+++ struct io_event *evt);
+++extern int io_getevents(io_context_t ctx, long min_nr, long nr,
+++ struct io_event *events, struct timespec *timeout);
++ extern int io_pgetevents(io_context_t ctx, long min_nr, long nr,
++ struct io_event *events, struct timespec *timeout,
++ sigset_t *sigmask);
++@@ -175,7 +177,8 @@ static inline void io_set_callback(struct iocb *iocb, io_callback_t cb)
++ iocb->data = (void *)cb;
++ }
++
++-static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
+++static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf,
+++ size_t count, long long offset)
++ {
++ memset(iocb, 0, sizeof(*iocb));
++ iocb->aio_fildes = fd;
++@@ -186,7 +189,8 @@ static inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t co
++ iocb->u.c.offset = offset;
++ }
++
++-static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
+++static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf,
+++ size_t count, long long offset)
++ {
++ memset(iocb, 0, sizeof(*iocb));
++ iocb->aio_fildes = fd;
++@@ -197,7 +201,8 @@ static inline void io_prep_pwrite(struct iocb *iocb, int fd, void *buf, size_t c
++ iocb->u.c.offset = offset;
++ }
++
++-static inline void io_prep_preadv(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
+++static inline void io_prep_preadv(struct iocb *iocb, int fd,
+++ const struct iovec *iov, int iovcnt, long long offset)
++ {
++ memset(iocb, 0, sizeof(*iocb));
++ iocb->aio_fildes = fd;
++@@ -208,7 +213,8 @@ static inline void io_prep_preadv(struct iocb *iocb, int fd, const struct iovec
++ iocb->u.c.offset = offset;
++ }
++
++-static inline void io_prep_pwritev(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset)
+++static inline void io_prep_pwritev(struct iocb *iocb, int fd,
+++ const struct iovec *iov, int iovcnt, long long offset)
++ {
++ memset(iocb, 0, sizeof(*iocb));
++ iocb->aio_fildes = fd;
++@@ -219,7 +225,9 @@ static inline void io_prep_pwritev(struct iocb *iocb, int fd, const struct iovec
++ iocb->u.c.offset = offset;
++ }
++
++-static inline void io_prep_preadv2(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset, int flags)
+++static inline void io_prep_preadv2(struct iocb *iocb, int fd,
+++ const struct iovec *iov, int iovcnt, long long offset,
+++ int flags)
++ {
++ memset(iocb, 0, sizeof(*iocb));
++ iocb->aio_fildes = fd;
++@@ -231,7 +239,9 @@ static inline void io_prep_preadv2(struct iocb *iocb, int fd, const struct iovec
++ iocb->u.c.offset = offset;
++ }
++
++-static inline void io_prep_pwritev2(struct iocb *iocb, int fd, const struct iovec *iov, int iovcnt, long long offset, int flags)
+++static inline void io_prep_pwritev2(struct iocb *iocb, int fd,
+++ const struct iovec *iov, int iovcnt, long long offset,
+++ int flags)
++ {
++ memset(iocb, 0, sizeof(*iocb));
++ iocb->aio_fildes = fd;
++@@ -252,7 +262,8 @@ static inline void io_prep_poll(struct iocb *iocb, int fd, int events)
++ iocb->u.poll.events = events;
++ }
++
++-static inline int io_poll(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd, int events)
+++static inline int io_poll(io_context_t ctx, struct iocb *iocb,
+++ io_callback_t cb, int fd, int events)
++ {
++ io_prep_poll(iocb, fd, events);
++ io_set_callback(iocb, cb);
++@@ -267,7 +278,8 @@ static inline void io_prep_fsync(struct iocb *iocb, int fd)
++ iocb->aio_reqprio = 0;
++ }
++
++-static inline int io_fsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
+++static inline int io_fsync(io_context_t ctx, struct iocb *iocb,
+++ io_callback_t cb, int fd)
++ {
++ io_prep_fsync(iocb, fd);
++ io_set_callback(iocb, cb);
++@@ -282,7 +294,8 @@ static inline void io_prep_fdsync(struct iocb *iocb, int fd)
++ iocb->aio_reqprio = 0;
++ }
++
++-static inline int io_fdsync(io_context_t ctx, struct iocb *iocb, io_callback_t cb, int fd)
+++static inline int io_fdsync(io_context_t ctx, struct iocb *iocb,
+++ io_callback_t cb, int fd)
++ {
++ io_prep_fdsync(iocb, fd);
++ io_set_callback(iocb, cb);
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 19fca4e7582fc39def19c41dc5225e014156c553 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Sun, 12 Apr 2020 03:39:47 +0200
++Subject: [PATCH libaio 12/26] syscall: Fix ARM definitions to match exactly
++ the kernel
++
++Otherwise we get preprocessor warnings due to the redefinitions.
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/syscall-arm.h | 10 +++++-----
++ 1 file changed, 5 insertions(+), 5 deletions(-)
++
++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)
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 43593f5c7f2d142409e0aed8c1f1c72ed9ac719a Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Sun, 12 Apr 2020 03:44:43 +0200
++Subject: [PATCH libaio 13/26] syscall: Fix ia64 definitions to match exactly
++ the kernel
++
++Otherwise we get preprocessor warnings due to the redefinitions.
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/syscall-ia64.h | 11 ++++++-----
++ 1 file changed, 6 insertions(+), 5 deletions(-)
++
++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)
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From f483509a17b2fb7ea072d0ba5d9a875335e71aaa Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Wed, 14 Aug 2019 03:30:09 +0200
++Subject: [PATCH libaio 14/26] harness: Add KERNEL_RW_POINTER for various
++ 32-bit architectures
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ harness/main.c | 9 +++++++++
++ 1 file changed, 9 insertions(+)
++
++diff --git a/harness/main.c b/harness/main.c
++index 82e9c69..0eed7bd 100644
++--- a/harness/main.c
+++++ b/harness/main.c
++@@ -12,7 +12,16 @@
++ #include <libaio.h>
++
++ #if __LP64__ == 0
+++#if defined(__i386__) || defined(__powerpc__)
++ #define KERNEL_RW_POINTER ((void *)0xc0010000)
+++#elif defined(__arm__) || defined(__s390__)
+++#define KERNEL_RW_POINTER ((void *)0x00010000)
+++#elif defined(__sparc__)
+++#define KERNEL_RW_POINTER ((void *)0xf0010000)
+++#else
+++#warning Not really sure where kernel memory is. Guessing.
+++#define KERNEL_RW_POINTER ((void *)0xc0010000)
+++#endif
++ #else
++ //#warning Not really sure where kernel memory is. Guessing.
++ #define KERNEL_RW_POINTER ((void *)0xffffffff81000000)
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 75b6aca9086a656747f7d49fb365daa6ab90a4d0 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Wed, 14 Aug 2019 03:18:50 +0200
++Subject: [PATCH libaio 15/26] Fix and improve MIPS support
++
++Fix structure padding for MIPS 64, add syscall definitions, and the
++kernel R/W pointer.
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ harness/main.c | 2 +-
++ src/libaio.h | 6 +++++-
++ src/syscall-mips.h | 54 ++++++++++++++++++++++++++++++++++++++++++++++
++ src/syscall.h | 2 ++
++ 4 files changed, 62 insertions(+), 2 deletions(-)
++ create mode 100644 src/syscall-mips.h
++
++diff --git a/harness/main.c b/harness/main.c
++index 0eed7bd..33d8e46 100644
++--- a/harness/main.c
+++++ b/harness/main.c
++@@ -12,7 +12,7 @@
++ #include <libaio.h>
++
++ #if __LP64__ == 0
++-#if defined(__i386__) || defined(__powerpc__)
+++#if defined(__i386__) || defined(__powerpc__) || defined(__mips__)
++ #define KERNEL_RW_POINTER ((void *)0xc0010000)
++ #elif defined(__arm__) || defined(__s390__)
++ #define KERNEL_RW_POINTER ((void *)0x00010000)
++diff --git a/src/libaio.h b/src/libaio.h
++index f247c96..bd882c2 100644
++--- a/src/libaio.h
+++++ b/src/libaio.h
++@@ -52,7 +52,9 @@ typedef enum io_iocb_cmd {
++
++ /* little endian, 32 bits */
++ #if defined(__i386__) || (defined(__arm__) && !defined(__ARMEB__)) || \
++- defined(__sh__) || defined(__bfin__) || defined(__MIPSEL__) || \
+++ defined(__sh__) || \
+++ defined(__bfin__) || \
+++ (defined(__MIPSEL__) && !defined(__mips64)) || \
++ defined(__cris__) || defined(__loongarch32) || \
++ (defined(__riscv) && __riscv_xlen == 32) || \
++ (defined(__GNUC__) && defined(__BYTE_ORDER__) && \
++@@ -63,6 +65,7 @@ typedef enum io_iocb_cmd {
++
++ /* little endian, 64 bits */
++ #elif defined(__ia64__) || defined(__x86_64__) || defined(__alpha__) || \
+++ (defined(__mips64) && defined(__MIPSEL__)) || \
++ (defined(__aarch64__) && defined(__AARCH64EL__)) || \
++ defined(__loongarch64) || \
++ (defined(__riscv) && __riscv_xlen == 64) || \
++@@ -75,6 +78,7 @@ typedef enum io_iocb_cmd {
++ /* big endian, 64 bits */
++ #elif defined(__powerpc64__) || defined(__s390x__) || \
++ (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)
++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.h b/src/syscall.h
++index 59e0bb3..4e56894 100644
++--- a/src/syscall.h
+++++ b/src/syscall.h
++@@ -40,6 +40,8 @@
++ #include "syscall-arm.h"
++ #elif defined(__sparc__)
++ #include "syscall-sparc.h"
+++#elif defined(__mips__)
+++#include "syscall-mips.h"
++ #elif defined(__aarch64__) || defined(__loongarch__) || defined(__riscv)
++ #include "syscall-generic.h"
++ #else
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From ca23ee0222a148339d45945e744f7a4663d03cdc Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Wed, 14 Aug 2019 03:22:10 +0200
++Subject: [PATCH libaio 16/26] Add PARISC support
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ harness/main.c | 2 ++
++ src/libaio.h | 1 +
++ src/syscall-parisc.h | 5 +++++
++ src/syscall.h | 2 ++
++ 4 files changed, 10 insertions(+)
++ create mode 100644 src/syscall-parisc.h
++
++diff --git a/harness/main.c b/harness/main.c
++index 33d8e46..01c81aa 100644
++--- a/harness/main.c
+++++ b/harness/main.c
++@@ -16,6 +16,8 @@
++ #define KERNEL_RW_POINTER ((void *)0xc0010000)
++ #elif defined(__arm__) || defined(__s390__)
++ #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
++diff --git a/src/libaio.h b/src/libaio.h
++index bd882c2..684bc7e 100644
++--- a/src/libaio.h
+++++ b/src/libaio.h
++@@ -77,6 +77,7 @@ 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__)) || \
++diff --git a/src/syscall-parisc.h b/src/syscall-parisc.h
++new file mode 100644
++index 0000000..1738075
++--- /dev/null
+++++ b/src/syscall-parisc.h
++@@ -0,0 +1,5 @@
+++#define __NR_io_setup 215
+++#define __NR_io_destroy 216
+++#define __NR_io_getevents 217
+++#define __NR_io_submit 218
+++#define __NR_io_cancel 219
++diff --git a/src/syscall.h b/src/syscall.h
++index 4e56894..3a6c85e 100644
++--- a/src/syscall.h
+++++ b/src/syscall.h
++@@ -40,6 +40,8 @@
++ #include "syscall-arm.h"
++ #elif defined(__sparc__)
++ #include "syscall-sparc.h"
+++#elif defined(__hppa__)
+++#include "syscall-parisc.h"
++ #elif defined(__mips__)
++ #include "syscall-mips.h"
++ #elif defined(__aarch64__) || defined(__loongarch__) || defined(__riscv)
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From daec34aef161844f607ab6253a497030449d68c0 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Wed, 14 Aug 2019 03:25:22 +0200
++Subject: [PATCH libaio 17/26] Add m68k support
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ harness/main.c | 2 +-
++ src/syscall-m68k.h | 5 +++++
++ src/syscall.h | 2 ++
++ 3 files changed, 8 insertions(+), 1 deletion(-)
++ create mode 100644 src/syscall-m68k.h
++
++diff --git a/harness/main.c b/harness/main.c
++index 01c81aa..99d393f 100644
++--- a/harness/main.c
+++++ b/harness/main.c
++@@ -14,7 +14,7 @@
++ #if __LP64__ == 0
++ #if defined(__i386__) || defined(__powerpc__) || defined(__mips__)
++ #define KERNEL_RW_POINTER ((void *)0xc0010000)
++-#elif defined(__arm__) || defined(__s390__)
+++#elif defined(__arm__) || defined(__m68k__) || defined(__s390__)
++ #define KERNEL_RW_POINTER ((void *)0x00010000)
++ #elif defined(__hppa__)
++ #define KERNEL_RW_POINTER ((void *)0x10100000)
++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.h b/src/syscall.h
++index 3a6c85e..e3825df 100644
++--- a/src/syscall.h
+++++ b/src/syscall.h
++@@ -40,6 +40,8 @@
++ #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__)
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From dad807a71fdc9af5e26fa45b9f0e338fe517c1d3 Mon Sep 17 00:00:00 2001
++From: Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
++Date: Sun, 12 Apr 2020 03:30:41 +0200
++Subject: [PATCH libaio 18/26] Add SH support
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ harness/main.c | 2 +-
++ src/libaio.h | 3 ++-
++ src/syscall-sh.h | 6 ++++++
++ src/syscall.h | 2 ++
++ 4 files changed, 11 insertions(+), 2 deletions(-)
++ create mode 100644 src/syscall-sh.h
++
++diff --git a/harness/main.c b/harness/main.c
++index 99d393f..ac0fba2 100644
++--- a/harness/main.c
+++++ b/harness/main.c
++@@ -14,7 +14,7 @@
++ #if __LP64__ == 0
++ #if defined(__i386__) || defined(__powerpc__) || defined(__mips__)
++ #define KERNEL_RW_POINTER ((void *)0xc0010000)
++-#elif defined(__arm__) || defined(__m68k__) || defined(__s390__)
+++#elif defined(__arm__) || defined(__m68k__) || defined(__s390__) || defined(__sh__)
++ #define KERNEL_RW_POINTER ((void *)0x00010000)
++ #elif defined(__hppa__)
++ #define KERNEL_RW_POINTER ((void *)0x10100000)
++diff --git a/src/libaio.h b/src/libaio.h
++index 684bc7e..474dbd6 100644
++--- a/src/libaio.h
+++++ b/src/libaio.h
++@@ -52,7 +52,7 @@ typedef enum io_iocb_cmd {
++
++ /* little endian, 32 bits */
++ #if defined(__i386__) || (defined(__arm__) && !defined(__ARMEB__)) || \
++- defined(__sh__) || \
+++ (defined(__sh__) && defined(__LITTLE_ENDIAN__)) || \
++ defined(__bfin__) || \
++ (defined(__MIPSEL__) && !defined(__mips64)) || \
++ defined(__cris__) || defined(__loongarch32) || \
++@@ -90,6 +90,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__) && \
++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.h b/src/syscall.h
++index e3825df..57dd1fa 100644
++--- a/src/syscall.h
+++++ b/src/syscall.h
++@@ -46,6 +46,8 @@
++ #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
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 4dd188788a972f9b35d18e22235e434efac832ba Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Sun, 12 Apr 2020 03:36:39 +0200
++Subject: [PATCH libaio 19/26] Add x32 support
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ harness/main.c | 2 +-
++ src/libaio.h | 4 +++-
++ src/syscall-x86_64.h | 10 ++++++++++
++ 3 files changed, 14 insertions(+), 2 deletions(-)
++
++diff --git a/harness/main.c b/harness/main.c
++index ac0fba2..db42a18 100644
++--- a/harness/main.c
+++++ b/harness/main.c
++@@ -14,7 +14,7 @@
++ #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__)
+++#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)
++diff --git a/src/libaio.h b/src/libaio.h
++index 474dbd6..3304bf7 100644
++--- a/src/libaio.h
+++++ b/src/libaio.h
++@@ -51,7 +51,9 @@ typedef enum io_iocb_cmd {
++ } io_iocb_cmd_t;
++
++ /* little endian, 32 bits */
++-#if defined(__i386__) || (defined(__arm__) && !defined(__ARMEB__)) || \
+++#if defined(__i386__) || \
+++ (defined(__x86_64__) && defined(__ILP32__)) || \
+++ (defined(__arm__) && !defined(__ARMEB__)) || \
++ (defined(__sh__) && defined(__LITTLE_ENDIAN__)) || \
++ defined(__bfin__) || \
++ (defined(__MIPSEL__) && !defined(__mips64)) || \
++diff --git a/src/syscall-x86_64.h b/src/syscall-x86_64.h
++index 0eccef3..6a44d53 100644
++--- a/src/syscall-x86_64.h
+++++ b/src/syscall-x86_64.h
++@@ -1,6 +1,16 @@
+++#if __ILP32__
+++#define __X32_SYSCALL_BIT 0x40000000UL
+++#define __NR_io_setup (__X32_SYSCALL_BIT + 543)
+++#define __NR_io_destroy (__X32_SYSCALL_BIT + 207)
+++#define __NR_io_submit (__X32_SYSCALL_BIT + 544)
+++#define __NR_io_cancel (__X32_SYSCALL_BIT + 210)
+++#define __NR_io_getevents (__X32_SYSCALL_BIT + 208)
+++#define __NR_io_pgetevents (__X32_SYSCALL_BIT + 333)
+++#else
++ #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
+++#endif
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From c1c9ba4348338afe21cf3a3e531409a80bb8cb1d Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Tue, 5 Mar 2024 02:47:50 +0100
++Subject: [PATCH libaio 20/26] Rename sigset struct from data to aio_sigset
++
++This makes the purpose more clear, and matches the naming in the aio
++syscall implementation in Linux.
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/io_pgetevents.c | 8 ++++----
++ 1 file changed, 4 insertions(+), 4 deletions(-)
++
++diff --git a/src/io_pgetevents.c b/src/io_pgetevents.c
++index 9d66dc8..63ff806 100644
++--- a/src/io_pgetevents.c
+++++ b/src/io_pgetevents.c
++@@ -36,14 +36,14 @@ int io_pgetevents(io_context_t ctx, long min_nr, long nr,
++ struct {
++ unsigned long ss;
++ unsigned long ss_len;
++- } data;
+++ } aio_sigset;
++
++ 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;
+++ return __io_pgetevents(ctx, min_nr, nr, events, timeout, &aio_sigset);
++ }
++ #else
++ int io_pgetevents(io_context_t ctx, long min_nr, long nr,
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 680e578af7440464a983c5b564b1eae459b95c90 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Fri, 1 Mar 2024 01:52:51 +0100
++Subject: [PATCH libaio 21/26] Add time64 syscall support
++
++This implements both io_getevents() and io_pgetevents() as wrappers over
++the new aio_getevents() and aio_pgetevents() which use __kernel_timespec
++as its timespec data type which should always be 64-bit. We add the
++necessary conversion from __kernel_old_timespec or timsepec struct
++types.
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/Makefile | 1 +
++ src/{io_getevents.c => aio_getevents.c} | 26 +++++++----
++ src/{io_pgetevents.c => aio_pgetevents.c} | 50 ++++++++++++++++-----
++ src/aio_ring.h | 3 +-
++ src/aio_time.h | 54 +++++++++++++++++++++++
++ src/compat-0_1.c | 14 +++---
++ src/io_getevents.c | 15 +++----
++ src/io_pgetevents.c | 33 +++-----------
++ src/io_queue_run.c | 5 ++-
++ src/io_queue_wait.c | 8 +++-
++ 10 files changed, 146 insertions(+), 63 deletions(-)
++ copy src/{io_getevents.c => aio_getevents.c} (64%)
++ copy src/{io_pgetevents.c => aio_pgetevents.c} (53%)
++ create mode 100644 src/aio_time.h
++
++diff --git a/src/Makefile b/src/Makefile
++index 387b57f..da18e8c 100644
++--- a/src/Makefile
+++++ b/src/Makefile
++@@ -27,6 +27,7 @@ libaio_srcs := io_queue_init.c io_queue_release.c
++ libaio_srcs += io_queue_wait.c io_queue_run.c
++
++ # real syscalls
+++libaio_srcs += aio_pgetevents.c aio_getevents.c
++ libaio_srcs += io_getevents.c io_submit.c io_cancel.c
++ libaio_srcs += io_setup.c io_destroy.c io_pgetevents.c
++
++diff --git a/src/io_getevents.c b/src/aio_getevents.c
++similarity index 64%
++copy from src/io_getevents.c
++copy to src/aio_getevents.c
++index f39d1af..b29ae32 100644
++--- a/src/io_getevents.c
+++++ b/src/aio_getevents.c
++@@ -1,6 +1,7 @@
++-/* io_getevents.c
+++/* aio_getevents.c
++ libaio Linux async I/O interface
++ Copyright 2002 Red Hat, Inc.
+++ Copyright 2024 Guillem Jover <guillem@hadrons.org>
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++@@ -21,18 +22,27 @@
++ #include <stdlib.h>
++ #include <time.h>
++ #include "syscall.h"
+++#include "aio_time.h"
++ #include "aio_ring.h"
++
++-io_syscall5(int, __io_getevents_0_4, io_getevents, io_context_t, ctx,
+++io_syscall5(int, __aio_getevents, io_getevents, io_context_t, ctx,
++ long, min_nr, long, nr, struct io_event *, events,
++- struct timespec *, timeout)
+++ struct sys_timespec *, timeout)
++
++-int io_getevents_0_4(io_context_t ctx, long min_nr, long nr,
++- struct io_event * events, struct timespec * timeout)
+++int aio_getevents(io_context_t ctx, long min_nr, long nr,
+++ struct io_event * events, struct __kernel_timespec * timeout)
++ {
+++ struct sys_timespec ts;
+++ int ret;
+++
+++ ret = aio_pgetevents(ctx, min_nr, nr, events, timeout, NULL);
+++ if (ret != -ENOSYS)
+++ return ret;
+++
++ if (aio_ring_is_empty(ctx, timeout))
++ return 0;
++- return __io_getevents_0_4(ctx, min_nr, nr, events, timeout);
++-}
++
++-DEFSYMVER(io_getevents_0_4, io_getevents, 0.4);
+++ if (timeout)
+++ sys_get_timespec(&ts, timeout);
+++ return __aio_getevents(ctx, min_nr, nr, events, timeout ? &ts : NULL);
+++}
++diff --git a/src/io_pgetevents.c b/src/aio_pgetevents.c
++similarity index 53%
++copy from src/io_pgetevents.c
++copy to src/aio_pgetevents.c
++index 63ff806..e12036e 100644
++--- a/src/io_pgetevents.c
+++++ b/src/aio_pgetevents.c
++@@ -1,6 +1,7 @@
++ /*
++ libaio Linux async I/O interface
++ Copyright 2018 Christoph Hellwig.
+++ Copyright 2024 Guillem Jover <guillem@hadrons.org>
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++@@ -22,35 +23,62 @@
++ #include <time.h>
++ #include <signal.h>
++ #include "syscall.h"
+++#include "aio_time.h"
++ #include "aio_ring.h"
++
++ #ifdef __NR_io_pgetevents
++ io_syscall6(int, __io_pgetevents, io_pgetevents, io_context_t, ctx,
++ long, min_nr, long, nr, struct io_event *, events,
++- struct timespec *, timeout, void *, sigmask);
+++ struct sys_timespec *, timeout, void *, sigmask);
+++#endif
++
++-int io_pgetevents(io_context_t ctx, long min_nr, long nr,
++- struct io_event *events, struct timespec *timeout,
+++#ifdef __NR_io_pgetevents_time64
+++io_syscall6(int, __io_pgetevents_time64, io_pgetevents_time64,
+++ io_context_t, ctx,
+++ long, min_nr, long, nr, struct io_event *, events,
+++ struct __kernel_timespec *, timeout, void *, sigmask);
+++#endif
+++
+++int aio_pgetevents(io_context_t ctx, long min_nr, long nr,
+++ struct io_event *events, struct __kernel_timespec *timeout,
++ sigset_t *sigmask)
++ {
+++ int ret;
+++#if defined(__NR_io_pgetevents) || defined(__NR_io_pgetevents_time64)
++ struct {
++ unsigned long ss;
++ unsigned long ss_len;
++ } aio_sigset;
+++ struct sys_timespec sys_ts;
++
++ if (aio_ring_is_empty(ctx, timeout))
++ return 0;
++
++ aio_sigset.ss = (unsigned long)sigmask;
++ aio_sigset.ss_len = _NSIG / 8;
++- return __io_pgetevents(ctx, min_nr, nr, events, timeout, &aio_sigset);
++-}
+++#endif
+++
+++#ifdef __NR_io_pgetevents_time64
+++ /*
+++ * On 32-bit systems that have a time64 variant of the syscall at
+++ * compile-time we try to use that, and if missing we fallback to
+++ * the 32-bit variant.
+++ */
+++ ret = __io_pgetevents_time64(ctx, min_nr, nr, events, timeout,
+++ sigmask ? &aio_sigset : NULL);
+++ if (ret != -ENOSYS)
+++ return ret;
+++#endif
+++
+++#ifdef __NR_io_pgetevents
+++ if (timeout)
+++ sys_get_timespec(&sys_ts, timeout);
+++
+++ ret = __io_pgetevents(ctx, min_nr, nr, events,
+++ timeout ? &sys_ts : NULL, &aio_sigset);
++ #else
++-int io_pgetevents(io_context_t ctx, long min_nr, long nr,
++- struct io_event *events, struct timespec *timeout,
++- sigset_t *sigmask)
+++ ret = -ENOSYS;
+++#endif
++
++-{
++- return -ENOSYS;
+++ return ret;
++ }
++-#endif /* __NR_io_pgetevents */
++diff --git a/src/aio_ring.h b/src/aio_ring.h
++index 3842c4b..17fe838 100644
++--- a/src/aio_ring.h
+++++ b/src/aio_ring.h
++@@ -33,7 +33,8 @@ struct aio_ring {
++ unsigned header_length; /* size of aio_ring */
++ };
++
++-static inline int aio_ring_is_empty(io_context_t ctx, struct timespec *timeout)
+++static inline int aio_ring_is_empty(io_context_t ctx,
+++ struct __kernel_timespec *timeout)
++ {
++ struct aio_ring *ring = (struct aio_ring *)ctx;
++
++diff --git a/src/aio_time.h b/src/aio_time.h
++new file mode 100644
++index 0000000..373a1b0
++--- /dev/null
+++++ b/src/aio_time.h
++@@ -0,0 +1,54 @@
+++/*
+++ libaio Linux async I/O interface
+++ Copyright 2024 Guillem Jover <guillem@hadrons.org>
+++
+++ This library is free software; you can redistribute it and/or
+++ modify it under the terms of the GNU Lesser General Public
+++ License as published by the Free Software Foundation; either
+++ version 2 of the License, or (at your option) any later version.
+++
+++ This library is distributed in the hope that it will be useful,
+++ but WITHOUT ANY WARRANTY; without even the implied warranty of
+++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+++ Lesser General Public License for more details.
+++
+++ You should have received a copy of the GNU Lesser General Public
+++ License along with this library; if not, write to the Free Software
+++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+++ */
+++#ifndef _AIO_TIME_H
+++#define _AIO_TIME_H
+++
+++#include <linux/time_types.h>
+++
+++#if __BITS_PER_LONG == 32
+++# define sys_timespec __kernel_old_timespec
+++# define sys_get_timespec(sys_ts, kern_ts) \
+++ aio_get_old_timespec(sys_ts, kern_ts)
+++#else
+++# define sys_timespec __kernel_timespec
+++# define sys_get_timespec(sys_ts, kern_ts) *sys_ts = *kern_ts
+++#endif
+++
+++static inline void aio_get_timespec(struct __kernel_timespec *kts,
+++ const struct timespec *uts)
+++{
+++ kts->tv_sec = uts->tv_sec;
+++ kts->tv_nsec = uts->tv_nsec;
+++}
+++
+++static inline void aio_get_old_timespec(struct __kernel_old_timespec *ots,
+++ const struct __kernel_timespec *kts)
+++{
+++ ots->tv_sec = kts->tv_sec;
+++ ots->tv_nsec = kts->tv_nsec;
+++}
+++
+++int aio_pgetevents(io_context_t ctx, long min_nr, long nr,
+++ struct io_event *events, struct __kernel_timespec *timeout,
+++ sigset_t *sigmask);
+++
+++int aio_getevents(io_context_t ctx, long min_nr, long nr,
+++ struct io_event * events, struct __kernel_timespec * timeout);
+++
+++#endif /* _AIO_TIME_H */
++diff --git a/src/compat-0_1.c b/src/compat-0_1.c
++index 459586c..25b789a 100644
++--- a/src/compat-0_1.c
+++++ b/src/compat-0_1.c
++@@ -3,6 +3,7 @@
++ compat-0_1.c : compatibility symbols for libaio 0.1.x-0.3.x
++
++ Copyright 2002 Red Hat, Inc.
+++ Copyright 2024 Guillem Jover <guillem@hadrons.org>
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++@@ -22,6 +23,7 @@
++ #include <asm/errno.h>
++
++ #include "libaio.h"
+++#include "aio_time.h"
++
++ #include "syscall.h"
++
++@@ -38,10 +40,10 @@ SYMVER(compat0_1_io_cancel, io_cancel, 0.1);
++
++ int compat0_1_io_queue_wait(io_context_t ctx, struct timespec *when)
++ {
++- struct timespec timeout;
+++ struct __kernel_timespec timeout;
++ if (when)
++- timeout = *when;
++- return io_getevents(ctx, 0, 0, NULL, when ? &timeout : NULL);
+++ aio_get_timespec(&timeout, when);
+++ return aio_getevents(ctx, 0, 0, NULL, when ? &timeout : NULL);
++ }
++ SYMVER(compat0_1_io_queue_wait, io_queue_wait, 0.1);
++
++@@ -51,10 +53,10 @@ int compat0_1_io_getevents(io_context_t ctx, long nr,
++ struct io_event *events,
++ const struct timespec *const_timeout)
++ {
++- struct timespec timeout;
+++ struct __kernel_timespec timeout;
++ if (const_timeout)
++- timeout = *const_timeout;
++- return io_getevents(ctx, 1, nr, events,
+++ aio_get_timespec(&timeout, const_timeout);
+++ return aio_getevents(ctx, 1, nr, events,
++ const_timeout ? &timeout : NULL);
++ }
++ SYMVER(compat0_1_io_getevents, io_getevents, 0.1);
++diff --git a/src/io_getevents.c b/src/io_getevents.c
++index f39d1af..c06e803 100644
++--- a/src/io_getevents.c
+++++ b/src/io_getevents.c
++@@ -1,6 +1,7 @@
++ /* io_getevents.c
++ libaio Linux async I/O interface
++ Copyright 2002 Red Hat, Inc.
+++ Copyright 2024 Guillem Jover <guillem@hadrons.org>
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++@@ -21,18 +22,16 @@
++ #include <stdlib.h>
++ #include <time.h>
++ #include "syscall.h"
++-#include "aio_ring.h"
++-
++-io_syscall5(int, __io_getevents_0_4, io_getevents, io_context_t, ctx,
++- long, min_nr, long, nr, struct io_event *, events,
++- struct timespec *, timeout)
+++#include "aio_time.h"
++
++ int io_getevents_0_4(io_context_t ctx, long min_nr, long nr,
++ struct io_event * events, struct timespec * timeout)
++ {
++- if (aio_ring_is_empty(ctx, timeout))
++- return 0;
++- return __io_getevents_0_4(ctx, min_nr, nr, events, timeout);
+++ struct __kernel_timespec ts;
+++
+++ if (timeout)
+++ aio_get_timespec(&ts, timeout);
+++ return aio_getevents(ctx, min_nr, nr, events, timeout ? &ts : NULL);
++ }
++
++ DEFSYMVER(io_getevents_0_4, io_getevents, 0.4);
++diff --git a/src/io_pgetevents.c b/src/io_pgetevents.c
++index 63ff806..d960a05 100644
++--- a/src/io_pgetevents.c
+++++ b/src/io_pgetevents.c
++@@ -1,6 +1,7 @@
++ /*
++ libaio Linux async I/O interface
++ Copyright 2018 Christoph Hellwig.
+++ Copyright 2024 Guillem Jover <guillem@hadrons.org>
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++@@ -21,36 +22,16 @@
++ #include <stdlib.h>
++ #include <time.h>
++ #include <signal.h>
++-#include "syscall.h"
++-#include "aio_ring.h"
++-
++-#ifdef __NR_io_pgetevents
++-io_syscall6(int, __io_pgetevents, io_pgetevents, io_context_t, ctx,
++- long, min_nr, long, nr, struct io_event *, events,
++- struct timespec *, timeout, void *, sigmask);
+++#include "aio_time.h"
++
++ 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;
++- } aio_sigset;
++-
++- if (aio_ring_is_empty(ctx, timeout))
++- return 0;
++-
++- aio_sigset.ss = (unsigned long)sigmask;
++- aio_sigset.ss_len = _NSIG / 8;
++- return __io_pgetevents(ctx, min_nr, nr, events, timeout, &aio_sigset);
++-}
++-#else
++-int io_pgetevents(io_context_t ctx, long min_nr, long nr,
++- struct io_event *events, struct timespec *timeout,
++- sigset_t *sigmask)
+++ struct __kernel_timespec ts;
++
++-{
++- return -ENOSYS;
+++ if (timeout)
+++ aio_get_timespec(&ts, timeout);
+++ return aio_pgetevents(ctx, min_nr, nr, events, timeout ? &ts : NULL,
+++ sigmask);
++ }
++-#endif /* __NR_io_pgetevents */
++diff --git a/src/io_queue_run.c b/src/io_queue_run.c
++index e0132f4..7b5a1be 100644
++--- a/src/io_queue_run.c
+++++ b/src/io_queue_run.c
++@@ -20,15 +20,16 @@
++ #include <errno.h>
++ #include <stdlib.h>
++ #include <time.h>
+++#include "aio_time.h"
++
++ int io_queue_run(io_context_t ctx)
++ {
++- static struct timespec timeout = { 0, 0 };
+++ static struct __kernel_timespec timeout = { 0, 0 };
++ struct io_event event;
++ int ret;
++
++ /* FIXME: batch requests? */
++- while (1 == (ret = io_getevents(ctx, 0, 1, &event, &timeout))) {
+++ while (1 == (ret = aio_getevents(ctx, 0, 1, &event, &timeout))) {
++ io_callback_t cb = (io_callback_t)event.data;
++ struct iocb *iocb = event.obj;
++
++diff --git a/src/io_queue_wait.c b/src/io_queue_wait.c
++index 6f69a51..b4bb236 100644
++--- a/src/io_queue_wait.c
+++++ b/src/io_queue_wait.c
++@@ -1,6 +1,7 @@
++ /* io_submit
++ libaio Linux async I/O interface
++ Copyright 2002 Red Hat, Inc.
+++ Copyright 2024 Guillem Jover <guillem@hadrons.org>
++
++ This library is free software; you can redistribute it and/or
++ modify it under the terms of the GNU Lesser General Public
++@@ -20,12 +21,17 @@
++ #include <sys/types.h>
++ #include <libaio.h>
++ #include <errno.h>
+++#include "aio_time.h"
++ #include "syscall.h"
++
++ struct timespec;
++
++ int io_queue_wait_0_4(io_context_t ctx, struct timespec *timeout)
++ {
++- return io_getevents(ctx, 0, 0, NULL, timeout);
+++ struct __kernel_timespec ts;
+++
+++ if (timeout)
+++ aio_get_timespec(&ts, timeout);
+++ return aio_getevents(ctx, 0, 0, NULL, timeout ? &ts : NULL);
++ }
++ DEFSYMVER(io_queue_wait_0_4, io_queue_wait, 0.4);
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From ac8645857e35b8ed162d7ad664928c075156664f Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Fri, 1 Mar 2024 01:52:51 +0100
++Subject: [PATCH libaio 22/26] Add time64 public functions on 32-bit
++ architectures
++
++This adds new time64 functions for io_getevents() and io_pgetevents()
++that will get redirected when building with _TIME_BITS=64.
++
++Ideally we should generate the .map file and not include these symbols
++on 64-bit architectures, but this will do for now.
++
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ harness/Makefile | 2 +-
++ src/Makefile | 3 ++-
++ src/compat-0_1.c | 7 +++++++
++ src/io_getevents.c | 7 +++++++
++ src/{io_getevents.c => io_getevents_time64.c} | 14 +++++++-------
++ src/io_pgetevents.c | 7 +++++++
++ ...{io_pgetevents.c => io_pgetevents_time64.c} | 10 ++++++----
++ src/io_queue_wait.c | 7 +++++++
++ src/libaio.h | 18 ++++++++++++++++++
++ src/libaio.map | 6 ++++++
++ 10 files changed, 68 insertions(+), 13 deletions(-)
++ copy src/{io_getevents.c => io_getevents_time64.c} (80%)
++ copy src/{io_pgetevents.c => io_pgetevents_time64.c} (82%)
++
++diff --git a/harness/Makefile b/harness/Makefile
++index ae4e45e..3f97650 100644
++--- a/harness/Makefile
+++++ b/harness/Makefile
++@@ -6,7 +6,7 @@ PROGS:=$(PARTPROGS) $(EXTRAPROGS)
++ HARNESS_SRCS:=main.c
++ # io_queue.c
++
++-MK_CPPFLAGS = -I../src $(CPPFLAGS)
+++MK_CPPFLAGS = -I../src -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 $(CPPFLAGS)
++ CFLAGS ?= -Wall -Werror -g -O2
++ MK_CFLAGS = $(CFLAGS)
++ #-lpthread -lrt
++diff --git a/src/Makefile b/src/Makefile
++index da18e8c..e63e706 100644
++--- a/src/Makefile
+++++ b/src/Makefile
++@@ -2,7 +2,7 @@ prefix ?= /usr
++ includedir ?= $(prefix)/include
++ libdir ?= $(prefix)/lib
++
++-MK_CPPFLAGS = -I. $(CPPFLAGS)
+++MK_CPPFLAGS = -I. -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64 $(CPPFLAGS)
++ CFLAGS ?= -Wall -g -fomit-frame-pointer -O2
++ MK_CFLAGS = -fPIC $(CFLAGS)
++ SO_CFLAGS = -shared $(MK_CFLAGS)
++@@ -30,6 +30,7 @@ libaio_srcs += io_queue_wait.c io_queue_run.c
++ libaio_srcs += aio_pgetevents.c aio_getevents.c
++ libaio_srcs += io_getevents.c io_submit.c io_cancel.c
++ libaio_srcs += io_setup.c io_destroy.c io_pgetevents.c
+++libaio_srcs += io_pgetevents_time64.c io_getevents_time64.c
++
++ # old symbols
++ libaio_srcs += compat-0_1.c
++diff --git a/src/compat-0_1.c b/src/compat-0_1.c
++index 25b789a..61df3b3 100644
++--- a/src/compat-0_1.c
+++++ b/src/compat-0_1.c
++@@ -19,6 +19,13 @@
++ License along with this library; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
+++
+++/*
+++ * On 32-bit systems these were using 32-bit struct timespec, keep these
+++ * backward compatibility functions that way.
+++ */
+++#undef _TIME_BITS
+++
++ #include <stdlib.h>
++ #include <asm/errno.h>
++
++diff --git a/src/io_getevents.c b/src/io_getevents.c
++index c06e803..0b2d448 100644
++--- a/src/io_getevents.c
+++++ b/src/io_getevents.c
++@@ -17,6 +17,13 @@
++ License along with this library; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
+++
+++/*
+++ * On 32-bit systems these were using 32-bit struct timespec, keep this
+++ * backward compatibility function that way.
+++ */
+++#undef _TIME_BITS
+++
++ #include <libaio.h>
++ #include <errno.h>
++ #include <stdlib.h>
++diff --git a/src/io_getevents.c b/src/io_getevents_time64.c
++similarity index 80%
++copy from src/io_getevents.c
++copy to src/io_getevents_time64.c
++index c06e803..942743d 100644
++--- a/src/io_getevents.c
+++++ b/src/io_getevents_time64.c
++@@ -1,4 +1,4 @@
++-/* io_getevents.c
+++/* io_getevents_time64.c
++ libaio Linux async I/O interface
++ Copyright 2002 Red Hat, Inc.
++ Copyright 2024 Guillem Jover <guillem@hadrons.org>
++@@ -24,14 +24,14 @@
++ #include "syscall.h"
++ #include "aio_time.h"
++
++-int io_getevents_0_4(io_context_t ctx, long min_nr, long nr,
+++#if __BITS_PER_LONG == 32
+++int io_getevents_time64(io_context_t ctx, long min_nr, long nr,
++ struct io_event * events, struct timespec * timeout)
++ {
++- struct __kernel_timespec ts;
+++ struct __kernel_timespec kts;
++
++ if (timeout)
++- aio_get_timespec(&ts, timeout);
++- return aio_getevents(ctx, min_nr, nr, events, timeout ? &ts : NULL);
+++ aio_get_timespec(&kts, timeout);
+++ return aio_getevents(ctx, min_nr, nr, events, timeout ? &kts : NULL);
++ }
++-
++-DEFSYMVER(io_getevents_0_4, io_getevents, 0.4);
+++#endif
++diff --git a/src/io_pgetevents.c b/src/io_pgetevents.c
++index d960a05..50b8d1c 100644
++--- a/src/io_pgetevents.c
+++++ b/src/io_pgetevents.c
++@@ -17,6 +17,13 @@
++ License along with this library; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
+++
+++/*
+++ * On 32-bit systems these were using 32-bit struct timespec, keep this
+++ * backward compatibility function that way.
+++ */
+++#undef _TIME_BITS
+++
++ #include <libaio.h>
++ #include <errno.h>
++ #include <stdlib.h>
++diff --git a/src/io_pgetevents.c b/src/io_pgetevents_time64.c
++similarity index 82%
++copy from src/io_pgetevents.c
++copy to src/io_pgetevents_time64.c
++index d960a05..55e4ad1 100644
++--- a/src/io_pgetevents.c
+++++ b/src/io_pgetevents_time64.c
++@@ -24,14 +24,16 @@
++ #include <signal.h>
++ #include "aio_time.h"
++
++-int io_pgetevents(io_context_t ctx, long min_nr, long nr,
+++#if __BITS_PER_LONG == 32
+++int io_pgetevents_time64(io_context_t ctx, long min_nr, long nr,
++ struct io_event *events, struct timespec *timeout,
++ sigset_t *sigmask)
++ {
++- struct __kernel_timespec ts;
+++ struct __kernel_timespec kts;
++
++ if (timeout)
++- aio_get_timespec(&ts, timeout);
++- return aio_pgetevents(ctx, min_nr, nr, events, timeout ? &ts : NULL,
+++ aio_get_timespec(&kts, timeout);
+++ return aio_pgetevents(ctx, min_nr, nr, events, timeout ? &kts : NULL,
++ sigmask);
++ }
+++#endif
++diff --git a/src/io_queue_wait.c b/src/io_queue_wait.c
++index b4bb236..fe89291 100644
++--- a/src/io_queue_wait.c
+++++ b/src/io_queue_wait.c
++@@ -17,6 +17,13 @@
++ License along with this library; if not, write to the Free Software
++ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
++ */
+++
+++/*
+++ * On 32-bit systems these were using 32-bit struct timespec, keep this
+++ * backward compatibility function that way.
+++ */
+++#undef _TIME_BITS
+++
++ #define NO_SYSCALL_ERRNO
++ #include <sys/types.h>
++ #include <libaio.h>
++diff --git a/src/libaio.h b/src/libaio.h
++index 3304bf7..feeee37 100644
++--- a/src/libaio.h
+++++ b/src/libaio.h
++@@ -27,6 +27,7 @@
++ extern "C" {
++ #endif
++
+++#include <linux/types.h>
++ #include <sys/types.h>
++ #include <string.h>
++ #include <signal.h>
++@@ -50,6 +51,12 @@ typedef enum io_iocb_cmd {
++ IO_CMD_PWRITEV = 8,
++ } io_iocb_cmd_t;
++
+++#define LIBAIO_STRING(x) #x
+++
+++#define LIBAIO_REDIRECT(name, proto, alias) name proto __asm__(LIBAIO_ASMNAME(#alias))
+++#define LIBAIO_ASMNAME(cname) LIBAIO_ASMNAME_PREFIX(__USER_LABEL_PREFIX__, cname)
+++#define LIBAIO_ASMNAME_PREFIX(prefix, cname) LIBAIO_STRING(prefix) cname
+++
++ /* little endian, 32 bits */
++ #if defined(__i386__) || \
++ (defined(__x86_64__) && defined(__ILP32__)) || \
++@@ -178,6 +185,17 @@ extern int io_getevents(io_context_t ctx, long min_nr, long nr,
++ extern int io_pgetevents(io_context_t ctx, long min_nr, long nr,
++ struct io_event *events, struct timespec *timeout,
++ sigset_t *sigmask);
+++#if __BITS_PER_LONG == 32 && defined(_TIME_BITS) && _TIME_BITS == 64
+++extern int LIBAIO_REDIRECT(io_getevents, (io_context_t ctx,
+++ long min_nr, long nr,
+++ struct io_event *events, struct timespec *timeout),
+++ io_getevents_time64);
+++extern int LIBAIO_REDIRECT(io_pgetevents, (io_context_t ctx,
+++ long min_nr, long nr,
+++ struct io_event *events, struct timespec *timeout,
+++ sigset_t *sigmask),
+++ io_pgetevents_time64);
+++#endif
++
++
++ static inline void io_set_callback(struct iocb *iocb, io_callback_t cb)
++diff --git a/src/libaio.map b/src/libaio.map
++index ec9d13b..74b2c08 100644
++--- a/src/libaio.map
+++++ b/src/libaio.map
++@@ -25,3 +25,9 @@ LIBAIO_0.5 {
++ global:
++ io_pgetevents;
++ } LIBAIO_0.4;
+++
+++LIBAIO_0.6 {
+++ global:
+++ io_getevents_time64;
+++ io_pgetevents_time64;
+++} LIBAIO_0.5;
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 50d7a07bab2bb6613bebd161c9a7618e815cfa35 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Fri, 16 Aug 2019 02:33:46 +0200
++Subject: [PATCH libaio 23/26] Fix io_pgetevents() syscall wrapper on 32-bit
++ userland on 64-bit kernels
++
++The kernel compat syscall in the kernel got introduced with a broken
++layout, which requires a pointer to the actual sigset_t variable but
++with the size of the running kernel, not the size of the compat code.
++
++This means that when the wrapper sends the expected compat (32-bit)
++pointer, the kernel reads a 64-bit pointer, eating with it also the
++sigset size member. And then proceeds to fail the comparison of the
++sigset_t size and returns EINVAL.
++
++This really needs to be fixed in the kernel, as there's no apparent
++user of the broken compat layout (from codesearch.debian.org, nor a
++quick github.com search). But we have to workaround it in libaio so
++that we can use kernels that have not yet been fixed.
++
++We do that, by trying the non-broken layout (that would be used with
++a 32-bit userland on a 32-bit kernel), and if that fails with -EINVAL
++we retry with a structure padded to what the kernel expects.
++
++Origin: vendor
++Forwarded: not-needed
++Sent-Upstream: rejected
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/aio_pgetevents.c | 30 ++++++++++++++++++++++++++----
++ src/libaio.h | 10 ++++++++++
++ 2 files changed, 36 insertions(+), 4 deletions(-)
++
++diff --git a/src/aio_pgetevents.c b/src/aio_pgetevents.c
++index e12036e..89cec7b 100644
++--- a/src/aio_pgetevents.c
+++++ b/src/aio_pgetevents.c
++@@ -45,10 +45,10 @@ int aio_pgetevents(io_context_t ctx, long min_nr, long nr,
++ {
++ int ret;
++ #if defined(__NR_io_pgetevents) || defined(__NR_io_pgetevents_time64)
++- struct {
++- unsigned long ss;
++- unsigned long ss_len;
++- } aio_sigset;
+++ struct io_sigset aio_sigset;
+++#ifndef __LP64__
+++ struct io_sigset_compat aio_sigset_compat = { 0 };
+++#endif
++ struct sys_timespec sys_ts;
++
++ if (aio_ring_is_empty(ctx, timeout))
++@@ -76,6 +76,28 @@ int aio_pgetevents(io_context_t ctx, long min_nr, long nr,
++
++ ret = __io_pgetevents(ctx, min_nr, nr, events,
++ timeout ? &sys_ts : NULL, &aio_sigset);
+++
+++#ifndef __LP64__
+++ /*
+++ * The compat kernel syscall got introduced with a 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 ? &sys_ts : NULL, &aio_sigset_compat);
+++#endif
++ #else
++ ret = -ENOSYS;
++ #endif
++diff --git a/src/libaio.h b/src/libaio.h
++index feeee37..e99a17b 100644
++--- a/src/libaio.h
+++++ b/src/libaio.h
++@@ -161,6 +161,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
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From bcc3be97d899fceeacf8865a6f82dba9baa7e718 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Tue, 5 Mar 2024 02:01:57 +0100
++Subject: [PATCH libaio 24/26] Disable io_pgetevents_time64 as it is broken on
++ 64-bit kernel 32-bit userland
++
++On 64-bit kernels running 32-bit userland, this syscall misbehaves
++when passing a sigmask by always returning -EINVAL. This works on 32-bit
++kernels. The syscall entry point is possible wrong and needs to be fixed
++in the kernel. For now disable as the code is handling clean 64-bit time_t
++and the timeout is relative anyway.
++
++Once this is fixed in the kernel, and after enough time has passed we
++can decide whether to enable this.
++
++Origin: vendor
++Forwarded: not-needed
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/aio_pgetevents.c | 9 +++++++++
++ 1 file changed, 9 insertions(+)
++
++diff --git a/src/aio_pgetevents.c b/src/aio_pgetevents.c
++index 89cec7b..7f55ead 100644
++--- a/src/aio_pgetevents.c
+++++ b/src/aio_pgetevents.c
++@@ -26,6 +26,15 @@
++ #include "aio_time.h"
++ #include "aio_ring.h"
++
+++/*
+++ * FIXME: On 64-bit kernels running 32-bit userland, this syscall misbehaves
+++ * when passing a sigmask by always returning -EINVAL. This works on 32-bit
+++ * kernels. The syscall entry point is possible wrong and needs to be fixed
+++ * in the kernel. For now disable as the code is handling clean 64-bit time_t
+++ * and the timeout is relative anyway.
+++ */
+++#undef __NR_io_pgetevents_time64
+++
++ #ifdef __NR_io_pgetevents
++ io_syscall6(int, __io_pgetevents, io_pgetevents, io_context_t, ctx,
++ long, min_nr, long, nr, struct io_event *, events,
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 3026b916ce811f64c36e04fcba2c99e308e22e86 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Mon, 4 Mar 2024 13:47:22 +0100
++Subject: [PATCH libaio 25/26] build: Use a temporary SONAME bump to avoid
++ stomping over upstream ABI
++
++We are using a different SONAME in case upstream wants to see a
++different implementation for the newly added symbols. Where we then can
++easily revert to the original SONAME. If upstream takes the symbols as
++is, then we can simply create a compat symlink.
++
++Origin: vendor
++Forwarded: not-needed
++Sent-Upstream: not-relevant
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ src/Makefile | 2 +-
++ 1 file changed, 1 insertion(+), 1 deletion(-)
++
++diff --git a/src/Makefile b/src/Makefile
++index e63e706..9e4fecd 100644
++--- a/src/Makefile
+++++ b/src/Makefile
++@@ -10,7 +10,7 @@ L_CFLAGS = $(MK_CFLAGS)
++ MK_LDFLAGS = $(LDFLAGS)
++ ENABLE_SHARED ?= 1
++
++-soname=libaio.so.1
+++soname=libaio.so.1t64
++ minor=0
++ micro=2
++ libname=$(soname).$(minor).$(micro)
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++From 175f859658d2bab463ed65532fd88a1541ad9912 Mon Sep 17 00:00:00 2001
++From: Guillem Jover <guillem@hadrons.org>
++Date: Tue, 19 Apr 2022 15:45:39 +0200
++Subject: [PATCH libaio 26/26] harness: Disable failing test 23
++
++This new test fails on several architectures. But it is a new test
++intended to check for a Linux kernel regression, so we are not worse
++off than were before. Add it to the EXTRACASES variables, which has
++currently the side effect of disabling it, as it is not handled
++explicitly in the make target responsible for that variable.
++
++This is probably not needed anymore with the off64_t fix in upstream,
++but let's not try to revert this now while the time64 transition is
++ongoing.
++
++Origin: vendor
++Forwarded: not-needed
++Sent-Upstream: not-relevant
++Signed-off-by: Guillem Jover <guillem@hadrons.org>
++---
++ harness/Makefile | 2 +-
++ 1 file changed, 1 insertion(+), 1 deletion(-)
++
++diff --git a/harness/Makefile b/harness/Makefile
++index 3f97650..a96bcfc 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
++--
++2.43.0
++
--- /dev/null
--- /dev/null
++# Upstream changes
++0001-harness-use-off64_t-instead-of-off_t-in-test-23.t-EI.patch
++# Local changes, pending submission
++0002-man-Fix-typos.patch
++0003-build-Update-.gitignore-for-the-harness-artifacts.patch
++0004-build-Fix-DESTDIR-and-pathname-variables-handling.patch
++0005-build-Honor-user-build-flags.patch
++0006-build-Remove-all-test-artifacts-on-clean.patch
++0007-Move-semicolon-to-SYMVER-and-DEFSYMVER-call-sites.patch
++0008-Use-new-symver-function-attribute-to-support-LTO-bui.patch
++0009-Remove-unused-vsys_def.h.patch
++0010-Remove-unused-raw_syscall.c.patch
++0011-Wrap-long-declarations-exceeding-80-columns.patch
++0012-syscall-Fix-ARM-definitions-to-match-exactly-the-ker.patch
++0013-syscall-Fix-ia64-definitions-to-match-exactly-the-ke.patch
++0014-harness-Add-KERNEL_RW_POINTER-for-various-32-bit-arc.patch
++0015-Fix-and-improve-MIPS-support.patch
++0016-Add-PARISC-support.patch
++0017-Add-m68k-support.patch
++0018-Add-SH-support.patch
++0019-Add-x32-support.patch
++0020-Rename-sigset-struct-from-data-to-aio_sigset.patch
++0021-Add-time64-syscall-support.patch
++0022-Add-time64-public-functions-on-32-bit-architectures.patch
++# Local changes, not for upstream
++0023-Fix-io_pgetevents-syscall-wrapper-on-32-bit-userland.patch
++0024-Disable-io_pgetevents_time64-as-it-is-broken-on-64-b.patch
++0025-build-Use-a-temporary-SONAME-bump-to-avoid-stomping-.patch
++0026-harness-Disable-failing-test-23.patch
++0001-harness-Hardcode-list-of-ports-that-cannot-check-PRO.patch
--- /dev/null
--- /dev/null
++#!/usr/bin/make -f
++
++# Uncomment this to turn on verbose mode.
++#export DH_VERBOSE = 1
++
++export DEB_BUILD_MAINT_OPTIONS = hardening=+all abi=+lfs
++export DEB_CFLAGS_MAINT_PREPEND = -Wall
++
++include /usr/share/dpkg/default.mk
++include /usr/share/dpkg/buildtools.mk
++
++# The following architectures still fail the test suite:
++# m68k
++# (emulated, no proper test results)
++# sh4
++# (emulated, no proper test results)
++# sparc64
++# (19: mremap EINVAL)
++# hppa
++# (19: mremap EINVAL)
++# (17: looping, timeout?)
++ifneq (,$(filter $(DEB_HOST_ARCH),m68k sh4 sparc64 hppa))
++ TESTS_FLAKY = yes
++endif
++
++export CC
++
++%:
++ dh $@
++
++override_dh_auto_test:
++ifeq ($(TESTS_FLAKY),yes)
++ @echo "Notice: Running tests in flaky mode, errors will be ignored."
++endif
++ $(if $(TESTS_FLAKY),-)$(MAKE) partcheck \
++ CPPFLAGS="$(CPPFLAGS)" \
++ CFLAGS="$(CFLAGS)" \
++ LDFLAGS="$(LDFLAGS)" \
++ # EOC
++
++override_dh_auto_install:
++ dh_auto_install -- \
++ libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
++ # EOC
++
++override_dh_installchangelogs:
++ dh_installchangelogs --no-trim
++
++override_dh_makeshlibs:
++ # XXX: Ideally we'd also rename the udeb, but d-i does not really
++ # care about file conflicts, and that would take us through NEW
++ # in the middle of the time64 transition.
++ dh_makeshlibs --add-udeb=libaio1-udeb
--- /dev/null
--- /dev/null
++3.0 (quilt)
--- /dev/null
--- /dev/null
++# Upstream does not sign releases.
++libaio: debian-watch-does-not-check-openpgp-signature [debian/watch]
--- /dev/null
--- /dev/null
++Tests:
++ test-unit
++Restrictions:
++ flaky
++ rw-build-tree
++Depends:
++ build-essential,
++ libaio-dev,
++
++Tests:
++ test-unit-root
++Restrictions:
++ flaky
++ rw-build-tree
++ needs-root
++Depends:
++ build-essential,
++ libaio-dev,
--- /dev/null
--- /dev/null
++#!/bin/sh
++
++set -e
++exec 2>&1
++set -u
++set -x
++
++if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
++ CC="$DEB_HOST_GNU_TYPE-gcc"
++else
++ CC=gcc
++fi
++
++make partcheck CC="$CC" LIBAIO=-laio
--- /dev/null
--- /dev/null
++#!/bin/sh
++
++set -e
++exec 2>&1
++set -u
++set -x
++
++if [ -n "${DEB_HOST_GNU_TYPE:-}" ]; then
++ CC="$DEB_HOST_GNU_TYPE-gcc"
++else
++ CC=gcc
++fi
++
++make check CC="$CC" LIBAIO=-laio
--- /dev/null
--- /dev/null
++Repository: https://pagure.io/libaio.git
++Repository-Browse: https://pagure.io/libaio
++Bug-Database: https://pagure.io/libaio/issues
++Bug-Submit: https://pagure.io/libaio/new_issue
--- /dev/null
--- /dev/null
++Version: 5
++
++Source: https://releases.pagure.org/libaio/
++Matching-Pattern: libaio-([\d\.]+)\.tar\.(?:gz|xz)
++Update-Script: uupdate