From: "Jan D." <jan.h.d@swipnet.se>
Cc: angeloff@acm.org
Subject: Re: subtty field in process
Date: Wed, 19 Feb 2003 23:21:59 +0100 (CET) [thread overview]
Message-ID: <200302192316.h1JNGqFM006865@stubby.bodenonline.com> (raw)
In-Reply-To: <E18lbei-0003QV-00@fencepost.gnu.org> "from Richard Stallman at Feb 19, 2003 04:21:28 pm"
[-- 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
prev parent reply other threads:[~2003-02-19 22:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[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. [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200302192316.h1JNGqFM006865@stubby.bodenonline.com \
--to=jan.h.d@swipnet.se \
--cc=angeloff@acm.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.