]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fincore: move sys/syscall.h include where it's needed master
authorKarel Zak <kzak@redhat.com>
Mon, 22 Jun 2026 09:43:39 +0000 (11:43 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 22 Jun 2026 09:43:39 +0000 (11:43 +0200)
Move the sys/syscall.h include inside the #ifndef HAVE_CACHESTAT block,
since it's only needed for the fallback SYS_cachestat definition.  Also
clean up indentation of nested #ifdefs.

Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/fincore.c

index 5603de59b791c30debff497cf72741c63e43a5f1..e0624cd280e36b2ca974364f06b10c2701c1c316 100644 (file)
@@ -20,9 +20,6 @@
 
 #include <sys/mman.h>
 #include <sys/stat.h>
-#ifdef HAVE_SYS_SYSCALL_H
-#include <sys/syscall.h>
-#endif
 #include <unistd.h>
 #include <getopt.h>
 #include <stdio.h>
 
 #ifndef HAVE_CACHESTAT
 
-#ifndef SYS_cachestat
-#if defined (__alpha__)
-#define SYS_cachestat 561
-#else
-#define SYS_cachestat 451
-#endif
-#endif
+# ifdef HAVE_SYS_SYSCALL_H
+#  include <sys/syscall.h>
+# endif
+
+# ifndef SYS_cachestat
+#  if defined (__alpha__)
+#   define SYS_cachestat 561
+#  else
+#   define SYS_cachestat 451
+#  endif
+# endif
 
 struct cachestat_range {
        uint64_t off;
@@ -80,8 +81,8 @@ static inline int cachestat(unsigned int fd,
        return syscall(SYS_cachestat, fd, cstat_range, cstat, flags);
 }
 
-#define HAVE_CACHESTAT 1
-#endif // HAVE_CACHESTAT
+# define HAVE_CACHESTAT 1
+#endif /* !HAVE_CACHESTAT */
 
 struct colinfo {
        const char * const name;