Skip to contentSkip to conversation

include/json_print.h: add includes for `__u32` and `timeval` declarations

PATCH Applied Sergei Trofimovich 2 participants 2 messages Feb 23 – Feb 28

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 include/json_print.h: add includes for `__u32` and `timeval` declarations

Without the change the build fails on musl as:

```
../include/json_print.h:100:44: error: unknown type name ‘__u32’
  100 | unsigned int print_range(const char *name, __u32 start, __u32 end);
      |                                            ^~~~~
...
../include/json_print.h:82:30: warning: ‘struct timeval’ declared inside parameter list will not be visible outside of this definition or declaration
   82 | _PRINT_FUNC(tv, const struct timeval *)
      |                              ^~~~~~~
../include/json_print.h:57:45: note: in definition of macro ‘_PRINT_FUNC’
   57 |                                             type value)                 \
      |                                             ^~~~
../include/json_print.h: In function ‘print_tv’:
../include/json_print.h:60:48: error: passing argument 5 of ‘print_color_tv’ from incompatible pointer type [-Wincompatible-pointer-types]
   60 |                                                value);                  \
      |                                                ^~~~~
      |                                                |
      |                                                const struct timeval *
```
---
 include/json_print.h | 4 ++++
 1 file changed, 4 insertions(+)
include/json_print.h +4 -0
index 59edd5b2..c0d6315f 100644
@@ -8,6 +8,10 @@
 #ifndef _JSON_PRINT_H_
 #define _JSON_PRINT_H_
 
+#include <sys/time.h> /* struct timeval typedef */
+
+#include <asm/types.h> /* __u32 typedef */
+
 #include "json_writer.h"
 #include "color.h"
 
Signature · 1 line
2.52.0
#1 lore raw
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Hello:

This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Quoted 21 lines · On Mon, 23 Feb 2026 22:34:35 +0000 you wrote:

Without the change the build fails on musl as:

```
../include/json_print.h:100:44: error: unknown type name ‘__u32’
  100 | unsigned int print_range(const char *name, __u32 start, __u32 end);
      |                                            ^~~~~
...
../include/json_print.h:82:30: warning: ‘struct timeval’ declared inside parameter list will not be visible outside of this definition or declaration
   82 | _PRINT_FUNC(tv, const struct timeval *)
      |                              ^~~~~~~
../include/json_print.h:57:45: note: in definition of macro ‘_PRINT_FUNC’
   57 |                                             type value)                 \
      |                                             ^~~~
../include/json_print.h: In function ‘print_tv’:
../include/json_print.h:60:48: error: passing argument 5 of ‘print_color_tv’ from incompatible pointer type [-Wincompatible-pointer-types]
   60 |                                                value);                  \
      |                                                ^~~~~
      |                                                |
      |                                                const struct timeval *
```
Quoted 1 line

[...]

Here is the summary with links:
- [iproute2] include/json_print.h: add includes for __u32 and timeval declarations

    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=987be6691510

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html