Open
Listed in
Description
While using socket API in cloud-hypervisor project, I noticed an inconsistency with msghdr
struct between gnu
and musl
targets.
In gnu
msghdr.msg_iovlen
is declared as size_t
libc/src/unix/linux_like/linux/gnu/mod.rs
Line 95 in 0488a83
In musl
msghdr.msg_iovlen
is declared as c_int
cloud-hypervisor/cloud-hypervisor#4642 (comment) describes the error I encountered due to this inconsistency.
Is this expected? If not, could you please fix it?
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
niluxv commentedon Oct 25, 2022
Hm, glibc seems to declare it as an integer too, see the glibc header source.
(The musl one is correct, see the musl header source.)
But changing it would be a breaking change I guess...
workingjubilee commentedon Mar 6, 2023
The glibc type should be corrected to match the glibc definition, we can consider this for 0.3
git-bruh commentedon Mar 6, 2024
The current declaration seems to be correct, the linux-specific socket.h header in glibc declares it as
size_t
: https://github.com/bminor/glibc/blob/b6e3898194bbae78910bbe9cd086937014961e45/sysdeps/unix/sysv/linux/bits/socket.h#L269niluxv commentedon Mar 7, 2024
My bad, I looked at the generic source 😞
niluxv commentedon Mar 7, 2024
So I suppose this issue can be closed then?
Amanieu commentedon Mar 15, 2024
See this musl commit for the background. Essentially, the glibc version matches the one used in the kernel. Musl uses a POSIX-ly correct variant, but then zero-fills the padding in the syscall wrapper before passing it on to the kernel.
It is hard to say what the correct approach is here.