* add #ifdefs when use statfs() and include statfs.h or vfs.h
Addresses: https://github.com/util-linux/util-linux/issues/1634
Signed-off-by: Karel Zak <kzak@redhat.com>
sys/socket.h \
sys/sockio.h \
sys/stat.h \
+ sys/statfs.h \
sys/swap.h \
sys/syscall.h \
sys/sysmacros.h \
sys/types.h \
sys/ucred.h \
sys/un.h \
+ sys/vfs.h \
sys/xattr.h \
unistd.h \
utmp.h \
#ifndef UTIL_LINUX_STATFS_MAGIC_H
#define UTIL_LINUX_STATFS_MAGIC_H
-#include <sys/statfs.h>
+#ifdef HAVE_SYS_STATFS_H
+# include <sys/statfs.h>
+#endif
/*
* If possible then don't depend on internal libc __SWORD_TYPE type.
*/
#include <ctype.h>
#include <unistd.h>
-#include <sys/vfs.h>
#include <errno.h>
+#ifdef HAVE_SYS_VFS_H
+# include <sys/vfs.h>
+# include "statfs_magic.h"
+#endif
+
#include "c.h"
#include "pathnames.h"
#include "procfs.h"
#include "all-io.h"
#include "debug.h"
#include "strutils.h"
-#include "statfs_magic.h"
static void procfs_process_deinit_path(struct path_cxt *pc);
return 0;
}
+#ifdef HAVE_SYS_VFS_H
/* checks if fd is file in a procfs;
* returns 1 if true, 0 if false or couldn't determine */
int fd_is_procfs(int fd)
} while (ret != 0);
return st.f_type == STATFS_PROC_MAGIC;
+ return 0;
}
+#else
+int fd_is_procfs(int fd __attribute__((__unused__)))
+{
+ return 0;
+}
+#endif
static char *strdup_procfs_file(pid_t pid, const char *name)
{
#include <ctype.h> /* tolower() */
#include <sys/ioctl.h>
-#if defined(HAVE_LINUX_FIEMAP_H)
+#if defined(HAVE_LINUX_FIEMAP_H) && defined(HAVE_SYS_VFS_H)
# include <linux/fs.h>
# include <linux/fiemap.h>
# ifdef FICLONE