diff --git a/Cargo.toml b/Cargo.toml index 1277fbc434..ad741e1524 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ exclude = [ ] [dependencies] -libc = { git = "https://github.com/rust-lang/libc/", features = [ "extra_traits" ] } +libc = { git = "https://github.com/asomers/libc/", rev = "6f3ffc9bf8d2f4a8569db765c4b0623e90c8babf", features = [ "extra_traits" ] } bitflags = "1.1" cfg-if = "0.1.10" void = "1.0.2" diff --git a/src/sys/statfs.rs b/src/sys/statfs.rs index 8e421167dc..1a9c127141 100644 --- a/src/sys/statfs.rs +++ b/src/sys/statfs.rs @@ -75,6 +75,8 @@ pub const NFS_SUPER_MAGIC: FsType = FsType(libc::NFS_SUPER_MAGIC); #[cfg(all(target_os = "linux", not(target_env = "musl"), not(target_arch = "s390x")))] pub const OPENPROM_SUPER_MAGIC: FsType = FsType(libc::OPENPROM_SUPER_MAGIC); #[cfg(all(target_os = "linux", not(target_env = "musl"), not(target_arch = "s390x")))] +pub const OVERLAYFS_SUPER_MAGIC: FsType = FsType(libc::OVERLAYFS_SUPER_MAGIC); +#[cfg(all(target_os = "linux", not(target_env = "musl"), not(target_arch = "s390x")))] pub const PROC_SUPER_MAGIC: FsType = FsType(libc::PROC_SUPER_MAGIC); #[cfg(all(target_os = "linux", not(target_env = "musl"), not(target_arch = "s390x")))] pub const QNX4_SUPER_MAGIC: FsType = FsType(libc::QNX4_SUPER_MAGIC); diff --git a/test/test_fcntl.rs b/test/test_fcntl.rs index 61a7d144fd..c8f1e5a049 100644 --- a/test/test_fcntl.rs +++ b/test/test_fcntl.rs @@ -219,6 +219,13 @@ mod linux_android { let tmp = NamedTempFile::new().unwrap(); let fd = tmp.as_raw_fd(); + let statfs = nix::sys::statfs::fstatfs(&tmp).unwrap(); + if statfs.filesystem_type() == nix::sys::statfs::OVERLAYFS_SUPER_MAGIC { + // OverlayFS is a union file system. It returns one inode value in + // stat(2), but a different one shows up in /proc/locks. So we must + // skip the test. + skip!("/proc/locks does not work on overlayfs"); + } let inode = fstat(fd).expect("fstat failed").st_ino as usize; let mut flock = libc::flock { @@ -256,6 +263,12 @@ mod linux_android { println!("TMPDIR is {:?}", std::env::var("TMPDIR")); let statfs = nix::sys::statfs::fstatfs(&tmp).unwrap(); + if statfs.filesystem_type() == nix::sys::statfs::OVERLAYFS_SUPER_MAGIC { + // OverlayFS is a union file system. It returns one inode value in + // stat(2), but a different one shows up in /proc/locks. So we must + // skip the test. + skip!("/proc/locks does not work on overlayfs"); + } println!("fd fstatfs is {:?}", statfs); println!("fd fstatfs.filesystem_type() is {:?}", statfs.filesystem_type());