From 9673d8d543c5fa8f14b168beed8280b98baf64cf Mon Sep 17 00:00:00 2001 From: Petr Sumbera Date: Tue, 4 Feb 2025 11:51:08 +0000 Subject: [PATCH] Fix build on Solaris where is no flock(). --- src/tools/miri/src/shims/unix/fs.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/tools/miri/src/shims/unix/fs.rs b/src/tools/miri/src/shims/unix/fs.rs index c7399b00d3fe..924dbb887999 100644 --- a/src/tools/miri/src/shims/unix/fs.rs +++ b/src/tools/miri/src/shims/unix/fs.rs @@ -178,7 +178,7 @@ impl UnixFileDescription for FileHandle { op: FlockOp, ) -> InterpResult<'tcx, io::Result<()>> { assert!(communicate_allowed, "isolation should have prevented even opening a file"); - #[cfg(target_family = "unix")] + #[cfg(all(target_family = "unix", not(target_os = "solaris")))] { use std::os::fd::AsRawFd; @@ -260,10 +260,15 @@ impl UnixFileDescription for FileHandle { interp_ok(res) } - #[cfg(not(any(target_family = "unix", target_family = "windows")))] + #[cfg(not(any( + all(target_family = "unix", not(target_os = "solaris")), + target_family = "windows" + )))] { let _ = op; - compile_error!("flock is supported only on UNIX and Windows hosts"); + throw_unsup_format!( + "flock is supported only on UNIX (except Solaris) and Windows hosts" + ); } } }