Sending signals to a subprocess

Ken Brown
Sun Oct 24 03:50:00 GMT 2010

On 10/20/2010 4:32 PM, Christopher Faylor wrote:
> On Wed, Oct 20, 2010 at 08:25:37PM +0100, Andy Koppe wrote:
>> On 20 October 2010 13:20, Andy Koppe wrote:
>>>> Corinna made tcgetpgrp return 0 instead of -1 in some circumstances
>>>> (see
>>>> because she saw Linux doing that.  ??But when I run Corinna's test on
>>>> my Linux system, I get -1 where she got 0.  ??So not all Linuxes agree
>>>> on what tcgetpgrp should do.
>>> Hmm, Corinna's test calls tcgetpgrp(master) in the parent only before
>>> the child is forked and after it exited, so it's correct to report that
>>> there's no foreground process.
>>> I wonder which Linux it was that returned 0 in case of failure.  I've
>>> tried it on a recent Opensuse, an old Redhat with a 2.6.9 kernel, and
>>> also a Debian with a 2.4 kernel, and got -1 on all of those.
>> Actually I'd only tried my test on all three systems, whereas I'd tried
>> Corinna's only on the old Redhat, where it did print -1 for failure.
>> On the 2.4 system it can't open /dev/ptmx, whereas on the Opensuse with
>> 2.6.34 I do get the results Corinna reported, including 0 on the master
>> side of the pty when enquiring from the parent.  (Process 0 is the
>> startup process, so I guess that makes some sense.)
>> To bring my ramblings to some sort of conclusion, here's a slightly
>> amended version of Corinna's test that checks the master side from the
>> parent process before, *during* and after the child process:
> FYI, I'm sticking with the test case that I first posted several days
> ago and which has been cruelly ignored ever since.  I've been slowly
> modifying it for the last several days.
> I think I'm seeing some pattern to the way Linux handles this and I should
> be able to make Cygwin work the same way.

This seems to be fixed in the latest snapshot, as far as emacs is 
concerned.  I no longer see any difference between Cygwin and Linux 
there.  I also get the expected results when I run the test cases that 
Andy posted.  But when I run the original test case that you posted in

I'm getting strange behavior.  I ran it with no argument, getting

0 = tcgetpgrp(4)
0 = ioctl(fd, TIOCGPGRP, &pid), pid = 0

but then the terminal seemed to hang, and I didn't get a new prompt.  I 
tried this both in mintty and xterm.


Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list