* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
[not found] <5983E4DAC939D311B2F20008C7E62E7A075D2365@clsh01xch.office.cfmu.eurocontrol.be>
@ 2002-07-12 11:12 ` Richard Stallman
2002-07-12 21:52 ` Stef Van Vlierberghe
0 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2002-07-12 11:12 UTC (permalink / raw)
Cc: philippe.waroquiers, twurgler, emacs-devel, stef.van-vlierberghe
On hp-ux, ioctl TIOCGPGRP always fails with errno ENOTTY (this is normal,
explained in the USG part of create_process).
I cannot find that explanation, and I am not sure what "the USG part
of create_process" refers to. Would you please show me the specific
code you mean? I'm trying to understand this. In particular,
I wonder why this code
if (!NILP (p->subtty))
err = ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid);
does not get the right value.
Does err get set to -1 when the ioctl fails?
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
2002-07-12 11:12 ` Richard Stallman
@ 2002-07-12 21:52 ` Stef Van Vlierberghe
2002-07-13 14:20 ` Richard Stallman
0 siblings, 1 reply; 15+ messages in thread
From: Stef Van Vlierberghe @ 2002-07-12 21:52 UTC (permalink / raw)
Cc: philippe.waroquiers, twurgler, emacs-devel, stef.van-vlierberghe
Richard Stallman writes:
> On hp-ux, ioctl TIOCGPGRP always fails with errno ENOTTY (this is normal,
> explained in the USG part of create_process).
>
> I cannot find that explanation, and I am not sure what "the USG part
> of create_process" refers to. Would you please show me the specific
> code you mean? I'm trying to understand this. In particular,
> I wonder why this code
>
> if (!NILP (p->subtty))
> err = ioctl (XFASTINT (p->subtty), TIOCGPGRP, &gid);
>
> does not get the right value.
>
> Does err get set to -1 when the ioctl fails?
Below you will find the source code of create_process, where
I have put a !!! in front of the lines that are executed in
create_process when we use M-x shell (I'm a big fan of the
emacs macro's and the gdb-mode).
This explains how we have NILP (p->subtty), and hence the
'else' part of the 'if' you mentioned above is of interest :
else
err = ioctl (XINT (p->infd), TIOCGPGRP, &gid);
Here err is returned -1 and errno is 25=ENOTTY, which makes
sense because p->infd was set to inchannel, which is a PTY
returned from allocate_pty (); (I thought a pty and a tty were
like two ends of the same comms channel, but I guess this
difference matters for the ioctl).
This failure passes by unnoticed, because the err is not tested
(unless if this #ifdef pfa kicks in, which does such a test and
might already have worked around the same problem in a very
awkward way).
So, if the uninitialized gid is initially -1, then the error
is discovered accidentally, no_pgrp = 1;, and this leads us
to the kill (XFASTINT (p->pid), signo);, which send the signal
to the shell, which does not interrupt the cat.
If the uninitialized gid is initially 1, then the error is not
discovered, gid is then set to -1 but that won't matter anymore,
and we get to ioctl (XINT (p->infd), TIOCSIGSEND, signo);
which does indeed kill the cat.
Conclusion : setting gid initially to 1 is a workaround for us,
but the way it works is major voodoo.
P.S. neither of us understood what a USG system is, why HP is
one, and why somebody believes HP can't have a pty/tty creation
during a fork()/exec() construct, surely a program like xterm must
accomplish this.
Best regards.
=============================================================
void
create_process (process, new_argv, current_dir)
Lisp_Object process;
char **new_argv;
Lisp_Object current_dir;
{
int pid, inchannel, outchannel;
int sv[2];
#ifdef POSIX_SIGNALS
sigset_t procmask;
sigset_t blocked;
struct sigaction sigint_action;
struct sigaction sigquit_action;
#ifdef AIX
struct sigaction sighup_action;
#endif
#else /* !POSIX_SIGNALS */
#if 0
#ifdef SIGCHLD
SIGTYPE (*sigchld)();
#endif
#endif /* 0 */
#endif /* !POSIX_SIGNALS */
/* Use volatile to protect variables from being clobbered by longjmp. */
volatile int forkin, forkout;
!!! volatile int pty_flag = 0;
#ifndef USE_CRT_DLL
extern char **environ;
#endif
!!! Lisp_Object buffer = XPROCESS (process)->buffer;
!!! inchannel = outchannel = -1;
#ifdef HAVE_PTYS
!!! if (!NILP (Vprocess_connection_type))
!!! outchannel = inchannel = allocate_pty ();
!!! if (inchannel >= 0)
{
#ifndef USG
/* On USG systems it does not work to open the pty's tty here
and then close and reopen it in the child. */
#ifdef O_NOCTTY
/* Don't let this terminal become our controlling terminal
(in case we don't have one). */
forkout = forkin = emacs_open (pty_name, O_RDWR | O_NOCTTY, 0);
#else
forkout = forkin = emacs_open (pty_name, O_RDWR, 0);
#endif
if (forkin < 0)
report_file_error ("Opening pty", Qnil);
#else
!!! forkin = forkout = -1;
#endif /* not USG */
!!! pty_flag = 1;
}
else
#endif /* HAVE_PTYS */
#ifdef SKTPAIR
{
if (socketpair (AF_UNIX, SOCK_STREAM, 0, sv) < 0)
report_file_error ("Opening socketpair", Qnil);
outchannel = inchannel = sv[0];
forkout = forkin = sv[1];
}
#else /* not SKTPAIR */
{
int tem;
tem = pipe (sv);
if (tem < 0)
report_file_error ("Creating pipe", Qnil);
inchannel = sv[0];
forkout = sv[1];
tem = pipe (sv);
if (tem < 0)
{
emacs_close (inchannel);
emacs_close (forkout);
report_file_error ("Creating pipe", Qnil);
}
outchannel = sv[1];
forkin = sv[0];
}
#endif /* not SKTPAIR */
#if 0
/* Replaced by close_process_descs */
set_exclusive_use (inchannel);
set_exclusive_use (outchannel);
#endif
/* Stride people say it's a mystery why this is needed
as well as the O_NDELAY, but that it fails without this. */
#if defined (STRIDE) || (defined (pfa) && defined (HAVE_PTYS))
{
int one = 1;
ioctl (inchannel, FIONBIO, &one);
}
#endif
#ifdef O_NONBLOCK
!!! fcntl (inchannel, F_SETFL, O_NONBLOCK);
!!! fcntl (outchannel, F_SETFL, O_NONBLOCK);
#else
#ifdef O_NDELAY
fcntl (inchannel, F_SETFL, O_NDELAY);
fcntl (outchannel, F_SETFL, O_NDELAY);
#endif
#endif
/* Record this as an active process, with its channels.
As a result, child_setup will close Emacs's side of the pipes. */
!!! chan_process[inchannel] = process;
!!! XSETINT (XPROCESS (process)->infd, inchannel);
!!! XSETINT (XPROCESS (process)->outfd, outchannel);
/* Record the tty descriptor used in the subprocess. */
!!! if (forkin < 0)
!!! XPROCESS (process)->subtty = Qnil;
else
XSETFASTINT (XPROCESS (process)->subtty, forkin);
!!! XPROCESS (process)->pty_flag = (pty_flag ? Qt : Qnil);
!!! XPROCESS (process)->status = Qrun;
!!! if (!proc_decode_coding_system[inchannel])
!!! proc_decode_coding_system[inchannel]
= (struct coding_system *) xmalloc (sizeof (struct coding_system));
!!! setup_coding_system (XPROCESS (process)->decode_coding_system,
proc_decode_coding_system[inchannel]);
!!! if (!proc_encode_coding_system[outchannel])
!!! proc_encode_coding_system[outchannel]
= (struct coding_system *) xmalloc (sizeof (struct coding_system));
!!! setup_coding_system (XPROCESS (process)->encode_coding_system,
proc_encode_coding_system[outchannel]);
/* Delay interrupts until we have a chance to store
the new fork's pid in its process structure */
#ifdef POSIX_SIGNALS
!!! sigemptyset (&blocked);
#ifdef SIGCHLD
!!! sigaddset (&blocked, SIGCHLD);
#endif
#ifdef HAVE_VFORK
/* On many hosts (e.g. Solaris 2.4), if a vforked child calls `signal',
this sets the parent's signal handlers as well as the child's.
So delay all interrupts whose handlers the child might munge,
and record the current handlers so they can be restored later. */
sigaddset (&blocked, SIGINT ); sigaction (SIGINT , 0, &sigint_action );
sigaddset (&blocked, SIGQUIT); sigaction (SIGQUIT, 0, &sigquit_action);
#ifdef AIX
sigaddset (&blocked, SIGHUP ); sigaction (SIGHUP , 0, &sighup_action );
#endif
#endif /* HAVE_VFORK */
!!! sigprocmask (SIG_BLOCK, &blocked, &procmask);
#else /* !POSIX_SIGNALS */
#ifdef SIGCHLD
#ifdef BSD4_1
sighold (SIGCHLD);
#else /* not BSD4_1 */
#if defined (BSD_SYSTEM) || defined (UNIPLUS) || defined (HPUX)
sigsetmask (sigmask (SIGCHLD));
#else /* ordinary USG */
#if 0
sigchld_deferred = 0;
sigchld = signal (SIGCHLD, create_process_sigchld);
#endif
#endif /* ordinary USG */
#endif /* not BSD4_1 */
#endif /* SIGCHLD */
#endif /* !POSIX_SIGNALS */
!!! FD_SET (inchannel, &input_wait_mask);
!!! FD_SET (inchannel, &non_keyboard_wait_mask);
!!! if (inchannel > max_process_desc)
!!! max_process_desc = inchannel;
/* Until we store the proper pid, enable sigchld_handler
to recognize an unknown pid as standing for this process.
It is very important not to let this `marker' value stay
in the table after this function has returned; if it does
it might cause call-process to hang and subsequent asynchronous
processes to get their return values scrambled. */
!!! XSETINT (XPROCESS (process)->pid, -1);
!!! BLOCK_INPUT;
{
/* child_setup must clobber environ on systems with true vfork.
Protect it from permanent change. */
!!! char **save_environ = environ;
!!! current_dir = ENCODE_FILE (current_dir);
#ifndef WINDOWSNT
!!! pid = vfork ();
!!! if (pid == 0)
#endif /* not WINDOWSNT */
{
int xforkin = forkin;
int xforkout = forkout;
#if 0 /* This was probably a mistake--it duplicates code later on,
but fails to handle all the cases. */
/* Make sure SIGCHLD is not blocked in the child. */
sigsetmask (SIGEMPTYMASK);
#endif
/* Make the pty be the controlling terminal of the process. */
#ifdef HAVE_PTYS
/* First, disconnect its current controlling terminal. */
#ifdef HAVE_SETSID
/* We tried doing setsid only if pty_flag, but it caused
process_set_signal to fail on SGI when using a pipe. */
setsid ();
/* Make the pty's terminal the controlling terminal. */
if (pty_flag)
{
#ifdef TIOCSCTTY
/* We ignore the return value
because faith@cs.unc.edu says that is necessary on Linux. */
ioctl (xforkin, TIOCSCTTY, 0);
#endif
}
#else /* not HAVE_SETSID */
#ifdef USG
/* It's very important to call setpgrp here and no time
afterwards. Otherwise, we lose our controlling tty which
is set when we open the pty. */
setpgrp ();
#endif /* USG */
#endif /* not HAVE_SETSID */
#if defined (HAVE_TERMIOS) && defined (LDISC1)
if (pty_flag && xforkin >= 0)
{
struct termios t;
tcgetattr (xforkin, &t);
t.c_lflag = LDISC1;
if (tcsetattr (xforkin, TCSANOW, &t) < 0)
emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39);
}
#else
#if defined (NTTYDISC) && defined (TIOCSETD)
if (pty_flag && xforkin >= 0)
{
/* Use new line discipline. */
int ldisc = NTTYDISC;
ioctl (xforkin, TIOCSETD, &ldisc);
}
#endif
#endif
#ifdef TIOCNOTTY
/* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you
can do TIOCSPGRP only to the process's controlling tty. */
if (pty_flag)
{
/* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here?
I can't test it since I don't have 4.3. */
int j = emacs_open ("/dev/tty", O_RDWR, 0);
ioctl (j, TIOCNOTTY, 0);
emacs_close (j);
#ifndef USG
/* In order to get a controlling terminal on some versions
of BSD, it is necessary to put the process in pgrp 0
before it opens the terminal. */
#ifdef HAVE_SETPGID
setpgid (0, 0);
#else
setpgrp (0, 0);
#endif
#endif
}
#endif /* TIOCNOTTY */
#if !defined (RTU) && !defined (UNIPLUS) && !defined (DONT_REOPEN_PTY)
/*** There is a suggestion that this ought to be a
conditional on TIOCSPGRP,
or !(defined (HAVE_SETSID) && defined (TIOCSCTTY)).
Trying the latter gave the wrong results on Debian GNU/Linux 1.1;
that system does seem to need this code, even though
both HAVE_SETSID and TIOCSCTTY are defined. */
/* Now close the pty (if we had it open) and reopen it.
This makes the pty the controlling terminal of the subprocess. */
if (pty_flag)
{
#ifdef SET_CHILD_PTY_PGRP
int pgrp = getpid ();
#endif
/* I wonder if emacs_close (emacs_open (pty_name, ...))
would work? */
if (xforkin >= 0)
emacs_close (xforkin);
xforkout = xforkin = emacs_open (pty_name, O_RDWR, 0);
if (xforkin < 0)
{
emacs_write (1, "Couldn't open the pty terminal ", 31);
emacs_write (1, pty_name, strlen (pty_name));
emacs_write (1, "\n", 1);
_exit (1);
}
#ifdef SET_CHILD_PTY_PGRP
ioctl (xforkin, TIOCSPGRP, &pgrp);
ioctl (xforkout, TIOCSPGRP, &pgrp);
#endif
}
#endif /* not UNIPLUS and not RTU and not DONT_REOPEN_PTY */
#ifdef SETUP_SLAVE_PTY
if (pty_flag)
{
SETUP_SLAVE_PTY;
}
#endif /* SETUP_SLAVE_PTY */
#ifdef AIX
/* On AIX, we've disabled SIGHUP above once we start a child on a pty.
Now reenable it in the child, so it will die when we want it to. */
if (pty_flag)
signal (SIGHUP, SIG_DFL);
#endif
#endif /* HAVE_PTYS */
signal (SIGINT, SIG_DFL);
signal (SIGQUIT, SIG_DFL);
/* Stop blocking signals in the child. */
#ifdef POSIX_SIGNALS
sigprocmask (SIG_SETMASK, &procmask, 0);
#else /* !POSIX_SIGNALS */
#ifdef SIGCHLD
#ifdef BSD4_1
sigrelse (SIGCHLD);
#else /* not BSD4_1 */
#if defined (BSD_SYSTEM) || defined (UNIPLUS) || defined (HPUX)
sigsetmask (SIGEMPTYMASK);
#else /* ordinary USG */
#if 0
signal (SIGCHLD, sigchld);
#endif
#endif /* ordinary USG */
#endif /* not BSD4_1 */
#endif /* SIGCHLD */
#endif /* !POSIX_SIGNALS */
if (pty_flag)
child_setup_tty (xforkout);
#ifdef WINDOWSNT
pid = child_setup (xforkin, xforkout, xforkout,
new_argv, 1, current_dir);
#else /* not WINDOWSNT */
child_setup (xforkin, xforkout, xforkout,
new_argv, 1, current_dir);
#endif /* not WINDOWSNT */
}
!!! environ = save_environ;
}
!!! UNBLOCK_INPUT;
/* This runs in the Emacs process. */
!!! if (pid < 0)
{
if (forkin >= 0)
emacs_close (forkin);
if (forkin != forkout && forkout >= 0)
emacs_close (forkout);
}
else
{
/* vfork succeeded. */
!!! XSETFASTINT (XPROCESS (process)->pid, pid);
#ifdef WINDOWSNT
register_child (pid, inchannel);
#endif /* WINDOWSNT */
/* If the subfork execv fails, and it exits,
this close hangs. I don't know why.
So have an interrupt jar it loose. */
{
struct atimer *timer;
EMACS_TIME offset;
!!! stop_polling ();
!!! EMACS_SET_SECS_USECS (offset, 1, 0);
!!! timer = start_atimer (ATIMER_RELATIVE, offset, create_process_1, 0);
!!! XPROCESS (process)->subtty = Qnil;
!!! if (forkin >= 0)
emacs_close (forkin);
!!! cancel_atimer (timer);
!!! start_polling ();
}
!!! if (forkin != forkout && forkout >= 0)
emacs_close (forkout);
#ifdef HAVE_PTYS
!!! if (pty_flag)
!!! XPROCESS (process)->tty_name = build_string (pty_name);
else
#endif
XPROCESS (process)->tty_name = Qnil;
}
/* Restore the signal state whether vfork succeeded or not.
(We will signal an error, below, if it failed.) */
#ifdef POSIX_SIGNALS
#ifdef HAVE_VFORK
/* Restore the parent's signal handlers. */
sigaction (SIGINT, &sigint_action, 0);
sigaction (SIGQUIT, &sigquit_action, 0);
#ifdef AIX
sigaction (SIGHUP, &sighup_action, 0);
#endif
#endif /* HAVE_VFORK */
/* Stop blocking signals in the parent. */
!!! sigprocmask (SIG_SETMASK, &procmask, 0);
#else /* !POSIX_SIGNALS */
#ifdef SIGCHLD
#ifdef BSD4_1
sigrelse (SIGCHLD);
#else /* not BSD4_1 */
#if defined (BSD_SYSTEM) || defined (UNIPLUS) || defined (HPUX)
sigsetmask (SIGEMPTYMASK);
#else /* ordinary USG */
#if 0
signal (SIGCHLD, sigchld);
/* Now really handle any of these signals
that came in during this function. */
if (sigchld_deferred)
kill (getpid (), SIGCHLD);
#endif
#endif /* ordinary USG */
#endif /* not BSD4_1 */
#endif /* SIGCHLD */
#endif /* !POSIX_SIGNALS */
/* Now generate the error if vfork failed. */
!!! if (pid < 0)
--
Stef Van Vlierberghe Eurocontrol - CFMU room 20115
stef.van-vlierberghe@eurocontrol.int Raketstraat 96
Tel: +32 2 729 97 32 B-1130 BRUSSELS
Fax: +32 2 729 90 22 Belgium
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
2002-07-12 21:52 ` Stef Van Vlierberghe
@ 2002-07-13 14:20 ` Richard Stallman
0 siblings, 0 replies; 15+ messages in thread
From: Richard Stallman @ 2002-07-13 14:20 UTC (permalink / raw)
Cc: philippe.waroquiers, twurgler, emacs-devel, stef.van-vlierberghe
!!! if (inchannel >= 0)
{
#ifndef USG
/* On USG systems it does not work to open the pty's tty here
and then close and reopen it in the child. */
What happens if you change USG to 0 in that conditional?
Does subtty get set up properly? Does everything work after that?
USG stands for Unix Somethingorother Group. That was the group
in AT&T that made System V. We use it to indicate all the systems
that are derived from System V.
Also, independent of that, if you take away the #if 0 that currently
surrounds these two lines, and make them unconditional,
if (err == -1)
gid = - XFASTINT (p->pid);
does that fix the problem?
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
@ 2002-07-15 10:42 WAROQUIERS Philippe
2002-07-16 13:29 ` Richard Stallman
0 siblings, 1 reply; 15+ messages in thread
From: WAROQUIERS Philippe @ 2002-07-15 10:42 UTC (permalink / raw)
Cc: WAROQUIERS Philippe, twurgler, emacs-devel
!!! if (inchannel >= 0)
{
#ifndef USG
/* On USG systems it does not work to open the pty's tty here
and then close and reopen it in the child. */
What happens if you change USG to 0 in that conditional?
Does subtty get set up properly? Does everything work after that?
I suppose that what you wanted is to execute the code inside the #ifndef
so I have replaced
#ifndef USG
by
#ifndef THIS_IS_NOT_DEFINED
(replaced USG by 0 was giving a compilation error).
After this, the following works properly:
M-x shell
cat
C-c C-c
(or Signals -> Break)
Note however that it is still needed to initialise int gid = 1;
in process_send_signal to have C-c C-c killing the cat. If I remove
the initialisation of int gid; then C-c C-c does not work while
Signals -> Break works.
Also, independent of that, if you take away the #if 0 that currently
surrounds these two lines, and make them unconditional,
if (err == -1)
gid = - XFASTINT (p->pid);
does that fix the problem?
(NB: in emacs-21.2, it is not #if 0
but #ifdef pfa).
Yes, it also fixes the problem. But I think this is just another way to put
any value in gid which makes the rest of the code work.
If I put gid = 12345; it works as good as if I put gid = - XFASTINT
(p->pid)
The ioctl TIOCPGRP still fails (err = -1, errno= 25 ENOTTY).
But any value in gid is ok because when TIOCSIGSEND is defined, gid is only
used afterwards to compare to -1.
After, when TIOCSIGSEND is defined and current_group is not nil, gid is
unused to send the signal.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
2002-07-15 10:42 WAROQUIERS Philippe
@ 2002-07-16 13:29 ` Richard Stallman
2002-07-16 13:49 ` Tom Wurgler
0 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2002-07-16 13:29 UTC (permalink / raw)
Cc: stef.van-vlierberghe, philippe.waroquiers, twurgler, emacs-devel
If you make this change, and also add
#define USG_SUBTTY_WORKS
in hpux11.h, does everything work right?
*** process.c.~1.376.~ Mon Jul 15 05:45:00 2002
--- process.c Mon Jul 15 14:42:52 2002
***************
*** 1562,1570 ****
if (inchannel >= 0)
{
! #ifndef USG
! /* On USG systems it does not work to open the pty's tty here
! and then close and reopen it in the child. */
#ifdef O_NOCTTY
/* Don't let this terminal become our controlling terminal
(in case we don't have one). */
--- 1562,1570 ----
if (inchannel >= 0)
{
! #if ! defined (USG) || defined (USG_SUBTTY_WORKS)
! /* On most USG systems it does not work to open the pty's tty here,
! then close it and reopen it in the child. */
#ifdef O_NOCTTY
/* Don't let this terminal become our controlling terminal
(in case we don't have one). */
***************
*** 1576,1582 ****
report_file_error ("Opening pty", Qnil);
#else
forkin = forkout = -1;
! #endif /* not USG */
pty_flag = 1;
}
else
--- 1576,1582 ----
report_file_error ("Opening pty", Qnil);
#else
forkin = forkout = -1;
! #endif /* not USG, or USG_SUBTTY_WORKS */
pty_flag = 1;
}
else
***************
*** 5027,5033 ****
current_group = Qnil;
/* If we are using pgrps, get a pgrp number and make it negative. */
! if (!NILP (current_group))
{
#ifdef SIGNALS_VIA_CHARACTERS
/* If possible, send signals to the entire pgrp
--- 5027,5036 ----
current_group = Qnil;
/* If we are using pgrps, get a pgrp number and make it negative. */
! if (NILP (current_group))
! /* Send the signal to the shell's process group. */
! gid = XFASTINT (p->pid);
! else
{
#ifdef SIGNALS_VIA_CHARACTERS
/* If possible, send signals to the entire pgrp
***************
*** 5122,5128 ****
#endif /* defined (SIGNALS_VIA_CHARACTERS) */
#ifdef TIOCGPGRP
! /* Get the pgrp using the tty itself, if we have that.
Otherwise, use the pty to get the pgrp.
On pfa systems, saka@pfu.fujitsu.co.JP writes:
"TIOCGPGRP symbol defined in sys/ioctl.h at E50.
--- 5125,5131 ----
#endif /* defined (SIGNALS_VIA_CHARACTERS) */
#ifdef TIOCGPGRP
! /* Get the current pgrp using the tty itself, if we have that.
Otherwise, use the pty to get the pgrp.
On pfa systems, saka@pfu.fujitsu.co.JP writes:
"TIOCGPGRP symbol defined in sys/ioctl.h at E50.
***************
*** 5137,5164 ****
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
- gid = - gid;
#else /* ! defined (TIOCGPGRP ) */
/* Can't select pgrps on this system, so we know that
the child itself heads the pgrp. */
! gid = - XFASTINT (p->pid);
#endif /* ! defined (TIOCGPGRP ) */
/* If current_group is lambda, and the shell owns the terminal,
don't send any signal. */
! if (EQ (current_group, Qlambda) && gid == - XFASTINT (p->pid))
return;
}
- else
- gid = - XFASTINT (p->pid);
switch (signo)
{
--- 5140,5167 ----
else
err = ioctl (XINT (p->infd), TIOCGPGRP, &gid);
if (err == -1)
! /* If we can't get the information, assume
! the shell owns the tty. */
! gid = XFASTINT (p->pid);
}
+
+ /* It is not clear whether anything really can set GID to -1.
+ Perhaps on some system one of those ioctls can or could do so.
+ Or perhaps this is vestigial. */
if (gid == -1)
no_pgrp = 1;
#else /* ! defined (TIOCGPGRP ) */
/* Can't select pgrps on this system, so we know that
the child itself heads the pgrp. */
! gid = XFASTINT (p->pid);
#endif /* ! defined (TIOCGPGRP ) */
/* If current_group is lambda, and the shell owns the terminal,
don't send any signal. */
! if (EQ (current_group, Qlambda) && gid == XFASTINT (p->pid))
return;
}
switch (signo)
{
***************
*** 5210,5216 ****
kill (gid, signo);
}
#else /* ! defined (TIOCSIGSEND) */
! EMACS_KILLPG (-gid, signo);
#endif /* ! defined (TIOCSIGSEND) */
}
--- 5213,5219 ----
kill (gid, signo);
}
#else /* ! defined (TIOCSIGSEND) */
! EMACS_KILLPG (gid, signo);
#endif /* ! defined (TIOCSIGSEND) */
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
2002-07-16 13:29 ` Richard Stallman
@ 2002-07-16 13:49 ` Tom Wurgler
2002-07-17 3:03 ` Richard Stallman
0 siblings, 1 reply; 15+ messages in thread
From: Tom Wurgler @ 2002-07-16 13:49 UTC (permalink / raw)
Cc: philippe.waroquiers, stef.van-vlierberghe, philippe.waroquiers,
twurgler, emacs-devel
Hi, I installed the patch to process.c, added the line to hpux11.h, took out
the change of Philippe's in atimer.c, uncommented the lines in hpux11.h that I
had commented out (the POSIX stuff), then compiled it with HP's cc.
Results: 1) I can now abort a running job in a shell fine.
2) (sleep-for 3) still never comes back.
3) Cursor doesn't blink and still goes away until you touch a key.
Thanks for all your efforts.
===========================================================================
Recently Richard Stallman <rms@gnu.org> wrote:
> Date: Tue, 16 Jul 2002 07:29:00 -0600 (MDT)
> From: Richard Stallman <rms@gnu.org>
> CC: stef.van-vlierberghe@eurocontrol.int, philippe.waroquiers@eurocontrol.int,
> twurgler@goodyear.com, emacs-devel@gnu.org
> Reply-to: rms@gnu.org
>
> If you make this change, and also add
>
> #define USG_SUBTTY_WORKS
>
> in hpux11.h, does everything work right?
>
> *** process.c.~1.376.~ Mon Jul 15 05:45:00 2002
> --- process.c Mon Jul 15 14:42:52 2002
> ***************
> *** 1562,1570 ****
>
> if (inchannel >= 0)
> {
> ! #ifndef USG
> ! /* On USG systems it does not work to open the pty's tty here
> ! and then close and reopen it in the child. */
> #ifdef O_NOCTTY
> /* Don't let this terminal become our controlling terminal
> (in case we don't have one). */
> --- 1562,1570 ----
>
> if (inchannel >= 0)
> {
> ! #if ! defined (USG) || defined (USG_SUBTTY_WORKS)
> ! /* On most USG systems it does not work to open the pty's tty here,
> ! then close it and reopen it in the child. */
> #ifdef O_NOCTTY
> /* Don't let this terminal become our controlling terminal
> (in case we don't have one). */
> ***************
> *** 1576,1582 ****
> report_file_error ("Opening pty", Qnil);
> #else
> forkin = forkout = -1;
> ! #endif /* not USG */
> pty_flag = 1;
> }
> else
> --- 1576,1582 ----
> report_file_error ("Opening pty", Qnil);
> #else
> forkin = forkout = -1;
> ! #endif /* not USG, or USG_SUBTTY_WORKS */
> pty_flag = 1;
> }
> else
> ***************
> *** 5027,5033 ****
> current_group = Qnil;
>
> /* If we are using pgrps, get a pgrp number and make it negative. */
> ! if (!NILP (current_group))
> {
> #ifdef SIGNALS_VIA_CHARACTERS
> /* If possible, send signals to the entire pgrp
> --- 5027,5036 ----
> current_group = Qnil;
>
> /* If we are using pgrps, get a pgrp number and make it negative. */
> ! if (NILP (current_group))
> ! /* Send the signal to the shell's process group. */
> ! gid = XFASTINT (p->pid);
> ! else
> {
> #ifdef SIGNALS_VIA_CHARACTERS
> /* If possible, send signals to the entire pgrp
> ***************
> *** 5122,5128 ****
> #endif /* defined (SIGNALS_VIA_CHARACTERS) */
>
> #ifdef TIOCGPGRP
> ! /* Get the pgrp using the tty itself, if we have that.
> Otherwise, use the pty to get the pgrp.
> On pfa systems, saka@pfu.fujitsu.co.JP writes:
> "TIOCGPGRP symbol defined in sys/ioctl.h at E50.
> --- 5125,5131 ----
> #endif /* defined (SIGNALS_VIA_CHARACTERS) */
>
> #ifdef TIOCGPGRP
> ! /* Get the current pgrp using the tty itself, if we have that.
> Otherwise, use the pty to get the pgrp.
> On pfa systems, saka@pfu.fujitsu.co.JP writes:
> "TIOCGPGRP symbol defined in sys/ioctl.h at E50.
> ***************
> *** 5137,5164 ****
> 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
> - gid = - gid;
> #else /* ! defined (TIOCGPGRP ) */
> /* Can't select pgrps on this system, so we know that
> the child itself heads the pgrp. */
> ! gid = - XFASTINT (p->pid);
> #endif /* ! defined (TIOCGPGRP ) */
>
> /* If current_group is lambda, and the shell owns the terminal,
> don't send any signal. */
> ! if (EQ (current_group, Qlambda) && gid == - XFASTINT (p->pid))
> return;
> }
> - else
> - gid = - XFASTINT (p->pid);
>
> switch (signo)
> {
> --- 5140,5167 ----
> else
> err = ioctl (XINT (p->infd), TIOCGPGRP, &gid);
>
> if (err == -1)
> ! /* If we can't get the information, assume
> ! the shell owns the tty. */
> ! gid = XFASTINT (p->pid);
> }
> +
> + /* It is not clear whether anything really can set GID to -1.
> + Perhaps on some system one of those ioctls can or could do so.
> + Or perhaps this is vestigial. */
> if (gid == -1)
> no_pgrp = 1;
> #else /* ! defined (TIOCGPGRP ) */
> /* Can't select pgrps on this system, so we know that
> the child itself heads the pgrp. */
> ! gid = XFASTINT (p->pid);
> #endif /* ! defined (TIOCGPGRP ) */
>
> /* If current_group is lambda, and the shell owns the terminal,
> don't send any signal. */
> ! if (EQ (current_group, Qlambda) && gid == XFASTINT (p->pid))
> return;
> }
>
> switch (signo)
> {
> ***************
> *** 5210,5216 ****
> kill (gid, signo);
> }
> #else /* ! defined (TIOCSIGSEND) */
> ! EMACS_KILLPG (-gid, signo);
> #endif /* ! defined (TIOCSIGSEND) */
> }
>
> --- 5213,5219 ----
> kill (gid, signo);
> }
> #else /* ! defined (TIOCSIGSEND) */
> ! EMACS_KILLPG (gid, signo);
> #endif /* ! defined (TIOCSIGSEND) */
> }
>
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
@ 2002-07-16 14:11 WAROQUIERS Philippe
0 siblings, 0 replies; 15+ messages in thread
From: WAROQUIERS Philippe @ 2002-07-16 14:11 UTC (permalink / raw)
Cc: WAROQUIERS Philippe, VAN VLIERBERGHE Stef, WAROQUIERS Philippe,
emacs-devel
> Results: 1) I can now abort a running job in a shell fine.
> 2) (sleep-for 3) still never comes back.
> 3) Cursor doesn't blink and still goes away until you touch a
key.
It is normal that sleep-for still does not come back because the problem
of sleep-for is unrelated to the problem in process.c.
To solve sleep-for problem, another change is needed (which is to avoid
using
SA_RESTART in file sysdep.c function sys_signal). I would think that the
problem
3 is also solved by not using SA_RESTART.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
2002-07-16 13:49 ` Tom Wurgler
@ 2002-07-17 3:03 ` Richard Stallman
0 siblings, 0 replies; 15+ messages in thread
From: Richard Stallman @ 2002-07-17 3:03 UTC (permalink / raw)
Cc: philippe.waroquiers, stef.van-vlierberghe, philippe.waroquiers,
twurgler, emacs-devel, bruce
Results: 1) I can now abort a running job in a shell fine.
2) (sleep-for 3) still never comes back.
3) Cursor doesn't blink and still goes away until you touch a key.
Thanks for all your efforts.
It looks like there is still work to be done.
Bruce, can you find an HPUX developer who can help us
solve these Emacs problems?
^ permalink raw reply [flat|nested] 15+ messages in thread
* RE: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
@ 2002-07-17 10:46 WAROQUIERS Philippe
2002-07-17 13:47 ` Tom Wurgler
` (2 more replies)
0 siblings, 3 replies; 15+ messages in thread
From: WAROQUIERS Philippe @ 2002-07-17 10:46 UTC (permalink / raw)
Cc: WAROQUIERS Philippe, VAN VLIERBERGHE Stef, emacs-devel, bruce
Results: 1) I can now abort a running job in a shell fine.
2) (sleep-for 3) still never comes back.
3) Cursor doesn't blink and still goes away until you touch a
key.
Thanks for all your efforts.
It looks like there is still work to be done.
Bruce, can you find an HPUX developer who can help us
solve these Emacs problems?
Maybe you have not seen the previous mail I send.
There are 2 problems that were investigated and solved.
One results in a simple patch in sysdep.c (avoid using SA_RESTART).
The other one is the patch in process.c (by the way, I confirm the
final patch you have send is working).
If *both* patches are applied and POSIX_SIGNALS is defined,
all the problems above are disappearing.
In other words:
(while t) is interrupted by C-g
(sleep-for 3) really sleeps 3 seconds
abort running job in shell works (both with C-c C-c and with Signal ->
Break)
As far as I can see, Tom has tested with only the process.c patch installed.
This patch only fixes the job abort. The other patch (SA_RESTART) is needed
to solve the problems 2 and 3 above.
Thanks for the work on all this ...
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
2002-07-17 10:46 [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]] WAROQUIERS Philippe
@ 2002-07-17 13:47 ` Tom Wurgler
2002-07-18 14:55 ` Richard Stallman
2002-07-17 18:39 ` Tom Wurgler
2002-07-18 14:55 ` Richard Stallman
2 siblings, 1 reply; 15+ messages in thread
From: Tom Wurgler @ 2002-07-17 13:47 UTC (permalink / raw)
Cc: rms, twurgler, philippe.waroquiers, stef.van-vlierberghe,
emacs-devel, bruce
I see at the end of this note that Richard took out using SA_RESTART on
HP-UX. Richard, do you have a patch for that fix? I'll be glad to try it out...
Thanks again for all the hard work.
rms> From rms@santafe.edu Sat Jul 13 10:20:41 2002
rms> Date: Sat, 13 Jul 2002 08:20:32 -0600 (MDT)
rms> From: Richard Stallman <rms@gnu.org>
rms> To: Stef.Van-Vlierberghe@eurocontrol.int
rms> CC: philippe.waroquiers@eurocontrol.int, twurgler@goodyear.com,
rms> emacs-pretesters@gnu.org, emacs-pretest-bug@gnu.org,
rms> stef.van-vlierberghe@eurocontrol.int, bruce@perens.com
rms> In-reply-to: <15663.16703.732756.819731@raven.sup.cfmu.eurocontrol.be>
rms> (message from Stef Van Vlierberghe on Fri, 12 Jul 2002 22:51:11 +0200)
rms> Subject: Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP
rms> 11.0]]
rms> Reply-to: rms@gnu.org
rms>
rms> Unix standardization is really getting nowhere, it seems that the only
rms> hope that is left is that Linux might replace them all...
rms>
rms> Linux is just a kernel. If you're talking about replacing Unix with
rms> another similar system that can work with Linux, that system is GNU.
rms> See http://www.gnu.org/gnu/linux-and-gnu.html.
rms>
rms> This describes the dummy restart that does not decrement the timer not
rms> as a bug but as a feature :
rms>
rms> How silly of them. Anyway, I installed code to turn off use of
rms> SA_RESTART on HPUX.
rms>
rms> Thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
2002-07-17 10:46 [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]] WAROQUIERS Philippe
2002-07-17 13:47 ` Tom Wurgler
@ 2002-07-17 18:39 ` Tom Wurgler
2002-07-18 14:55 ` Richard Stallman
2 siblings, 0 replies; 15+ messages in thread
From: Tom Wurgler @ 2002-07-17 18:39 UTC (permalink / raw)
Cc: rms, twurgler, philippe.waroquiers, stef.van-vlierberghe,
emacs-devel, bruce
Ok, here is a patch that I did for the sysdep.c to take out SA_RESTART for hp.
Just went around it. This patch + Richard's patch for process.c + adding the
line in hpux11.h (#define USG_SUBTTY_WORKS) seems to fix all the problems I
reported. Both for cc and gcc. I don't know that this is the proper thing to
do, of course.
*** sysdep.c.~1~ Mon Nov 19 09:48:11 2001
--- sysdep.c Wed Jul 17 11:06:11 2002
***************
*** 2803,2808 ****
--- 2803,2814 ----
struct sigaction new_action, old_action;
sigemptyset (&new_action.sa_mask);
new_action.sa_handler = action;
+
+ /* the hpux11 portion below by wurgler 7/17/2002 */
+
+ #ifdef HPUX11
+ new_action.sa_flags = 0;
+ #else
#ifdef SA_RESTART
/* Emacs mostly works better with restartable system services. If this
* flag exists, we probably want to turn it on here.
***************
*** 2811,2816 ****
--- 2817,2824 ----
#else
new_action.sa_flags = 0;
#endif
+ #endif /* HPUX11 */
+
sigaction (signal_number, &new_action, &old_action);
return (old_action.sa_handler);
}
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
2002-07-17 10:46 [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]] WAROQUIERS Philippe
2002-07-17 13:47 ` Tom Wurgler
2002-07-17 18:39 ` Tom Wurgler
@ 2002-07-18 14:55 ` Richard Stallman
2002-07-19 13:37 ` Tom Wurgler
2 siblings, 1 reply; 15+ messages in thread
From: Richard Stallman @ 2002-07-18 14:55 UTC (permalink / raw)
Cc: twurgler, philippe.waroquiers, stef.van-vlierberghe, emacs-devel,
bruce
If *both* patches are applied and POSIX_SIGNALS is defined,
all the problems above are disappearing.
In other words:
(while t) is interrupted by C-g
(sleep-for 3) really sleeps 3 seconds
abort running job in shell works (both with C-c C-c and with Signal ->
Break)
That is good. Thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
2002-07-17 13:47 ` Tom Wurgler
@ 2002-07-18 14:55 ` Richard Stallman
0 siblings, 0 replies; 15+ messages in thread
From: Richard Stallman @ 2002-07-18 14:55 UTC (permalink / raw)
Cc: philippe.waroquiers, twurgler, philippe.waroquiers,
stef.van-vlierberghe, emacs-devel, bruce
I see at the end of this note that Richard took out using SA_RESTART on
HP-UX. Richard, do you have a patch for that fix?
It is in the CVS sources--please try the latest versions.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
2002-07-18 14:55 ` Richard Stallman
@ 2002-07-19 13:37 ` Tom Wurgler
2002-07-19 21:11 ` Stef Van Vlierberghe
0 siblings, 1 reply; 15+ messages in thread
From: Tom Wurgler @ 2002-07-19 13:37 UTC (permalink / raw)
Cc: philippe.waroquiers, twurgler, philippe.waroquiers,
stef.van-vlierberghe, emacs-devel, bruce
Recently Richard Stallman <rms@gnu.org> wrote:
> Date: Thu, 18 Jul 2002 08:55:08 -0600 (MDT)
> From: Richard Stallman <rms@gnu.org>
> CC: twurgler@goodyear.com, philippe.waroquiers@eurocontrol.int,
> stef.van-vlierberghe@eurocontrol.int, emacs-devel@gnu.org,
> bruce@perens.com
> Reply-to: rms@gnu.org
>
> If *both* patches are applied and POSIX_SIGNALS is defined,
> all the problems above are disappearing.
> In other words:
> (while t) is interrupted by C-g
> (sleep-for 3) really sleeps 3 seconds
> abort running job in shell works (both with C-c C-c and with Signal ->
> Break)
>
> That is good. Thanks.
>
>
I have that the all the problems I reported are fixed with these patches (the
BROKEN_SA_RESTART in sysdep.c and hpux11.h, and the process.c patch), but I
don't find that the (while t) is interruptable. Did I miss a fix here?
thanks
tom
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]]
2002-07-19 13:37 ` Tom Wurgler
@ 2002-07-19 21:11 ` Stef Van Vlierberghe
0 siblings, 0 replies; 15+ messages in thread
From: Stef Van Vlierberghe @ 2002-07-19 21:11 UTC (permalink / raw)
Cc: rms, philippe.waroquiers, stef.van-vlierberghe, emacs-devel,
bruce
Tom Wurgler writes:
>
> Recently Richard Stallman <rms@gnu.org> wrote:
>
> > Date: Thu, 18 Jul 2002 08:55:08 -0600 (MDT)
> > From: Richard Stallman <rms@gnu.org>
> > CC: twurgler@goodyear.com, philippe.waroquiers@eurocontrol.int,
> > stef.van-vlierberghe@eurocontrol.int, emacs-devel@gnu.org,
> > bruce@perens.com
> > Reply-to: rms@gnu.org
> >
> > If *both* patches are applied and POSIX_SIGNALS is defined,
> > all the problems above are disappearing.
> > In other words:
> > (while t) is interrupted by C-g
> > (sleep-for 3) really sleeps 3 seconds
> > abort running job in shell works (both with C-c C-c and with Signal ->
> > Break)
> >
> > That is good. Thanks.
> >
> >
>
> I have that the all the problems I reported are fixed with these patches (the
> BROKEN_SA_RESTART in sysdep.c and hpux11.h, and the process.c patch), but I
> don't find that the (while t) is interruptable. Did I miss a fix here?
>
> thanks
>
> tom
I think the (while t) problem was caused by the SA_RESTART.
If you use tusc (tusc.7.2.shar from HP devresource site) to look at
the system calls being made with emacs is hanging, you should see a
repetition of select() calls being continuously interrupted by SIGALARMs.
Use :
tusc -R -v -o /tmp/emacs.tusc emacs
That will show you the system call restarts (-R)
The options used when installing signal handlers (-v)
will put the output in /tmp/emacs.tusc (-o)
Good luck.
--
Stef Van Vlierberghe Eurocontrol - CFMU room 20115
stef.van-vlierberghe@eurocontrol.int Raketstraat 96
Tel: +32 2 729 97 32 B-1130 BRUSSELS
Fax: +32 2 729 90 22 Belgium
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2002-07-19 21:11 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-07-17 10:46 [rms@gnu.org: Re: [twurgler@goodyear.com: emacs-21.2.90 on HP 11.0]] WAROQUIERS Philippe
2002-07-17 13:47 ` Tom Wurgler
2002-07-18 14:55 ` Richard Stallman
2002-07-17 18:39 ` Tom Wurgler
2002-07-18 14:55 ` Richard Stallman
2002-07-19 13:37 ` Tom Wurgler
2002-07-19 21:11 ` Stef Van Vlierberghe
-- strict thread matches above, loose matches on Subject: below --
2002-07-16 14:11 WAROQUIERS Philippe
2002-07-15 10:42 WAROQUIERS Philippe
2002-07-16 13:29 ` Richard Stallman
2002-07-16 13:49 ` Tom Wurgler
2002-07-17 3:03 ` Richard Stallman
[not found] <5983E4DAC939D311B2F20008C7E62E7A075D2365@clsh01xch.office.cfmu.eurocontrol.be>
2002-07-12 11:12 ` Richard Stallman
2002-07-12 21:52 ` Stef Van Vlierberghe
2002-07-13 14:20 ` Richard Stallman
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.