From owner-freebsd-current Thu Dec 3 07:23:03 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id HAA17186 for freebsd-current-outgoing; Thu, 3 Dec 1998 07:23:03 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from highwind.com (hurricane.highwind.com [209.61.45.50]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id HAA17179 for ; Thu, 3 Dec 1998 07:22:57 -0800 (PST) (envelope-from info@highwind.com) Received: (from info@localhost) by highwind.com (8.8.6/8.8.6) id KAA28193; Thu, 3 Dec 1998 10:22:31 -0500 (EST) Date: Thu, 3 Dec 1998 10:22:31 -0500 (EST) Message-Id: <199812031522.KAA28193@highwind.com> From: HighWind Software Information To: current@FreeBSD.ORG Subject: Thread fd locking and fork() Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Here is the problem: 1. You have a program that starts a few threads, one of these threads blocks in "accept()" waiting for a new connection on a file descriptor. 2. In another thread, you want to start a child program. After the fork(), but before exec(), you close() all the file descriptors you don't want the child to touch. 3. The child hangs in close() forever. Why? At fork(), you get a copy of all the fd's. Problem is, many of them have their file descriptors locked. --- Is there any solution to this? Perhaps the fork() code should unlock all the descriptors. Does this makes sense? Opening a PR now. -Rob rmf@highwind.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message