]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
refactor things to avoid an other header.
authorMark Harfouche <mark.harfouche@gmail.com>
Tue, 14 Jan 2025 16:25:19 +0000 (11:25 -0500)
committerGitHub <noreply@github.com>
Tue, 14 Jan 2025 16:25:19 +0000 (11:25 -0500)
lsfd-cmd/lsfd.c

index c10f0758bdb10285e1220236d5a63331601334af..8c5b8456fe05017101d3e1267f63b750e5a9eada 100644 (file)
 #include <sys/uio.h>
 #include <linux/sched.h>
 #include <sys/syscall.h>
-#include <errno.h>
 
 #ifdef HAVE_LINUX_KCMP_H
 #  include <linux/kcmp.h>
+#endif
+
+/* See proc(5).
+ * Defined in linux/include/linux/sched.h private header file. */
+#define PF_KTHREAD             0x00200000      /* I am a kernel thread */
+
+#include "c.h"
+#include "list.h"
+#include "closestream.h"
+#include "column-list-table.h"
+#include "strutils.h"
+#include "procfs.h"
+#include "fileutils.h"
+#include "idcache.h"
+#include "pathnames.h"
+
+#include "lsfd.h"
+
+// Make sure this ifdef block comes after all the includes since
+// c.h is required for the case where the system does not have kcmp.h
+#ifdef HAVE_LINUX_KCMP_H
 static int kcmp(pid_t pid1, pid_t pid2, int type,
                unsigned long idx1, unsigned long idx2)
 {
@@ -69,22 +89,6 @@ static int kcmp(pid_t pid1 __attribute__((__unused__)),
 }
 #endif
 
-/* See proc(5).
- * Defined in linux/include/linux/sched.h private header file. */
-#define PF_KTHREAD             0x00200000      /* I am a kernel thread */
-
-#include "c.h"
-#include "list.h"
-#include "closestream.h"
-#include "column-list-table.h"
-#include "strutils.h"
-#include "procfs.h"
-#include "fileutils.h"
-#include "idcache.h"
-#include "pathnames.h"
-
-#include "lsfd.h"
-
 UL_DEBUG_DEFINE_MASK(lsfd);
 UL_DEBUG_DEFINE_MASKNAMES(lsfd) = UL_DEBUG_EMPTY_MASKNAMES;