Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] Two small F_SETFL changes
@ 2026-07-17 17:07 Tom Tromey
  2026-07-17 17:07 ` [PATCH 1/2] Don't use F_SETFL in gdbreplay Tom Tromey
  2026-07-17 17:07 ` [PATCH 2/2] Use F_SETFL after F_SETOWN Tom Tromey
  0 siblings, 2 replies; 3+ messages in thread
From: Tom Tromey @ 2026-07-17 17:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

I was looking at the F_SETFL / SIGIO handling code in gdbserver
recently, and I noticed a couple of oddities.

This series fixes both of them.  I wouldn't expect these patches to
really affect anything in practice.

Signed-off-by: Tom Tromey <tromey@adacore.com>
---
Tom Tromey (2):
      Don't use F_SETFL in gdbreplay
      Use F_SETFL after F_SETOWN

 gdbserver/gdbreplay.cc    | 3 ---
 gdbserver/remote-utils.cc | 6 ++----
 2 files changed, 2 insertions(+), 7 deletions(-)
---
base-commit: f8ebb8db3bd5bcfaeaa42f803fe15300e65196ee
change-id: 20260717-f-setfl-1556b2b5ed46

Best regards,
--  
Tom Tromey <tromey@adacore.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] Don't use F_SETFL in gdbreplay
  2026-07-17 17:07 [PATCH 0/2] Two small F_SETFL changes Tom Tromey
@ 2026-07-17 17:07 ` Tom Tromey
  2026-07-17 17:07 ` [PATCH 2/2] Use F_SETFL after F_SETOWN Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2026-07-17 17:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

There's no need to call fcntl with F_SETFL in gdbreplay, as gdbreplay
does not use or need SIGIO.
---
 gdbserver/gdbreplay.cc | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/gdbserver/gdbreplay.cc b/gdbserver/gdbreplay.cc
index 4426dc316ec..ba03bf64b67 100644
--- a/gdbserver/gdbreplay.cc
+++ b/gdbserver/gdbreplay.cc
@@ -255,9 +255,6 @@ remote_open (const char *name)
 #endif
     }
 
-#if defined(F_SETFL) && defined (FASYNC)
-  fcntl (remote_desc_in, F_SETFL, FASYNC);
-#endif
   remote_desc_out = remote_desc_in;
 }
 

-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 2/2] Use F_SETFL after F_SETOWN
  2026-07-17 17:07 [PATCH 0/2] Two small F_SETFL changes Tom Tromey
  2026-07-17 17:07 ` [PATCH 1/2] Don't use F_SETFL in gdbreplay Tom Tromey
@ 2026-07-17 17:07 ` Tom Tromey
  1 sibling, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2026-07-17 17:07 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes enable_async_notification to use F_SETFL after F_SETOWN.
This order more correct because it ensures that the owning process is
set before the request to enable SIGIO.
---
 gdbserver/remote-utils.cc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gdbserver/remote-utils.cc b/gdbserver/remote-utils.cc
index ffde4956776..e92adf903ce 100644
--- a/gdbserver/remote-utils.cc
+++ b/gdbserver/remote-utils.cc
@@ -128,13 +128,11 @@ static void
 enable_async_notification (int fd)
 {
 #if defined(F_SETFL) && defined (FASYNC)
-  int save_fcntl_flags;
-
-  save_fcntl_flags = fcntl (fd, F_GETFL, 0);
-  fcntl (fd, F_SETFL, save_fcntl_flags | FASYNC);
 #if defined (F_SETOWN)
   fcntl (fd, F_SETOWN, getpid ());
 #endif
+  int save_fcntl_flags = fcntl (fd, F_GETFL, 0);
+  fcntl (fd, F_SETFL, save_fcntl_flags | FASYNC);
 #endif
 }
 

-- 
2.55.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-17 17:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-17 17:07 [PATCH 0/2] Two small F_SETFL changes Tom Tromey
2026-07-17 17:07 ` [PATCH 1/2] Don't use F_SETFL in gdbreplay Tom Tromey
2026-07-17 17:07 ` [PATCH 2/2] Use F_SETFL after F_SETOWN Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox