delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2002/07/29/20:47:32

Mailing-List: contact cygwin-developers-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT cygwin DOT com>
List-Help: <mailto:cygwin-developers-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT cygwin DOT com
Delivered-To: mailing list cygwin-developers AT cygwin DOT com
Message-ID: <023d01c23762$47746bd0$6132bc3e@BABEL>
From: "Conrad Scott" <Conrad DOT Scott AT dsl DOT pipex DOT com>
To: <cygwin-developers AT cygwin DOT com>
Subject: ProtectHandle
Date: Tue, 30 Jul 2002 01:44:35 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
Note-from-DJ: This may be spam

This is a multi-part message in MIME format.

------=_NextPart_000_023A_01C2376A.A8E97B50
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

This is more for the record than anything else, but I've just come
up with a program that repeatedly tickles problems with the
ProtectHandle mechanism.

I'll have a dig around with this when I get a chance but I thought
I'd post it just in case anyone else was interested in having this
fixed sooner rather than later.

The "dup.txt" attachment is the output of the "dup.cc" program
showing some (bogus?) add_handle reports from the latest
cygwin_daemon branch code.

Cheers,

// Conrad


------=_NextPart_000_023A_01C2376A.A8E97B50
Content-Type: text/plain;
	name="dup.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="dup.txt"

	fork [pid =3D 1656]
	fork [pid =3D 640]
	fork [pid =3D 1508]
	fork [pid =3D 1428]
	fork [pid =3D 452]
   2117 [main] dup 1408 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x70>
  44467 [main] dup 1408 add_handle:  previously allocated by void =
events_init():1115(title_mutex<0x70>) winpid 1608
	fork [pid =3D 1408]
	fork [pid =3D 964]
	fork [pid =3D 1792]
	fork [pid =3D 1692]
   2180 [main] dup 1656 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x90>
  47347 [main] dup 1656 add_handle:  previously allocated by void =
sigproc_init():581(signal_arrived<0x90>) winpid 1608
	fork [pid =3D 1656]
   2022 [main] dup 640 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x94>
  47460 [main] dup 640 add_handle:  previously allocated by void =
sigproc_init():589(hwait_sig<0x94>) winpid 1608
	fork [pid =3D 640]
	fork [pid =3D 1508]
	fork [pid =3D 1428]
   1864 [main] dup 452 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0xA4>
  40546 [main] dup 452 add_handle:  previously allocated by DWORD =
wait_sig(void *):1106(sigcatch_nosync<0xA4>) winpid 1608
	fork [pid =3D 452]
   2227 [main] dup 1408 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0xB0>
  47726 [main] dup 1408 add_handle:  previously allocated by DWORD =
wait_sig(void *):1107(sigcatch_nonmain<0xB0>) winpid 1608
	fork [pid =3D 1408]
	fork [pid =3D 964]
   2125 [main] dup 1792 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0xB8>
  49764 [main] dup 1792 add_handle:  previously allocated by DWORD =
wait_sig(void *):1108(sigcatch_main<0xB8>) winpid 1608
	fork [pid =3D 1792]
   2138 [main] dup 1692 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0xBC>
  46234 [main] dup 1692 add_handle:  previously allocated by DWORD =
wait_sig(void *):1109(sigcomplete_nonmain<0xBC>) winpid 1608
	fork [pid =3D 1692]
   1842 [main] dup 1656 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0xC0>
  44055 [main] dup 1656 add_handle:  previously allocated by DWORD =
wait_sig(void *):1110(sigcomplete_main<0xC0>) winpid 1608
	fork [pid =3D 1656]
	fork [pid =3D 640]
	fork [pid =3D 1508]
	fork [pid =3D 1428]
	fork [pid =3D 452]
	fork [pid =3D 1408]
	fork [pid =3D 964]
	fork [pid =3D 1792]
	fork [pid =3D 1692]
	fork [pid =3D 1656]
	fork [pid =3D 640]
	fork [pid =3D 1508]
   2343 [main] dup 1428 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x12C>
  42811 [main] dup 1428 add_handle:  previously allocated by void =
slow_pid_reuse(void *):339(fork_stupidity<0x12C>) winpid 1608
	fork [pid =3D 1428]
   2038 [main] dup 452 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x138>
  45435 [main] dup 452 add_handle:  previously allocated by void =
slow_pid_reuse(void *):339(fork_stupidity<0x138>) winpid 1608
	fork [pid =3D 452]
   2005 [main] dup 1408 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x140>
  46265 [main] dup 1408 add_handle:  previously allocated by void =
slow_pid_reuse(void *):339(fork_stupidity<0x140>) winpid 1608
	fork [pid =3D 1408]
   1846 [main] dup 964 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x148>
  46555 [main] dup 964 add_handle:  previously allocated by void =
subproc_init():852(events[0]<0x148>) winpid 1608
	fork [pid =3D 964]
   1899 [main] dup 1792 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x150>
  46246 [main] dup 1792 add_handle:  previously allocated by void =
slow_pid_reuse(void *):339(fork_stupidity<0x150>) winpid 1608
	fork [pid =3D 1792]
   1840 [main] dup 1692 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x170>
  42183 [main] dup 1692 add_handle:  previously allocated by void =
slow_pid_reuse(void *):339(fork_stupidity<0x170>) winpid 1608
	fork [pid =3D 1692]
	fork [pid =3D 1656]
   2060 [main] dup 640 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x180>
  48027 [main] dup 640 add_handle:  previously allocated by int =
proc_subproc(long unsigned int, long unsigned int):383(wval->ev<0x180>) =
winpid 1608
	fork [pid =3D 640]
	fork [pid =3D 1508]
   2057 [main] dup 1428 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x188>
  42915 [main] dup 1428 add_handle:  previously allocated by void =
subproc_init():853(hwait_subproc<0x188>) winpid 1608
	fork [pid =3D 1428]
	fork [pid =3D 452]
   1864 [main] dup 1408 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x1AC>
  42283 [main] dup 1408 add_handle:  previously allocated by void =
slow_pid_reuse(void *):339(fork_stupidity<0x1AC>) winpid 1608
	fork [pid =3D 1408]
   1858 [main] dup 964 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x1B4>
  45387 [main] dup 964 add_handle:  previously allocated by void =
slow_pid_reuse(void *):339(fork_stupidity<0x1B4>) winpid 1608
	fork [pid =3D 964]
   2039 [main] dup 1792 add_handle: void pinfo::init(int, long unsigned =
int =3D 0, void * =3D 0):167 - multiple attempts to add handle =
pinfo_shared_handle<0x1B8>
  45823 [main] dup 1792 add_handle:  previously allocated by void =
slow_pid_reuse(void *):339(fork_stupidity<0x1B8>) winpid 1608
	fork [pid =3D 1792]
	fork [pid =3D 1692]
	fork [pid =3D 1656]
	fork [pid =3D 640]
	fork [pid =3D 1508]
	fork [pid =3D 1428]
	fork [pid =3D 452]
	fork [pid =3D 1408]
	fork [pid =3D 964]
	fork [pid =3D 1792]
	fork [pid =3D 1692]
	fork [pid =3D 1656]
	fork [pid =3D 640]
	fork [pid =3D 1508]
	fork [pid =3D 1428]
	fork [pid =3D 452]
	fork [pid =3D 1408]
	fork [pid =3D 964]
	fork [pid =3D 1792]
	fork [pid =3D 1692]
	fork [pid =3D 1656]

------=_NextPart_000_023A_01C2376A.A8E97B50
Content-Type: application/octet-stream;
	name="dup.cc"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
	filename="dup.cc"

#include <sys/socket.h>
#include <sys/wait.h>

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int
main ()
{
  const int fd = socket (AF_INET, SOCK_STREAM, 0);

  for (int index = 0; index != 64; index++)
    {
      dup (fd);

      const pid_t pid = fork ();

      switch (pid)
	{
	case -1:		// error
	  perror ("\tfork");
	  exit (EXIT_FAILURE);

	case 0:			// child
	  printf ("\tfork [pid = %d]\n", getpid ());
	  return EXIT_SUCCESS;
	  break;

	default:		// parent
	  {
	    int status;
	    if (wait (&status) == -1)
	      {
		perror ("\twait ()");
		exit (EXIT_FAILURE);
	      }
	  }
	}

    }
}

------=_NextPart_000_023A_01C2376A.A8E97B50--


- Raw text -


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