public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Usage of _exit(0) closes fd's of parent process
@ 2010-04-11  5:49 tmhikaru
  2010-04-11  6:29 ` Christopher Faylor
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: tmhikaru @ 2010-04-11  5:49 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 1129 bytes --]

	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

[-- Attachment #2: Type: application/pgp-signature, Size: 481 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-04-13 17:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-11  5:49 Usage of _exit(0) closes fd's of parent process tmhikaru
2010-04-11  6:29 ` Christopher Faylor
2010-04-11 11:30   ` Dave Korn
2010-04-11 12:30     ` Corinna Vinschen
2010-04-12  1:11 ` tmhikaru
2010-04-13  2:17 ` tmhikaru
2010-04-13 17:34   ` gothrog

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).