canvenient: include <sys/time.h> for struct timeval on musl

canvenient_socketcan.c uses struct timeval without pulling in a header
that declares it; glibc gets it transitively, musl doesn't.

AI-Generated: Uses Claude Code

Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
This commit is contained in:
Khem Raj committed 2026-09-29 09:57:21 -07:00
1 parent 2838a98341
commit df137f3ffd
2 files changed
+33 -1

No files matched your search

@@ -17,7 +17,9 @@ DEPENDS = "libsocketcan"
PV .= "+git"
SRC_URI = "git://github.com/CANopenTerm/CANvenient.git;protocol=https;branch=main"
SRC_URI = "git://github.com/CANopenTerm/CANvenient.git;protocol=https;branch=main \
file://0001-CANvenient_SocketCAN-include-sys-time.h-for-struct-.patch \
"
SRCREV = "23408935f230f59632eafd56056824f8e91cd896"
@@ -0,0 +1,30 @@
From: Khem Raj <khem.raj@oss.qualcomm.com>
Date: Tue, 29 Sep 2026 01:54:51 +0000
Subject: [PATCH] CANvenient_SocketCAN: include sys/time.h for struct timeval
On glibc, <linux/can.h>/<sys/socket.h> transitively pull in a full
definition of struct timeval via <sys/time.h>. musl's headers do not
provide this transitive include, so struct timeval is only forward
declared (via <sys/types.h>) and the file fails to build with
"variable has incomplete type 'struct timeval'". Include
<sys/time.h> explicitly so the type is fully defined regardless of
libc.
Upstream-Status: Pending
Signed-off-by: Khem Raj <khem.raj@oss.qualcomm.com>
---
src/drivers/CANvenient_SocketCAN.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/drivers/CANvenient_SocketCAN.c b/src/drivers/CANvenient_SocketCAN.c
index 1111111..2222222 100644
--- a/src/drivers/CANvenient_SocketCAN.c
+++ b/src/drivers/CANvenient_SocketCAN.c
@@ -24,6 +24,7 @@
#include <linux/can.h>
#include <linux/can/raw.h>
#include <libsocketcan.h>
+#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#endif