From: Rusty Russell Date: Fri, 13 Jun 2025 02:13:20 +0000 (+0930) Subject: fdpass: fix complilation on FreeBSD. X-Git-Url: http://git.ozlabs.org/?a=commitdiff_plain;h=HEAD;p=ccan fdpass: fix complilation on FreeBSD. ``` cc ccan/ccan/fdpass/fdpass.c ccan/ccan/fdpass/fdpass.c:16:12: error: use of undeclared identifier 'u_long'; did you mean 'long'? char buf[CMSG_SPACE(sizeof(fd))]; ^ /usr/include/sys/socket.h:577:25: note: expanded from macro 'CMSG_SPACE' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:16:12: error: use of undeclared identifier 'u_long' /usr/include/sys/socket.h:577:25: note: expanded from macro 'CMSG_SPACE' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:16:12: error: use of undeclared identifier 'u_long'; did you mean 'long'? /usr/include/sys/socket.h:577:58: note: expanded from macro 'CMSG_SPACE' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:16:12: error: use of undeclared identifier 'u_long' /usr/include/sys/socket.h:577:58: note: expanded from macro 'CMSG_SPACE' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:26:19: error: use of undeclared identifier 'u_long'; did you mean 'long'? cmsg->cmsg_len = CMSG_LEN(sizeof(fd)); ^ /usr/include/sys/socket.h:578:23: note: expanded from macro 'CMSG_LEN' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:26:19: error: use of undeclared identifier 'u_long' cmsg->cmsg_len = CMSG_LEN(sizeof(fd)); ^ /usr/include/sys/socket.h:578:23: note: expanded from macro 'CMSG_LEN' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:26:19: error: use of undeclared identifier 'u_long' /usr/include/sys/socket.h:578:23: note: expanded from macro 'CMSG_LEN' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:27:9: error: use of undeclared identifier 'u_long'; did you mean 'long'? memcpy(CMSG_DATA(cmsg), &fd, sizeof(fd)); ^ /usr/include/sys/socket.h:554:6: note: expanded from macro 'CMSG_DATA' _ALIGN(sizeof(struct cmsghdr))) ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:27:9: error: use of undeclared identifier 'u_long' /usr/include/sys/socket.h:554:6: note: expanded from macro 'CMSG_DATA' _ALIGN(sizeof(struct cmsghdr))) ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:53:12: error: use of undeclared identifier 'u_long'; did you mean 'long'? char buf[CMSG_SPACE(sizeof(fd))]; ^ /usr/include/sys/socket.h:577:25: note: expanded from macro 'CMSG_SPACE' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:53:12: error: use of undeclared identifier 'u_long' /usr/include/sys/socket.h:577:25: note: expanded from macro 'CMSG_SPACE' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:53:12: error: use of undeclared identifier 'u_long'; did you mean 'long'? /usr/include/sys/socket.h:577:58: note: expanded from macro 'CMSG_SPACE' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:74:27: error: use of undeclared identifier 'u_long'; did you mean 'long'? || cmsg->cmsg_len != CMSG_LEN(sizeof(fd)) ^ /usr/include/sys/socket.h:578:23: note: expanded from macro 'CMSG_LEN' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:74:27: error: use of undeclared identifier 'u_long' /usr/include/sys/socket.h:578:23: note: expanded from macro 'CMSG_LEN' ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:81:14: error: use of undeclared identifier 'u_long'; did you mean 'long'? memcpy(&fd, CMSG_DATA(cmsg), sizeof(fd)); ^ /usr/include/sys/socket.h:554:6: note: expanded from macro 'CMSG_DATA' _ALIGN(sizeof(struct cmsghdr))) ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ ccan/ccan/fdpass/fdpass.c:81:14: error: use of undeclared identifier 'u_long' /usr/include/sys/socket.h:554:6: note: expanded from macro 'CMSG_DATA' _ALIGN(sizeof(struct cmsghdr))) ^ /usr/include/machine/_align.h:45:22: note: expanded from macro '_ALIGN' ^ 16 errors generated. gmake: *** [Makefile:994: ccan-fdpass.o] Error 1 ``` Reported-by: https://github.com/21M4TW Signed-off-by: Rusty Russell --- diff --git a/ccan/fdpass/fdpass.c b/ccan/fdpass/fdpass.c index 7331468f..af1a7fdb 100644 --- a/ccan/fdpass/fdpass.c +++ b/ccan/fdpass/fdpass.c @@ -3,6 +3,7 @@ #include #include #include +#include bool fdpass_send(int sockout, int fd) {