-
Hi, I've been debugging crash caused by
Note 2 things:
However when debugging inside
There, Unfortunately my application is seeing the broken data. But, I don't have too much of a clue how this should work. net_ip is setting socklen_t when zephyr/include/zephyr/net/net_ip.h Lines 170 to 174 in 5ad9494 ... and But system headers shipped with Ubuntu are using uint32:
bits/types.h is included by many standard headers. Commit 6c934ab / PR #57196 has been dealing with this issue, but seems to only hide it? Should something be forcing __socklen_t_defined, or how? If I change socklen_t typedef from size_t to uint32_t I see my application is fine, and so it is also with 32 bit native_sim. In general, 4 bytes is more than enough to store the length of socket address? How do you see this should work? It's bit hard to create standalone reproducible example, but I can try that later if it is helpful. I am working on top of Zephyr 3.7. (Pinging @rlubos and @jukkar maybe as I think this is area of your expertise if it is appropriate to do that) |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
POSIX 2024 explains socklen_t type:
|
Beta Was this translation helpful? Give feedback.
-
It looks like we should define it as 32-bits in zephyr to make sure things work properly in native_sim_64. The size of 4 bytes is certainly enough to store the information. |
Beta Was this translation helpful? Give feedback.
-
Rather than using In any case, it seems to be 4 bytes in 32-bit and 64-bit GNU systems. cfriedt@ubuntu:/tmp$ gcc -m32 -o /tmp/blah /tmp/blah.c
cfriedt@ubuntu:/tmp$ /tmp/blah
sizeof(socklen_t): 4
cfriedt@ubuntu:/tmp$ gcc -m64 -o /tmp/blah /tmp/blah.c
cfriedt@ubuntu:/tmp$ /tmp/blah
sizeof(socklen_t): 4 In POSIX, we could also use a |
Beta Was this translation helpful? Give feedback.
Fixed by #96903