www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/03/21/14:58:19

From: cgf AT bbc DOT com (Christopher Faylor)
Subject: Re: Fixes to last snapshot
21 Mar 1998 14:58:19 -0800 :
Message-ID: <Eq6y08.6u7.cygnus.cygwin32.developers@bbc.com>
References: <01BD550A DOT 1B7D91D0 AT sos>
Reply-To: cgf AT bbc DOT com
To: cygwin32-developers AT cygnus DOT com

In article <01BD550A DOT 1B7D91D0 AT sos>,
Sergey Okhapkin  <sos AT buggy DOT prospect DOT com DOT ru> wrote:
>spawn.cc	(spawn_guts): do not call close_all_files() in tty master
>after exec().

This patch essentially undoes what I was trying to accomplish in this
section of code.  I don't think it is right.

With Sergey's patch installed, something like this hangs:

	set CYGWIN32=tty
	sh -c "exec mem"	# Where `mem' is any non-cygwin program

That's what I was trying to fix.

I can see that there is a problem, though.  This doesn't work right:

	set CYGWIN32=tty
	sh -c "exec sleep 5"

It reports that the tty count is < 0.

This should fix that without causing the hang above.

	patch from cgf AT bbc DOT com (Christopher Faylor)
	* spawn.cc (spawn_guts): Don't call close_all_files if a cygwin
	process has been spawned.  Otherwise, we close tty handles twice.

*** spawn.cc.old	Thu Mar 12 21:41:03 1998
--- spawn.cc	Sat Mar 21 17:43:35 1998
*************** sigproc_printf ("process execed process_
*** 635,647 ****
  		res = exec_exit;
  	      exited = TRUE;
  	     }
! 	  if (nwait > 2 && WaitForSingleObject (spr, 1) == WAIT_OBJECT_0)
! 	    res |= EXIT_REPARENTING;
! 	  else if (!(res & EXIT_REPARENTING))
! 	    {
! 	      (void) myself->hmap.de_linearize_fd_array (resrv);
! 	      close_all_files ();
! 	    }
  	  break;
  	case WAIT_OBJECT_0 + 1:
  	  ResetEvent (signal_arrived);
--- 635,648 ----
  		res = exec_exit;
  	      exited = TRUE;
  	     }
! 	  if (nwait > 2)
! 	    if (WaitForSingleObject (spr, 1) == WAIT_OBJECT_0)
! 	      res |= EXIT_REPARENTING;
! 	    else if (!(res & EXIT_REPARENTING))
! 	      {
! 		(void) myself->hmap.de_linearize_fd_array (resrv);
! 		close_all_files ();
! 	      }
  	  break;
  	case WAIT_OBJECT_0 + 1:
  	  ResetEvent (signal_arrived);
-- 
http://www.bbc.com/	cgf AT bbc DOT com			"Strange how unreal
VMS=>UNIX Solutions	Boston Business Computing	 the real can be."

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019