Skip to contentSkip to conversation

tools/thermal: tmon: include pthread and time headers in tmon.h

PATCH RESEND Applied Florian Fainelli 3 participants 4 messages Jul 18, 2022 – Jul 28, 2022 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 tools/thermal: tmon: include pthread and time headers in tmon.h

From: Markus Mayer <[email protected]>

Include sys/time.h and pthread.h in tmon.h, so that types "pthread_mutex_t" and "struct timeval tv" are known when tmon.h references them.

Without these headers, compiling tmon against musl-libc will fail with these errors:

In file included from sysfs.c:31:0:
tmon.h:47:8: error: unknown type name 'pthread_mutex_t'

 extern pthread_mutex_t input_lock;
        ^~~~~~~~~~~~~~~

make[3]: *** [<builtin>: sysfs.o] Error 1 make[3]: *** Waiting for unfinished jobs.... In file included from tui.c:31:0:
tmon.h:54:17: error: field 'tv' has incomplete type

  struct timeval tv;
                 ^~

make[3]: *** [<builtin>: tui.o] Error 1
make[2]: *** [Makefile:83: tmon] Error 2

---
This patch was first submitted here:

https://lore.kernel.org/all/[email protected]/

but never applied, meanwhile the issue is still present

 tools/thermal/tmon/tmon.h | 3 +++
 1 file changed, 3 insertions(+)
tools/thermal/tmon/tmon.h +3 -0
index c9066ec104dd..44d16d778f04 100644
@@ -27,6 +27,9 @@
 #define NR_LINES_TZDATA 1
 #define TMON_LOG_FILE "/var/tmp/tmon.log"
 
+#include <sys/time.h>
+#include <pthread.h>
+
 extern unsigned long ticktime;
 extern double time_elapsed;
 extern unsigned long target_temp_user;
Signature · 1 line
2.25.1
#1 lore raw
Quoted 27 lines · Florian Fainelli

From: Markus Mayer <[email protected]>

Include sys/time.h and pthread.h in tmon.h, so that types "pthread_mutex_t" and "struct timeval tv" are known when tmon.h references them.

Without these headers, compiling tmon against musl-libc will fail with these errors:

In file included from sysfs.c:31:0:
tmon.h:47:8: error: unknown type name 'pthread_mutex_t'

  extern pthread_mutex_t input_lock;
         ^~~~~~~~~~~~~~~

make[3]: *** [<builtin>: sysfs.o] Error 1 make[3]: *** Waiting for unfinished jobs.... In file included from tui.c:31:0:
tmon.h:54:17: error: field 'tv' has incomplete type

   struct timeval tv;
                  ^~

make[3]: *** [<builtin>: tui.o] Error 1
make[2]: *** [Makefile:83: tmon] Error 2

Quoted 6 lines

---
This patch was first submitted here:

https://lore.kernel.org/all/[email protected]/

but never applied, meanwhile the issue is still present

Daniel, Rafael, any chance to get that into v5.19-rc7? I should probably also have added:

Fixes 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal subsystem")

Thanks!

Signature · 1 line
Florian
#2 lore raw
Quoted 33 lines · Florian Fainelli
Quoted 30 lines · Florian Fainelli

From: Markus Mayer <[email protected]>

Include sys/time.h and pthread.h in tmon.h, so that types "pthread_mutex_t" and "struct timeval tv" are known when tmon.h references them.

Without these headers, compiling tmon against musl-libc will fail with these errors:

In file included from sysfs.c:31:0:
tmon.h:47:8: error: unknown type name 'pthread_mutex_t' extern pthread_mutex_t input_lock; ^~~~~~~~~~~~~~~
make[3]: *** [<builtin>: sysfs.o] Error 1 make[3]: *** Waiting for unfinished jobs.... In file included from tui.c:31:0:
tmon.h:54:17: error: field 'tv' has incomplete type struct timeval tv;
                  ^~
make[3]: *** [<builtin>: tui.o] Error 1 make[2]: *** [Makefile:83: tmon] Error 2

---
This patch was first submitted here:

Quoted 7 lines
Quoted 3 lines

https://lore.kernel.org/all/[email protected]/

but never applied, meanwhile the issue is still present

Daniel, Rafael, any chance to get that into v5.19-rc7? I should probably also have added:

Fixes 94f69966faf8 ("tools/thermal: Introduce tmon, a tool for thermal subsystem")

Yes, I'll pick it up

Thanks for resending

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#3 lore raw

[thermal: thermal/next] thermal/tools/tmon: Include pthread and time headers in tmon.h

In reply to Florian Fainelli
The following commit has been merged into the thermal/next branch of thermal:

The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     0cf51bfe999524377fbb71becb583b4ca6d07cfc
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//0cf51bfe999524377fbb71becb583b4ca6d07cfc
Author:        Markus Mayer <[email protected]>
AuthorDate:    Sun, 17 Jul 2022 20:10:39 -07:00
Committer:     Daniel Lezcano <[email protected]>
CommitterDate: Thu, 28 Jul 2022 17:29:51 +02:00

thermal/tools/tmon: Include pthread and time headers in tmon.h

Include sys/time.h and pthread.h in tmon.h, so that types "pthread_mutex_t" and "struct timeval tv" are known when tmon.h references them.

Without these headers, compiling tmon against musl-libc will fail with these errors:

In file included from sysfs.c:31:0:
tmon.h:47:8: error: unknown type name 'pthread_mutex_t'

 extern pthread_mutex_t input_lock;
        ^~~~~~~~~~~~~~~

make[3]: *** [<builtin>: sysfs.o] Error 1 make[3]: *** Waiting for unfinished jobs.... In file included from tui.c:31:0:
tmon.h:54:17: error: field 'tv' has incomplete type

  struct timeval tv;
                 ^~

make[3]: *** [<builtin>: tui.o] Error 1
make[2]: *** [Makefile:83: tmon] Error 2

---
 tools/thermal/tmon/tmon.h | 3 +++
 1 file changed, 3 insertions(+)
tools/thermal/tmon/tmon.h +3 -0
index c9066ec..44d16d7 100644
@@ -27,6 +27,9 @@
 #define NR_LINES_TZDATA 1
 #define TMON_LOG_FILE "/var/tmp/tmon.log"
 
+#include <sys/time.h>
+#include <pthread.h>
+
 extern unsigned long ticktime;
 extern double time_elapsed;
 extern unsigned long target_temp_user;