]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
check for sys/pidfd.h
authorKhem Raj <raj.khem@gmail.com>
Sun, 7 Aug 2022 21:39:19 +0000 (14:39 -0700)
committerKhem Raj <raj.khem@gmail.com>
Sun, 7 Aug 2022 21:51:01 +0000 (14:51 -0700)
This header in newer glibc defines the signatures of functions
pidfd_send_signal() and pidfd_open() and when these functions are
defined by libc then we need to include the relevant header to get
the definitions. Clang 15+ has started to error out when function
signatures are missing.

Fixes errors like
misc-utils/kill.c:402:6: error: call to undeclared function 'pidfd_send_signal'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        if (pidfd_send_signal(pfd, ctl->numsig, &info, 0) < 0)

Signed-off-by: Khem Raj <raj.khem@gmail.com>
configure.ac
include/pidfd-utils.h

index 51deeecd4ee336cbe6acad82b4ef010a7bf43b8b..daa8f0dca492a4ec67bcd10d163a1eb0e742d623 100644 (file)
@@ -342,6 +342,7 @@ AC_CHECK_HEADERS([ \
        sys/mkdev.h \
        sys/mount.h \
        sys/param.h \
+       sys/pidfd.h \
        sys/prctl.h \
        sys/resource.h \
        sys/sendfile.h \
index eddede9767478be22eafd15f7fd69840362a9d02..d9e33cbc57ae38c874437a360a5d603f9db9c473 100644 (file)
@@ -4,8 +4,10 @@
 #ifdef HAVE_SYS_SYSCALL_H
 # include <sys/syscall.h>
 # if defined(SYS_pidfd_send_signal) && defined(SYS_pidfd_open)
+#  ifdef HAVE_SYS_PIDFD_H
+#   include <sys/pidfd.h>
+#  endif
 #  include <sys/types.h>
-
 #  ifndef HAVE_PIDFD_SEND_SIGNAL
 static inline int pidfd_send_signal(int pidfd, int sig, siginfo_t *info,
                                    unsigned int flags)