GDB (API)
/home/stan/gdb/src/gdb/terminal.h
Go to the documentation of this file.
00001 /* Terminal interface definitions for GDB, the GNU Debugger.
00002    Copyright (C) 1986-2013 Free Software Foundation, Inc.
00003 
00004    This file is part of GDB.
00005 
00006    This program is free software; you can redistribute it and/or modify
00007    it under the terms of the GNU General Public License as published by
00008    the Free Software Foundation; either version 3 of the License, or
00009    (at your option) any later version.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
00018 
00019 #if !defined (TERMINAL_H)
00020 #define TERMINAL_H 1
00021 
00022 
00023 /* If we're using autoconf, it will define HAVE_TERMIOS_H,
00024    HAVE_TERMIO_H and HAVE_SGTTY_H for us.  One day we can rewrite
00025    ser-unix.c and inflow.c to inspect those names instead of
00026    HAVE_TERMIOS, HAVE_TERMIO and the implicit HAVE_SGTTY (when neither
00027    HAVE_TERMIOS or HAVE_TERMIO is set).  Until then, make sure that
00028    nothing has already defined the one of the names, and do the right
00029    thing.  */
00030 
00031 #if !defined (HAVE_TERMIOS) && !defined(HAVE_TERMIO) && !defined(HAVE_SGTTY)
00032 #if defined(HAVE_TERMIOS_H)
00033 #define HAVE_TERMIOS
00034 #else /* ! defined (HAVE_TERMIOS_H) */
00035 #if defined(HAVE_TERMIO_H)
00036 #define HAVE_TERMIO
00037 #else /* ! defined (HAVE_TERMIO_H) */
00038 #if defined(HAVE_SGTTY_H)
00039 #define HAVE_SGTTY
00040 #endif /* ! defined (HAVE_SGTTY_H) */
00041 #endif /* ! defined (HAVE_TERMIO_H) */
00042 #endif /* ! defined (HAVE_TERMIOS_H) */
00043 #endif /* !defined (HAVE_TERMIOS) && !defined (HAVE_TERMIO) &&
00044           !defined (HAVE_SGTTY) */
00045 
00046 #if defined(HAVE_TERMIOS)
00047 #include <termios.h>
00048 #endif
00049 
00050 #if !defined(_WIN32) && !defined (HAVE_TERMIOS)
00051 
00052 /* Define a common set of macros -- BSD based -- and redefine whatever
00053    the system offers to make it look like that.  FIXME: serial.h and
00054    ser-*.c deal with this in a much cleaner fashion; as soon as stuff
00055    is converted to use them, can get rid of this crap.  */
00056 
00057 #ifdef HAVE_TERMIO
00058 
00059 #include <termio.h>
00060 
00061 #undef TIOCGETP
00062 #define TIOCGETP TCGETA
00063 #undef TIOCSETN
00064 #define TIOCSETN TCSETA
00065 #undef TIOCSETP
00066 #define TIOCSETP TCSETAF
00067 #define TERMINAL struct termio
00068 
00069 #else /* sgtty */
00070 
00071 #include <fcntl.h>
00072 #include <sgtty.h>
00073 #include <sys/ioctl.h>
00074 #define TERMINAL struct sgttyb
00075 
00076 #endif /* sgtty */
00077 #endif
00078 
00079 struct inferior;
00080 
00081 extern void new_tty_prefork (const char *);
00082 
00083 extern void new_tty (void);
00084 
00085 extern void new_tty_postfork (void);
00086 
00087 extern void copy_terminal_info (struct inferior *to, struct inferior *from);
00088 
00089 /* Do we have job control?  Can be assumed to always be the same within
00090    a given run of GDB.  In inflow.c.  */
00091 extern int job_control;
00092 
00093 extern pid_t create_tty_session (void);
00094 
00095 /* Set the process group of the caller to its own pid, or do nothing if
00096    we lack job control.  */
00097 extern int gdb_setpgid (void);
00098 
00099 /* Set up a serial structure describing standard input.  In inflow.c.  */
00100 extern void initialize_stdin_serial (void);
00101 
00102 extern int gdb_has_a_terminal (void);
00103 
00104 /* Set the process group of the caller to its own pid, or do nothing
00105    if we lack job control.  */
00106 extern int gdb_setpgid (void);
00107 
00108 #endif /* !defined (TERMINAL_H) */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines