From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 2/3] Don't set terminal flags twice in a row
Date: Thu, 02 Nov 2017 15:12:00 -0000 [thread overview]
Message-ID: <1509635522-16945-3-git-send-email-palves@redhat.com> (raw)
In-Reply-To: <1509635522-16945-1-git-send-email-palves@redhat.com>
I find this odd 'set flags twice' ancient code and comment annoyingly
distracting. It may well be that the reason for the double-set was
simply a copy/paste mistake, and that we've been doing this for
decades [1] for no good reason. Let's just get rid of it, and if we
find a real reason, add it back with a comment explaining why it's
necessary.
[1] This double-set was already in gdb 2.4 / 1988, the oldest release
we have sources for, and imported in git. From 'git show 7b4ac7e1ed2c
inflow.c':
+void
+terminal_inferior ()
+{
+ if (terminal_is_ours) /* && inferior_thisrun_terminal == 0) */
+ {
+ fcntl (0, F_SETFL, tflags_inferior);
+ fcntl (0, F_SETFL, tflags_inferior);
The "is there a reason" comment was added in 1993, by:
commit a88797b5eadf31e21804bc820429028bf708fbcd
Author: Fred Fish <fnf@specifix.com>
AuthorDate: Thu Aug 5 01:33:45 1993 +0000
gdb/ChangeLog:
yyyy-mm-dd Pedro Alves <palves@redhat.com>
* inflow.c (child_terminal_inferior, child_terminal_ours_1): No
longer set flags twice in row.
---
gdb/inflow.c | 9 ---------
1 file changed, 9 deletions(-)
diff --git a/gdb/inflow.c b/gdb/inflow.c
index a96d4fc..d46d693 100644
--- a/gdb/inflow.c
+++ b/gdb/inflow.c
@@ -244,10 +244,6 @@ child_terminal_inferior (struct target_ops *self)
int result;
#ifdef F_GETFL
- /* Is there a reason this is being done twice? It happens both
- places we use F_SETFL, so I'm inclined to think perhaps there
- is some reason, however perverse. Perhaps not though... */
- result = fcntl (0, F_SETFL, tinfo->tflags);
result = fcntl (0, F_SETFL, tinfo->tflags);
OOPSY ("fcntl F_SETFL");
#endif
@@ -403,11 +399,6 @@ child_terminal_ours_1 (int output_only)
#ifdef F_GETFL
tinfo->tflags = fcntl (0, F_GETFL, 0);
-
- /* Is there a reason this is being done twice? It happens both
- places we use F_SETFL, so I'm inclined to think perhaps there
- is some reason, however perverse. Perhaps not though... */
- result = fcntl (0, F_SETFL, our_terminal_info.tflags);
result = fcntl (0, F_SETFL, our_terminal_info.tflags);
#endif
}
--
2.5.5
next prev parent reply other threads:[~2017-11-02 15:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-02 15:12 [PATCH 0/3] Some terminal handling TCL Pedro Alves
2017-11-02 15:12 ` [PATCH 1/3] Assume termios is available, remove support for termio and sgtty Pedro Alves
2017-11-02 18:54 ` Sergio Durigan Junior
2017-11-02 19:27 ` Pedro Alves
2017-11-02 19:32 ` Sergio Durigan Junior
2017-11-06 16:11 ` Pedro Alves
2017-11-06 16:31 ` [pushed] Don't check termio.h and sgtty.h in common/common.m4 either (Re: [PATCH 1/3] Assume termios is available, remove support for termio and sgtty) Pedro Alves
2017-11-02 15:12 ` [PATCH 3/3] Eliminate STOP_SIGNAL, use SIGTSTP directly Pedro Alves
2017-11-02 15:12 ` Pedro Alves [this message]
2017-11-02 18:34 ` [PATCH 2/3] Don't set terminal flags twice in a row Sergio Durigan Junior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1509635522-16945-3-git-send-email-palves@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox