/[emacs]/emacs/src/process.c
ViewVC logotype

Diff of /emacs/src/process.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.341.4.4 by lektu, Mon Feb 17 08:58:43 2003 UTC revision 1.341.4.5 by jhd, Sun Feb 23 18:57:54 2003 UTC
# Line 3572  Output from processes can arrive in betw Line 3572  Output from processes can arrive in betw
3572    return Qnil;    return Qnil;
3573  }  }
3574    
3575    /* Return the foreground process group for the tty/pty that
3576       the process P uses.  */
3577    static int
3578    emacs_get_tty_pgrp (p)
3579         struct Lisp_Process *p;
3580    {
3581      int gid = -1;
3582    
3583    #ifdef TIOCGPGRP
3584      if (ioctl (XINT (p->infd), TIOCGPGRP, &gid) == -1 && ! NILP (p->tty_name))
3585        {
3586          int fd;
3587          /* Some OS:es (Solaris 8/9) does not allow TIOCGPGRP from the
3588             master side.  Try the slave side.  */
3589          fd = emacs_open (XSTRING (p->tty_name)->data, O_RDONLY, 0);
3590    
3591          if (fd != -1)
3592            {
3593              ioctl (fd, TIOCGPGRP, &gid);
3594              emacs_close (fd);
3595            }
3596        }
3597    #endif /* defined (TIOCGPGRP ) */
3598    
3599      return gid;
3600    }
3601    
3602  DEFUN ("process-running-child-p", Fprocess_running_child_p,  DEFUN ("process-running-child-p", Fprocess_running_child_p,
3603         Sprocess_running_child_p, 0, 1, 0,         Sprocess_running_child_p, 0, 1, 0,
3604    "Return t if PROCESS has given the terminal to a child.\n\    "Return t if PROCESS has given the terminal to a child.\n\
# Line 3582  return t unconditionally.") Line 3609  return t unconditionally.")
3609  {  {
3610    /* Initialize in case ioctl doesn't exist or gives an error,    /* Initialize in case ioctl doesn't exist or gives an error,
3611       in a way that will cause returning t.  */       in a way that will cause returning t.  */
3612    int gid = 0;    int gid;
3613    Lisp_Object proc;    Lisp_Object proc;
3614    struct Lisp_Process *p;    struct Lisp_Process *p;
3615    
# Line 3596  return t unconditionally.") Line 3623  return t unconditionally.")
3623      error ("Process %s is not active",      error ("Process %s is not active",
3624             XSTRING (p->name)->data);             XSTRING (p->name)->data);
3625    
3626  #ifdef TIOCGPGRP    gid = emacs_get_tty_pgrp (p);
   if (!NILP (p->subtty))  
     ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid);  
   else  
     ioctl (XINT (p->infd), TIOCGPGRP, &gid);  
 #endif /* defined (TIOCGPGRP ) */  
3627    
3628    if (gid == XFASTINT (p->pid))    if (gid == XFASTINT (p->pid))
3629      return Qnil;      return Qnil;
# Line 3748  process_send_signal (process, signo, cur Line 3770  process_send_signal (process, signo, cur
3770           But, TIOCGPGRP does not work on E50 ;-P works fine on E60"           But, TIOCGPGRP does not work on E50 ;-P works fine on E60"
3771           His patch indicates that if TIOCGPGRP returns an error, then           His patch indicates that if TIOCGPGRP returns an error, then
3772           we should just assume that p->pid is also the process group id.  */           we should just assume that p->pid is also the process group id.  */
       {  
         int err;  
3773    
3774          if (!NILP (p->subtty))        gid = emacs_get_tty_pgrp (p);
           err = ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid);  
         else  
           err = ioctl (XINT (p->infd), TIOCGPGRP, &gid);  
3775    
3776  #ifdef pfa  #ifdef pfa
3777          if (err == -1)        if (gid == -1)
3778            gid = - XFASTINT (p->pid);          gid = - XFASTINT (p->pid);
3779  #endif /* ! defined (pfa) */  #endif /* ! defined (pfa) */
3780        }  
3781        if (gid == -1)        if (gid == -1)
3782          no_pgrp = 1;          no_pgrp = 1;
3783        else        else
# Line 3822  process_send_signal (process, signo, cur Line 3839  process_send_signal (process, signo, cur
3839    /* gid may be a pid, or minus a pgrp's number */    /* gid may be a pid, or minus a pgrp's number */
3840  #ifdef TIOCSIGSEND  #ifdef TIOCSIGSEND
3841    if (!NILP (current_group))    if (!NILP (current_group))
3842      ioctl (XINT (p->infd), TIOCSIGSEND, signo);      {
3843          if (ioctl (XINT (p->infd), TIOCSIGSEND, signo) == -1)
3844            EMACS_KILLPG (-gid, signo);
3845        }
3846    else    else
3847      {      {
3848        gid = - XFASTINT (p->pid);        gid = - XFASTINT (p->pid);

Legend:
Removed from v.1.341.4.4  
changed lines
  Added in v.1.341.4.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26