Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: slinky.cs.nyu.edu: pechtcha owned process doing -bs Date: Mon, 10 Feb 2003 22:50:04 -0500 (EST) From: Igor Pechtchanski Reply-To: cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com Subject: Re: gethostbyname thread-safe? In-Reply-To: <20030211025157.GA14792@redhat.com> Message-ID: Importance: Normal MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII On Mon, 10 Feb 2003, Christopher Faylor wrote: > On Mon, Feb 10, 2003 at 09:36:53PM -0500, Igor Pechtchanski wrote: > >On Mon, 10 Feb 2003, Ajay Nerurkar wrote: > > > >> Is Cygwin's gethostbyname thread-safe? From a web search I got the > >> impression that it wasn't and also that Cygwin does not have its > >> reentrant version gethostbyname_r. So, what does one do? > >> > >> Ajay > > > >Ajay, > > > >Looking at the code (src/winsup/cygwin/net.cc), > > > >964:#ifdef _MT_SAFE > >965:#define hostent_buf _reent_winsup ()->_hostent_buf > >966:#else > >967:static struct hostent *hostent_buf = NULL; > >968:#endif > >969: > >970:/* exported as gethostbyname: standards? */ > >971:extern "C" struct hostent * > >972:cygwin_gethostbyname (const char *name) > > > >you can see that there is a provision for reentrancy. However, > >src/winsup/cygwin/acconfig.h #undef's _MT_SAFE. OpenGroup's specification > >() > >says that "The gethostbyname() function need not be reentrant." > >See for a good > >discussion of gethostbyname() thread-safety issues. > > _MT_SAFE is always set to 1 in config.h unless the dll is built with > --disable-threadsafe. I don't know that this option even works, though. > > So gethostbyname should be threadsafe. > > cgf Yeah, I started a build with a full intention of searching the result for any overrides of _MT_SAFE, but got too impatient and sent the message before the build finished. Apologies for the misinformation. Igor -- http://cs.nyu.edu/~pechtcha/ |\ _,,,---,,_ pechtcha AT cs DOT nyu DOT edu ZZZzz /,`.-'`' -. ;-;;,_ igor AT watson DOT ibm DOT com |,4- ) )-,_. ,\ ( `'-' Igor Pechtchanski '---''(_/--' `-'\_) fL a.k.a JaguaR-R-R-r-r-r-.-.-. Meow! Oh, boy, virtual memory! Now I'm gonna make myself a really *big* RAMdisk! -- /usr/games/fortune -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/