Skip to contentSkip to conversation

tools/sd-notify.h: Include string.h too

PATCH In review Andrew Cooper 3 participants 3 messages Dec 5, 2025 – Dec 10, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/sd-notify.h: Include string.h too

Alpine Linux, when using --enable-systemd to get the init files, fails with:

tools/include/xen-sd-notify.h:69:3: error: call to undeclared library function 'memcpy' with type 'void *(void *, const void *, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

     69 |   memcpy(socket_addr.sun.sun_path, socket_path, path_length);
        |   ^

This will be down to using musl rather than glibc. Include the appropriate header.

Fixes 78510f3a1522 ("tools: Import stand-alone sd_notify() implementation from systemd")

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

Example failure:
https://gitlab.com/xen-project/people/marmarek/xen/-/jobs/12336994239

---
 tools/include/xen-sd-notify.h | 1 +
 1 file changed, 1 insertion(+)
tools/include/xen-sd-notify.h +1 -0
index 28c9b20f152d..20441d0ec9b8 100644
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <unistd.h>

base-commit: d430c0a66e102fb12baeec6a178c20da7864d5b5
prerequisite-patch-id: 3db642dd7c06f6988283444c764cd646982775bb

Signature · 1 line
2.39.5
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Andrew Cooper

Alpine Linux, when using --enable-systemd to get the init files, fails with:

tools/include/xen-sd-notify.h:69:3: error: call to undeclared library function 'memcpy' with type 'void *(void *, const void *, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

     69 |   memcpy(socket_addr.sun.sun_path, socket_path, path_length);
        |   ^
Quoted 6 lines

This will be down to using musl rather than glibc. Include the appropriate header.

Fixes 78510f3a1522 ("tools: Import stand-alone sd_notify() implementation from systemd")

And also, this works:
https://gitlab.com/xen-project/people/marmarek/xen/-/pipelines/2199305972

Quoted 33 lines

---
CC: Anthony PERARD <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Julien Grall <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Marek Marczykowski-Górecki <[email protected]>

Example failure:
https://gitlab.com/xen-project/people/marmarek/xen/-/jobs/12336994239

---
 tools/include/xen-sd-notify.h | 1 +
 1 file changed, 1 insertion(+)
tools/include/xen-sd-notify.h +1 -0
index 28c9b20f152d..20441d0ec9b8 100644
@@ -20,6 +20,7 @@
 #include <errno.h>
 #include <stddef.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <unistd.h>

base-commit: d430c0a66e102fb12baeec6a178c20da7864d5b5
prerequisite-patch-id: 3db642dd7c06f6988283444c764cd646982775bb

Signature · 1 line
2.39.5
Signature · 3 lines
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
Acked-by on v1 1/1
#2 lore raw
In reply to Andrew Cooper
Quoted 9 lines · Andrew Cooper

Alpine Linux, when using --enable-systemd to get the init files, fails with:

tools/include/xen-sd-notify.h:69:3: error: call to undeclared library function 'memcpy' with type 'void *(void *, const void *, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

     69 |   memcpy(socket_addr.sun.sun_path, socket_path, path_length);
        |   ^
Quoted 6 lines

This will be down to using musl rather than glibc. Include the appropriate header.

Fixes 78510f3a1522 ("tools: Import stand-alone sd_notify() implementation from systemd")

Thanks,

Signature · 1 line
Anthony PERARD