package/cpulimit: Backport fix for function signature

Backport the upstream pull request patch fixing the incorrect function
signature passed to pthread_create()

Fixes: https://autobuild.buildroot.org/results/5308cb8239f31ef39e5c67d65ff1d69cdec1cedc
Fixes: https://autobuild.buildroot.org/results/6722247e3c830558ac0377352d05f4bb1684978d
Fixes: https://autobuild.buildroot.org/results/adc385fe35432be28453b8ed9f40e8a6647a4b28
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
[Julien: reformat patch "Upstream:" tag to fix check-package error]
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Florian Fainelli
2025-07-02 20:57:51 -07:00
committed by Julien Olivain
parent eee0f6c078
commit e63181bc00

View File

@@ -0,0 +1,49 @@
From 74e95c96e8d82e4e374f86142972fcf4305fe1f2 Mon Sep 17 00:00:00 2001
From: Florian Fainelli <f.fainelli@gmail.com>
Date: Wed, 2 Jul 2025 20:47:58 -0700
Subject: [PATCH] Correct loop function signature
loop is passed to pthread_create() which requires the following
prototype to be used: void *(*start_routine) (void *)
Correct the signature to avoid such warnings:
In file included from busy.c:3:
/home/buildroot/instance-0/output-1/host/mips-buildroot-linux-uclibc/sysroot/usr/include/pthread.h:164:36: note: expected 'void * (*)(void *)' but argument is of type 'void * (*)(void)'
164 | void *(*__start_routine) (void *),
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
busy.c:6:7: note: 'loop' declared here
6 | void *loop()
| ^~~~
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Upstream: https://github.com/opsengine/cpulimit/pull/127
---
tests/busy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/busy.c b/tests/busy.c
index b3afb7cd853b..93f0bcce67a8 100644
--- a/tests/busy.c
+++ b/tests/busy.c
@@ -3,7 +3,7 @@
#include <pthread.h>
#include <unistd.h>
-void *loop()
+void *loop(void *)
{
while(1);
}
@@ -23,7 +23,7 @@ int main(int argc, char **argv) {
exit(1);
}
}
- loop();
+ loop(NULL);
return 0;
}
--
2.43.0