From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27262 invoked by alias); 11 Apr 2010 05:49:18 -0000 Received: (qmail 27254 invoked by uid 22791); 11 Apr 2010 05:49:16 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from qw-out-1920.google.com (HELO qw-out-1920.google.com) (74.125.92.149) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 11 Apr 2010 05:49:12 +0000 Received: by qw-out-1920.google.com with SMTP id 4so1592414qwk.20 for ; Sat, 10 Apr 2010 22:48:59 -0700 (PDT) Received: by 10.224.26.73 with SMTP id d9mr833608qac.317.1270964938988; Sat, 10 Apr 2010 22:48:58 -0700 (PDT) Received: from localhost ([68.239.22.45]) by mx.google.com with ESMTPS id 2sm2165314qwi.49.2010.04.10.22.48.58 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 10 Apr 2010 22:48:58 -0700 (PDT) Date: Sun, 11 Apr 2010 05:49:00 -0000 From: tmhikaru@gmail.com To: cygwin@cygwin.com Subject: Usage of _exit(0) closes fd's of parent process Message-ID: <20100411054851.GA25578@roll> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="BOKacYhQ+x31HxR3" Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com X-SW-Source: 2010-04/txt/msg00501.txt.bz2 --BOKacYhQ+x31HxR3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-length: 1129 Hi. I'm having an unusual problem in a program I'm trying to get working in cygwin. My program fork()'s a child process to do a hostname lookup, establishes a tcp connection in the parent, then has the child _exit(0) itself. For some reason I don't understand, _exit is not just closing the fd's of the child, but of the parent as well. From my understanding, _exit is supposed to close the fd's of the process it is run from only. The program works correctly (That is to say, stays connected) if I comment out the _exit and instead have it while (1) { sleep (10000); }. Obviously I would like to be able to kill off the child at some point, but for testing this proved to me that either my expectation of how _exit is supposed to work in cygwin is flawed, or _exit is. Please let me know if I'm using this function call incorrectly, and what behavior I should be expecting. If my expectation of how _exit is supposed to act is correct, let me know and I'll file a bug report. I am not subscribed to the cygwin mailing list, so please make sure replies are sent to my email address as well as the list. Thank you, Hikaru --BOKacYhQ+x31HxR3 Content-Type: application/pgp-signature Content-Disposition: inline Content-length: 481 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iQEVAwUBS8Fiw5EncCrqzVruAQJiwQgAuBgIdkMC4EsHBNSBmUrFraXu/NCvq1Ja SDjidNJ6bMdCGAeuYcXGUnSZWkWgjub9mTaWv923RtqUSWWtXbZKkdwdz0AwxO2d DZjKrNADy7XxAnaEgm6CXeUzO7xYsb/6/l32+arCVFB0b6YGidBU2IFL3+WS2ArT a3DT7i0qmtyIvR89s+g17WMAcMuAUH6UF2zchUuEmAZzwHhaneIY4j1T5EPMptiw 7ysILUUJ2+rHi37PUqMOvdrcJOOIfXOO6ybQ+gSL8urRAWcKFPuEQvaBpIROgruT IgYeFp7WzzMRqfqcBVxzcGS5RvdsB/Vr2YKOEzBqMtV5ATd8Y2xYoQ== =MetO -----END PGP SIGNATURE----- --BOKacYhQ+x31HxR3--