* subtty field in process
[not found] <200302182237.h1IMbtFQ015438@stubby.bodenonline.com>
@ 2003-02-19 21:21 ` Richard Stallman
2003-02-19 22:21 ` Jan D.
0 siblings, 1 reply; 2+ messages in thread
From: Richard Stallman @ 2003-02-19 21:21 UTC (permalink / raw)
Cc: angeloff
> It looks like subtty is obsolete. We could delete it,
> unless there is some system on which really using it would
> solve some problem today.
I propose we delete it. If it served some purpose it should have been
noticed over the last 8-9 years :-).
It MAY be the case that on some system it works better to do certain
things to the subprocess (perhaps, send signals) using the tty desc
rather than the pty desc. I am not sure such a case ever exists, but
there are some systems where sending signals to subprocesses doesn't
work entirely right.
I guess it is sufficient if I send this message to emacs-devel. Then
if we ever encounter a problem for which subtty would be a solution,
with luck someone will remember that.
So please do delete the code for subtty.
Is this a change we want to put in RC as well?
We certainly don't want to delete the code for subtty in RC.
We should make the minimum necessary changes there.
What change would you propose for RC?
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: subtty field in process
2003-02-19 21:21 ` subtty field in process Richard Stallman
@ 2003-02-19 22:21 ` Jan D.
0 siblings, 0 replies; 2+ messages in thread
From: Jan D. @ 2003-02-19 22:21 UTC (permalink / raw)
Cc: angeloff
[-- Attachment #1: Type: text/plain, Size: 1153 bytes --]
> > It looks like subtty is obsolete. We could delete it,
> > unless there is some system on which really using it would
> > solve some problem today.
>
> I propose we delete it. If it served some purpose it should have been
> noticed over the last 8-9 years :-).
>
> It MAY be the case that on some system it works better to do certain
> things to the subprocess (perhaps, send signals) using the tty desc
> rather than the pty desc. I am not sure such a case ever exists, but
> there are some systems where sending signals to subprocesses doesn't
> work entirely right.
Indeed there are.
> I guess it is sufficient if I send this message to emacs-devel. Then
> if we ever encounter a problem for which subtty would be a solution,
> with luck someone will remember that.
I can put in some comments about it.
>
> So please do delete the code for subtty.
Will do.
> Is this a change we want to put in RC as well?
>
> We certainly don't want to delete the code for subtty in RC.
> We should make the minimum necessary changes there.
>
> What change would you propose for RC?
I propose the attached patch.
Jan D.
[-- Attachment #2: emacsRC.diff --]
[-- Type: text/plain, Size: 3676 bytes --]
Index: src/process.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/process.c,v
retrieving revision 1.341.4.3
diff -c -r1.341.4.3 process.c
*** src/process.c 23 Oct 2002 17:40:15 -0000 1.341.4.3
--- src/process.c 15 Feb 2003 16:56:35 -0000
***************
*** 3571,3576 ****
--- 3571,3603 ----
return Qnil;
}
\f
+ /* Return the foreground process group for the tty/pty that
+ the process P uses. */
+ static int
+ emacs_get_tty_pgrp (p)
+ struct Lisp_Process *p;
+ {
+ int gid = -1;
+
+ #ifdef TIOCGPGRP
+ if (ioctl (XINT (p->infd), TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name))
+ {
+ int fd;
+ /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the
+ master side. Try the slave side. */
+ fd = emacs_open (XSTRING (p->tty_name)->data, O_RDONLY, 0);
+
+ if (fd != -1)
+ {
+ ioctl (fd, TIOCGPGRP, &gid);
+ emacs_close (fd);
+ }
+ }
+ #endif /* defined (TIOCGPGRP ) */
+
+ return gid;
+ }
+
DEFUN ("process-running-child-p", Fprocess_running_child_p,
Sprocess_running_child_p, 0, 1, 0,
"Return t if PROCESS has given the terminal to a child.\n\
***************
*** 3581,3587 ****
{
/* Initialize in case ioctl doesn't exist or gives an error,
in a way that will cause returning t. */
! int gid = 0;
Lisp_Object proc;
struct Lisp_Process *p;
--- 3608,3614 ----
{
/* Initialize in case ioctl doesn't exist or gives an error,
in a way that will cause returning t. */
! int gid;
Lisp_Object proc;
struct Lisp_Process *p;
***************
*** 3595,3606 ****
error ("Process %s is not active",
XSTRING (p->name)->data);
! #ifdef TIOCGPGRP
! if (!NILP (p->subtty))
! ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid);
! else
! ioctl (XINT (p->infd), TIOCGPGRP, &gid);
! #endif /* defined (TIOCGPGRP ) */
if (gid == XFASTINT (p->pid))
return Qnil;
--- 3622,3628 ----
error ("Process %s is not active",
XSTRING (p->name)->data);
! gid = emacs_get_tty_pgrp (p);
if (gid == XFASTINT (p->pid))
return Qnil;
***************
*** 3747,3765 ****
But, TIOCGPGRP does not work on E50 ;-P works fine on E60"
His patch indicates that if TIOCGPGRP returns an error, then
we should just assume that p->pid is also the process group id. */
- {
- int err;
! if (!NILP (p->subtty))
! err = ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid);
! else
! err = ioctl (XINT (p->infd), TIOCGPGRP, &gid);
#ifdef pfa
! if (err == -1)
! gid = - XFASTINT (p->pid);
#endif /* ! defined (pfa) */
! }
if (gid == -1)
no_pgrp = 1;
else
--- 3769,3782 ----
But, TIOCGPGRP does not work on E50 ;-P works fine on E60"
His patch indicates that if TIOCGPGRP returns an error, then
we should just assume that p->pid is also the process group id. */
! gid = emacs_get_tty_pgrp (p);
#ifdef pfa
! if (gid == -1)
! gid = - XFASTINT (p->pid);
#endif /* ! defined (pfa) */
!
if (gid == -1)
no_pgrp = 1;
else
***************
*** 3821,3827 ****
/* gid may be a pid, or minus a pgrp's number */
#ifdef TIOCSIGSEND
if (!NILP (current_group))
! ioctl (XINT (p->infd), TIOCSIGSEND, signo);
else
{
gid = - XFASTINT (p->pid);
--- 3838,3847 ----
/* gid may be a pid, or minus a pgrp's number */
#ifdef TIOCSIGSEND
if (!NILP (current_group))
! {
! if (ioctl (XINT (p->infd), TIOCSIGSEND, signo) == -1)
! EMACS_KILLPG (-gid, signo);
! }
else
{
gid = - XFASTINT (p->pid);
[-- Attachment #3: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-02-19 22:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <200302182237.h1IMbtFQ015438@stubby.bodenonline.com>
2003-02-19 21:21 ` subtty field in process Richard Stallman
2003-02-19 22:21 ` Jan D.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.