package: Add cpulimit
PATCH v2 1/1 package: Add cpulimit
Cpulimit is a tool which limits the CPU usage of a process (expressed in percentage, not in CPU time). It is useful to control batch jobs, when you don't want them to eat too many CPU cycles.
---
Changes in v2:
- added DEVELOPERS entry
- back ported 2 patches from upstream project pull requests to address build warnings
- added _GNU_SOURCE to the CFLAGS
- added hash file
- corrected check-package warnings
DEVELOPERS | 3 + package/Config.in | 1 + ...0001-Fix-crash-and-compiler-warnings.patch | 56 +++++++++++++++++++ ...l.h-and-add-missing-libgen.h-include.patch | 41 ++++++++++++++ package/cpulimit/Config.in | 7 +++ package/cpulimit/cpulimit.hash | 3 + package/cpulimit/cpulimit.mk | 24 ++++++++ 7 files changed, 135 insertions(+) create mode 100644 package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch create mode 100644 package/cpulimit/0002-Remove-sys-sysctl.h-and-add-missing-libgen.h-include.patch create mode 100644 package/cpulimit/Config.in create mode 100644 package/cpulimit/cpulimit.hash create mode 100644 package/cpulimit/cpulimit.mk
DEVELOPERS +3 -0
@@ -965,6 +965,9 @@ N: Filip Skoneczny <[email protected]> F: board/sinovoip/m1-plus F: configs/bananapi_m1_plus_defconfig +N: Florian Fainelli <[email protected]> +F: package/cpulimit/ + N: Floris Bos <[email protected]> F: package/ipmitool/ F: package/odhcploc/
package/Config.in +1 -0
@@ -2522,6 +2522,7 @@ menu "System tools" source "package/circus/Config.in" source "package/containerd/Config.in" source "package/coreutils/Config.in" + source "package/cpulimit/Config.in" source "package/cpuload/Config.in" source "package/daemon/Config.in" source "package/dc3dd/Config.in"
package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch new file +56 -0
56 lines not on this page · raw message
package/cpulimit/0002-Remove-sys-sysctl.h-and-add-missing-libgen.h-include.patch new file +41 -0
41 lines not on this page · raw message
package/cpulimit/Config.in new file +7 -0
@@ -0,0 +1,7 @@ +config BR2_PACKAGE_CPULIMIT + bool "cpulimit" + 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
package/cpulimit/cpulimit.hash new file +3 -0
@@ -0,0 +1,3 @@ +# sha256sum locally computed: +sha256 64312f9ac569ddcadb615593cd002c94b76e93a0d4625d3ce1abb49e08e2c2da v0.2.tar.gz +sha256 920489ca9da706d842870701155e70a101315ba0783cff39765d7e15e0916a4a LICENSE
package/cpulimit/cpulimit.mk new file +24 -0
@@ -0,0 +1,24 @@ +################################################################################ +# +# cpulimit +# +################################################################################ + +CPULIMIT_VERSION = v0.2 +CPULIMIT_SOURCE = $(CPULIMIT_VERSION).tar.gz +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))
Signature · 6 lines
2.25.1 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 33 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Florian" == Florian Fainelli <[email protected]> writes:
Cpulimit is a tool which limits the CPU usage of a process (expressed in percentage, not in CPU time). It is useful to control batch jobs, when you don't want them to eat too many CPU cycles.
Signed-off-by Florian Fainelli <[email protected]>---
Changes in v2:- added DEVELOPERS entry
- back ported 2 patches from upstream project pull requests to address build warnings
- added_GNU_SOURCEto the CFLAGS
- added hash file
- corrected check-package warnings+++
b/package/cpulimit/0001-Fix-crash-and-compiler-warnings.patchpackage/cpulimit/0001-Fix-crash-and-compiler-warnings.patch new file +14
-0@@ -0,0 +1,56 @@ +From d1f42082590bed42cbf6ef1bf37e936df1afbf6b Mon Sep 17 00:00:00 2001 +From: Tobias Tangemann <[email protected]> +Date: Thu, 9 Jul 2015 23:51:07 +0200 +Subject: [PATCH] Fix crash (and compiler warnings) + +Signed-off-by: Florian Fainelli <[email protected]> +--- + 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
package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch line 24
Quoted 10 lines
package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch new file +10
-0+--- 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
Why is this patch interesting in the context of Buildroot? Presumably neither __APPLE__ or __FREEBSD__ will be defined?
package/cpulimit/cpulimit.mk line 8
Quoted 8 lines
package/cpulimit/cpulimit.mk new file +8
-0+################################################################################ +# +# cpulimit +# +################################################################################ + +CPULIMIT_VERSION = v0.2 +CPULIMIT_SOURCE = $(CPULIMIT_VERSION).tar.gz
You can drop CPULIMIT_SOURCE (which will make Buildroot use cpulimit-$(CPULIMIT_VERSION).tar.gz). Don't forget to update the .hash file as well?
package/cpulimit/cpulimit.mk line 9
Quoted 1 line
package/cpulimit/cpulimit.mk new file +1
-0+CPULIMIT_SITE = $(call github,opsengine,cpulimit,v$(CPULIMIT_VERSION))
You have a 'v' here AND in CPULIMIT_VERSION, please drop it from CPULIMIT_VERSION.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 38 lines · Peter Korsgaard
Quoted 38 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Florian" == Florian Fainelli <[email protected]> writes:
Cpulimit is a tool which limits the CPU usage of a process (expressed in percentage, not in CPU time). It is useful to control batch jobs, when you don't want them to eat too many CPU cycles.
Signed-off-by Florian Fainelli <[email protected]>---
Changes in v2:- added DEVELOPERS entry
- back ported 2 patches from upstream project pull requests to address build warnings
- added_GNU_SOURCEto the CFLAGS
- added hash file
- corrected check-package warnings+++
b/package/cpulimit/0001-Fix-crash-and-compiler-warnings.patchpackage/cpulimit/0001-Fix-crash-and-compiler-warnings.patch new file +19
-0@@ -0,0 +1,56 @@ +From d1f42082590bed42cbf6ef1bf37e936df1afbf6b Mon Sep 17 00:00:00 2001 +From: Tobias Tangemann <[email protected]> +Date: Thu, 9 Jul 2015 23:51:07 +0200 +Subject: [PATCH] Fix crash (and compiler warnings) + +Signed-off-by: Florian Fainelli <[email protected]> +--- + 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>
Quoted 8 lines
package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch line 24
Quoted 5 lines
package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch new file +5
-0+ +-#ifdef __APPLE__ || __FREEBSD__ ++#if defined(__APPLE__) || defined(__FREEBSD__) + #include <libgen.h> + #endifWhy is this patch interesting in the context of Buildroot? Presumably neither
__APPLE__or__FREEBSD__will be defined?
Right, neither would be defined and therefore we would get the following build warning:
/usr/include/x86_64-linux-gnu/sys/sysctl.h:21:2: warning: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Wcpp]
21 | #warning "The <sys/sysctl.h> header is deprecated and will be
removed."
| ^~~~~~~
cpulimit.c:46:18: warning: extra tokens at end of #ifdef directive
46 | #ifdef __APPLE__ || __FREEBSD__
| ^~Quoted 14 lines
package/cpulimit/cpulimit.mk line 8
Quoted 10 lines
package/cpulimit/cpulimit.mk new file +8
-0+################################################################################ +# +# cpulimit +# +################################################################################ + +CPULIMIT_VERSION = v0.2 +CPULIMIT_SOURCE = $(CPULIMIT_VERSION).tar.gzYou can drop
CPULIMIT_SOURCE(which will make Buildroot use cpulimit-$(CPULIMIT_VERSION).tar.gz). Don't forget to update the .hash file as well?
OK
Quoted 5 lines
package/cpulimit/cpulimit.mk line 9
Quoted 2 lines
package/cpulimit/cpulimit.mk new file +1
-0+CPULIMIT_SITE = $(call github,opsengine,cpulimit,v$(CPULIMIT_VERSION))You have a 'v' here AND in
CPULIMIT_VERSION, please drop it fromCPULIMIT_VERSION.
Will do, thanks Peter.
Signature · 5 lines
Florian _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Florian" == Florian Fainelli <[email protected]> writes:
Hi,
Quoted 28 lines
Quoted 16 lines
Quoted 16 lines
package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch new file +16
-0+Subject: [PATCH] Fix crash (and compiler warnings) + +Signed-off-by: Florian Fainelli <[email protected]> +--- + 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>Quoted 8 lines
Quoted 5 lines
+
+-#ifdef __APPLE__ || __FREEBSD__ ++#if defined(__APPLE__) || defined(__FREEBSD__)+ #include <
libgen.h>
+ #endifWhy is this patch interesting in the context of Buildroot? Presumably
neither__APPLE__or__FREEBSD__will be defined?Right, neither would be defined and therefore we would get the following build warning:
Quoted 8 lines
/usr/include/x86_64-linux-gnu/sys/sysctl.h:21:2: warning: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Wcpp]
21 | #warning "The <sys/sysctl.h> header is deprecated and will be removed."| ^~~~~~~ cpulimit.c:46:18: warning: extra tokens at end of #ifdef directive 46 | #ifdef __APPLE__ || __FREEBSD__ | ^~
Ok, so it is about the 2nd warning? The commit message mentioned something about a crash, which sounded odd to me.
Signature · 5 lines
Bye, Peter Korsgaard _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot