sys-libs/liburing: Sync with Gentoo

It's from Gentoo commit dd8826ccb0154cbd7bf849e4a1738e4d20b291fd.
This commit is contained in:
Krzesimir Nowak 2023-11-23 14:48:41 +01:00
parent 731da34a0f
commit a11c09a451
9 changed files with 402 additions and 20 deletions

View File

@ -1 +1,4 @@
DIST liburing-2.1.tar.bz2 120806 BLAKE2B 3a09d1504150ed1c111f064187d868fd86ec7c3dbf661f73999f7fbb9c945b528f7ab2e0cfff5d270a1a977f04deedc7c790b6df8708ef2884fbf28c1a9ffd1b SHA512 a658454869b01752b5e499c4f0b50c342a8ff63b3dd1a473a96f9fad03f22a6e4d2354b0e658a4e7e50ea27440a84ee274856b3687803583bc80cb4bc45aec71
DIST liburing-2.2.tar.bz2 172733 BLAKE2B 19ae8a356e4fdc296bfb3ff121b777bd7c970388b31686aac5c531508e807360d58220bc27f9c62c55bd76ca687013acfceb3fa8a2162b615561f637cc50ffe1 SHA512 55b935a90c108be54393a5ab341b56e40ad8d506360fe15b3dcde5ee263356f11080f8614efdc4253f6318ea35d808ec47a9dbfc6b9f6cc2e04f7f1a75c3f621
DIST liburing-2.3.tar.bz2 197929 BLAKE2B 94ae2a79522fbac13c071ad752f5cbfae3e3b3dd6b35da24e5c756ba47a7b304e5bcb18391ca23fc2edafeb2dbcdcf143fd2cda71656396ac34248159a964fb7 SHA512 341aa13d3b560617f3710291945ec2fe35d828e0b67ee3a97555fd4eb3d2042a7f9e722080d8ebb45aa74a2ca4ef58db1e8a10c351e951a604da007ba69d2738
DIST liburing-2.4.tar.bz2 213774 BLAKE2B 3e6c28842db6ee10e38df297e392803e0ff40ccfea774b2c473ba63b5583e760371bf0ce8e34ca4311e2bef69eee81b2b50b5e906bb328d5b321488136fc61e0 SHA512 45b5123739280835c88c1addcf99a3210a91c6e1b3e0c5a20fd4cf3ff55db5fd1475b0351806be2e86fedfa313200eecac6a9a6f410a9eca7e451081fd8eec96

View File

@ -0,0 +1,35 @@
From 19424b0baa5999918701e1972b901b0937331581 Mon Sep 17 00:00:00 2001
From: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Date: Sat, 14 Jan 2023 10:54:05 +0700
Subject: [PATCH] liburing.map: Export
`io_uring_{enable_rings,register_restrictions}`
When adding these two functions, Stefano didn't add
io_uring_enable_rings() and io_uring_register_restrictions() to
liburing.map. It causes a linking problem. Add them to liburing.map.
This issue hits liburing 2.0 to 2.3.
[flow: backport to liburing 2.3]
Closes: https://github.com/axboe/liburing/pull/774
Fixes: https://github.com/axboe/liburing/issues/773
Fixes: https://github.com/facebook/folly/issues/1908
Fixes: d2654b1ac886 ("Add helper to enable rings")
Fixes: 25cf9b968a27 ("Add helper to register restrictions")
Cc: Dylan Yudaken <dylany@meta.com>
Cc: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Ammar Faizi <ammarfaizi2@gnuweeb.org>
Link: https://lore.kernel.org/r/20230114035405.429608-1-ammar.faizi@intel.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
--- a/src/liburing.map
+++ b/src/liburing.map
@@ -68,2 +68,5 @@ LIBURING_2.3 {
io_uring_submit_and_get_events;
+
+ io_uring_enable_rings;
+ io_uring_register_restrictions;
} LIBURING_2.3;
--
2.39.1

View File

@ -0,0 +1,150 @@
From 11dc64a71558948aef16730cb363e7e5da773a5b Mon Sep 17 00:00:00 2001
From: Steffen <steffen.winter@proton.me>
Date: Mon, 13 Feb 2023 17:32:16 +0100
Subject: [PATCH 1/3] Add custom error function for tests.
On musl systems, liburing cannot build examples and tests due to
it's usage of error.h. t_error calls fprintf(stderr, ...) and
exits.
Closes: #786
Signed-off-by: Steffen Winter <steffen.winter@proton.me>
--- a/test/helpers.c
+++ b/test/helpers.c
@@ -8,6 +8,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
+#include <stdarg.h>
#include <sys/types.h>
#include <arpa/inet.h>
@@ -300,3 +301,20 @@ unsigned __io_uring_flush_sq(struct io_uring *ring)
*/
return tail - *sq->khead;
}
+
+/*
+ * Implementation of error(3), prints an error message and exits.
+ */
+void t_error(int status, int errnum, const char *format, ...)
+{
+ va_list args;
+ va_start(args, format);
+
+ vfprintf(stderr, format, args);
+ if (errnum)
+ fprintf(stderr, ": %s", strerror(errnum));
+
+ fprintf(stderr, "\n");
+ va_end(args);
+ exit(status);
+}
--- a/test/helpers.h
+++ b/test/helpers.h
@@ -89,6 +89,8 @@ unsigned __io_uring_flush_sq(struct io_uring *ring);
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
+void t_error(int status, int errnum, const char *format, ...);
+
#ifdef __cplusplus
}
#endif
From 3b0b4976d7da2e4616fe860fb7a8e52d88d4523b Mon Sep 17 00:00:00 2001
From: Steffen <steffen.winter@proton.me>
Date: Mon, 13 Feb 2023 17:56:03 +0100
Subject: [PATCH 2/3] test: Use t_error instead of glibc's error.
On musl systems, liburing cannot build examples and tests due to
it's usage of error.h. Replacing calls to error() with t_error().
Closes: #786
Signed-off-by: Steffen Winter <steffen.winter@proton.me>
--- a/test/defer-taskrun.c
+++ b/test/defer-taskrun.c
@@ -4,7 +4,6 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
-#include <error.h>
#include <sys/eventfd.h>
#include <signal.h>
#include <poll.h>
--- a/test/send-zerocopy.c
+++ b/test/send-zerocopy.c
@@ -4,7 +4,6 @@
#include <stdint.h>
#include <assert.h>
#include <errno.h>
-#include <error.h>
#include <limits.h>
#include <fcntl.h>
#include <unistd.h>
--- a/test/single-issuer.c
+++ b/test/single-issuer.c
@@ -5,7 +5,6 @@
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
-#include <error.h>
#include <sys/types.h>
#include <sys/wait.h>
@@ -56,13 +55,13 @@ static int try_submit(struct io_uring *ring)
return ret;
if (ret != 1)
- error(1, ret, "submit %i", ret);
+ t_error(1, ret, "submit %i", ret);
ret = io_uring_wait_cqe(ring, &cqe);
if (ret)
- error(1, ret, "wait fail %i", ret);
+ t_error(1, ret, "wait fail %i", ret);
if (cqe->res || cqe->user_data != 42)
- error(1, ret, "invalid cqe");
+ t_error(1, ret, "invalid cqe");
io_uring_cqe_seen(ring, cqe);
return 0;
@@ -105,7 +104,7 @@ int main(int argc, char *argv[])
ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER |
IORING_SETUP_R_DISABLED);
if (ret)
- error(1, ret, "ring init (2) %i", ret);
+ t_error(1, ret, "ring init (2) %i", ret);
if (!fork_t()) {
io_uring_enable_rings(&ring);
@@ -121,7 +120,7 @@ int main(int argc, char *argv[])
ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER |
IORING_SETUP_R_DISABLED);
if (ret)
- error(1, ret, "ring init (3) %i", ret);
+ t_error(1, ret, "ring init (3) %i", ret);
io_uring_enable_rings(&ring);
if (!fork_t()) {
@@ -136,7 +135,7 @@ int main(int argc, char *argv[])
/* test that anyone can submit to a SQPOLL|SINGLE_ISSUER ring */
ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER|IORING_SETUP_SQPOLL);
if (ret)
- error(1, ret, "ring init (4) %i", ret);
+ t_error(1, ret, "ring init (4) %i", ret);
ret = try_submit(&ring);
if (ret) {
@@ -156,7 +155,7 @@ int main(int argc, char *argv[])
/* test that IORING_ENTER_REGISTERED_RING doesn't break anything */
ret = io_uring_queue_init(8, &ring, IORING_SETUP_SINGLE_ISSUER);
if (ret)
- error(1, ret, "ring init (5) %i", ret);
+ t_error(1, ret, "ring init (5) %i", ret);
if (!fork_t()) {
ret = try_submit(&ring);

View File

@ -12,7 +12,7 @@ if [[ "${PV}" == *9999 ]] ; then
EGIT_REPO_URI="https://github.com/axboe/liburing.git"
else
SRC_URI="https://git.kernel.dk/cgit/${PN}/snapshot/${P}.tar.bz2"
KEYWORDS="~alpha amd64 ~arm arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~sparc ~x86"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ppc ppc64 ~riscv sparc x86"
fi
LICENSE="MIT"
SLOT="0/2" # liburing.so major version
@ -54,7 +54,7 @@ multilib_src_configure() {
--cxx="$(tc-getCXX)"
)
# No autotools configure! "econf" will fail.
TMPDIR="${T}" ./configure "${myconf[@]}"
TMPDIR="${T}" ./configure "${myconf[@]}" || die
}
multilib_src_compile() {

View File

@ -12,7 +12,7 @@ if [[ "${PV}" == *9999 ]] ; then
EGIT_REPO_URI="https://github.com/axboe/liburing.git"
else
SRC_URI="https://git.kernel.dk/cgit/${PN}/snapshot/${P}.tar.bz2"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ppc ppc64 ~riscv sparc x86"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ppc ppc64 ~riscv sparc x86"
fi
LICENSE="MIT"
SLOT="0/2" # liburing.so major version
@ -21,10 +21,9 @@ IUSE="static-libs"
# fsync test hangs forever
RESTRICT="test"
PATCHES=(
# Upstream, bug #816798
"${FILESDIR}"/${P}-arm-syscall.patch
)
# At least installed headers need <linux/*>, bug #802516
DEPEND=">=sys-kernel/linux-headers-5.1"
RDEPEND="${DEPEND}"
src_prepare() {
default
@ -45,9 +44,10 @@ multilib_src_configure() {
--libdevdir="${EPREFIX}/usr/$(get_libdir)"
--mandir="${EPREFIX}/usr/share/man"
--cc="$(tc-getCC)"
--cxx="$(tc-getCXX)"
)
# No autotools configure! "econf" will fail.
TMPDIR="${T}" ./configure "${myconf[@]}"
TMPDIR="${T}" ./configure "${myconf[@]}" || die
}
multilib_src_compile() {

View File

@ -0,0 +1,90 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit multilib-minimal toolchain-funcs
DESCRIPTION="Efficient I/O with io_uring"
HOMEPAGE="https://github.com/axboe/liburing"
if [[ "${PV}" == *9999 ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/axboe/liburing.git"
else
SRC_URI="https://git.kernel.dk/cgit/${PN}/snapshot/${P}.tar.bz2"
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc x86"
QA_PKGCONFIG_VERSION=${PV}
fi
LICENSE="MIT"
SLOT="0/2" # liburing.so major version
IUSE="examples static-libs test"
# fsync test hangs forever
RESTRICT="!test? ( test )"
# At least installed headers need <linux/*>, bug #802516
DEPEND=">=sys-kernel/linux-headers-5.1"
RDEPEND="${DEPEND}"
PATCHES=(
# https://bugs.gentoo.org/891633
"${FILESDIR}/${PN}-2.3-liburing.map-Export-io_uring_-enable_rings-register_.patch"
# https://github.com/axboe/liburing/pull/787
"${FILESDIR}/${PN}-2.3-remove-error-from-error_h-for-portability.patch"
)
src_prepare() {
default
if ! use examples; then
sed -e '/examples/d' Makefile -i || die
fi
if ! use test; then
sed -e '/test/d' Makefile -i || die
fi
multilib_copy_sources
}
multilib_src_configure() {
local myconf=(
--prefix="${EPREFIX}/usr"
--libdir="${EPREFIX}/usr/$(get_libdir)"
--libdevdir="${EPREFIX}/usr/$(get_libdir)"
--mandir="${EPREFIX}/usr/share/man"
--cc="$(tc-getCC)"
--cxx="$(tc-getCXX)"
)
# No autotools configure! "econf" will fail.
TMPDIR="${T}" ./configure "${myconf[@]}" || die
}
multilib_src_compile() {
emake V=1 AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)"
}
multilib_src_install_all() {
einstalldocs
if ! use static-libs ; then
find "${ED}" -type f -name "*.a" -delete || die
fi
}
multilib_src_test() {
local disabled_tests=(
accept.c
fpos.c
io_uring_register.c
link-timeout.c
read-before-exit.c
recv-msgall-stream.c
)
local disabled_test
for disabled_test in "${disabled_tests[@]}"; do
sed -i "/\s*${disabled_test}/d" test/Makefile \
|| die "Failed to remove ${disabled_test}"
done
emake -C test V=1 runtests
}

View File

@ -0,0 +1,83 @@
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit multilib-minimal toolchain-funcs
DESCRIPTION="Efficient I/O with io_uring"
HOMEPAGE="https://github.com/axboe/liburing"
if [[ "${PV}" == *9999 ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/axboe/liburing.git"
else
SRC_URI="https://git.kernel.dk/cgit/${PN}/snapshot/${P}.tar.bz2"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
QA_PKGCONFIG_VERSION=${PV}
fi
LICENSE="MIT"
SLOT="0/2" # liburing.so major version
IUSE="examples static-libs test"
# fsync test hangs forever
RESTRICT="!test? ( test )"
# At least installed headers need <linux/*>, bug #802516
DEPEND=">=sys-kernel/linux-headers-5.1"
RDEPEND="${DEPEND}"
src_prepare() {
default
if ! use examples; then
sed -e '/examples/d' Makefile -i || die
fi
if ! use test; then
sed -e '/test/d' Makefile -i || die
fi
multilib_copy_sources
}
multilib_src_configure() {
local myconf=(
--prefix="${EPREFIX}/usr"
--libdir="${EPREFIX}/usr/$(get_libdir)"
--libdevdir="${EPREFIX}/usr/$(get_libdir)"
--mandir="${EPREFIX}/usr/share/man"
--cc="$(tc-getCC)"
--cxx="$(tc-getCXX)"
)
# No autotools configure! "econf" will fail.
TMPDIR="${T}" ./configure "${myconf[@]}" || die
}
multilib_src_compile() {
emake V=1 AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)"
}
multilib_src_install_all() {
einstalldocs
if ! use static-libs ; then
find "${ED}" -type f -name "*.a" -delete || die
fi
}
multilib_src_test() {
local disabled_tests=(
accept.c
fpos.c
io_uring_register.c
link-timeout.c
read-before-exit.c
recv-msgall-stream.c
)
local disabled_test
for disabled_test in "${disabled_tests[@]}"; do
sed -i "/\s*${disabled_test}/d" test/Makefile \
|| die "Failed to remove ${disabled_test}"
done
emake -C test V=1 runtests
}

View File

@ -1,4 +1,4 @@
# Copyright 1999-2022 Gentoo Authors
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
@ -12,22 +12,28 @@ if [[ "${PV}" == *9999 ]] ; then
EGIT_REPO_URI="https://github.com/axboe/liburing.git"
else
SRC_URI="https://git.kernel.dk/cgit/${PN}/snapshot/${P}.tar.bz2"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~riscv ~sparc ~x86"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
QA_PKGCONFIG_VERSION=${PV}
fi
LICENSE="MIT"
SLOT="0/2" # liburing.so major version
IUSE="static-libs"
IUSE="examples static-libs test"
# fsync test hangs forever
RESTRICT="test"
RESTRICT="!test? ( test )"
# At least installed headers need <linux/*>, bug #802516
DEPEND=">=sys-kernel/linux-headers-5.1"
RDEPEND="${DEPEND}"
src_prepare() {
default
if [[ "${PV}" != *9999 ]] ; then
# Make sure pkgconfig files contain the correct version
# bug #809095 and #833895
sed -i "/^Version:/s@[[:digit:]\.]\+@${PV}@" ${PN}.spec || die
if ! use examples; then
sed -e '/examples/d' Makefile -i || die
fi
if ! use test; then
sed -e '/test/d' Makefile -i || die
fi
multilib_copy_sources
@ -40,9 +46,10 @@ multilib_src_configure() {
--libdevdir="${EPREFIX}/usr/$(get_libdir)"
--mandir="${EPREFIX}/usr/share/man"
--cc="$(tc-getCC)"
--cxx="$(tc-getCXX)"
)
# No autotools configure! "econf" will fail.
TMPDIR="${T}" ./configure "${myconf[@]}"
TMPDIR="${T}" ./configure "${myconf[@]}" || die
}
multilib_src_compile() {
@ -58,5 +65,19 @@ multilib_src_install_all() {
}
multilib_src_test() {
emake V=1 runtests
local disabled_tests=(
accept.c
fpos.c
io_uring_register.c
link-timeout.c
read-before-exit.c
recv-msgall-stream.c
)
local disabled_test
for disabled_test in "${disabled_tests[@]}"; do
sed -i "/\s*${disabled_test}/d" test/Makefile \
|| die "Failed to remove ${disabled_test}"
done
emake -C test V=1 runtests
}

View File

@ -2,8 +2,8 @@
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>polynomial-c@gentoo.org</email>
<name>Lars Wendler</name>
<name>Florian Schmaus</name>
<email>flow@gentoo.org</email>
</maintainer>
<upstream>
<remote-id type="github">axboe/liburing</remote-id>