* [PATCH] passt-repair: Build fixes for musl
@ 2025-02-05 16:00 Stefano Brivio
2025-02-05 16:06 ` Stefano Brivio
2025-02-05 22:31 ` David Gibson
0 siblings, 2 replies; 3+ messages in thread
From: Stefano Brivio @ 2025-02-05 16:00 UTC (permalink / raw)
To: passt-dev
When building against musl headers:
- sizeof() needs sttdef.h, as it should be;
- we can't initialise a struct msghdr by simply listing fields in
order, as they contain explicit padding fields. Use field names
instead.
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
passt-repair.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/passt-repair.c b/passt-repair.c
index 6f79423..3c3247b 100644
--- a/passt-repair.c
+++ b/passt-repair.c
@@ -21,6 +21,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <errno.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -75,7 +76,11 @@ int main(int argc, char **argv)
}
iov = (struct iovec){ &cmd, sizeof(cmd) };
- msg = (struct msghdr){ NULL, 0, &iov, 1, buf, sizeof(buf), 0 };
+ msg = (struct msghdr){ .msg_name = NULL, .msg_namelen = 0,
+ .msg_iov = &iov, .msg_iovlen = 1,
+ .msg_control = buf,
+ .msg_controllen = sizeof(buf),
+ .msg_flags = 0 };
cmsg = CMSG_FIRSTHDR(&msg);
if (argc != 2) {
--
@@ -21,6 +21,7 @@
#include <sys/socket.h>
#include <sys/un.h>
#include <errno.h>
+#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -75,7 +76,11 @@ int main(int argc, char **argv)
}
iov = (struct iovec){ &cmd, sizeof(cmd) };
- msg = (struct msghdr){ NULL, 0, &iov, 1, buf, sizeof(buf), 0 };
+ msg = (struct msghdr){ .msg_name = NULL, .msg_namelen = 0,
+ .msg_iov = &iov, .msg_iovlen = 1,
+ .msg_control = buf,
+ .msg_controllen = sizeof(buf),
+ .msg_flags = 0 };
cmsg = CMSG_FIRSTHDR(&msg);
if (argc != 2) {
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] passt-repair: Build fixes for musl
2025-02-05 16:00 [PATCH] passt-repair: Build fixes for musl Stefano Brivio
@ 2025-02-05 16:06 ` Stefano Brivio
2025-02-05 22:31 ` David Gibson
1 sibling, 0 replies; 3+ messages in thread
From: Stefano Brivio @ 2025-02-05 16:06 UTC (permalink / raw)
To: passt-dev
On Wed, 5 Feb 2025 17:00:06 +0100
Stefano Brivio <sbrivio@redhat.com> wrote:
> When building against musl headers:
>
> - sizeof() needs sttdef.h, as it should be;
stddef.h, of course...
--
Stefano
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] passt-repair: Build fixes for musl
2025-02-05 16:00 [PATCH] passt-repair: Build fixes for musl Stefano Brivio
2025-02-05 16:06 ` Stefano Brivio
@ 2025-02-05 22:31 ` David Gibson
1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2025-02-05 22:31 UTC (permalink / raw)
To: Stefano Brivio; +Cc: passt-dev
[-- Attachment #1: Type: text/plain, Size: 1507 bytes --]
On Wed, Feb 05, 2025 at 05:00:06PM +0100, Stefano Brivio wrote:
> When building against musl headers:
>
> - sizeof() needs sttdef.h, as it should be;
>
> - we can't initialise a struct msghdr by simply listing fields in
> order, as they contain explicit padding fields. Use field names
> instead.
>
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> passt-repair.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/passt-repair.c b/passt-repair.c
> index 6f79423..3c3247b 100644
> --- a/passt-repair.c
> +++ b/passt-repair.c
> @@ -21,6 +21,7 @@
> #include <sys/socket.h>
> #include <sys/un.h>
> #include <errno.h>
> +#include <stddef.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> @@ -75,7 +76,11 @@ int main(int argc, char **argv)
> }
>
> iov = (struct iovec){ &cmd, sizeof(cmd) };
> - msg = (struct msghdr){ NULL, 0, &iov, 1, buf, sizeof(buf), 0 };
> + msg = (struct msghdr){ .msg_name = NULL, .msg_namelen = 0,
> + .msg_iov = &iov, .msg_iovlen = 1,
> + .msg_control = buf,
> + .msg_controllen = sizeof(buf),
> + .msg_flags = 0 };
> cmsg = CMSG_FIRSTHDR(&msg);
>
> if (argc != 2) {
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-05 22:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-02-05 16:00 [PATCH] passt-repair: Build fixes for musl Stefano Brivio
2025-02-05 16:06 ` Stefano Brivio
2025-02-05 22:31 ` David Gibson
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).