Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Dec 1998 10:22:31 -0500 (EST)
From:      HighWind Software Information <info@highwind.com>
To:        current@FreeBSD.ORG
Subject:   Thread fd locking and fork()
Message-ID:  <199812031522.KAA28193@highwind.com>

next in thread | raw e-mail | index | archive | help

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812031522.KAA28193>