From cadb56d92e596d4922dda253e3ca374b0479627c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AE=87=E9=80=B8?= Date: Thu, 21 Aug 2025 01:06:51 +0800 Subject: [PATCH] Add flock support for cygwin --- library/std/src/sys/fs/unix.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/std/src/sys/fs/unix.rs b/library/std/src/sys/fs/unix.rs index 7ee9f3c445a04..0d710a4b2a6c8 100644 --- a/library/std/src/sys/fs/unix.rs +++ b/library/std/src/sys/fs/unix.rs @@ -1265,6 +1265,7 @@ impl File { target_os = "linux", target_os = "netbsd", target_os = "openbsd", + target_os = "cygwin", target_vendor = "apple", ))] pub fn lock(&self) -> io::Result<()> { @@ -1278,6 +1279,7 @@ impl File { target_os = "linux", target_os = "netbsd", target_os = "openbsd", + target_os = "cygwin", target_vendor = "apple", )))] pub fn lock(&self) -> io::Result<()> { @@ -1290,6 +1292,7 @@ impl File { target_os = "linux", target_os = "netbsd", target_os = "openbsd", + target_os = "cygwin", target_vendor = "apple", ))] pub fn lock_shared(&self) -> io::Result<()> { @@ -1303,6 +1306,7 @@ impl File { target_os = "linux", target_os = "netbsd", target_os = "openbsd", + target_os = "cygwin", target_vendor = "apple", )))] pub fn lock_shared(&self) -> io::Result<()> { @@ -1315,6 +1319,7 @@ impl File { target_os = "linux", target_os = "netbsd", target_os = "openbsd", + target_os = "cygwin", target_vendor = "apple", ))] pub fn try_lock(&self) -> Result<(), TryLockError> { @@ -1336,6 +1341,7 @@ impl File { target_os = "linux", target_os = "netbsd", target_os = "openbsd", + target_os = "cygwin", target_vendor = "apple", )))] pub fn try_lock(&self) -> Result<(), TryLockError> { @@ -1351,6 +1357,7 @@ impl File { target_os = "linux", target_os = "netbsd", target_os = "openbsd", + target_os = "cygwin", target_vendor = "apple", ))] pub fn try_lock_shared(&self) -> Result<(), TryLockError> { @@ -1372,6 +1379,7 @@ impl File { target_os = "linux", target_os = "netbsd", target_os = "openbsd", + target_os = "cygwin", target_vendor = "apple", )))] pub fn try_lock_shared(&self) -> Result<(), TryLockError> { @@ -1387,6 +1395,7 @@ impl File { target_os = "linux", target_os = "netbsd", target_os = "openbsd", + target_os = "cygwin", target_vendor = "apple", ))] pub fn unlock(&self) -> io::Result<()> { @@ -1400,6 +1409,7 @@ impl File { target_os = "linux", target_os = "netbsd", target_os = "openbsd", + target_os = "cygwin", target_vendor = "apple", )))] pub fn unlock(&self) -> io::Result<()> {