equal
deleted
inserted
replaced
25 #include <sys/types.h> |
25 #include <sys/types.h> |
26 #include <unistd.h> |
26 #include <unistd.h> |
27 #ifdef HAVE_LINUX_MAGIC_H |
27 #ifdef HAVE_LINUX_MAGIC_H |
28 #include <linux/magic.h> |
28 #include <linux/magic.h> |
29 #endif |
29 #endif |
30 #ifdef HAVE_SYS_MOUNT_H |
30 #ifdef HAVE_BSD_STATFS |
31 #include <sys/mount.h> |
31 #include <sys/mount.h> |
32 #endif |
|
33 #ifdef HAVE_SYS_PARAM_H |
|
34 #include <sys/param.h> |
32 #include <sys/param.h> |
35 #endif |
33 #endif |
36 #ifdef HAVE_SYS_VFS_H |
34 #ifdef HAVE_SYS_VFS_H |
37 #include <sys/vfs.h> |
35 #include <sys/vfs.h> |
38 #endif |
36 #endif |
799 #endif /* ndef SETPROCNAME_USE_NONE */ |
797 #endif /* ndef SETPROCNAME_USE_NONE */ |
800 |
798 |
801 #ifdef HAVE_STATFS |
799 #ifdef HAVE_STATFS |
802 /* given a directory path, return filesystem type (best-effort), or None */ |
800 /* given a directory path, return filesystem type (best-effort), or None */ |
803 const char *getfstype(const char *path) { |
801 const char *getfstype(const char *path) { |
|
802 #ifdef HAVE_BSD_STATFS |
|
803 /* need to return a string field */ |
|
804 static struct statfs buf; |
|
805 #else |
804 struct statfs buf; |
806 struct statfs buf; |
|
807 #endif |
805 int r; |
808 int r; |
806 memset(&buf, 0, sizeof(buf)); |
809 memset(&buf, 0, sizeof(buf)); |
807 r = statfs(path, &buf); |
810 r = statfs(path, &buf); |
808 if (r != 0) |
811 if (r != 0) |
809 return NULL; |
812 return NULL; |
|
813 #ifdef HAVE_BSD_STATFS |
|
814 /* BSD or OSX provides a f_fstypename field */ |
|
815 return buf.f_fstypename; |
|
816 #endif |
810 /* Begin of Linux filesystems */ |
817 /* Begin of Linux filesystems */ |
811 #ifdef ADFS_SUPER_MAGIC |
818 #ifdef ADFS_SUPER_MAGIC |
812 if (buf.f_type == ADFS_SUPER_MAGIC) |
819 if (buf.f_type == ADFS_SUPER_MAGIC) |
813 return "adfs"; |
820 return "adfs"; |
814 #endif |
821 #endif |