diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-10-08 22:18:27 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1993-10-08 22:18:27 +0000 |
commit | a14a8fad360ddc983045a94621380761fa30721d (patch) | |
tree | b64070b1c3b4cc2823a3d2c3f6c2ca00b80c039d /gdb/ser-unix.c | |
parent | 5357f1287d574310c08a9e54e8b903f9571d4129 (diff) | |
download | gdb-a14a8fad360ddc983045a94621380761fa30721d.zip gdb-a14a8fad360ddc983045a94621380761fa30721d.tar.gz gdb-a14a8fad360ddc983045a94621380761fa30721d.tar.bz2 |
* inflow.c: Remove unused includes of sys/param.h, etc.
* inflow.c, ser-unix.c, ser-go32.c, ser-tcp.c, serial.h,
terminal.h: Move all the process group stuff back to inflow.c;
that's a better place for it and fixes problems with trying to get/set
the process group of a tty we're doing remote debugging on.
* terminal.h: Skip the redefine crap if HAVE_TERMIOS.
Diffstat (limited to 'gdb/ser-unix.c')
-rw-r--r-- | gdb/ser-unix.c | 123 |
1 files changed, 3 insertions, 120 deletions
diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index c39663f..b306e8a 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -33,7 +33,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ struct hardwire_ttystate { struct termios termios; - pid_t process_group; }; #endif /* termios */ @@ -65,13 +64,6 @@ struct hardwire_ttystate struct ltchars ltc; /* Line discipline flags. */ int lmode; - -#ifdef SHORT_PGRP - /* This is only used for the ultra. Does it have pid_t? */ - short process_group; -#else - int process_group; -#endif }; #endif /* sgtty */ @@ -110,23 +102,10 @@ get_tty_state(scb, state) { #ifdef HAVE_TERMIOS extern int errno; - pid_t new_process_group; if (tcgetattr(scb->fd, &state->termios) < 0) return -1; - if (!job_control) - return 0; - - /* Apparently, if a tty has no process group, then tcgetpgrp returns -1 with - errno == 0. In this case, set the process group to -1 so that we know to - omit resetting it later. */ - new_process_group = tcgetpgrp (scb->fd); - if ((new_process_group == (pid_t)-1) - && (errno != ENOTTY)) - return -1; - errno = 0; - state->process_group = new_process_group; return 0; #endif @@ -146,10 +125,7 @@ get_tty_state(scb, state) if (ioctl (scb->fd, TIOCLGET, &state->lmode) < 0) return -1; - if (!job_control) - return 0; - - return ioctl (scb->fd, TIOCGPGRP, &state->process_group); + return 0; #endif } @@ -162,14 +138,7 @@ set_tty_state(scb, state) if (tcsetattr(scb->fd, TCSANOW, &state->termios) < 0) return -1; - if (!job_control) - return 0; - - /* If the tty had no process group before, then do not reset it. */ - if (state->process_group == -1) - return 0; - else - return tcsetpgrp (scb->fd, state->process_group); + return 0; #endif #ifdef HAVE_TERMIO @@ -182,10 +151,7 @@ set_tty_state(scb, state) if (ioctl (scb->fd, TIOCSETN, &state->sgttyb) < 0) return -1; - if (!job_control) - return 0; - - return ioctl (scb->fd, TIOCSPGRP, &state->process_group); + return 0; #endif } @@ -270,8 +236,6 @@ hardwire_print_tty_state (scb, ttystate) int i; #ifdef HAVE_TERMIOS - printf_filtered ("Process group = %d\n", state->process_group); - printf_filtered ("c_iflag = 0x%x, c_oflag = 0x%x,\n", state->termios.c_iflag, state->termios.c_oflag); printf_filtered ("c_cflag = 0x%x, c_lflag = 0x%x\n", @@ -300,8 +264,6 @@ hardwire_print_tty_state (scb, ttystate) #endif #ifdef HAVE_SGTTY - printf_filtered ("Process group = %d\n", state->process_group); - printf_filtered ("sgttyb.sg_flags = 0x%x.\n", state->sgttyb.sg_flags); printf_filtered ("tchars: "); @@ -615,18 +577,6 @@ hardwire_setbaudrate(scb, rate) } static int -hardwire_set_process_group (scb, ttystate, group) - serial_t scb; - serial_ttystate ttystate; - int group; -{ -#if defined (HAVE_SGTTY) || defined (HAVE_TERMIOS) - ((struct hardwire_ttystate *)ttystate)->process_group = group; -#endif - return 0; -} - -static int hardwire_write(scb, str, len) serial_t scb; const char *str; @@ -674,77 +624,10 @@ static struct serial_ops hardwire_ops = hardwire_print_tty_state, hardwire_noflush_set_tty_state, hardwire_setbaudrate, - hardwire_set_process_group }; -int job_control; -#if defined (HAVE_TERMIOS) -#include <unistd.h> -#endif - -/* This is here because this is where we figure out whether we (probably) - have job control. Just using job_control only does part of it because - setpgid or setpgrp might not exist on a system without job control. - It might be considered misplaced (on the other hand, process groups and - job control are closely related to ttys). - - For a more clean implementation, in libiberty, put a setpgid which merely - calls setpgrp and a setpgrp which does nothing (any system with job control - will have one or the other). */ -int -gdb_setpgid () -{ - int retval = 0; - if (job_control) - { -#if defined (NEED_POSIX_SETPGID) || defined (HAVE_TERMIOS) - /* Do all systems with termios have setpgid? I hope so. */ - /* setpgid (0, 0) is supposed to work and mean the same thing as - this, but on Ultrix 4.2A it fails with EPERM (and - setpgid (getpid (), getpid ()) succeeds). */ - retval = setpgid (getpid (), getpid ()); -#else -#if defined (TIOCGPGRP) -#if defined(USG) && !defined(SETPGRP_ARGS) - retval = setpgrp (); -#else - retval = setpgrp (getpid (), getpid ()); -#endif /* USG */ -#endif /* TIOCGPGRP. */ -#endif /* NEED_POSIX_SETPGID */ - } - return retval; -} - void _initialize_ser_hardwire () { serial_add_interface (&hardwire_ops); - - /* OK, figure out whether we have job control. */ - -#if defined (HAVE_TERMIOS) - /* Do all systems with termios have the POSIX way of identifying job - control? I hope so. */ -#ifdef _POSIX_JOB_CONTROL - job_control = 1; -#else - job_control = sysconf (_SC_JOB_CONTROL); -#endif -#endif /* termios */ - -#ifdef HAVE_TERMIO - /* See comment at top of file about trying to support process groups - with termio. */ - job_control = 0; -#endif /* termio */ - -#ifdef HAVE_SGTTY -#ifdef TIOCGPGRP - job_control = 1; -#else - job_control = 0; -#endif /* TIOCGPGRP */ -#endif /* sgtty */ - } |