aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2021-06-17 16:16:54 +0100
committerPedro Alves <pedro@palves.net>2021-06-17 16:22:11 +0100
commit965febe599ab3a5f9fa17a7aaed4dd714f265ecd (patch)
tree6070fefce3712338afe42d5a13504b893a64223d /gdbsupport
parent96cbfd9f0488e9536bfc27550ebf90cb1ecac93b (diff)
downloadgdb-965febe599ab3a5f9fa17a7aaed4dd714f265ecd.zip
gdb-965febe599ab3a5f9fa17a7aaed4dd714f265ecd.tar.gz
gdb-965febe599ab3a5f9fa17a7aaed4dd714f265ecd.tar.bz2
Move scoped_ignore_sigttou to gdbsupport/
A following patch will want to use scoped_ignore_sigttou in code shared between GDB and GDBserver. Move it under gdbsupport/. Note that despite what inflow.h/inflow.c's first line says, inflow.c is no longer about ptrace, it is about terminal management. Some other files were unnecessarily including inflow.h, I guess a leftover from the days when inflow.c really was about ptrace. Those inclusions are simply dropped. gdb/ChangeLog: yyyy-mm-dd Pedro Alves <pedro@palves.net> * Makefile.in (HFILES_NO_SRCDIR): Remove inflow.h. * inf-ptrace.c, inflow.c, procfs.c: Don't include "inflow.h". * inflow.h: Delete, moved to gdbsupport/ under a different name. * ser-unix.c: Don't include "inflow.h". Include "gdbsupport/scoped_ignore_sigttou.h". gdbsupport/ChangeLog: yyyy-mm-dd Pedro Alves <pedro@palves.net> * scoped_ignore_sigttou.h: New file, moved from gdb/ and renamed. Change-Id: Ie390abf42c3a78bec6d282ad2a63edd3e623559a
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/ChangeLog4
-rw-r--r--gdbsupport/scoped_ignore_sigttou.h56
2 files changed, 60 insertions, 0 deletions
diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog
index b790a97..ac424f3 100644
--- a/gdbsupport/ChangeLog
+++ b/gdbsupport/ChangeLog
@@ -1,3 +1,7 @@
+2021-06-17 Pedro Alves <pedro@palves.net>
+
+ * scoped_ignore_sigttou.h: New file, moved from gdb/ and renamed.
+
2021-05-17 Andrew Burgess <andrew.burgess@embecosm.com>
* .dir-locals.el: Set sentence-end-double-space for all modes, and
diff --git a/gdbsupport/scoped_ignore_sigttou.h b/gdbsupport/scoped_ignore_sigttou.h
new file mode 100644
index 0000000..a313164
--- /dev/null
+++ b/gdbsupport/scoped_ignore_sigttou.h
@@ -0,0 +1,56 @@
+/* Support for signoring SIGTTOU.
+
+ Copyright (C) 2003-2021 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef SCOPED_IGNORE_SIGTTOU_H
+#define SCOPED_IGNORE_SIGTTOU_H
+
+#include <unistd.h>
+#include <signal.h>
+#include "gdbsupport/job-control.h"
+
+/* RAII class used to ignore SIGTTOU in a scope. */
+
+class scoped_ignore_sigttou
+{
+public:
+ scoped_ignore_sigttou ()
+ {
+#ifdef SIGTTOU
+ if (job_control)
+ m_osigttou = signal (SIGTTOU, SIG_IGN);
+#endif
+ }
+
+ ~scoped_ignore_sigttou ()
+ {
+#ifdef SIGTTOU
+ if (job_control)
+ signal (SIGTTOU, m_osigttou);
+#endif
+ }
+
+ DISABLE_COPY_AND_ASSIGN (scoped_ignore_sigttou);
+
+private:
+#ifdef SIGTTOU
+ sighandler_t m_osigttou = NULL;
+#endif
+};
+
+#endif /* SCOPED_IGNORE_SIGTTOU_H */