* ser-unix.c: Don't try to use job control with termio.
This commit is contained in:
parent
ffffc8fb5c
commit
dc34b11d9d
2 changed files with 26 additions and 21 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Mon Jul 19 11:48:57 1993 Jim Kingdon (kingdon@deneb.cygnus.com)
|
||||||
|
|
||||||
|
* ser-unix.c: Don't try to use job control with termio.
|
||||||
|
|
||||||
Sun Jul 18 23:11:28 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
|
Sun Jul 18 23:11:28 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
|
||||||
and Jim Kingdon (kingdon@cygnus.com)
|
and Jim Kingdon (kingdon@cygnus.com)
|
||||||
|
|
||||||
|
|
|
@ -35,17 +35,21 @@ struct hardwire_ttystate
|
||||||
struct termios termios;
|
struct termios termios;
|
||||||
pid_t process_group;
|
pid_t process_group;
|
||||||
};
|
};
|
||||||
#endif
|
#endif /* termios */
|
||||||
|
|
||||||
#ifdef HAVE_TERMIO
|
#ifdef HAVE_TERMIO
|
||||||
#include <termio.h>
|
#include <termio.h>
|
||||||
|
|
||||||
|
/* It is believed that all systems which have added job control to SVR3
|
||||||
|
(e.g. sco) have also added termios. Even if not, trying to figure out
|
||||||
|
all the variations (TIOCGPGRP vs. TCGETPGRP, etc.) would be pretty
|
||||||
|
bewildering. So we don't attempt it. */
|
||||||
|
|
||||||
struct hardwire_ttystate
|
struct hardwire_ttystate
|
||||||
{
|
{
|
||||||
struct termio termio;
|
struct termio termio;
|
||||||
int process_group;
|
|
||||||
};
|
};
|
||||||
#endif
|
#endif /* termio */
|
||||||
|
|
||||||
#ifdef HAVE_SGTTY
|
#ifdef HAVE_SGTTY
|
||||||
/* Needed for the code which uses select(). We would include <sys/select.h>
|
/* Needed for the code which uses select(). We would include <sys/select.h>
|
||||||
|
@ -69,7 +73,7 @@ struct hardwire_ttystate
|
||||||
int process_group;
|
int process_group;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif /* sgtty */
|
||||||
|
|
||||||
static int hardwire_open PARAMS ((serial_t scb, const char *name));
|
static int hardwire_open PARAMS ((serial_t scb, const char *name));
|
||||||
static void hardwire_raw PARAMS ((serial_t scb));
|
static void hardwire_raw PARAMS ((serial_t scb));
|
||||||
|
@ -123,11 +127,7 @@ get_tty_state(scb, state)
|
||||||
#ifdef HAVE_TERMIO
|
#ifdef HAVE_TERMIO
|
||||||
if (ioctl (scb->fd, TCGETA, &state->termio) < 0)
|
if (ioctl (scb->fd, TCGETA, &state->termio) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!job_control)
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return ioctl (scb->fd, TIOCGPGRP, &state->process_group);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SGTTY
|
#ifdef HAVE_SGTTY
|
||||||
|
@ -167,12 +167,6 @@ set_tty_state(scb, state)
|
||||||
#ifdef HAVE_TERMIO
|
#ifdef HAVE_TERMIO
|
||||||
if (ioctl (scb->fd, TCSETA, &state->termio) < 0)
|
if (ioctl (scb->fd, TCSETA, &state->termio) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!job_control)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Need to ignore errors, at least if attach_flag is set. */
|
|
||||||
ioctl (scb->fd, TIOCSPGRP, &state->process_group);
|
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -269,9 +263,9 @@ hardwire_print_tty_state (scb, ttystate)
|
||||||
struct hardwire_ttystate *state = (struct hardwire_ttystate *) ttystate;
|
struct hardwire_ttystate *state = (struct hardwire_ttystate *) ttystate;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#ifdef HAVE_TERMIOS
|
||||||
printf_filtered ("Process group = %d\n", state->process_group);
|
printf_filtered ("Process group = %d\n", state->process_group);
|
||||||
|
|
||||||
#ifdef HAVE_TERMIOS
|
|
||||||
printf_filtered ("c_iflag = 0x%x, c_oflag = 0x%x,\n",
|
printf_filtered ("c_iflag = 0x%x, c_oflag = 0x%x,\n",
|
||||||
state->termios.c_iflag, state->termios.c_oflag);
|
state->termios.c_iflag, state->termios.c_oflag);
|
||||||
printf_filtered ("c_cflag = 0x%x, c_lflag = 0x%x\n",
|
printf_filtered ("c_cflag = 0x%x, c_lflag = 0x%x\n",
|
||||||
|
@ -300,6 +294,8 @@ hardwire_print_tty_state (scb, ttystate)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_SGTTY
|
#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 ("sgttyb.sg_flags = 0x%x.\n", state->sgttyb.sg_flags);
|
||||||
|
|
||||||
printf_filtered ("tchars: ");
|
printf_filtered ("tchars: ");
|
||||||
|
@ -569,7 +565,9 @@ hardwire_set_process_group (scb, ttystate, group)
|
||||||
serial_ttystate ttystate;
|
serial_ttystate ttystate;
|
||||||
int group;
|
int group;
|
||||||
{
|
{
|
||||||
|
#if defined (HAVE_SGTTY) || defined (HAVE_TERMIOS)
|
||||||
((struct hardwire_ttystate *)ttystate)->process_group = group;
|
((struct hardwire_ttystate *)ttystate)->process_group = group;
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -669,21 +667,24 @@ _initialize_ser_hardwire ()
|
||||||
/* Do all systems with termios have the POSIX way of identifying job
|
/* Do all systems with termios have the POSIX way of identifying job
|
||||||
control? I hope so. */
|
control? I hope so. */
|
||||||
#ifdef _POSIX_JOB_CONTROL
|
#ifdef _POSIX_JOB_CONTROL
|
||||||
/* AIX defines _POSIX_JOB_CONTROL to an empty string, so I guess
|
|
||||||
defining _POSIX_JOB_CONTROL to 0 to mean no job control doesn't work
|
|
||||||
(I don't have the standard handy). */
|
|
||||||
job_control = 1;
|
job_control = 1;
|
||||||
#else
|
#else
|
||||||
job_control = sysconf (_SC_JOB_CONTROL);
|
job_control = sysconf (_SC_JOB_CONTROL);
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* termios */
|
||||||
|
|
||||||
#else /* not 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
|
#ifdef TIOCGPGRP
|
||||||
job_control = 1;
|
job_control = 1;
|
||||||
#else
|
#else
|
||||||
job_control = 0;
|
job_control = 0;
|
||||||
#endif /* TIOCGPGRP */
|
#endif /* TIOCGPGRP */
|
||||||
|
#endif /* sgtty */
|
||||||
|
|
||||||
#endif /* not termios. */
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue