* [pushed] gdb: remove O_NOCTTY fallback definitions
@ 2026-10-22 16:57 Simon Marchi
2026-10-22 18:36 ` Tom Tromey
0 siblings, 1 reply; 2+ messages in thread
From: Simon Marchi @ 2026-10-22 16:57 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
top.c and inflow.c define O_NOCTTY to 0 if it is not defined. This is
unnecessary, since gnulib's fcntl.h already provides the same fallback:
‘O_DSYNC’, ‘O_NOCTTY’, ‘O_NOFOLLOW’, ‘O_RSYNC’, ‘O_SYNC’, and
‘O_TTY_INIT’ are not defined on some platforms. When not otherwise
defined, Gnulib defines these macros to 0, which is generally safe.
Other files use O_NOCTTY without defining the fallback, showing that the
gnulib fallback works.
Add fcntl-h to the list of imported gnulib modules, since we now
explicitly rely on it. Nothing changes in the import, since that module
was already imported as a dependency.
Change-Id: Ia4e34d5a2521a1e92f2d284b527e996e75f66d28
---
gdb/inflow.c | 4 ----
gdb/top.c | 4 ----
gnulib/import/Makefile.am | 1 +
gnulib/import/Makefile.in | 1 +
gnulib/import/m4/gnulib-cache.m4 | 2 ++
gnulib/update-gnulib.sh | 1 +
6 files changed, 5 insertions(+), 8 deletions(-)
diff --git a/gdb/inflow.c b/gdb/inflow.c
index c40ad2cf5294..9ad8e628363d 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -43,10 +43,6 @@
#include <sys/cygwin.h>
#endif
-#ifndef O_NOCTTY
-#define O_NOCTTY 0
-#endif
-
static void pass_signal (int);
static int gdb_has_a_terminal (void);
diff --git a/gdb/top.c b/gdb/top.c
index 308b5552fd5e..18d4bfcd4fd3 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -80,10 +80,6 @@
# include "tui/tui-io.h"
#endif
-#ifndef O_NOCTTY
-# define O_NOCTTY 0
-#endif
-
extern void initialize_all_files (void);
/* Default command line prompt. This is overridden in some configs. */
diff --git a/gnulib/import/Makefile.am b/gnulib/import/Makefile.am
index 1548615f131a..951965f54428 100644
--- a/gnulib/import/Makefile.am
+++ b/gnulib/import/Makefile.am
@@ -44,6 +44,7 @@
# dirent \
# dirfd \
# errno \
+# fcntl-h \
# ffs \
# fnmatch-gnu \
# frexpl \
diff --git a/gnulib/import/Makefile.in b/gnulib/import/Makefile.in
index 2e567c09d389..d8bb5ff429be 100644
--- a/gnulib/import/Makefile.in
+++ b/gnulib/import/Makefile.in
@@ -58,6 +58,7 @@
# dirent \
# dirfd \
# errno \
+# fcntl-h \
# ffs \
# fnmatch-gnu \
# frexpl \
diff --git a/gnulib/import/m4/gnulib-cache.m4 b/gnulib/import/m4/gnulib-cache.m4
index 0cf177add8e5..a0e6cf2bd4a0 100644
--- a/gnulib/import/m4/gnulib-cache.m4
+++ b/gnulib/import/m4/gnulib-cache.m4
@@ -49,6 +49,7 @@
# dirent \
# dirfd \
# errno \
+# fcntl-h \
# ffs \
# fnmatch-gnu \
# frexpl \
@@ -105,6 +106,7 @@ gl_MODULES([
dirent
dirfd
errno
+ fcntl-h
ffs
fnmatch-gnu
frexpl
diff --git a/gnulib/update-gnulib.sh b/gnulib/update-gnulib.sh
index 0e3964f1bbe9..f38b31f31faf 100755
--- a/gnulib/update-gnulib.sh
+++ b/gnulib/update-gnulib.sh
@@ -41,6 +41,7 @@ IMPORTED_GNULIB_MODULES="\
dirent \
dirfd \
errno \
+ fcntl-h \
ffs \
fnmatch-gnu \
frexpl \
base-commit: 3793336385dec373c5dc626bf9088041365d3701
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [pushed] gdb: remove O_NOCTTY fallback definitions
2026-10-22 16:57 [pushed] gdb: remove O_NOCTTY fallback definitions Simon Marchi
@ 2026-10-22 18:36 ` Tom Tromey
0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2026-10-22 18:36 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
>>>>> "Simon" == Simon Marchi <simon.marchi@efficios.com> writes:
Simon> top.c and inflow.c define O_NOCTTY to 0 if it is not defined. This is
Simon> unnecessary, since gnulib's fcntl.h already provides the same fallback:
Simon> ‘O_DSYNC’, ‘O_NOCTTY’, ‘O_NOFOLLOW’, ‘O_RSYNC’, ‘O_SYNC’, and
Simon> ‘O_TTY_INIT’ are not defined on some platforms. When not otherwise
Simon> defined, Gnulib defines these macros to 0, which is generally safe.
Simon> Other files use O_NOCTTY without defining the fallback, showing that the
Simon> gnulib fallback works.
Simon> Add fcntl-h to the list of imported gnulib modules, since we now
Simon> explicitly rely on it. Nothing changes in the import, since that module
Simon> was already imported as a dependency.
Thanks.
Approved-By: Tom Tromey <tom@tromey.com>
Tom
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-22 18:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-22 16:57 [pushed] gdb: remove O_NOCTTY fallback definitions Simon Marchi
2026-10-22 18:36 ` Tom Tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox