[Buildroot] [PATCH v2] package: Add cpulimit
Florian Fainelli
f.fainelli at gmail.com
Wed May 4 21:06:17 UTC 2022
On 5/4/22 14:02, Peter Korsgaard wrote:
>>>>>> "Florian" == Florian Fainelli <f.fainelli at gmail.com> 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 <f.fainelli at gmail.com>
> > ---
> > 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
>
> > +++ b/package/cpulimit/0001-Fix-crash-and-compiler-warnings.patch
> > @@ -0,0 +1,56 @@
> > +From d1f42082590bed42cbf6ef1bf37e936df1afbf6b Mon Sep 17 00:00:00 2001
> > +From: Tobias Tangemann <tobias at tangemann.org>
> > +Date: Thu, 9 Jul 2015 23:51:07 +0200
> > +Subject: [PATCH] Fix crash (and compiler warnings)
> > +
> > +Signed-off-by: Florian Fainelli <f.fainelli at 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
>
> Why 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__
| ^~
>
>
> > +################################################################################
> > +#
> > +# 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?
OK
>
>> +CPULIMIT_SITE = $(call github,opsengine,cpulimit,v$(CPULIMIT_VERSION))
>
> You have a 'v' here AND in CPULIMIT_VERSION, please drop it from
> CPULIMIT_VERSION.
Will do, thanks Peter.
--
Florian
More information about the buildroot
mailing list