Date: Thu, 10 Sep 1998 13:37:21 -0400 (EDT) From: HighWind Software Information <info@highwind.com> To: eischen@vigrid.com Cc: freebsd-current@FreeBSD.ORG, tlambert@primenet.com, eischen@vigrid.com Subject: Re: Thread Problems Message-ID: <199809101737.NAA17787@highwind.com> In-Reply-To: <35F80435.41C67EA6@vigrid.com> (eischen@vigrid.com)
next in thread | previous in thread | raw e-mail | index | archive | help
It looks like the problem lies in the threads implementation of fork and execve. When you fork, the child process gets a copy of the parents file descriptors, which includes the listen socket. When you exec, the threads library goes through its list of file descriptors and returns their mode to non-blocking (unless the application explicitly sets the mode to non-blocking). Yep. That is what is happening. It seems to me that someplace (perhaps on the fork() or exec() or pthread man page), this should be noted. This is a serious problem and is hard to know about. > A simple solution that you can make in your application, is to close > all relevent sockets after the fork and before the execl. Seems to me that this is the only really workable solution. Is there a way to get "the highest numbered socket in use"? That would make the task easy. Just loop 0 to that number and test against the few sockets you need open. -Rob 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?199809101737.NAA17787>