commit:     1b7592516eea9b64b0b6fe3db3d91b8cda9acb59
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Jan  3 23:39:02 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Jan  3 23:39:02 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1b759251

sys-process/schedtool: fix modern C issue

Closes: https://bugs.gentoo.org/918974
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../schedtool/files/schedtool-1.3.0-c99.patch      | 33 ++++++++++++++++++++
 sys-process/schedtool/schedtool-1.3.0-r2.ebuild    | 36 ++++++++++++++++++++++
 2 files changed, 69 insertions(+)

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
+}

Reply via email to