From d78bf365a6149e4c8c47f469b997c71772d4517e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Tue, 16 Dec 2025 08:38:45 +0100 Subject: [PATCH] Enable file locking support for Hurd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit like Illumos (#148322) and aix (#148619), Hurd was missed when originally introducing locking gates per target OS in #132977. building rustc on Hurd was broken as a result since 1.91. Signed-off-by: Fabian Grünbichler --- library/std/src/fs/tests.rs | 4 ++++ library/std/src/sys/fs/unix.rs | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/library/std/src/fs/tests.rs b/library/std/src/fs/tests.rs index bcaafcfee787a..ec2f2307ca303 100644 --- a/library/std/src/fs/tests.rs +++ b/library/std/src/fs/tests.rs @@ -212,6 +212,7 @@ fn file_test_io_seek_and_write() { target_os = "cygwin", target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "illumos", target_os = "linux", target_os = "netbsd", @@ -244,6 +245,7 @@ fn file_lock_multiple_shared() { target_os = "cygwin", target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "illumos", target_os = "linux", target_os = "netbsd", @@ -277,6 +279,7 @@ fn file_lock_blocking() { target_os = "cygwin", target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "illumos", target_os = "linux", target_os = "netbsd", @@ -307,6 +310,7 @@ fn file_lock_drop() { target_os = "cygwin", target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "illumos", target_os = "linux", target_os = "netbsd", diff --git a/library/std/src/sys/fs/unix.rs b/library/std/src/sys/fs/unix.rs index ee3cb54a5ee6e..670bb425c0a27 100644 --- a/library/std/src/sys/fs/unix.rs +++ b/library/std/src/sys/fs/unix.rs @@ -1305,6 +1305,7 @@ impl File { #[cfg(any( target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "linux", target_os = "netbsd", target_os = "openbsd", @@ -1330,6 +1331,7 @@ impl File { #[cfg(not(any( target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "linux", target_os = "netbsd", target_os = "openbsd", @@ -1346,6 +1348,7 @@ impl File { #[cfg(any( target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "linux", target_os = "netbsd", target_os = "openbsd", @@ -1371,6 +1374,7 @@ impl File { #[cfg(not(any( target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "linux", target_os = "netbsd", target_os = "openbsd", @@ -1387,6 +1391,7 @@ impl File { #[cfg(any( target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "linux", target_os = "netbsd", target_os = "openbsd", @@ -1428,6 +1433,7 @@ impl File { #[cfg(not(any( target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "linux", target_os = "netbsd", target_os = "openbsd", @@ -1447,6 +1453,7 @@ impl File { #[cfg(any( target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "linux", target_os = "netbsd", target_os = "openbsd", @@ -1488,6 +1495,7 @@ impl File { #[cfg(not(any( target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "linux", target_os = "netbsd", target_os = "openbsd", @@ -1507,6 +1515,7 @@ impl File { #[cfg(any( target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "linux", target_os = "netbsd", target_os = "openbsd", @@ -1532,6 +1541,7 @@ impl File { #[cfg(not(any( target_os = "freebsd", target_os = "fuchsia", + target_os = "hurd", target_os = "linux", target_os = "netbsd", target_os = "openbsd",