All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] package/cpulimit: Backport a fix for an infrequent crash
@ 2022-05-19 22:07 Florian Fainelli
  2022-05-19 22:07 ` [Buildroot] [PATCH 2/2] package/cpulimit: Remove or1k/musl limitation Florian Fainelli
  2022-06-02 14:04 ` [Buildroot] [PATCH 1/2] package/cpulimit: Backport a fix for an infrequent crash Thomas Petazzoni via buildroot
  0 siblings, 2 replies; 3+ messages in thread
From: Florian Fainelli @ 2022-05-19 22:07 UTC (permalink / raw)
  To: buildroot; +Cc: Florian Fainelli, mmayer, thomas.petazzoni, yann.morin.1998

Backport the fix submitted from this pull request:

https://github.com/opsengine/cpulimit/pull/61

to fix an infrequent crash.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 .../0003-Fix-an-infrequent-crash.patch        | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 package/cpulimit/0003-Fix-an-infrequent-crash.patch

diff --git a/package/cpulimit/0003-Fix-an-infrequent-crash.patch b/package/cpulimit/0003-Fix-an-infrequent-crash.patch
new file mode 100644
index 000000000000..a19fb6e304d4
--- /dev/null
+++ b/package/cpulimit/0003-Fix-an-infrequent-crash.patch
@@ -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
+
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [Buildroot] [PATCH 2/2] package/cpulimit: Remove or1k/musl limitation
  2022-05-19 22:07 [Buildroot] [PATCH 1/2] package/cpulimit: Backport a fix for an infrequent crash Florian Fainelli
@ 2022-05-19 22:07 ` Florian Fainelli
  2022-06-02 14:04 ` [Buildroot] [PATCH 1/2] package/cpulimit: Backport a fix for an infrequent crash Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2022-05-19 22:07 UTC (permalink / raw)
  To: buildroot; +Cc: Florian Fainelli, mmayer, thomas.petazzoni, yann.morin.1998

It turns out that we can build cpulimit for or1k using musl-libc if we
remove the inclusion of the problematic procfs.h header file which is
not required at all. This is a backport of the following upstream pull
request:

https://github.com/opsengine/cpulimit/pull/110

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 .../0004-Remove-procfs.h-inclusion.patch      | 30 +++++++++++++++++++
 package/cpulimit/Config.in                    |  5 ++--
 2 files changed, 32 insertions(+), 3 deletions(-)
 create mode 100644 package/cpulimit/0004-Remove-procfs.h-inclusion.patch

diff --git a/package/cpulimit/0004-Remove-procfs.h-inclusion.patch b/package/cpulimit/0004-Remove-procfs.h-inclusion.patch
new file mode 100644
index 000000000000..771c2fe12c71
--- /dev/null
+++ b/package/cpulimit/0004-Remove-procfs.h-inclusion.patch
@@ -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
+
diff --git a/package/cpulimit/Config.in b/package/cpulimit/Config.in
index cca74afc9955..11a4f1da01e2 100644
--- a/package/cpulimit/Config.in
+++ b/package/cpulimit/Config.in
@@ -1,12 +1,11 @@
-comment "cpulimit needs a toolchain w/ threads, does not build open openrisc with musl"
+comment "cpulimit needs a toolchain w/ threads"
 	depends on BR2_USE_MMU
-	depends on !BR2_TOOLCHAIN_HAS_THREADS || (BR2_or1k && BR2_TOOLCHAIN_USES_MUSL)
+	depends on !BR2_TOOLCHAIN_HAS_THREADS
 
 config BR2_PACKAGE_CPULIMIT
 	bool "cpulimit"
 	depends on BR2_USE_MMU # fork()
 	depends on BR2_TOOLCHAIN_HAS_THREADS
-	depends on !(BR2_or1k && BR2_TOOLCHAIN_USES_MUSL)
 	help
 	  Cpulimit is a tool which limits the CPU usage of a process
 	  (expressed in percentage, not in CPU time)
-- 
2.25.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [PATCH 1/2] package/cpulimit: Backport a fix for an infrequent crash
  2022-05-19 22:07 [Buildroot] [PATCH 1/2] package/cpulimit: Backport a fix for an infrequent crash Florian Fainelli
  2022-05-19 22:07 ` [Buildroot] [PATCH 2/2] package/cpulimit: Remove or1k/musl limitation Florian Fainelli
@ 2022-06-02 14:04 ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Petazzoni via buildroot @ 2022-06-02 14:04 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: yann.morin.1998, mmayer, buildroot

On Thu, 19 May 2022 15:07:46 -0700
Florian Fainelli <f.fainelli@gmail.com> wrote:

> Backport the fix submitted from this pull request:
> 
> https://github.com/opsengine/cpulimit/pull/61
> 
> to fix an infrequent crash.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  .../0003-Fix-an-infrequent-crash.patch        | 26 +++++++++++++++++++
>  1 file changed, 26 insertions(+)
>  create mode 100644 package/cpulimit/0003-Fix-an-infrequent-crash.patch

Both applied to master. PATCH 2/2 isn't really a fix, but it makes
sense to have it in master IMO instead of this weird special case for
the or1k/musl situation.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-06-02 14:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-19 22:07 [Buildroot] [PATCH 1/2] package/cpulimit: Backport a fix for an infrequent crash Florian Fainelli
2022-05-19 22:07 ` [Buildroot] [PATCH 2/2] package/cpulimit: Remove or1k/musl limitation Florian Fainelli
2022-06-02 14:04 ` [Buildroot] [PATCH 1/2] package/cpulimit: Backport a fix for an infrequent crash Thomas Petazzoni via buildroot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.