1562 |
|
|
1563 |
if (inchannel >= 0) |
if (inchannel >= 0) |
1564 |
{ |
{ |
1565 |
#ifndef USG |
#if ! defined (USG) || defined (USG_SUBTTY_WORKS) |
1566 |
/* On USG systems it does not work to open the pty's tty here |
/* On most USG systems it does not work to open the pty's tty here, |
1567 |
and then close and reopen it in the child. */ |
then close it and reopen it in the child. */ |
1568 |
#ifdef O_NOCTTY |
#ifdef O_NOCTTY |
1569 |
/* Don't let this terminal become our controlling terminal |
/* Don't let this terminal become our controlling terminal |
1570 |
(in case we don't have one). */ |
(in case we don't have one). */ |
1576 |
report_file_error ("Opening pty", Qnil); |
report_file_error ("Opening pty", Qnil); |
1577 |
#else |
#else |
1578 |
forkin = forkout = -1; |
forkin = forkout = -1; |
1579 |
#endif /* not USG */ |
#endif /* not USG, or USG_SUBTTY_WORKS */ |
1580 |
pty_flag = 1; |
pty_flag = 1; |
1581 |
} |
} |
1582 |
else |
else |
5027 |
current_group = Qnil; |
current_group = Qnil; |
5028 |
|
|
5029 |
/* If we are using pgrps, get a pgrp number and make it negative. */ |
/* If we are using pgrps, get a pgrp number and make it negative. */ |
5030 |
if (!NILP (current_group)) |
if (NILP (current_group)) |
5031 |
|
/* Send the signal to the shell's process group. */ |
5032 |
|
gid = XFASTINT (p->pid); |
5033 |
|
else |
5034 |
{ |
{ |
5035 |
#ifdef SIGNALS_VIA_CHARACTERS |
#ifdef SIGNALS_VIA_CHARACTERS |
5036 |
/* If possible, send signals to the entire pgrp |
/* If possible, send signals to the entire pgrp |
5125 |
#endif /* defined (SIGNALS_VIA_CHARACTERS) */ |
#endif /* defined (SIGNALS_VIA_CHARACTERS) */ |
5126 |
|
|
5127 |
#ifdef TIOCGPGRP |
#ifdef TIOCGPGRP |
5128 |
/* Get the pgrp using the tty itself, if we have that. |
/* Get the current pgrp using the tty itself, if we have that. |
5129 |
Otherwise, use the pty to get the pgrp. |
Otherwise, use the pty to get the pgrp. |
5130 |
On pfa systems, saka@pfu.fujitsu.co.JP writes: |
On pfa systems, saka@pfu.fujitsu.co.JP writes: |
5131 |
"TIOCGPGRP symbol defined in sys/ioctl.h at E50. |
"TIOCGPGRP symbol defined in sys/ioctl.h at E50. |
5140 |
else |
else |
5141 |
err = ioctl (XINT (p->infd), TIOCGPGRP, &gid); |
err = ioctl (XINT (p->infd), TIOCGPGRP, &gid); |
5142 |
|
|
|
#ifdef pfa |
|
5143 |
if (err == -1) |
if (err == -1) |
5144 |
gid = - XFASTINT (p->pid); |
/* If we can't get the information, assume |
5145 |
#endif /* ! defined (pfa) */ |
the shell owns the tty. */ |
5146 |
|
gid = XFASTINT (p->pid); |
5147 |
} |
} |
5148 |
|
|
5149 |
|
/* It is not clear whether anything really can set GID to -1. |
5150 |
|
Perhaps on some system one of those ioctls can or could do so. |
5151 |
|
Or perhaps this is vestigial. */ |
5152 |
if (gid == -1) |
if (gid == -1) |
5153 |
no_pgrp = 1; |
no_pgrp = 1; |
|
else |
|
|
gid = - gid; |
|
5154 |
#else /* ! defined (TIOCGPGRP ) */ |
#else /* ! defined (TIOCGPGRP ) */ |
5155 |
/* Can't select pgrps on this system, so we know that |
/* Can't select pgrps on this system, so we know that |
5156 |
the child itself heads the pgrp. */ |
the child itself heads the pgrp. */ |
5157 |
gid = - XFASTINT (p->pid); |
gid = XFASTINT (p->pid); |
5158 |
#endif /* ! defined (TIOCGPGRP ) */ |
#endif /* ! defined (TIOCGPGRP ) */ |
5159 |
|
|
5160 |
/* If current_group is lambda, and the shell owns the terminal, |
/* If current_group is lambda, and the shell owns the terminal, |
5161 |
don't send any signal. */ |
don't send any signal. */ |
5162 |
if (EQ (current_group, Qlambda) && gid == - XFASTINT (p->pid)) |
if (EQ (current_group, Qlambda) && gid == XFASTINT (p->pid)) |
5163 |
return; |
return; |
5164 |
} |
} |
|
else |
|
|
gid = - XFASTINT (p->pid); |
|
5165 |
|
|
5166 |
switch (signo) |
switch (signo) |
5167 |
{ |
{ |
5213 |
kill (gid, signo); |
kill (gid, signo); |
5214 |
} |
} |
5215 |
#else /* ! defined (TIOCSIGSEND) */ |
#else /* ! defined (TIOCSIGSEND) */ |
5216 |
EMACS_KILLPG (-gid, signo); |
EMACS_KILLPG (gid, signo); |
5217 |
#endif /* ! defined (TIOCSIGSEND) */ |
#endif /* ! defined (TIOCSIGSEND) */ |
5218 |
} |
} |
5219 |
|
|