summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2024-01-03 23:39:02 +0000
committerSam James <sam@gentoo.org>2024-01-03 23:39:02 +0000
commit1b7592516eea9b64b0b6fe3db3d91b8cda9acb59 (patch)
tree901efaea9d8bbce8514a13b4ddf32c7adbacb68c /sys-process
parentapp-metrics/exabgp_exporter: add 1.1.3 (diff)
downloadgentoo-1b7592516eea9b64b0b6fe3db3d91b8cda9acb59.tar.gz
gentoo-1b7592516eea9b64b0b6fe3db3d91b8cda9acb59.tar.bz2
gentoo-1b7592516eea9b64b0b6fe3db3d91b8cda9acb59.zip
sys-process/schedtool: fix modern C issue
Closes: https://bugs.gentoo.org/918974 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'sys-process')
-rw-r--r--sys-process/schedtool/files/schedtool-1.3.0-c99.patch33
-rw-r--r--sys-process/schedtool/schedtool-1.3.0-r2.ebuild36
2 files changed, 69 insertions, 0 deletions
diff --git a/sys-process/schedtool/files/schedtool-1.3.0-c99.patch b/sys-process/schedtool/files/schedtool-1.3.0-c99.patch
new file mode 100644
index 000000000000..8f3c0b33afca
--- /dev/null
+++ b/sys-process/schedtool/files/schedtool-1.3.0-c99.patch
@@ -0,0 +1,33 @@
+https://bugs.gentoo.org/918974
+https://src.fedoraproject.org/rpms/schedtool/c/f84b6a0fdc4b368e2b1c5ea59739f002063e3c9e?branch=rawhide
+
+Invoke decode_error separately with the correct argument types for
+each variant. This avoids an int-conversion error.
+
+--- a/schedtool.c
++++ b/schedtool.c
+@@ -422,19 +422,14 @@ int set_process(pid_t pid, int policy, int prio)
+ struct sched_param p;
+ int ret;
+
+- char *msg1="could not set PID %d to %s";
+- char *msg2="could not set PID %d to raw policy #%d";
+-
+ p.sched_priority=prio;
+
+ /* anything other than 0 indicates error */
+ if((ret=sched_setscheduler(pid, policy, &p))) {
+-
+- /* la la pointer mismatch .. lala */
+- decode_error((CHECK_RANGE_POLICY(policy) ? msg1 : msg2),
+- pid,
+- (CHECK_RANGE_POLICY(policy) ? TAB[policy] : policy)
+- );
++ if (CHECK_RANGE_POLICY(policy))
++ decode_error("could not set PID %d to %s", pid, TAB[policy]);
++ else
++ decode_error("could not set PID %d to raw policy #%d", pid, policy);
+ return(ret);
+ }
+ return(0);
+
diff --git a/sys-process/schedtool/schedtool-1.3.0-r2.ebuild b/sys-process/schedtool/schedtool-1.3.0-r2.ebuild
new file mode 100644
index 000000000000..7f3a2230158e
--- /dev/null
+++ b/sys-process/schedtool/schedtool-1.3.0-r2.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2024 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs
+
+DESCRIPTION="A tool to query or alter a process' scheduling policy"
+HOMEPAGE="https://github.com/freequaos/schedtool"
+SRC_URI="https://github.com/freequaos/schedtool/archive/${P}.tar.gz"
+S="${WORKDIR}/${PN}-${P}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~loong ~mips ~ppc ~riscv ~x86 ~amd64-linux ~x86-linux"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-1.3.0-c99.patch
+)
+
+src_prepare() {
+ default
+ sed \
+ -e '/^CFLAGS=/d;/^install:/s@ install-doc zipman@@' \
+ -e '/install/s@\(schedtool.8\).gz@\1@' \
+ -i Makefile || die
+}
+
+src_compile() {
+ emake CC="$(tc-getCC)"
+}
+
+src_install() {
+ emake DESTPREFIX="${ED}"/usr install
+ dodoc CHANGES INSTALL PACKAGERS README SCHED_DESIGN TODO TUNING
+}