[newlib-cygwin] Cygwin: flock: Remove the unnecessary fdtab lock
Takashi Yano
tyan0@sourceware.org
Fri Jan 9 21:43:10 GMT 2026
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=cfb21d7d416018cccd58419d4769861c1f0aad2e
commit cfb21d7d416018cccd58419d4769861c1f0aad2e
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Thu Jan 8 21:20:04 2026 +0900
Cygwin: flock: Remove the unnecessary fdtab lock
There are two more fdtab enumerations using fdtab locking, one is in
inode_t::del_my_locks(), and the other is in fixup_lockf_after_exec().
They merely count the file descriptors affected by the corresponding
lock, so locking fdtab seems unnecessary. The latter runs only during
execve(), when no other threads exist. Therefore, these two locks are
redundant. This patch removes them.
Suggested-by: Corinna Vinschen <corinna@vinschen.de>
Reviewed-by: Corinna Vinschen <corinna@vinschen.de>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diff:
---
winsup/cygwin/flock.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/flock.cc b/winsup/cygwin/flock.cc
index 221501d65..857762f4a 100644
--- a/winsup/cygwin/flock.cc
+++ b/winsup/cygwin/flock.cc
@@ -379,7 +379,7 @@ inode_t::del_my_locks (long long id, HANDLE fhdl)
else if (id && lock->lf_id == id)
{
int cnt = 0;
- cygheap_fdenum cfd (true);
+ cygheap_fdenum cfd (false);
while (cfd.next () >= 0)
if (cfd->get_unique_id () == lock->lf_id && ++cnt > 1)
break;
@@ -441,7 +441,7 @@ fixup_lockf_after_exec (bool exec)
{
node->notused ();
int cnt = 0;
- cygheap_fdenum cfd (true);
+ cygheap_fdenum cfd (false);
while (cfd.next () >= 0)
if (cfd->get_dev () == node->i_dev
&& cfd->get_ino () == node->i_ino
More information about the Cygwin-cvs
mailing list