Fix build on non-Linux
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Sun, 11 Nov 2018 14:31:15 +0000 (18:31 +0400)
committerNikolaus Rath <Nikolaus@rath.org>
Sun, 11 Nov 2018 19:40:25 +0000 (19:40 +0000)
 * Update meson.build to add mount_util.c to libfuse_sources
   unconditionally, it's non Linux-only
 * FreeBSD, like NetBSD, doesn't have mntent.h, so don't include
   that and define IGNORE_MTAB for both
 * FreeBSD, like NetBSD, has no umount2() sysctl, so similarly define
   it to unmount()

lib/meson.build
lib/mount_util.c

index 492abf7d49832cf47565e13eae0f1bc0817887e3..996bcfd484dd07bc1f1f3c4592163b274896bb77 100644 (file)
@@ -1,10 +1,10 @@
 libfuse_sources = ['fuse.c', 'fuse_i.h', 'fuse_loop.c', 'fuse_loop_mt.c',
                    'fuse_lowlevel.c', 'fuse_misc.h', 'fuse_opt.c',
                    'fuse_signals.c', 'buffer.c', 'cuse_lowlevel.c',
-                  'helper.c', 'modules/subdir.c' ]
+                   'helper.c', 'modules/subdir.c', 'mount_util.c' ]
 
 if host_machine.system().startswith('linux')
-   libfuse_sources += [ 'mount.c', 'mount_util.c' ]
+   libfuse_sources += [ 'mount.c' ]
 else
    libfuse_sources += [ 'mount_bsd.c' ]
 endif
index 95e038f61d9a99b5c20c1964426b98aadd27e83d..48324c8a51bdfe3576bcc48e73343577941e82e5 100644 (file)
 #include <fcntl.h>
 #include <limits.h>
 #include <paths.h>
-#ifndef __NetBSD__
+#if !defined( __NetBSD__) && !defined(__FreeBSD__)
 #include <mntent.h>
+#else
+#define IGNORE_MTAB
 #endif
 #include <sys/stat.h>
 #include <sys/wait.h>
 #include <sys/mount.h>
 #include <sys/param.h>
 
-#ifdef __NetBSD__
+#if defined(__NetBSD__) || defined(__FreeBSD__)
 #define umount2(mnt, flags) unmount(mnt, (flags == 2) ? MNT_FORCE : 0)
 #endif