diff --git a/Cargo.toml b/Cargo.toml index b5c017f7fe..56f1698626 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ exclude = [ ] [dependencies] -libc = { git = "https://github.com/rust-lang/libc/", features = [ "extra_traits" ] } +libc = { git = "https://github.com/asomers/libc/", rev = "1528ff12559b4902923f7ae253756f754b81ccb9", features = [ "extra_traits" ] } bitflags = "1.1" cfg-if = "0.1.10" diff --git a/src/sys/statfs.rs b/src/sys/statfs.rs index 3d46be9cad..e2b9e6b924 100644 --- a/src/sys/statfs.rs +++ b/src/sys/statfs.rs @@ -72,6 +72,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 c9f382bc9b..2971907224 100644 --- a/test/test_fcntl.rs +++ b/test/test_fcntl.rs @@ -228,11 +228,19 @@ mod linux_android { target_arch = "mips64", target_arch = "mips64el", target_arch = "powerpc64", - target_arch = "powerpc64le")))] + target_arch = "powerpc64le", + target_env = "musl")))] fn test_ofd_write_lock() { 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 { @@ -262,11 +270,19 @@ mod linux_android { target_arch = "mips64", target_arch = "mips64el", target_arch = "powerpc64", - target_arch = "powerpc64le")))] + target_arch = "powerpc64le", + target_env = "musl")))] fn test_ofd_read_lock() { 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 {