Date: Thu, 10 Sep 1998 14:15:58 -0400 From: "Daniel M. Eischen" <eischen@vigrid.com> To: info@highwind.com Cc: eischen@vigrid.com, freebsd-current@FreeBSD.ORG, tlambert@primenet.com Subject: Re: Thread Problems Message-ID: <35F8175E.167EB0E7@vigrid.com>
next 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. Not that I know of. Does the program being forkExec'd need to access sockets? Dan Eischen eischen@vigrid.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?35F8175E.167EB0E7>