Initial Commit
- initial default booting image
This commit is contained in:
57
package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch
Normal file
57
package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch
Normal file
@@ -0,0 +1,57 @@
|
||||
From d1f42082590bed42cbf6ef1bf37e936df1afbf6b Mon Sep 17 00:00:00 2001
|
||||
From: Tobias Tangemann <tobias@tangemann.org>
|
||||
Date: Thu, 9 Jul 2015 23:51:07 +0200
|
||||
Subject: [PATCH] Fix crash (and compiler warnings)
|
||||
|
||||
[Upstream: https://github.com/opsengine/cpulimit/pull/48]
|
||||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
---
|
||||
src/cpulimit.c | 2 +-
|
||||
src/process_group.c | 4 ++++
|
||||
tests/process_iterator_test.c | 2 +-
|
||||
3 files changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/cpulimit.c b/src/cpulimit.c
|
||||
index 50eabeacf214..42d7ca280738 100644
|
||||
--- a/src/cpulimit.c
|
||||
+++ b/src/cpulimit.c
|
||||
@@ -43,7 +43,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
-#ifdef __APPLE__ || __FREEBSD__
|
||||
+#if defined(__APPLE__) || defined(__FREEBSD__)
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
|
||||
diff --git a/src/process_group.c b/src/process_group.c
|
||||
index 06d73a6f3541..c9e148cd1b60 100644
|
||||
--- a/src/process_group.c
|
||||
+++ b/src/process_group.c
|
||||
@@ -25,6 +25,10 @@
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
|
||||
+#if defined(__APPLE__) || defined(__FREEBSD__)
|
||||
+#include <libgen.h>
|
||||
+#endif
|
||||
+
|
||||
#include <assert.h>
|
||||
|
||||
#include "process_iterator.h"
|
||||
diff --git a/tests/process_iterator_test.c b/tests/process_iterator_test.c
|
||||
index 16151967eb24..1bfc167ba895 100644
|
||||
--- a/tests/process_iterator_test.c
|
||||
+++ b/tests/process_iterator_test.c
|
||||
@@ -28,7 +28,7 @@
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
|
||||
-#ifdef __APPLE__ || __FREEBSD__
|
||||
+#if defined(__APPLE__) || defined(__FREEBSD__)
|
||||
#include <libgen.h>
|
||||
#endif
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
From 4c1e021037550c437c7da3a276b95b5bf79e967e Mon Sep 17 00:00:00 2001
|
||||
From: Portia <stephensportia@gmail.com>
|
||||
Date: Sun, 1 May 2022 12:43:35 +1000
|
||||
Subject: [PATCH] Remove sys/sysctl.h and add missing libgen.h include
|
||||
|
||||
- sys/sysctl.h has been deprecated and should be removed
|
||||
- Adds missing libgen.h include when calling basename()
|
||||
|
||||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
[Upstream: https://github.com/opsengine/cpulimit/pull/109]
|
||||
---
|
||||
src/cpulimit.c | 1 -
|
||||
src/process_group.c | 1 +
|
||||
2 files changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/cpulimit.c b/src/cpulimit.c
|
||||
index 50eabeacf214..5b0ec4978f02 100644
|
||||
--- a/src/cpulimit.c
|
||||
+++ b/src/cpulimit.c
|
||||
@@ -38,7 +38,6 @@
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
-#include <sys/sysctl.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
diff --git a/src/process_group.c b/src/process_group.c
|
||||
index 06d73a6f3541..d4f6fab3385c 100644
|
||||
--- a/src/process_group.c
|
||||
+++ b/src/process_group.c
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <limits.h>
|
||||
#include <sys/time.h>
|
||||
#include <signal.h>
|
||||
+#include <libgen.h>
|
||||
|
||||
#if defined(__APPLE__) || defined(__FREEBSD__)
|
||||
#include <libgen.h>
|
||||
--
|
||||
2.25.1
|
||||
|
||||
26
package/cpulimit/0003-Fix-an-infrequent-crash.patch
Normal file
26
package/cpulimit/0003-Fix-an-infrequent-crash.patch
Normal file
@@ -0,0 +1,26 @@
|
||||
From 512998f967a9dab5e98010e1043985fc855d9f4e Mon Sep 17 00:00:00 2001
|
||||
From: Pavel Timofeev <timp87@gmail.com>
|
||||
Date: Thu, 14 Jul 2016 13:50:35 +0300
|
||||
Subject: [PATCH] Fix an infrequent crash
|
||||
|
||||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
[Upstream: https://github.com/opsengine/cpulimit/pull/61]
|
||||
---
|
||||
src/process_iterator_linux.c | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
diff --git a/src/process_iterator_linux.c b/src/process_iterator_linux.c
|
||||
index c8cdd07adcbe..93b44bab1755 100644
|
||||
--- a/src/process_iterator_linux.c
|
||||
+++ b/src/process_iterator_linux.c
|
||||
@@ -98,6 +98,7 @@ static int read_process_info(pid_t pid, struct process *p)
|
||||
//read command line
|
||||
sprintf(exefile,"/proc/%d/cmdline", p->pid);
|
||||
fd = fopen(exefile, "r");
|
||||
+ if (fd==NULL) return -1;
|
||||
if (fgets(buffer, sizeof(buffer), fd)==NULL) {
|
||||
fclose(fd);
|
||||
return -1;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
30
package/cpulimit/0004-Remove-procfs.h-inclusion.patch
Normal file
30
package/cpulimit/0004-Remove-procfs.h-inclusion.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
From 48a88c033c5704d37645051ca51799a8b5a7e059 Mon Sep 17 00:00:00 2001
|
||||
From: Florian Fainelli <f.fainelli@gmail.com>
|
||||
Date: Thu, 19 May 2022 14:22:40 -0700
|
||||
Subject: [PATCH] Remove procfs.h inclusion
|
||||
|
||||
We do not use anything from this header
|
||||
|
||||
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
||||
[Upstream: https://github.com/opsengine/cpulimit/pull/110]
|
||||
---
|
||||
src/process_iterator.c | 3 ---
|
||||
1 file changed, 3 deletions(-)
|
||||
|
||||
diff --git a/src/process_iterator.c b/src/process_iterator.c
|
||||
index 8b4019d237f2..5b6c651bc5d0 100644
|
||||
--- a/src/process_iterator.c
|
||||
+++ b/src/process_iterator.c
|
||||
@@ -22,9 +22,6 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
-#ifndef __APPLE__
|
||||
-#include <sys/procfs.h>
|
||||
-#endif
|
||||
#include <time.h>
|
||||
#include "process_iterator.h"
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
49
package/cpulimit/0005-Correct-loop-function-signature.patch
Normal file
49
package/cpulimit/0005-Correct-loop-function-signature.patch
Normal file
@@ -0,0 +1,49 @@
|
||||
From e94b6dd7b3ca884f72f02879fd85792a3aee961d 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..8acbcd82e04f 100644
|
||||
--- a/tests/busy.c
|
||||
+++ b/tests/busy.c
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <pthread.h>
|
||||
#include <unistd.h>
|
||||
|
||||
-void *loop()
|
||||
+void *loop(void *unused)
|
||||
{
|
||||
while(1);
|
||||
}
|
||||
@@ -23,7 +23,7 @@ int main(int argc, char **argv) {
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
- loop();
|
||||
+ loop(NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
13
package/cpulimit/Config.in
Normal file
13
package/cpulimit/Config.in
Normal file
@@ -0,0 +1,13 @@
|
||||
comment "cpulimit needs a toolchain w/ threads"
|
||||
depends on BR2_USE_MMU
|
||||
depends on !BR2_TOOLCHAIN_HAS_THREADS
|
||||
|
||||
config BR2_PACKAGE_CPULIMIT
|
||||
bool "cpulimit"
|
||||
depends on BR2_USE_MMU # fork()
|
||||
depends on BR2_TOOLCHAIN_HAS_THREADS
|
||||
help
|
||||
Cpulimit is a tool which limits the CPU usage of a process
|
||||
(expressed in percentage, not in CPU time)
|
||||
|
||||
https://github.com/opsengine/cpulimit
|
||||
3
package/cpulimit/cpulimit.hash
Normal file
3
package/cpulimit/cpulimit.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# sha256sum locally computed:
|
||||
sha256 64312f9ac569ddcadb615593cd002c94b76e93a0d4625d3ce1abb49e08e2c2da cpulimit-0.2.tar.gz
|
||||
sha256 920489ca9da706d842870701155e70a101315ba0783cff39765d7e15e0916a4a LICENSE
|
||||
23
package/cpulimit/cpulimit.mk
Normal file
23
package/cpulimit/cpulimit.mk
Normal file
@@ -0,0 +1,23 @@
|
||||
################################################################################
|
||||
#
|
||||
# cpulimit
|
||||
#
|
||||
################################################################################
|
||||
|
||||
CPULIMIT_VERSION = 0.2
|
||||
CPULIMIT_SITE = $(call github,opsengine,cpulimit,v$(CPULIMIT_VERSION))
|
||||
CPULIMIT_LICENSE = GPL-2.0+
|
||||
CPULIMIT_LICENSE_FILES = LICENSE
|
||||
|
||||
define CPULIMIT_BUILD_CMDS
|
||||
$(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D) \
|
||||
CFLAGS="$(TARGET_CFLAGS) -D_GNU_SOURCE" \
|
||||
LDLIBS="$(TARGET_LDFLAGS)"
|
||||
endef
|
||||
|
||||
define CPULIMIT_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -D -m 0755 $(@D)/src/cpulimit \
|
||||
$(TARGET_DIR)/usr/bin/cpulimit
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
||||
Reference in New Issue
Block a user