SO_PASSCRED and SCM_CREDENTIALS | error: use of undeclared identifier
Date: Wed, 20 Mar 2024 20:16:08 UTC
Hi Disclaimer: I am trying to create a new port (knot-resolver-current) developed under Linux upstream. A so-called manager functionality is brand new in comparison to the previous knot-resolver. The corresponding git repository is leading edge development. My main motivation is: learning how to create ports ;-) Compilation fails: cc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -fPIC -I/usr/local/include/python3.9 -c knot_resolver_manager/kresd_controller/supervisord/plugin/notifymodule.c -o build/temp.freebsd-14.0-STABLE-amd64-cpython-39/knot_resolver_manager/kresd_controller/supervisord/plugin/notifymodule.o knot_resolver_manager/kresd_controller/supervisord/plugin/notifymodule.c:52:42: error: use of undeclared identifier 'SO_PASSCRED' 52 | res = setsockopt(controlfd, SOL_SOCKET, SO_PASSCRED, &data, | ^ knot_resolver_manager/kresd_controller/supervisord/plugin/notifymodule.c:97:23: error: invalid application of 'sizeof' to an incomplete type 'struct ucred' 97 | char cmsg[CMSG_SPACE(sizeof(struct ucred))]; | ^ ~~~~~~~~~~~~~~ /usr/include/sys/socket.h:577:65: note: expanded from macro 'CMSG_SPACE' 577 | #define CMSG_SPACE(l) (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(l)) | ^ /usr/include/x86/_align.h:51:35: note: expanded from macro '_ALIGN' 51 | #define _ALIGN(p) (((__uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) | ^ knot_resolver_manager/kresd_controller/supervisord/plugin/notifymodule.c:97:37: note: forward declaration of 'struct ucred' 97 | char cmsg[CMSG_SPACE(sizeof(struct ucred))]; | ^ knot_resolver_manager/kresd_controller/supervisord/plugin/notifymodule.c:116:27: error: use of undeclared identifier 'SCM_CREDENTIALS' 116 | if (cmsgp->cmsg_type == SCM_CREDENTIALS) { | ^ knot_resolver_manager/kresd_controller/supervisord/plugin/notifymodule.c:118:36: error: invalid application of 'sizeof' to an incomplete type 'struct ucred' 118 | cmsgp->cmsg_len != CMSG_LEN(sizeof(struct ucred)) || | ^ ~~~~~~~~~~~~~~ /usr/include/sys/socket.h:578:57: note: expanded from macro 'CMSG_LEN' 578 | #define CMSG_LEN(l) (_ALIGN(sizeof(struct cmsghdr)) + (l)) | ^ knot_resolver_manager/kresd_controller/supervisord/plugin/notifymodule.c:97:37: note: forward declaration of 'struct ucred' 97 | char cmsg[CMSG_SPACE(sizeof(struct ucred))]; | ^ knot_resolver_manager/kresd_controller/supervisord/plugin/notifymodule.c:125:17: error: variable has incomplete type 'struct ucred' 125 | struct ucred cred; | ^ knot_resolver_manager/kresd_controller/supervisord/plugin/notifymodule.c:97:37: note: forward declaration of 'struct ucred' 97 | char cmsg[CMSG_SPACE(sizeof(struct ucred))]; | ^ 5 errors generated. error: command '/usr/bin/cc' failed with exit code 1 FAILED: install script '/bin/bash /wrkdirs/usr/ports/dns/knot-resolver-current/work/knot-resolver-v6.0.6/manager/scripts/install.sh /usr/local/bin/python3' failed with exit code 1. Both SO_PASSCRED and SCM_CREDENTIALS aren't defined in the complete git repository. Is there a way to include Linux compatibility regarding sockets? Thanks and regards, Michael