code:
diff -urdN kmod-29.orig/Makefile.am kmod-29/Makefile.am
--- kmod-29.orig/Makefile.am	2021-05-21 00:37:20.553782500 +0200
+++ kmod-29/Makefile.am	2022-02-27 13:55:12.910447392 +0100
@@ -19,7 +19,7 @@
 	-include $(top_builddir)/config.h \
 	-I$(top_srcdir) \
 	-DSYSCONFDIR=\""$(sysconfdir)"\" \
-	${zlib_CFLAGS}
+	${lzlib_CFLAGS} ${zlib_CFLAGS}

 AM_CFLAGS = $(OUR_CFLAGS)
 AM_LDFLAGS = $(OUR_LDFLAGS)
@@ -35,6 +35,8 @@
 	-e 's,@libzstd_LIBS\@,${libzstd_LIBS},g' \
 	-e 's,@liblzma_CFLAGS\@,${liblzma_CFLAGS},g' \
 	-e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
+	-e 's,@lzlib_CFLAGS\@,${lzlib_CFLAGS},g' \
+	-e 's,@lzlib_LIBS\@,${lzlib_LIBS},g' \
 	-e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
 	-e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
 	-e 's,@libcrypto_CFLAGS\@,${libcrypto_CFLAGS},g' \
@@ -105,7 +107,7 @@
 	${top_srcdir}/libkmod/libkmod.sym
 libkmod_libkmod_la_LIBADD = \
 	shared/libshared.la \
-	${libzstd_LIBS} ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
+	${libzstd_LIBS} ${liblzma_LIBS} ${lzlib_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}

 noinst_LTLIBRARIES += libkmod/libkmod-internal.la
 libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
diff -urdN kmod-29.orig/Makefile.in kmod-29/Makefile.in
--- kmod-29.orig/Makefile.in	2021-05-21 01:02:52.645592794 +0200
+++ kmod-29/Makefile.in	2022-02-27 13:55:12.920445685 +0100
@@ -910,6 +910,8 @@
 libzstd_LIBS = @libzstd_LIBS@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lzlib_CFLAGS = @lzlib_CFLAGS@
+lzlib_LIBS = @lzlib_LIBS@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
@@ -981,7 +983,7 @@
 	-include $(top_builddir)/config.h \
 	-I$(top_srcdir) \
 	-DSYSCONFDIR=\""$(sysconfdir)"\" \
-	${zlib_CFLAGS}
+	${lzlib_CFLAGS} ${zlib_CFLAGS}

 AM_CFLAGS = $(OUR_CFLAGS)
 AM_LDFLAGS = $(OUR_LDFLAGS)
@@ -996,6 +998,8 @@
 	-e 's,@libzstd_LIBS\@,${libzstd_LIBS},g' \
 	-e 's,@liblzma_CFLAGS\@,${liblzma_CFLAGS},g' \
 	-e 's,@liblzma_LIBS\@,${liblzma_LIBS},g' \
+	-e 's,@lzlib_CFLAGS\@,${lzlib_CFLAGS},g' \
+	-e 's,@lzlib_LIBS\@,${lzlib_LIBS},g' \
 	-e 's,@zlib_CFLAGS\@,${zlib_CFLAGS},g' \
 	-e 's,@zlib_LIBS\@,${zlib_LIBS},g' \
 	-e 's,@libcrypto_CFLAGS\@,${libcrypto_CFLAGS},g' \
@@ -1060,7 +1064,7 @@

 libkmod_libkmod_la_LIBADD = \
 	shared/libshared.la \
-	${libzstd_LIBS} ${liblzma_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}
+	${libzstd_LIBS} ${liblzma_LIBS} ${lzlib_LIBS} ${zlib_LIBS} ${libcrypto_LIBS}

 libkmod_libkmod_internal_la_SOURCES = $(libkmod_libkmod_la_SOURCES)
 libkmod_libkmod_internal_la_LDFLAGS = $(AM_LDFLAGS) \
diff -urdN kmod-29.orig/README kmod-29/README
--- kmod-29.orig/README	2021-01-21 03:49:19.913366600 +0100
+++ kmod-29/README	2022-02-27 13:55:12.920445685 +0100
@@ -47,6 +47,7 @@

 Optional dependencies:
 	- ZLIB library
+	- LZLIB library
 	- LZMA library

 Typical configuration:
diff -urdN kmod-29.orig/config.h.in kmod-29/config.h.in
--- kmod-29.orig/config.h.in	2021-05-21 01:03:51.174335845 +0200
+++ kmod-29/config.h.in	2022-02-27 13:55:12.920445685 +0100
@@ -15,6 +15,9 @@
 /* Enable Xz for modules. */
 #undef ENABLE_XZ

+/* Enable lzlib for modules. */
+#undef ENABLE_LZLIB
+
 /* Enable zlib for modules. */
 #undef ENABLE_ZLIB

diff -urdN kmod-29.orig/configure.ac kmod-29/configure.ac
--- kmod-29.orig/configure.ac	2021-05-21 00:37:39.438647859 +0200
+++ kmod-29/configure.ac	2022-02-27 13:55:12.920445685 +0100
@@ -105,6 +105,17 @@
 ])
 CC_FEATURE_APPEND([with_features], [with_xz], [XZ])

+AC_ARG_WITH([lzlib],
+	AS_HELP_STRING([--with-lzlib], [handle lzipped modules @<:@default=disabled@:>@]),
+	[], [with_lzlib=no])
+AS_IF([test "x$with_lzlib" != "xno"], [
+	PKG_CHECK_MODULES([lzlib], [lzlib])
+	AC_DEFINE([ENABLE_LZLIB], [1], [Enable lzlib for modules.])
+], [
+	AC_MSG_NOTICE([lzlib support not requested])
+])
+CC_FEATURE_APPEND([with_features], [with_lzlib], [LZLIB])
+
 AC_ARG_WITH([zlib],
 	AS_HELP_STRING([--with-zlib], [handle gzipped modules @<:@default=disabled@:>@]),
 	[], [with_zlib=no])
@@ -320,7 +331,7 @@
 	tools:			${enable_tools}
 	python bindings:	${enable_python}
 	logging:		${enable_logging}
-	compression:		zstd=${with_zstd}  xz=${with_xz}  zlib=${with_zlib}
+	compression:		zstd=${with_zstd}  xz=${with_xz}  lzlib=${with_lzlib}  zlib=${with_zlib}
 	debug:			${enable_debug}
 	coverage:		${enable_coverage}
 	doc:			${enable_gtk_doc}
diff -urdN kmod-29.orig/configure kmod-29/configure
--- kmod-29.orig/configure	2021-05-21 01:02:52.949057874 +0200
+++ kmod-29/configure	2022-02-27 19:34:02.380431023 +0100
@@ -701,6 +701,8 @@
 libcrypto_CFLAGS
 zlib_LIBS
 zlib_CFLAGS
+lzlib_LIBS
+lzlib_CFLAGS
 liblzma_LIBS
 liblzma_CFLAGS
 libzstd_LIBS
@@ -845,6 +847,7 @@
 with_rootlibdir
 with_zstd
 with_xz
+with_lzlib
 with_zlib
 with_openssl
 with_bashcompletiondir
@@ -873,6 +876,8 @@
 libzstd_LIBS
 liblzma_CFLAGS
 liblzma_LIBS
+lzlib_CFLAGS
+lzlib_LIBS
 zlib_CFLAGS
 zlib_LIBS
 libcrypto_CFLAGS
@@ -1550,6 +1555,7 @@
   --with-zstd             handle Zstandard-compressed modules
                           [default=disabled]
   --with-xz               handle Xz-compressed modules [default=disabled]
+  --with-lzlib            handle lzipped modules [default=disabled]
   --with-zlib             handle gzipped modules [default=disabled]
   --with-openssl          handle PKCS7 signatures [default=disabled]
   --with-bashcompletiondir=DIR
@@ -1578,6 +1584,9 @@
               C compiler flags for liblzma, overriding pkg-config
   liblzma_LIBS
               linker flags for liblzma, overriding pkg-config
+  lzlib_CFLAGS
+              C compiler flags for lzlib, overriding pkg-config
+  lzlib_LIBS  linker flags for lzlib, overriding pkg-config
   zlib_CFLAGS C compiler flags for zlib, overriding pkg-config
   zlib_LIBS   linker flags for zlib, overriding pkg-config
   libcrypto_CFLAGS
@@ -14174,6 +14183,146 @@

+# Check whether --with-lzlib was given.
+if test ${with_lzlib+y}
+then :
+  withval=$with_lzlib;
+else $as_nop
+  with_lzlib=no
+fi
+
+if test "x$with_lzlib" != "xno"
+then :
+
+
+pkg_failed=no
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for lzlib" >&5
+printf %s "checking for lzlib... " >&6; }
+
+if test -n "$lzlib_CFLAGS"; then
+    pkg_cv_lzlib_CFLAGS="$lzlib_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lzlib\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "lzlib") 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_lzlib_CFLAGS=`$PKG_CONFIG --cflags "lzlib" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+if test -n "$lzlib_LIBS"; then
+    pkg_cv_lzlib_LIBS="$lzlib_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+    if test -n "$PKG_CONFIG" && \
+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"lzlib\""; } >&5
+  ($PKG_CONFIG --exists --print-errors "lzlib") 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; }; then
+  pkg_cv_lzlib_LIBS=`$PKG_CONFIG --libs "lzlib" 2>/dev/null`
+		      test "x$?" != "x0" && pkg_failed=yes
+else
+  pkg_failed=yes
+fi
+ else
+    pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+   	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+        _pkg_short_errors_supported=yes
+else
+        _pkg_short_errors_supported=no
+fi
+        if test $_pkg_short_errors_supported = yes; then
+	        lzlib_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "lzlib" 2>&1`
+        else
+	        lzlib_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "lzlib" 2>&1`
+        fi
+	# Put the nasty error message in config.log where it belongs
+	echo "$lzlib_PKG_ERRORS" >&5
+
+	as_fn_error $? "Package requirements (lzlib) were not met:
+
+$lzlib_PKG_ERRORS
+
+Consider adjusting the PKG_CONFIG_PATH environment variable if you
+installed software in a non-standard prefix.
+
+Alternatively, you may set the environment variables lzlib_CFLAGS
+and lzlib_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details." "$LINENO" 5
+elif test $pkg_failed = untried; then
+     	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+	{ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "The pkg-config script could not be found or is too old.  Make sure it
+is in your PATH or set the PKG_CONFIG environment variable to the full
+path to pkg-config.
+
+Alternatively, you may set the environment variables lzlib_CFLAGS
+and lzlib_LIBS to avoid the need to call pkg-config.
+See the pkg-config man page for more details.
+
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.
+See \`config.log' for more details" "$LINENO" 5; }
+else
+	lzlib_CFLAGS=$pkg_cv_lzlib_CFLAGS
+	lzlib_LIBS=$pkg_cv_lzlib_LIBS
+        { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+printf "%s\n" "yes" >&6; }
+
+fi
+
+printf "%s\n" "#define ENABLE_LZLIB 1" >>confdefs.h
+
+
+else $as_nop
+
+	{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: lzlib support not requested" >&5
+printf "%s\n" "$as_me: lzlib support not requested" >&6;}
+
+fi
+
+
+  case " $with_features "  in #(
+  *" LZLIB "*) :
+    { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: : with_features already contains LZLIB"; } >&5
+  (: with_features already contains LZLIB) 2>&5
+  ac_status=$?
+  printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+  test $ac_status = 0; } ;; #(
+  *) :
+
+	    if test "x$with_features" != "x"
+then :
+  as_fn_append with_features " "
+fi
+            if test "x$with_lzlib" = "xyes"
+then :
+  as_fn_append with_features "+LZLIB"
+else $as_nop
+  as_fn_append with_features "-LZLIB"
+fi
+
+   ;;
+esac
+
+
+
+
 # Check whether --with-zlib was given.
 if test ${with_zlib+y}
 then :
@@ -17743,7 +17892,7 @@
 	tools:			${enable_tools}
 	python bindings:	${enable_python}
 	logging:		${enable_logging}
-	compression:		zstd=${with_zstd}  xz=${with_xz}  zlib=${with_zlib}
+	compression:		zstd=${with_zstd}  xz=${with_xz}  lzlib=${with_lzlib}  zlib=${with_zlib}
 	debug:			${enable_debug}
 	coverage:		${enable_coverage}
 	doc:			${enable_gtk_doc}
@@ -17772,7 +17921,7 @@
 	tools:			${enable_tools}
 	python bindings:	${enable_python}
 	logging:		${enable_logging}
-	compression:		zstd=${with_zstd}  xz=${with_xz}  zlib=${with_zlib}
+	compression:		zstd=${with_zstd}  xz=${with_xz}  lzlib=${with_lzlib}  zlib=${with_zlib}
 	debug:			${enable_debug}
 	coverage:		${enable_coverage}
 	doc:			${enable_gtk_doc}
diff -urdN kmod-29.orig/libkmod/docs/Makefile.in kmod-29/libkmod/docs/Makefile.in
--- kmod-29.orig/libkmod/docs/Makefile.in	2021-05-21 01:02:52.655597137 +0200
+++ kmod-29/libkmod/docs/Makefile.in	2022-02-27 13:55:12.920445685 +0100
@@ -248,6 +248,8 @@
 libzstd_LIBS = @libzstd_LIBS@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lzlib_CFLAGS = @lzlib_CFLAGS@
+lzlib_LIBS = @lzlib_LIBS@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
diff -urdN kmod-29.orig/libkmod/libkmod-file.c kmod-29/libkmod/libkmod-file.c
--- kmod-29.orig/libkmod/libkmod-file.c	2020-09-11 06:55:01.331987063 +0200
+++ kmod-29/libkmod/libkmod-file.c	2022-02-27 13:55:12.920445685 +0100
@@ -37,6 +37,9 @@
 #endif

 #include <shared/util.h>
+#ifdef ENABLE_LZLIB
+#include <lzlib.h>
+#endif

 #include "libkmod.h"
 #include "libkmod-internal.h"
@@ -54,6 +57,9 @@
 #ifdef ENABLE_XZ
 	bool xz_used;
 #endif
+#ifdef ENABLE_LZLIB
+	bool lz_used;
+#endif
 #ifdef ENABLE_ZLIB
 	gzFile gzf;
 #endif
@@ -310,6 +316,88 @@
 static const char magic_xz[] = {0xfd, '7', 'z', 'X', 'Z', 0};
 #endif

+#ifdef ENABLE_LZLIB
+#ifndef min
+  #define min(x,y) ((x) <= (y) ? (x) : (y))
+#endif
+
+static int load_lzlib(struct kmod_file *file)
+{
+	uint8_t in_buf[16384];
+	int err = 0;
+	off_t did = 0, total = 0;
+	_cleanup_free_ unsigned char *p = NULL;
+
+	struct LZ_Decoder *lzd = LZ_decompress_open();
+	if (!lzd || LZ_decompress_errno( lzd ) != LZ_ok)
+		{ LZ_decompress_close(lzd); return -ENOMEM; }
+
+	for (;;) {
+		int rd;
+		const int size = min(LZ_decompress_write_size(lzd),
+				     (int)sizeof in_buf);
+
+		if (did == total) {
+			const int realloc_step = 4 * 1024 * 1024;
+			void *tmp = realloc(p, total + realloc_step);
+			if (tmp == NULL) {
+				err = -ENOMEM;
+				goto error;
+			}
+			total += realloc_step;
+			p = tmp;
+		}
+
+		if (size > 0) {
+			rd = read(file->fd, in_buf, size);
+			if (rd < 0) {
+				err = -errno;
+				goto error;
+			}
+			if (rd == 0)
+				LZ_decompress_finish(lzd);
+			else if (LZ_decompress_write(lzd, in_buf, rd) != rd) {
+				err = -EINVAL;
+				goto error;
+			}
+		}
+		rd = LZ_decompress_read(lzd, p + did, total - did);
+		if (rd < 0) {
+			const char *lz_errmsg =
+				LZ_strerror(LZ_decompress_errno(lzd));
+
+			ERR(file->ctx, "lzip: %s\n", lz_errmsg);
+			err = -EINVAL;
+			goto error;
+		}
+		did += rd;
+		if (LZ_decompress_finished(lzd) == 1)
+			break;
+	}
+
+	if (LZ_decompress_close(lzd) < 0)
+		return -EINVAL;
+	file->lz_used = true;
+	file->memory = p;
+	file->size = did;
+	p = NULL;
+	return 0;
+
+error:
+	LZ_decompress_close(lzd);
+	return err;
+}
+
+static void unload_lzlib(struct kmod_file *file)
+{
+	if (!file->lz_used)
+		return;
+	free(file->memory);
+}
+
+static const char magic_lzlib[] = { 0x4C, 0x5A, 0x49, 0x50 }; /* "LZIP" */
+#endif
+
 #ifdef ENABLE_ZLIB
 #define READ_STEP (4 * 1024 * 1024)
 static int load_zlib(struct kmod_file *file)
@@ -385,6 +473,9 @@
 #ifdef ENABLE_XZ
 	{sizeof(magic_xz), magic_xz, {load_xz, unload_xz}},
 #endif
+#ifdef ENABLE_LZLIB
+	{sizeof(magic_lzlib), magic_lzlib, {load_lzlib, unload_lzlib}},
+#endif
 #ifdef ENABLE_ZLIB
 	{sizeof(magic_zlib), magic_zlib, {load_zlib, unload_zlib}},
 #endif
diff -urdN kmod-29.orig/libkmod/libkmod.pc.in kmod-29/libkmod/libkmod.pc.in
--- kmod-29.orig/libkmod/libkmod.pc.in	2020-09-11 06:55:01.331987063 +0200
+++ kmod-29/libkmod/libkmod.pc.in	2022-02-27 13:55:12.920445685 +0100
@@ -7,5 +7,5 @@
 Description: Library to deal with kernel modules
 Version: @VERSION@
 Libs: -L${libdir} -lkmod
-Libs.private: @libzstd_LIBS@ @liblzma_LIBS@ @zlib_LIBS@
+Libs.private: @libzstd_LIBS@ @liblzma_LIBS@ @lzlib_LIBS@ @zlib_LIBS@
 Cflags: -I${includedir}
diff -urdN kmod-29.orig/man/Makefile.in kmod-29/man/Makefile.in
--- kmod-29.orig/man/Makefile.in	2021-05-21 01:02:52.665601480 +0200
+++ kmod-29/man/Makefile.in	2022-02-27 13:55:12.920445685 +0100
@@ -278,6 +278,8 @@
 libzstd_LIBS = @libzstd_LIBS@
 localedir = @localedir@
 localstatedir = @localstatedir@
+lzlib_CFLAGS = @lzlib_CFLAGS@
+lzlib_LIBS = @lzlib_LIBS@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
 oldincludedir = @oldincludedir@
diff -urdN kmod-29.orig/shared/util.c kmod-29/shared/util.c
--- kmod-29.orig/shared/util.c	2020-09-11 06:55:01.331987063 +0200
+++ kmod-29/shared/util.c	2022-02-27 13:55:12.920445685 +0100
@@ -43,6 +43,9 @@
 #ifdef ENABLE_ZLIB
 	{".ko.gz", sizeof(".ko.gz") - 1},
 #endif
+#ifdef ENABLE_LZLIB
+	{".ko.lz", sizeof(".ko.lz") - 1},
+#endif
 #ifdef ENABLE_XZ
 	{".ko.xz", sizeof(".ko.xz") - 1},
 #endif
diff -urdN kmod-29.orig/testsuite/test-util.c kmod-29/testsuite/test-util.c
--- kmod-29.orig/testsuite/test-util.c	2020-09-11 06:55:01.331987063 +0200
+++ kmod-29/testsuite/test-util.c	2022-02-27 13:55:12.920445685 +0100
@@ -154,6 +154,9 @@
 #ifdef ENABLE_ZLIB
 		{ "/bla.ko.gz", true },
 #endif
+#ifdef ENABLE_LZLIB
+		{ "/bla.ko.lz", true },
+#endif
 #ifdef ENABLE_XZ
 		{ "/bla.ko.xz", true },
 #endif


code:
From 70bed6aad97ad28d3bfc6dc8bf3c8f9aed77282b 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] 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.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
---
 src/io_pgetevents.c | 38 +++++++++++++++++++++++++++++++-------
 src/libaio.h        | 10 ++++++++++
 2 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/src/io_pgetevents.c b/src/io_pgetevents.c
index e6b0614..b2515f2 100644
--- a/src/io_pgetevents.c
+++ b/src/io_pgetevents.c
@@ -33,17 +33,41 @@ int io_pgetevents(io_context_t ctx, long min_nr, long nr,
 		struct io_event *events, struct timespec *timeout,
 		sigset_t *sigmask)
 {
-	struct {
-		unsigned long ss;
-		unsigned long ss_len;
-	} data;
+	struct io_sigset aio_sigset;
+#ifndef __LP64__
+	struct io_sigset_compat aio_sigset_compat = { 0 };
+#endif
+	int ret;

 	if (aio_ring_is_empty(ctx, timeout))
 		return 0;

-	data.ss = (unsigned long)sigmask;
-	data.ss_len = _NSIG / 8;
-	return __io_pgetevents(ctx, min_nr, nr, events, timeout, &data);
+	aio_sigset.ss = (unsigned long)sigmask;
+	aio_sigset.ss_len = _NSIG / 8;
+	ret = __io_pgetevents(ctx, min_nr, nr, events, timeout, &aio_sigset);
+
+#ifndef __LP64__
+	/*
+	 * The compat kernel syscall got introduced with an broken layout for
+	 * its sigset argument, expecting it to contain a pointer for the
+	 * non-compat pointer size.
+	 *
+	 * To cope with this on unfixed kernels, in case we are built as a
+	 * 32-bit library (which could run on a kernel with compat code) and
+	 * when the syscall returns EINVAL due to the kernel not finding the
+	 * sigset size member when unpacking the structure, we retry with
+	 * the fixed up compat layout, which requires the padding to be
+	 * zero-filled, otherwise the 64-bit pointer will contain garbage.
+	 */
+	if (ret != -EINVAL)
+		return ret;
+
+	aio_sigset_compat.ss = (unsigned long)sigmask;
+	aio_sigset_compat.ss_len = _NSIG / 8;
+	ret = __io_pgetevents(ctx, min_nr, nr, events, timeout, &aio_sigset_compat);
+#endif
+
+	return ret;
 }
 #else
 int io_pgetevents(io_context_t ctx, long min_nr, long nr,
diff --git a/src/libaio.h b/src/libaio.h
index ce3aad1..36ab9bc 100644
--- a/src/libaio.h
+++ b/src/libaio.h
@@ -152,6 +152,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.26.0.292.g33ef6b2f38

repo_name: dustdfg/dragora

license: mit


code:
From cb1a595e89837b342a8cfd1ace73537c9563fedb 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 01/11] 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.26.0.292.g33ef6b2f38


code:
From e458ea6bf9526543c206fa4142ed5ef1c77530a6 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 02/11] 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.26.0.292.g33ef6b2f38


code:
From 9e87b37ec648e69f641dd83c7909a337dbd15728 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 03/11] 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.26.0.292.g33ef6b2f38


code:
From f9c8695989fea731c93d99c684482df5744b385c 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 04/11] 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 8b33382..26b07f9 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(__riscv) && __riscv_xlen == 32) || \
     (defined(__GNUC__) && defined(__BYTE_ORDER__) && \
          __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ && __SIZEOF_LONG__ == 4)
@@ -62,6 +64,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(__riscv) && __riscv_xlen == 64) || \
       (defined(__GNUC__) && defined(__BYTE_ORDER__) && \
@@ -73,6 +76,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 b53da4c..db78e28 100644
--- a/src/syscall.h
+++ b/src/syscall.h
@@ -27,6 +27,8 @@
 #include "syscall-arm.h"
 #elif defined(__sparc__)
 #include "syscall-sparc.h"
+#elif defined(__mips__)
+#include "syscall-mips.h"
 #elif defined(__aarch64__) || defined(__riscv)
 #include "syscall-generic.h"
 #else
--
2.26.0.292.g33ef6b2f38


code:
From 1f01c77ff58df16b75d666a4737d80a09ba61b92 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 05/11] 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 26b07f9..29005d0 100644
--- a/src/libaio.h
+++ b/src/libaio.h
@@ -75,6 +75,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 db78e28..61c18c6 100644
--- a/src/syscall.h
+++ b/src/syscall.h
@@ -27,6 +27,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(__riscv)
--
2.26.0.292.g33ef6b2f38


code:
From 7791885da4e72ecbd9dd5c27be53b876f3630e9a 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 06/11] 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 61c18c6..a88876f 100644
--- a/src/syscall.h
+++ b/src/syscall.h
@@ -27,6 +27,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.26.0.292.g33ef6b2f38


code:
From 29782e82f83ed000edecc56ac77285864ec2672b 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 07/11] 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 29005d0..c748454 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(__riscv) && __riscv_xlen == 32) || \
@@ -88,6 +88,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 a88876f..b86d745 100644
--- a/src/syscall.h
+++ b/src/syscall.h
@@ -33,6 +33,8 @@
 #include "syscall-parisc.h"
 #elif defined(__mips__)
 #include "syscall-mips.h"
+#elif defined(__sh__)
+#include "syscall-sh.h"
 #elif defined(__aarch64__) || defined(__riscv)
 #include "syscall-generic.h"
 #else
--
2.26.0.292.g33ef6b2f38


code:
From 15e2be45860c5f7bac4beed0551ec8257e863d7e 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 08/11] 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 c748454..9695a53 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.26.0.292.g33ef6b2f38


code:
From d4ec369c6457cca55db5297701ddd5d9d3ff5ae0 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 09/11] build: Fix DESTDIR 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.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
---
 Makefile     |  8 +++++++-
 src/Makefile | 11 ++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/Makefile b/Makefile
index c1fb831..e48b520 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,7 @@ VERSION=$(shell awk '/Version:/ { print $$2 }' $(SPECFILE))
 TAG = $(NAME)-$(VERSION)
 RPMBUILD=$(shell `which rpmbuild >&/dev/null` && echo "rpmbuild" || echo "rpm")

+DESTDIR=
 prefix=/usr
 includedir=$(prefix)/include
 libdir=$(prefix)/lib
@@ -14,7 +15,12 @@ all:
 	@$(MAKE) -C src

 install:
-	@$(MAKE) -C src install prefix=$(DESTDIR)$(prefix) includedir=$(DESTDIR)$(includedir) libdir=$(DESTDIR)$(libdir)
+	@$(MAKE) -C src install \
+	  DESTDIR=$(DESTDIR) \
+	  prefix=$(prefix) \
+	  includedir=$(includedir) \
+	  libdir=$(libdir) \
+	  $(nil)

 check:
 	@$(MAKE) -C harness check
diff --git a/src/Makefile b/src/Makefile
index 37ae219..a53c43c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,3 +1,4 @@
+DESTDIR=
 prefix=/usr
 includedir=$(prefix)/include
 libdir=$(prefix)/lib
@@ -58,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.26.0.292.g33ef6b2f38


code:
From 4246fcf2c0c1c6518a5689c8a0ee2662f67c4030 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Sun, 12 Apr 2020 04:00:03 +0200
Subject: [PATCH libaio 10/11] build: Do not use -Werror by default

Using -Werror on a released project is in general not a good idea, as
changes in the toolchain and environment can trigger unexpected build
failures.

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 5cc2b25..84e03a6 100644
--- a/harness/Makefile
+++ b/harness/Makefile
@@ -6,7 +6,7 @@ PROGS:=$(PARTPROGS) $(EXTRAPROGS)
 HARNESS_SRCS:=main.c
 # io_queue.c

-CFLAGS+=-Wall -Werror -I../src -g -O2
+CFLAGS+=-Wall -I../src -g -O2
 #-lpthread -lrt

 # Change this on the build line to run tests against the installed libraries:
--
2.26.0.292.g33ef6b2f38


code:
From b8f802cee62430d4951990f578bcd27eba27476e 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 11/11] build: Honour user build flags

CPPFLAGS, CFLAGS and LDFLAGS are user flags, which we need to preserve.
Any required flag that the build system needs, has to be set in some
other flag so that the build will succeed even if the user flags are
passed.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
---
 harness/Makefile |  7 +++++--
 src/Makefile     | 18 +++++++++---------
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/harness/Makefile b/harness/Makefile
index 84e03a6..42aa49a 100644
--- a/harness/Makefile
+++ b/harness/Makefile
@@ -6,8 +6,11 @@ PROGS:=$(PARTPROGS) $(EXTRAPROGS)
 HARNESS_SRCS:=main.c
 # io_queue.c

-CFLAGS+=-Wall -I../src -g -O2
+MK_CPPFLAGS := -I../src $(CPPFLAGS)
+CFLAGS = -Wall -g -O2
 #-lpthread -lrt
+MK_CFLAGS = $(CFLAGS)
+MK_LDFLAGS = main.c $(LIBAIO) -lpthread $(LDFLAGS)

 # Change this on the build line to run tests against the installed libraries:
 # make LIBAIO=-laio partcheck
@@ -16,7 +19,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 a53c43c..f6215f9 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,12 +3,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.
+MK_CFLAGS = -fPIC $(CFLAGS)
+CFLAGS = -Wall -g -fomit-frame-pointer -O2
+SO_CFLAGS = -shared $(MK_CFLAGS)
+L_CFLAGS = $(MK_CFLAGS)
+MK_LDFLAGS = $(LDFLAGS)
 ENABLE_SHARED ?= 1

 soname=libaio.so.1
@@ -43,10 +43,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
@@ -56,7 +56,7 @@ libaio.a: $(libaio_objs)
 	$(RANLIB) libaio.a

 $(libname): $(libaio_sobjs) libaio.map
-	$(CC) $(SO_CFLAGS) -Wl,--version-script=libaio.map -Wl,-soname=$(soname) -o $@ $(libaio_sobjs) $(LINK_FLAGS)
+	$(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.26.0.292.g33ef6b2f38


code:
From 672eaebd131c789a528e3a9cd089b4b69a82012b Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Fri, 28 Sep 2018 13:15:54 +0300
Subject: [PATCH libaio] Link against libgcc to avoid unresolved symbols

We need to link agaisnt -lgcc, on at least hppa, PPC and ARC.
That's because in some corner-cases like compilation with -Os
on ARC and PPC so-called millicode (basically function prologue and
epilogue) implemented in libgcc.a is used. So we end up with
GLOBAL UNDEFINED symbol in libaio.so and then on linkage of the final
applicaiton LD fails to proceed saying:
--------------------------->8----------------------
hidden symbol '__ld_r13_to_r15_ret' in .../libgcc.a(_millicodethunk_ret.o) is referenced by DSO
--------------------------->8----------------------

Also it looks like in general it is not the best idea to use either
"-nostartfiles" or "-nostdlib" when linking shared libs because
default construtor/destructor functions won't be executed, see
"5.2. Library constructor and destructor functions" in [1]

So let's stop passing "-nostdlib" and "-nostartfiles" and get required
stuff built-in libaio.

Initial patch taken from Debian [2].

Fixes build failures in Buildroot like blktrace [3], lvm2 [4].

[1] http://tldp.org/HOWTO/Program-Library-HOWTO/miscellaneous.html
[2] https://sources.debian.org/patches/libaio/0.3.111-1/01_link_libs.patch/
[3] http://autobuild.buildroot.net/results/17461209755038a30118d76acb4f43469a22a139/
[4] http://autobuild.buildroot.net/results/a5dfc87f94b97135e5cc84f6a876114891ed9dd9/

Signed-off-by: Guillem Jover <guillem@debian.org>
Signed-off-by: Alexey Brodkin <abrodkin@synopsys.com>
---
 src/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/Makefile b/src/Makefile
index eadb336..5911c81 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,7 +3,7 @@ includedir=$(prefix)/include
 libdir=$(prefix)/lib

 CFLAGS ?= -g -fomit-frame-pointer -O2
-CFLAGS += -nostdlib -nostartfiles -Wall -I. -fPIC
+CFLAGS += -Wall -I. -fPIC
 SO_CFLAGS=-shared $(CFLAGS)
 L_CFLAGS=$(CFLAGS)
 LINK_FLAGS=
--
2.23.0.rc1.170.gbd704faa3e


code:
From 6507d3f7a2b1985a33d06f280b9388aa34054889 Mon Sep 17 00:00:00 2001
From: Jeff Moyer <jmoyer@redhat.com>
Date: Mon, 29 Jul 2019 10:07:23 -0400
Subject: [PATCH libaio 01/28] harness: allow running tests against the
 installed library

A user can now specify "LIBAIO=/path/to/libaio.so" in order to run
the test harness against the installed library.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 harness/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/harness/Makefile b/harness/Makefile
index f477737..87b33f6 100644
--- a/harness/Makefile
+++ b/harness/Makefile
@@ -9,10 +9,14 @@ HARNESS_SRCS:=main.c
 CFLAGS+=-Wall -Werror -I../src -g -O2 -DPAGE_SIZE=$(shell getconf PAGESIZE)
 #-lpthread -lrt

+# Change this on the build line to run tests against the installed libraries:
+# make LIBAIO=-laio partcheck
+LIBAIO?=../src/libaio.a
+
 all: $(PROGS)

 $(PROGS): %.p: %.t $(HARNESS_SRCS)
-	$(CC) $(CFLAGS) -DTEST_NAME=\"$<\" -o $@ main.c ../src/libaio.a -lpthread
+	$(CC) $(CFLAGS) -DTEST_NAME=\"$<\" -o $@ main.c $(LIBAIO) -lpthread

 clean:
 	rm -f $(PROGS) *.o runtests.out rofile wofile rwfile
--
2.26.0.292.g33ef6b2f38


code:
From 0cd5b9ea20e8bc315d43ba1e38ed113804e3c759 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Sat, 20 Jul 2019 21:18:01 +0200
Subject: [PATCH libaio 03/28] man: Use the correct troff macro for comments

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 man/io_fsync.3        | 12 ++++++------
 man/io_getevents.3    | 36 ++++++++++++++++++------------------
 man/io_prep_fsync.3   | 14 +++++++-------
 man/io_prep_pread.3   | 20 ++++++++++----------
 man/io_prep_pwrite.3  | 20 ++++++++++----------
 man/io_set_callback.3 |  2 +-
 man/io_submit.3       | 24 ++++++++++++------------
 7 files changed, 64 insertions(+), 64 deletions(-)

diff --git a/man/io_fsync.3 b/man/io_fsync.3
index 859de1b..77a62ff 100644
--- a/man/io_fsync.3
+++ b/man/io_fsync.3
@@ -1,9 +1,9 @@
-./" 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);
-./" 	return io_submit(ctx, 1, &iocb);
-./" }
+.\" 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);
+.\" 	return io_submit(ctx, 1, &iocb);
+.\" }
 .TH io_fsync 3 2002-09-12 "Linux 2.4" Linux AIO"
 .SH NAME
 io_fsync \- Synchronize a file's complete in-core state with that on disk
diff --git a/man/io_getevents.3 b/man/io_getevents.3
index a4f8b57..1e643ac 100644
--- a/man/io_getevents.3
+++ b/man/io_getevents.3
@@ -1,21 +1,21 @@
-./"/* io_getevents:
-./" *      Attempts to read at least min_nr events and up to nr events from
-./" *      the completion queue for the aio_context specified by ctx_id.  May
-./" *      fail with -EINVAL if ctx_id is invalid, if min_nr is out of range,
-./" *      if nr is out of range, if when is out of range.  May fail with
-./" *      -EFAULT if any of the memory specified to is invalid.  May return
-./" *      0 or < min_nr if no events are available and the timeout specified
-./" *      by when has elapsed, where when == NULL specifies an infinite
-./" *      timeout.  Note that the timeout pointed to by when is relative and
-./" *      will be updated if not NULL and the operation blocks.  Will fail
-./" *      with -ENOSYS if not implemented.
-./" */
-./"asmlinkage long sys_io_getevents(io_context_t ctx_id,
-./"                                 long min_nr,
-./"                                 long nr,
-./"                                 struct io_event *events,
-./"                                 struct timespec *timeout)
-./"
+.\"/* io_getevents:
+.\" *      Attempts to read at least min_nr events and up to nr events from
+.\" *      the completion queue for the aio_context specified by ctx_id.  May
+.\" *      fail with -EINVAL if ctx_id is invalid, if min_nr is out of range,
+.\" *      if nr is out of range, if when is out of range.  May fail with
+.\" *      -EFAULT if any of the memory specified to is invalid.  May return
+.\" *      0 or < min_nr if no events are available and the timeout specified
+.\" *      by when has elapsed, where when == NULL specifies an infinite
+.\" *      timeout.  Note that the timeout pointed to by when is relative and
+.\" *      will be updated if not NULL and the operation blocks.  Will fail
+.\" *      with -ENOSYS if not implemented.
+.\" */
+.\"asmlinkage long sys_io_getevents(io_context_t ctx_id,
+.\"                                 long min_nr,
+.\"                                 long nr,
+.\"                                 struct io_event *events,
+.\"                                 struct timespec *timeout)
+.\"
 .TH io_getevents 2 2002-09-03 "Linux 2.4" "Linux AIO"
 .SH NAME
 io_getevents, aio_pgetevents \- Read resulting events from io requests
diff --git a/man/io_prep_fsync.3 b/man/io_prep_fsync.3
index 1173e2a..2daddee 100644
--- a/man/io_prep_fsync.3
+++ b/man/io_prep_fsync.3
@@ -1,10 +1,10 @@
-./" static inline void io_prep_fsync(struct iocb *iocb, int fd)
-./" {
-./" 	memset(iocb, 0, sizeof(*iocb));
-./" 	iocb->aio_fildes = fd;
-./" 	iocb->aio_lio_opcode = IO_CMD_FSYNC;
-./" 	iocb->aio_reqprio = 0;
-./" }
+.\" static inline void io_prep_fsync(struct iocb *iocb, int fd)
+.\" {
+.\" 	memset(iocb, 0, sizeof(*iocb));
+.\" 	iocb->aio_fildes = fd;
+.\" 	iocb->aio_lio_opcode = IO_CMD_FSYNC;
+.\" 	iocb->aio_reqprio = 0;
+.\" }
 .TH io_prep_fsync 3 2002-09-12 "Linux 2.4" Linux AIO"
 .SH NAME
 io_prep_fsync \- Synchronize a file's complete in-core state with that on disk
diff --git a/man/io_prep_pread.3 b/man/io_prep_pread.3
index 2c3b314..1ab28f5 100644
--- a/man/io_prep_pread.3
+++ b/man/io_prep_pread.3
@@ -1,13 +1,13 @@
-./" 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;
-./" 	iocb->aio_lio_opcode = IO_CMD_PREAD;
-./" 	iocb->aio_reqprio = 0;
-./" 	iocb->u.c.buf = buf;
-./" 	iocb->u.c.nbytes = count;
-./" 	iocb->u.c.offset = 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;
+.\" 	iocb->aio_lio_opcode = IO_CMD_PREAD;
+.\" 	iocb->aio_reqprio = 0;
+.\" 	iocb->u.c.buf = buf;
+.\" 	iocb->u.c.nbytes = count;
+.\" 	iocb->u.c.offset = offset;
+.\" }
 .TH io_prep_pread 3 2002-09-12 "Linux 2.4" Linux AIO"
 .SH NAME
 io_prep_pread \- Set up asynchronous read
diff --git a/man/io_prep_pwrite.3 b/man/io_prep_pwrite.3
index 669b8c2..f8d7fac 100644
--- a/man/io_prep_pwrite.3
+++ b/man/io_prep_pwrite.3
@@ -1,13 +1,13 @@
-./" 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;
-./" 	iocb->aio_lio_opcode = IO_CMD_PWRITE;
-./" 	iocb->aio_reqprio = 0;
-./" 	iocb->u.c.buf = buf;
-./" 	iocb->u.c.nbytes = count;
-./" 	iocb->u.c.offset = 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;
+.\" 	iocb->aio_lio_opcode = IO_CMD_PWRITE;
+.\" 	iocb->aio_reqprio = 0;
+.\" 	iocb->u.c.buf = buf;
+.\" 	iocb->u.c.nbytes = count;
+.\" 	iocb->u.c.offset = offset;
+.\" }
 .TH io_prep_pwrite 3 2002-09-12 "Linux 2.4" Linux AIO"
 .SH NAME
 io_prep_pwrite \- Set up iocb for asynchronous writes
diff --git a/man/io_set_callback.3 b/man/io_set_callback.3
index 3c7e43f..cc842f7 100644
--- a/man/io_set_callback.3
+++ b/man/io_set_callback.3
@@ -1,4 +1,4 @@
-./"static inline void io_set_callback(struct iocb *iocb, io_callback_t cb)
+.\"static inline void io_set_callback(struct iocb *iocb, io_callback_t cb)
 .TH io_set_callback 3 2002-09-12 "Linux 2.4" Linux AIO"
 .SH NAME
 io_set_callback \- Set up io completion callback function
diff --git a/man/io_submit.3 b/man/io_submit.3
index 7281147..a810b3f 100644
--- a/man/io_submit.3
+++ b/man/io_submit.3
@@ -1,15 +1,15 @@
-./"/* sys_io_submit:
-./" *      Queue the nr iocbs pointed to by iocbpp for processing.  Returns
-./" *      the number of iocbs queued.  May return -EINVAL if the aio_context
-./" *      specified by ctx_id is invalid, if nr is < 0, if the iocb at
-./" *      *iocbpp[0] is not properly initialized, if the operation specified
-./" *      is invalid for the file descriptor in the iocb.  May fail with
-./" *      -EFAULT if any of the data structures point to invalid data.  May
-./" *      fail with -EBADF if the file descriptor specified in the first
-./" *      iocb is invalid.  May fail with -EAGAIN if insufficient resources
-./" *      are available to queue any iocbs.  Will return 0 if nr is 0.  Will
-./" *      fail with -ENOSYS if not implemented.
-./" */
+.\"/* sys_io_submit:
+.\" *      Queue the nr iocbs pointed to by iocbpp for processing.  Returns
+.\" *      the number of iocbs queued.  May return -EINVAL if the aio_context
+.\" *      specified by ctx_id is invalid, if nr is < 0, if the iocb at
+.\" *      *iocbpp[0] is not properly initialized, if the operation specified
+.\" *      is invalid for the file descriptor in the iocb.  May fail with
+.\" *      -EFAULT if any of the data structures point to invalid data.  May
+.\" *      fail with -EBADF if the file descriptor specified in the first
+.\" *      iocb is invalid.  May fail with -EAGAIN if insufficient resources
+.\" *      are available to queue any iocbs.  Will return 0 if nr is 0.  Will
+.\" *      fail with -ENOSYS if not implemented.
+.\" */
 .TH io_submit 2 2002-09-02 "Linux 2.4" "Linux AIO"
 .SH NAME
 io_submit \- Submit io requests
--
2.26.0.292.g33ef6b2f38


code:
From e9dce27ad722dc2f17f913e56432107bc3c1229f Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Sat, 20 Jul 2019 21:18:02 +0200
Subject: [PATCH libaio 04/28] man: Refer to libaio.h instead of libio.h

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 man/io.3 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/man/io.3 b/man/io.3
index 968b1f9..e4fe108 100644
--- a/man/io.3
+++ b/man/io.3
@@ -6,7 +6,7 @@ io \- Asynchronous IO
 .B #include <errno.h>
 .sp
 .br
-.B #include <libio.h>
+.B #include <libaio.h>
 .sp
 .fi
 .SH DESCRIPTION
@@ -29,7 +29,7 @@ might be arbitrarily many operations running for one file.  The
 asynchronous I/O operations are controlled using a data structure named
 .IR "struct iocb"
 It is defined in
-.IR "libio.h"
+.IR "libaio.h"
 as follows.

 .nf
--
2.26.0.292.g33ef6b2f38


code:
From d868db4f2c993ebb2895ca77c32b5a5d000355d7 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Sat, 20 Jul 2019 21:18:03 +0200
Subject: [PATCH libaio 05/28] man: End sentences with a period

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 man/io_prep_fsync.3    | 4 ++--
 man/io_prep_pread.3    | 4 ++--
 man/io_prep_pwrite.3   | 4 ++--
 man/io_queue_init.3    | 2 +-
 man/io_queue_release.3 | 2 +-
 man/io_queue_run.3     | 2 +-
 man/io_queue_wait.3    | 2 +-
 man/io_set_callback.3  | 2 +-
 8 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/man/io_prep_fsync.3 b/man/io_prep_fsync.3
index 2daddee..3a5f952 100644
--- a/man/io_prep_fsync.3
+++ b/man/io_prep_fsync.3
@@ -70,9 +70,9 @@ must be called.
 Simultaneous asynchronous operations using the same iocb produce
 undefined results.
 .SH "RETURN VALUES"
-None
+None.
 .SH ERRORS
-None
+None.
 .SH "SEE ALSO"
 .BR io (3),
 .BR io_cancel (3),
diff --git a/man/io_prep_pread.3 b/man/io_prep_pread.3
index 1ab28f5..a4df182 100644
--- a/man/io_prep_pread.3
+++ b/man/io_prep_pread.3
@@ -60,9 +60,9 @@ must be called.
 Simultaneous asynchronous operations using the same iocb produce
 undefined results.
 .SH "RETURN VALUES"
-None
+None.
 .SH ERRORS
-None
+None.
 .SH "SEE ALSO"
 .BR io (3),
 .BR io_cancel (3),
diff --git a/man/io_prep_pwrite.3 b/man/io_prep_pwrite.3
index f8d7fac..73c62c7 100644
--- a/man/io_prep_pwrite.3
+++ b/man/io_prep_pwrite.3
@@ -58,9 +58,9 @@ must be called.
 Simultaneous asynchronous operations using the same iocb produce
 undefined results.
 .SH "RETURN VALUES"
-None
+None.
 .SH ERRORS
-None
+None.
 .SH "SEE ALSO"
 .BR io (3),
 .BR io_cancel (3),
diff --git a/man/io_queue_init.3 b/man/io_queue_init.3
index 7531f51..666dfae 100644
--- a/man/io_queue_init.3
+++ b/man/io_queue_init.3
@@ -42,7 +42,7 @@ is <= 0 or
 is an invalid memory locattion.
 .TP
 .B ENOSYS
-Not implemented
+Not implemented.
 .TP
 .B EAGAIN
 .IR "maxevents > max_aio_reqs"
diff --git a/man/io_queue_release.3 b/man/io_queue_release.3
index 9df39a0..f927562 100644
--- a/man/io_queue_release.3
+++ b/man/io_queue_release.3
@@ -30,7 +30,7 @@ refers to an unitialized aio context, the iocb pointed to by
 contains an improperly initialized iocb,
 .TP
 .B ENOSYS
-Not implemented
+Not implemented.
 .SH "SEE ALSO"
 .BR io (3),
 .BR io_cancel (3),
diff --git a/man/io_queue_run.3 b/man/io_queue_run.3
index 45762f5..35f385b 100644
--- a/man/io_queue_run.3
+++ b/man/io_queue_run.3
@@ -33,7 +33,7 @@ refers to an unitialized aio context, the iocb pointed to by
 contains an improperly initialized iocb,
 .TP
 .B ENOSYS
-Not implemented
+Not implemented.
 .SH "SEE ALSO"
 .BR io (3),
 .BR io_cancel (3),
diff --git a/man/io_queue_wait.3 b/man/io_queue_wait.3
index 2c7fc2c..eb6db83 100644
--- a/man/io_queue_wait.3
+++ b/man/io_queue_wait.3
@@ -39,7 +39,7 @@ refers to an unitialized aio context, the iocb pointed to by
 contains an improperly initialized iocb,
 .TP
 .B ENOSYS
-Not implemented
+Not implemented.
 .SH "SEE ALSO"
 .BR io (3),
 .BR io_cancel (3),
diff --git a/man/io_set_callback.3 b/man/io_set_callback.3
index cc842f7..71efd2f 100644
--- a/man/io_set_callback.3
+++ b/man/io_set_callback.3
@@ -25,7 +25,7 @@ typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, lon
 .fi
 .SH DESCRIPTION
 The callback is not done if the caller uses raw events from
-io_getevents, only with the library helpers
+io_getevents, only with the library helpers.
 .SH "RETURN VALUES"
 .SH ERRORS
 .SH "SEE ALSO"
--
2.26.0.292.g33ef6b2f38


code:
From 19a7217fe0a4dafd5f171b99bc27b7d8a29df9a0 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Sat, 20 Jul 2019 21:18:04 +0200
Subject: [PATCH libaio 06/28] man: Fix casing

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 man/io_cancel.3    | 4 ++--
 man/io_getevents.3 | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/man/io_cancel.3 b/man/io_cancel.3
index 3cf1bc6..9ac1b40 100644
--- a/man/io_cancel.3
+++ b/man/io_cancel.3
@@ -33,7 +33,7 @@ have to be overwritten soon.  As an example, assume an application, which
 writes data in files in a situation where new incoming data would have
 to be written in a file which will be updated by an enqueued request.
 .SH "RETURN VALUES"
-0 is returned on success , otherwise returns Errno.
+0 is returned on success , otherwise returns errno.
 .SH ERRORS
 .TP
 .B EFAULT
@@ -48,7 +48,7 @@ If the iocb specified was not
 cancelled.
 .TP
 .B ENOSYS
-if not implemented.
+If not implemented.
 .SH "SEE ALSO"
 .BR io (3),
 .BR io_fsync (3),
diff --git a/man/io_getevents.3 b/man/io_getevents.3
index 1e643ac..c8f2676 100644
--- a/man/io_getevents.3
+++ b/man/io_getevents.3
@@ -112,11 +112,11 @@ behaves the same as
 .SH ERRORS
 .TP
 .B EINVAL
-if ctx_id is invalid, if min_nr is out of range,
+If ctx_id is invalid, if min_nr is out of range,
 if nr is out of range, if when is out of range.
 .TP
 .B EFAULT
-if any of the memory specified to is invalid.
+If any of the memory specified to is invalid.
 .SH "SEE ALSO"
 .BR io (3),
 .BR io_cancel (3),
--
2.26.0.292.g33ef6b2f38


code:
From 0319efeeea3dbd4b53b81934b4f24bba96d77959 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Sat, 20 Jul 2019 21:18:05 +0200
Subject: [PATCH libaio 07/28] man: Fix period formatting

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 man/io.3               | 13 +++++--------
 man/io_fsync.3         |  2 +-
 man/io_getevents.3     |  3 +--
 man/io_prep_fsync.3    |  2 +-
 man/io_prep_pread.3    |  5 ++---
 man/io_prep_pwrite.3   |  5 ++---
 man/io_queue_release.3 |  2 +-
 man/io_queue_run.3     |  2 +-
 man/io_queue_wait.3    |  2 +-
 man/io_submit.3        |  8 ++++----
 10 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/man/io.3 b/man/io.3
index e4fe108..7b8ab5e 100644
--- a/man/io.3
+++ b/man/io.3
@@ -17,8 +17,8 @@ then immediately resume normal work while the I/O operations are
 executed in parallel.

 These functions are part of the library with realtime functions named
-.IR "libaio"
-.  They are not actually part of the
+.IR libaio .
+They are not actually part of the
 .IR "libc"
 binary.
 The implementation of these functions can be done using support in the
@@ -98,8 +98,7 @@ where the read data is stored.
 .TP
 .IR "long u.c.nbytes"
 This element specifies the length of the buffer pointed to by
-.IR "io_buf"
-.
+.IR io_buf .
 .TP
 .IR "int aio_reqprio"
 Is not currently used.
@@ -111,8 +110,7 @@ and store the next
 .IR "u.c.nbytes"
 bytes in the
 buffer pointed to by
-.IR "buf"
-.
+.IR buf .
 .TP
 .B "IO_CMD_PWRITE"
 Start a write operation.  Write
@@ -120,8 +118,7 @@ Start a write operation.  Write
 bytes starting at
 .IR "buf"
 into the file starting at position
-.IR "u.c.offset"
-.
+.IR u.c.offset .
 .TP
 .B "IO_CMD_NOP"
 Do nothing for this control block.  This value is useful sometimes when
diff --git a/man/io_fsync.3 b/man/io_fsync.3
index 77a62ff..03c81bc 100644
--- a/man/io_fsync.3
+++ b/man/io_fsync.3
@@ -39,7 +39,7 @@ resources (mainly computation time).
 Calling this function forces all I/O operations operating queued at the
 time of the function call operating on the file descriptor
 .IR "iocb->io_fildes"
-into the synchronized I/O completion state .  The
+into the synchronized I/O completion state.  The
 .IR "io_fsync"
 function returns
 immediately but the notification through the method described in
diff --git a/man/io_getevents.3 b/man/io_getevents.3
index c8f2676..24c07c3 100644
--- a/man/io_getevents.3
+++ b/man/io_getevents.3
@@ -107,8 +107,7 @@ argument is specified as NULL, then no signal mask manipulation is
 performed (and thus
 .BR io_pgetevents ()
 behaves the same as
-.BR io_getevents()
-) .
+.BR io_getevents() ).
 .SH ERRORS
 .TP
 .B EINVAL
diff --git a/man/io_prep_fsync.3 b/man/io_prep_fsync.3
index 3a5f952..cf4ecff 100644
--- a/man/io_prep_fsync.3
+++ b/man/io_prep_fsync.3
@@ -62,7 +62,7 @@ forced to the relevant completion state. The completion of
 subsequent I/O on the file descriptor is not guaranteed to be
 completed in a synchronized fashion.
 .PP
-This function returns immediately . To schedule the operation, the
+This function returns immediately. To schedule the operation, the
 function
 .IR io_submit
 must be called.
diff --git a/man/io_prep_pread.3 b/man/io_prep_pread.3
index a4df182..6d66c0f 100644
--- a/man/io_prep_pread.3
+++ b/man/io_prep_pread.3
@@ -44,15 +44,14 @@ bytes of the file for which
 is a descriptor are written to the buffer
 starting at
 .TP
-.IR "iocb->u.c.buf = buf"
-.
+.IR "iocb->u.c.buf = buf" .
 .br
 Reading starts at the absolute position
 .TP
 .IR "ioc->u.c.offset = offset"
 in the file.
 .PP
-This function returns immediately . To schedule the operation, the
+This function returns immediately. To schedule the operation, the
 function
 .IR io_submit
 must be called.
diff --git a/man/io_prep_pwrite.3 b/man/io_prep_pwrite.3
index 73c62c7..98b3a65 100644
--- a/man/io_prep_pwrite.3
+++ b/man/io_prep_pwrite.3
@@ -42,15 +42,14 @@ bytes of the file for which
 is a descriptor are written from the buffer
 starting at
 .TP
-.IR "iocb->u.c.buf = buf"
-.
+.IR "iocb->u.c.buf = buf" .
 .br
 Writing starts at the absolute position
 .TP
 .IR "ioc->u.c.offset = offset"
 in the file.
 .PP
-This function returns immediately . To schedule the operation, the
+This function returns immediately. To schedule the operation, the
 function
 .IR io_submit
 must be called.
diff --git a/man/io_queue_release.3 b/man/io_queue_release.3
index f927562..db91bad 100644
--- a/man/io_queue_release.3
+++ b/man/io_queue_release.3
@@ -12,7 +12,7 @@ io_queue_release \- Release the context associated with the userspace handle
 .sp
 .SH DESCRIPTION
 .B io_queue_release
-destroys the context associated with the userspace handle.    May cancel any outstanding
+destroys the context associated with the userspace handle. May cancel any outstanding
 AIOs and block on completion.

 .B cts.
diff --git a/man/io_queue_run.3 b/man/io_queue_run.3
index 35f385b..018257f 100644
--- a/man/io_queue_run.3
+++ b/man/io_queue_run.3
@@ -30,7 +30,7 @@ referenced data outside of the program's accessible address space.
 .I ctx
 refers to an unitialized aio context, the iocb pointed to by
 .I iocbs
-contains an improperly initialized iocb,
+contains an improperly initialized iocb.
 .TP
 .B ENOSYS
 Not implemented.
diff --git a/man/io_queue_wait.3 b/man/io_queue_wait.3
index eb6db83..e3598d9 100644
--- a/man/io_queue_wait.3
+++ b/man/io_queue_wait.3
@@ -36,7 +36,7 @@ referenced data outside of the program's accessible address space.
 .I ctx
 refers to an unitialized aio context, the iocb pointed to by
 .I iocbs
-contains an improperly initialized iocb,
+contains an improperly initialized iocb.
 .TP
 .B ENOSYS
 Not implemented.
diff --git a/man/io_submit.3 b/man/io_submit.3
index a810b3f..76e68d1 100644
--- a/man/io_submit.3
+++ b/man/io_submit.3
@@ -49,12 +49,12 @@ gets the
 .IR "nr"
 requests from the array pointed to
 by
-.IR "iocbs"
-.  The operation to be performed is determined by the
+.IR "iocbs" .
+The operation to be performed is determined by the
 .IR "aio_lio_opcode"
 member in each element of
-.IR "iocbs"
-.  If this
+.IR "iocbs" .
+If this
 field is
 .B "IO_CMD_PREAD"
 a read operation is enqueued, similar to a call
--
2.26.0.292.g33ef6b2f38


code:
From 767c68f7ea77f46fe9a227c2dc64a48f8eaa06f5 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Sat, 20 Jul 2019 21:18:06 +0200
Subject: [PATCH libaio 08/28] man: Remove spurious spaces

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 man/io_cancel.3     | 2 +-
 man/io_queue_run.3  | 2 +-
 man/io_queue_wait.3 | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/man/io_cancel.3 b/man/io_cancel.3
index 9ac1b40..261a407 100644
--- a/man/io_cancel.3
+++ b/man/io_cancel.3
@@ -33,7 +33,7 @@ have to be overwritten soon.  As an example, assume an application, which
 writes data in files in a situation where new incoming data would have
 to be written in a file which will be updated by an enqueued request.
 .SH "RETURN VALUES"
-0 is returned on success , otherwise returns errno.
+0 is returned on success, otherwise returns errno.
 .SH ERRORS
 .TP
 .B EFAULT
diff --git a/man/io_queue_run.3 b/man/io_queue_run.3
index 018257f..b05851c 100644
--- a/man/io_queue_run.3
+++ b/man/io_queue_run.3
@@ -14,7 +14,7 @@ io_queue_run \- Handle completed io requests
 .fi
 .SH DESCRIPTION
 .B io_queue_run
-Attempts to read  all the events events from
+Attempts to read all the events events from
 the completion queue for the aio_context specified by ctx_id.
 .SH "RETURN VALUES"
 May return
diff --git a/man/io_queue_wait.3 b/man/io_queue_wait.3
index e3598d9..fff8141 100644
--- a/man/io_queue_wait.3
+++ b/man/io_queue_wait.3
@@ -12,7 +12,7 @@ io_queue_wait \- Wait for io requests to complete
 .BI "int io_queue_wait(io_context_t ctx, const struct timespec *timeout);"
 .fi
 .SH DESCRIPTION
-Attempts to read  an event from
+Attempts to read an event from
 the completion queue for the aio_context specified by ctx_id.
 .SH "RETURN VALUES"
 May return
--
2.26.0.292.g33ef6b2f38


code:
From 5f0e08fda606b960eb1652f5e6743dc031e595f1 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Sat, 20 Jul 2019 21:18:07 +0200
Subject: [PATCH libaio 09/28] man: Remove spurious text

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 man/io_getevents.3     | 1 -
 man/io_prep_pread.3    | 2 +-
 man/io_queue_release.3 | 3 +--
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/man/io_getevents.3 b/man/io_getevents.3
index 24c07c3..37e9f7a 100644
--- a/man/io_getevents.3
+++ b/man/io_getevents.3
@@ -73,7 +73,6 @@ events happens or until a signal is caught.
 The following
 .BR io_pgetevents ()
 call:
-call:
 .PP
 .in +4n
 .EX
diff --git a/man/io_prep_pread.3 b/man/io_prep_pread.3
index 6d66c0f..b32fe4c 100644
--- a/man/io_prep_pread.3
+++ b/man/io_prep_pread.3
@@ -20,7 +20,7 @@ io_prep_pread \- Set up asynchronous read
 .br
 .sp
 .BI "inline void io_prep_pread(struct iocb *iocb, int fd, void *buf, size_t count, long long offset)
-"
+.
 .sp
 struct iocb {
 	void		*data;
diff --git a/man/io_queue_release.3 b/man/io_queue_release.3
index db91bad..6444aff 100644
--- a/man/io_queue_release.3
+++ b/man/io_queue_release.3
@@ -14,8 +14,7 @@ io_queue_release \- Release the context associated with the userspace handle
 .B io_queue_release
 destroys the context associated with the userspace handle. May cancel any outstanding
 AIOs and block on completion.
-
-.B cts.
+.
 .SH "RETURN VALUES"
 On success,
 .B io_queue_release
--
2.26.0.292.g33ef6b2f38


code:
From 69874fec6fef24564302b2efa9af53af07851058 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Sat, 20 Jul 2019 21:18:08 +0200
Subject: [PATCH libaio 10/28] man: Add "None" to empty sections

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 man/io_set_callback.3 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/man/io_set_callback.3 b/man/io_set_callback.3
index 71efd2f..4ee4b05 100644
--- a/man/io_set_callback.3
+++ b/man/io_set_callback.3
@@ -27,7 +27,9 @@ typedef void (*io_callback_t)(io_context_t ctx, struct iocb *iocb, long res, lon
 The callback is not done if the caller uses raw events from
 io_getevents, only with the library helpers.
 .SH "RETURN VALUES"
+None.
 .SH ERRORS
+None.
 .SH "SEE ALSO"
 .BR io (3),
 .BR io_cancel (3),
--
2.26.0.292.g33ef6b2f38


code:
From 716fe28caeefd07235413c309d316e9a92587e0c Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Sat, 20 Jul 2019 21:18:09 +0200
Subject: [PATCH libaio 11/28] man: Fix typos

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 man/io.3               | 2 +-
 man/io_fsync.3         | 4 ++--
 man/io_getevents.3     | 4 ++--
 man/io_prep_fsync.3    | 2 +-
 man/io_prep_pread.3    | 2 +-
 man/io_prep_pwrite.3   | 4 ++--
 man/io_queue_init.3    | 2 +-
 man/io_queue_release.3 | 2 +-
 man/io_queue_run.3     | 4 ++--
 man/io_queue_wait.3    | 2 +-
 man/io_set_callback.3  | 2 +-
 man/io_submit.3        | 2 +-
 12 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/man/io.3 b/man/io.3
index 7b8ab5e..bc529ea 100644
--- a/man/io.3
+++ b/man/io.3
@@ -1,7 +1,7 @@
 .TH io 3 2002-09-12 "Linux 2.4" Linux IO"
 .SH NAME
 io \- Asynchronous IO
-.SH SYNOPSYS
+.SH SYNOPSIS
 .nf
 .B #include <errno.h>
 .sp
diff --git a/man/io_fsync.3 b/man/io_fsync.3
index 03c81bc..5400d41 100644
--- a/man/io_fsync.3
+++ b/man/io_fsync.3
@@ -7,7 +7,7 @@
 .TH io_fsync 3 2002-09-12 "Linux 2.4" Linux AIO"
 .SH NAME
 io_fsync \- Synchronize a file's complete in-core state with that on disk
-.SH SYNOPSYS
+.SH SYNOPSIS
 .nf
 .B #include <errno.h>
 .sp
@@ -58,7 +58,7 @@ referenced data outside of the program's accessible address space.
 .TP
 .B EINVAL
 .I ctx
-refers to an unitialized aio context, the iocb pointed to by
+refers to an uninitialized aio context, the iocb pointed to by
 .I iocbs
 contains an improperly initialized iocb,
 .TP
diff --git a/man/io_getevents.3 b/man/io_getevents.3
index 37e9f7a..95fa86e 100644
--- a/man/io_getevents.3
+++ b/man/io_getevents.3
@@ -64,11 +64,11 @@ is analogous to the relationship between
 .BR select (2)
 and
 .BR pselect (2):
-similar
+similar to
 .BR pselect (2),
 .BR pgetevents ()
 allows an application to safely wait until either an aio completion
-events happens or until a signal is caught.
+event happens or until a signal is caught.
 .PP
 The following
 .BR io_pgetevents ()
diff --git a/man/io_prep_fsync.3 b/man/io_prep_fsync.3
index cf4ecff..0397172 100644
--- a/man/io_prep_fsync.3
+++ b/man/io_prep_fsync.3
@@ -8,7 +8,7 @@
 .TH io_prep_fsync 3 2002-09-12 "Linux 2.4" Linux AIO"
 .SH NAME
 io_prep_fsync \- Synchronize a file's complete in-core state with that on disk
-.SH SYNOPSYS
+.SH SYNOPSIS
 .nf
 .B #include <errno.h>
 .br
diff --git a/man/io_prep_pread.3 b/man/io_prep_pread.3
index b32fe4c..3c28f61 100644
--- a/man/io_prep_pread.3
+++ b/man/io_prep_pread.3
@@ -11,7 +11,7 @@
 .TH io_prep_pread 3 2002-09-12 "Linux 2.4" Linux AIO"
 .SH NAME
 io_prep_pread \- Set up asynchronous read
-.SH SYNOPSYS
+.SH SYNOPSIS
 .nf
 .B #include <errno.h>
 .sp
diff --git a/man/io_prep_pwrite.3 b/man/io_prep_pwrite.3
index 98b3a65..69479c2 100644
--- a/man/io_prep_pwrite.3
+++ b/man/io_prep_pwrite.3
@@ -11,7 +11,7 @@
 .TH io_prep_pwrite 3 2002-09-12 "Linux 2.4" Linux AIO"
 .SH NAME
 io_prep_pwrite \- Set up iocb for asynchronous writes
-.SH SYNOPSYS
+.SH SYNOPSIS
 .nf
 .B #include <errno.h>
 .br
@@ -31,7 +31,7 @@ struct iocb {
 };
 .fi
 .SH DESCRIPTION
-io_prep_write is a convenicence function for setting up parallel writes.
+io_prep_write is a convenience function for setting up parallel writes.

 The first
 .TP
diff --git a/man/io_queue_init.3 b/man/io_queue_init.3
index 666dfae..9c04b3f 100644
--- a/man/io_queue_init.3
+++ b/man/io_queue_init.3
@@ -39,7 +39,7 @@ referenced data outside of the program's accessible address space.
 .I maxevents
 is <= 0 or
 .IR ctx
-is an invalid memory locattion.
+is an invalid memory location.
 .TP
 .B ENOSYS
 Not implemented.
diff --git a/man/io_queue_release.3 b/man/io_queue_release.3
index 6444aff..5c9ded1 100644
--- a/man/io_queue_release.3
+++ b/man/io_queue_release.3
@@ -24,7 +24,7 @@ error is one of the Exxx values defined in the Errors section.
 .TP
 .B EINVAL
 .I ctx
-refers to an unitialized aio context, the iocb pointed to by
+refers to an uninitialized aio context, the iocb pointed to by
 .I iocbs
 contains an improperly initialized iocb,
 .TP
diff --git a/man/io_queue_run.3 b/man/io_queue_run.3
index b05851c..8e0691c 100644
--- a/man/io_queue_run.3
+++ b/man/io_queue_run.3
@@ -14,7 +14,7 @@ io_queue_run \- Handle completed io requests
 .fi
 .SH DESCRIPTION
 .B io_queue_run
-Attempts to read all the events events from
+Attempts to read all the events from
 the completion queue for the aio_context specified by ctx_id.
 .SH "RETURN VALUES"
 May return
@@ -28,7 +28,7 @@ referenced data outside of the program's accessible address space.
 .TP
 .B EINVAL
 .I ctx
-refers to an unitialized aio context, the iocb pointed to by
+refers to an uninitialized aio context, the iocb pointed to by
 .I iocbs
 contains an improperly initialized iocb.
 .TP
diff --git a/man/io_queue_wait.3 b/man/io_queue_wait.3
index fff8141..0cf0497 100644
--- a/man/io_queue_wait.3
+++ b/man/io_queue_wait.3
@@ -34,7 +34,7 @@ referenced data outside of the program's accessible address space.
 .TP
 .B EINVAL
 .I ctx
-refers to an unitialized aio context, the iocb pointed to by
+refers to an uninitialized aio context, the iocb pointed to by
 .I iocbs
 contains an improperly initialized iocb.
 .TP
diff --git a/man/io_set_callback.3 b/man/io_set_callback.3
index 4ee4b05..3599e8c 100644
--- a/man/io_set_callback.3
+++ b/man/io_set_callback.3
@@ -2,7 +2,7 @@
 .TH io_set_callback 3 2002-09-12 "Linux 2.4" Linux AIO"
 .SH NAME
 io_set_callback \- Set up io completion callback function
-.SH SYNOPSYS
+.SH SYNOPSIS
 .nf
 .B #include <errno.h>
 .br
diff --git a/man/io_submit.3 b/man/io_submit.3
index 76e68d1..3ae8721 100644
--- a/man/io_submit.3
+++ b/man/io_submit.3
@@ -110,7 +110,7 @@ referenced data outside of the program's accessible address space.
 .TP
 .B EINVAL
 .I ctx
-refers to an unitialized aio context, the iocb pointed to by
+refers to an uninitialized aio context, the iocb pointed to by
 .I iocbs
 contains an improperly initialized iocb,
 .TP
--
2.26.0.292.g33ef6b2f38


code:
From ed25b0e63b2bedecc9c181a620422627f27064ef Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@hadrons.org>
Date: Tue, 23 Jul 2019 01:28:10 +0200
Subject: [PATCH libaio 12/28] man: Fix title header

- Update year.
- Balance double quotes.
- Remove version from source argument as recommended in man-pages(7).
- Fix all sections numbers to 3.

Signed-off-by: Guillem Jover <guillem@hadrons.org>
Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
---
 man/io.3               | 2 +-
 man/io_cancel.3        | 2 +-
 man/io_fsync.3         | 2 +-
 man/io_getevents.3     | 2 +-
 man/io_prep_fsync.3    | 2 +-
 man/io_prep_pread.3    | 2 +-
 man/io_prep_pwrite.3   | 2 +-
 man/io_queue_init.3    | 2 +-
 man/io_queue_release.3 | 2 +-
 man/io_queue_run.3     | 2 +-
 man/io_queue_wait.3    | 2 +-
 man/io_set_callback.3  | 2 +-
 man/io_submit.3        | 2 +-
 13 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/man/io.3 b/man/io.3
index bc529ea..922fbca 100644
--- a/man/io.3
+++ b/man/io.3
@@ -1,4 +1,4 @@
-.TH io 3 2002-09-12 "Linux 2.4" Linux IO"
+.TH io 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io \- Asynchronous IO
 .SH SYNOPSIS
diff --git a/man/io_cancel.3 b/man/io_cancel.3
index 261a407..a4683be 100644
--- a/man/io_cancel.3
+++ b/man/io_cancel.3
@@ -1,4 +1,4 @@
-.TH io_cancel 2 2002-09-03 "Linux 2.4" "Linux AIO"
+.TH io_cancel 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_cancel \- Cancel io requests
 .SH SYNOPSIS
diff --git a/man/io_fsync.3 b/man/io_fsync.3
index 5400d41..bc6778a 100644
--- a/man/io_fsync.3
+++ b/man/io_fsync.3
@@ -4,7 +4,7 @@
 .\" 	io_set_callback(iocb, cb);
 .\" 	return io_submit(ctx, 1, &iocb);
 .\" }
-.TH io_fsync 3 2002-09-12 "Linux 2.4" Linux AIO"
+.TH io_fsync 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_fsync \- Synchronize a file's complete in-core state with that on disk
 .SH SYNOPSIS
diff --git a/man/io_getevents.3 b/man/io_getevents.3
index 95fa86e..05b2507 100644
--- a/man/io_getevents.3
+++ b/man/io_getevents.3
@@ -16,7 +16,7 @@
 .\"                                 struct io_event *events,
 .\"                                 struct timespec *timeout)
 .\"
-.TH io_getevents 2 2002-09-03 "Linux 2.4" "Linux AIO"
+.TH io_getevents 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_getevents, aio_pgetevents \- Read resulting events from io requests
 .SH SYNOPSIS
diff --git a/man/io_prep_fsync.3 b/man/io_prep_fsync.3
index 0397172..bc0c43b 100644
--- a/man/io_prep_fsync.3
+++ b/man/io_prep_fsync.3
@@ -5,7 +5,7 @@
 .\" 	iocb->aio_lio_opcode = IO_CMD_FSYNC;
 .\" 	iocb->aio_reqprio = 0;
 .\" }
-.TH io_prep_fsync 3 2002-09-12 "Linux 2.4" Linux AIO"
+.TH io_prep_fsync 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_prep_fsync \- Synchronize a file's complete in-core state with that on disk
 .SH SYNOPSIS
diff --git a/man/io_prep_pread.3 b/man/io_prep_pread.3
index 3c28f61..e981e41 100644
--- a/man/io_prep_pread.3
+++ b/man/io_prep_pread.3
@@ -8,7 +8,7 @@
 .\" 	iocb->u.c.nbytes = count;
 .\" 	iocb->u.c.offset = offset;
 .\" }
-.TH io_prep_pread 3 2002-09-12 "Linux 2.4" Linux AIO"
+.TH io_prep_pread 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_prep_pread \- Set up asynchronous read
 .SH SYNOPSIS
diff --git a/man/io_prep_pwrite.3 b/man/io_prep_pwrite.3
index 69479c2..f2837b6 100644
--- a/man/io_prep_pwrite.3
+++ b/man/io_prep_pwrite.3
@@ -8,7 +8,7 @@
 .\" 	iocb->u.c.nbytes = count;
 .\" 	iocb->u.c.offset = offset;
 .\" }
-.TH io_prep_pwrite 3 2002-09-12 "Linux 2.4" Linux AIO"
+.TH io_prep_pwrite 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_prep_pwrite \- Set up iocb for asynchronous writes
 .SH SYNOPSIS
diff --git a/man/io_queue_init.3 b/man/io_queue_init.3
index 9c04b3f..d8753a7 100644
--- a/man/io_queue_init.3
+++ b/man/io_queue_init.3
@@ -1,4 +1,4 @@
-.TH io_queue_init 2 2002-09-03 "Linux 2.4" "Linux AIO"
+.TH io_queue_init 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_queue_init \- Initialize asynchronous io state machine

diff --git a/man/io_queue_release.3 b/man/io_queue_release.3
index 5c9ded1..392a478 100644
--- a/man/io_queue_release.3
+++ b/man/io_queue_release.3
@@ -1,4 +1,4 @@
-.TH io_queue_release 2 2002-09-03 "Linux 2.4" "Linux AIO"
+.TH io_queue_release 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_queue_release \- Release the context associated with the userspace handle
 .SH SYNOPSIS
diff --git a/man/io_queue_run.3 b/man/io_queue_run.3
index 8e0691c..dc54acd 100644
--- a/man/io_queue_run.3
+++ b/man/io_queue_run.3
@@ -1,4 +1,4 @@
-.TH io_queue_run 2 2002-09-03 "Linux 2.4" "Linux AIO"
+.TH io_queue_run 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_queue_run \- Handle completed io requests
 .SH SYNOPSIS
diff --git a/man/io_queue_wait.3 b/man/io_queue_wait.3
index 0cf0497..356c3b2 100644
--- a/man/io_queue_wait.3
+++ b/man/io_queue_wait.3
@@ -1,4 +1,4 @@
-.TH io_queue_wait 2 2002-09-03 "Linux 2.4" "Linux AIO"
+.TH io_queue_wait 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_queue_wait \- Wait for io requests to complete
 .SH SYNOPSIS
diff --git a/man/io_set_callback.3 b/man/io_set_callback.3
index 3599e8c..25b9a7f 100644
--- a/man/io_set_callback.3
+++ b/man/io_set_callback.3
@@ -1,5 +1,5 @@
 .\"static inline void io_set_callback(struct iocb *iocb, io_callback_t cb)
-.TH io_set_callback 3 2002-09-12 "Linux 2.4" Linux AIO"
+.TH io_set_callback 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_set_callback \- Set up io completion callback function
 .SH SYNOPSIS
diff --git a/man/io_submit.3 b/man/io_submit.3
index 3ae8721..01c25cd 100644
--- a/man/io_submit.3
+++ b/man/io_submit.3
@@ -10,7 +10,7 @@
 .\" *      are available to queue any iocbs.  Will return 0 if nr is 0.  Will
 .\" *      fail with -ENOSYS if not implemented.
 .\" */
-.TH io_submit 2 2002-09-02 "Linux 2.4" "Linux AIO"
+.TH io_submit 3 2019-07-23 "Linux" "Linux AIO"
 .SH NAME
 io_submit \- Submit io requests
 .SH SYNOPSIS
--
2.26.0.292.g33ef6b2f38