gethostbyaddr() and threads.

1999-08-08 Thread Dan Moschuk
Greetings, After quite an exhausting night (of all the ways I didn't want to spend my Sunday...) I've managed to track down a problem that has been frustrating me all night. The problem exists with multiple threads calling gethostbyaddr() (not necessarily at the same time). Here's a debug out

gethostbyaddr() and threads.

1999-08-08 Thread Dan Moschuk
Greetings, After quite an exhausting night (of all the ways I didn't want to spend my Sunday...) I've managed to track down a problem that has been frustrating me all night. The problem exists with multiple threads calling gethostbyaddr() (not necessarily at the same time). Here's a debug ou

Re: gethostbyaddr() and threads.

1999-08-09 Thread Tony Finch
Dan Moschuk wrote: > >After quite an exhausting night (of all the ways I didn't want to spend my >Sunday...) I've managed to track down a problem that has been frustrating me >all night. The problem exists with multiple threads calling gethostbyaddr() >(not necessarily at the same time). src/l

Re: gethostbyaddr() and threads.

1999-08-09 Thread Dan Moschuk
| >After quite an exhausting night (of all the ways I didn't want to spend my | >Sunday...) I've managed to track down a problem that has been frustrating me | >all night. The problem exists with multiple threads calling gethostbyaddr() | >(not necessarily at the same time). | | src/lib/libc/n

Re: gethostbyaddr() and threads.

1999-08-09 Thread Wes Peters
Dan Moschuk wrote: > > | >After quite an exhausting night (of all the ways I didn't want to spend my > | >Sunday...) I've managed to track down a problem that has been frustrating > me > | >all night. The problem exists with multiple threads calling > gethostbyaddr() > | >(not necessarily at th

Re: gethostbyaddr() and threads.

1999-08-09 Thread Brian McGovern
[snip] gethostbyaddr... actually, most of the gethostby* functions... are not thread safe. They all use a static buffer in the library. Therefore, with threads, if you don't take precautions, I'd expect your results to be odd. -Brian To Unsubscribe: send mail to majord...@freebsd.org wi

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
---Brian McGovern said: > [snip] > > gethostbyaddr... actually, most of the gethostby* functions... are not > thread safe. They all use a static buffer in the library. > > Therefore, with threads, if you don't take precautions, I'd expect your > results to be odd. > -Brian > Couldn't this be

Re: gethostbyaddr() and threads.

1999-08-09 Thread Steve Tarkalson
...@cisco.com CC: d...@trinsec.com, hack...@freebsd.org Subject: Re: gethostbyaddr() and threads. Date: Mon, 9 Aug 1999 14:21:38 -0700 (PDT) MIME-Version: 1.0 From owner-freebsd-hack...@freebsd.org Mon Aug 9 14:22:43 1999 Received: by hub.freebsd.org (Postfix, from userid 538)id 13F1E152DC; Mon, 9

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
---Steve Tarkalson said: > this is solved by one of two methods: >1-) require the caller of gethostbyaddr() to supply a pointer to >a hostent struct which will be filled. > or 2-) the library uses thread specific storage which is re-used in >each call. > You could malloc() a st

Re: gethostbyaddr() and threads.

1999-08-09 Thread Louis A. Mamakos
> ---Steve Tarkalson said: > > this is solved by one of two methods: > >1-) require the caller of gethostbyaddr() to supply a pointer to > >a hostent struct which will be filled. > > or 2-) the library uses thread specific storage which is re-used in > >each call. > > > You cou

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
---Louis A. Mamakos said: >> You could malloc() a struct hostent for each call to >> gethostby*(), each time registering the hostent in some list along with the >> thread's PID. If the same thread calls gethostby*, use the same buffer, or >> allocate a new one if another thread calls it. Have a sta

Re: gethostbyaddr() and threads.

1999-08-09 Thread Nate Williams
> > ---Steve Tarkalson said: > > > this is solved by one of two methods: > > >1-) require the caller of gethostbyaddr() to supply a pointer to > > >a hostent struct which will be filled. > > > or 2-) the library uses thread specific storage which is re-used in > > >each call. >

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
---Louis A. Mamakos said: >> ---Steve Tarkalson said: >> > this is solved by one of two methods: >> >1-) require the caller of gethostbyaddr() to supply a pointer to >> >a hostent struct which will be filled. >> > or 2-) the library uses thread specific storage which is re-used in >> >

Re: gethostbyaddr() and threads.

1999-08-09 Thread Dan Moschuk
| Well, I guess we might as well change the API, since everyone else does. Unless | someone comes up with a bettter idea, of course :) | | -Joe The API should not change. There is already enough descrepency between UNIXs to warrant programs like autoconf, we should not introduce another. We sh

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
---Dan Moschuk said: > > | Well, I guess we might as well change the API, since everyone else does. > Unless > | someone comes up with a bettter idea, of course :) > | > | -Joe > > The API should not change. There is already enough descrepency between UNIXs > to warrant programs like autoconf,

Re: gethostbyaddr() and threads.

1999-08-09 Thread Wes Peters
Joe Groff wrote: > > ---Louis A. Mamakos said: > >> You could malloc() a struct hostent for each call to > >> gethostby*(), each time registering the hostent in some list along with the > >> thread's PID. If the same thread calls gethostby*, use the same buffer, or > >> allocate a new one if anoth

Re: gethostbyaddr() and threads.

1999-08-09 Thread Wes Peters
Joe Groff wrote: > > ---Dan Moschuk said: > > > > | Well, I guess we might as well change the API, since everyone else does. > > Unless > > | someone comes up with a bettter idea, of course :) > > | > > | -Joe > > > > The API should not change. There is already enough descrepency between > > UNI

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
On Mon, 9 Aug 1999, Wes Peters wrote: > Here are the prototypes. Hosts: > > #include > #include > #include > #include > #include > > struct hostent *gethostbyname_r(const char *name, > struct hostent *result, char *buffer, int buflen, > i

Re: gethostbyaddr() and threads.

1999-08-09 Thread Wes Peters
Joe Groff wrote: > > On Mon, 9 Aug 1999, Wes Peters wrote: > > > > struct rpcent *getrpcent_r(struct rpcent *result, > > char *buffer, int buflen); > > > > Any questions? > > Looks pretty close to the POSIX/GNU way. Good luck with it. ;^) Straight from the Solaris man pages. Shou

Re: gethostbyaddr() and threads.

1999-08-10 Thread Tony Finch
Dan Moschuk wrote: > >A quicker fix would be just to enclose those global variables in >mutexes. God, no. The resolver is already stupidly unparallelizable -- there's no need to make it thread-resistant too. Tony. -- f.a.n.finchd...@dotat.atf...@demon.nete pluribus unix To Unsubsc

Re: gethostbyaddr() and threads.

1999-08-10 Thread Don Lewis
On Aug 9, 9:21pm, Dan Moschuk wrote: } Subject: Re: gethostbyaddr() and threads. } } | Well, I guess we might as well change the API, since everyone else does. Unless } | someone comes up with a bettter idea, of course :) } | } | -Joe } } The API should not change. There is already enough

Re: gethostbyaddr() and threads.

1999-08-10 Thread Brian McGovern
>> gethostbyaddr... actually, most of the gethostby* functions... are not >> thread safe. They all use a static buffer in the library. >> >> Therefore, with threads, if you don't take precautions, I'd expect your >> results to be odd. >> -Brian >> >Couldn't this be easily fixed? I haven't loo

Re: gethostbyaddr() and threads.

1999-08-10 Thread Dan Moschuk
| > Yeah, that IS a horrible idea of mine. :) Changing the API should be a last | > resort, though, since we don't want to introduce to many FreeBSDisms into the | > already-fragmented-enough Unix world. | > | > Just a thought, how does Linux's GNU libc handle gethostby* in threaded apps? | |

Re: gethostbyaddr() and threads.

1999-08-10 Thread Dan Moschuk
| } If no one has any objections, I'd like to start on this tomorrow. | | You might want to grab the latest BIND release from ftp.isc.org. One | of the comments in the CHANGES file from a while ago is: | | 384. [feature] there is now a nearly-thread-safe resolver API, with |

Re: gethostbyaddr() and threads.

1999-08-10 Thread Wes Peters
Dan Moschuk wrote: > > | > Yeah, that IS a horrible idea of mine. :) Changing the API should be a > last > | > resort, though, since we don't want to introduce to many FreeBSDisms into > the > | > already-fragmented-enough Unix world. > | > > | > Just a thought, how does Linux's GNU libc handle

Re: gethostbyaddr() and threads.

1999-08-10 Thread Kip Macy
On Tue, 10 Aug 1999, Wes Peters wrote: > Dan Moschuk wrote: > > > > | > Yeah, that IS a horrible idea of mine. :) Changing the API should be a > > last > > | > resort, though, since we don't want to introduce to many FreeBSDisms > > into the > > | > already-fragmented-enough Unix world. > > |

Re: gethostbyaddr() and threads.

1999-08-10 Thread Daniel C. Sobral
Dan Moschuk wrote: > > Does anyone have any issues with merging the new bind resolver API into > libc? Well, Terry does, though I don't quite recall his reasoning. :-) Notice, he objects the way FreeBSD is today, with the bind resolver API inside libc. Of foremost importance, though, check the l

Re: gethostbyaddr() and threads.

1999-08-10 Thread Warner Losh
In message <37b05320.e6722...@newsguy.com> "Daniel C. Sobral" writes: : Well, Terry does, though I don't quite recall his reasoning. :-) : Notice, he objects the way FreeBSD is today, with the bind resolver : API inside libc. The size of _res has changed. Although it starts with an _, it is offic

Re: gethostbyaddr() and threads.

1999-08-10 Thread Assar Westerlund
"Daniel C. Sobral" writes: > Of foremost importance, though, check the license. Are we still talking about irs? I don't find any particular strange licenses in src/lib/irs in recent bind distributions: /assar /* * Copyright (c) 1996,1999 by Internet Software Consortium. * * Permission to us

Re: gethostbyaddr() and threads.

1999-08-13 Thread Terry Lambert
> > Dan Moschuk wrote: > > > > Does anyone have any issues with merging the new bind resolver API into > > libc? > > Well, Terry does, though I don't quite recall his reasoning. :-) > Notice, he objects the way FreeBSD is today, with the bind resolver > API inside libc. I object because it perp

Re: gethostbyaddr() and threads.

1999-08-15 Thread Doug
Terry Lambert wrote: > I object because it perpetuates a situation which has made it > take this long to get the issue addressed. > > I also object because BIND 9 is currently in the works, and there > is talk of replacing the records with A6 records in the DNSEXT > working group. > > The r

Re: gethostbyaddr() and threads.

1999-08-09 Thread Tony Finch
Dan Moschuk <[EMAIL PROTECTED]> wrote: > >After quite an exhausting night (of all the ways I didn't want to spend my >Sunday...) I've managed to track down a problem that has been frustrating me >all night. The problem exists with multiple threads calling gethostbyaddr() >(not necessarily at the

Re: gethostbyaddr() and threads.

1999-08-09 Thread Dan Moschuk
| >After quite an exhausting night (of all the ways I didn't want to spend my | >Sunday...) I've managed to track down a problem that has been frustrating me | >all night. The problem exists with multiple threads calling gethostbyaddr() | >(not necessarily at the same time). | | src/lib/libc/

Re: gethostbyaddr() and threads.

1999-08-09 Thread Wes Peters
Dan Moschuk wrote: > > | >After quite an exhausting night (of all the ways I didn't want to spend my > | >Sunday...) I've managed to track down a problem that has been frustrating me > | >all night. The problem exists with multiple threads calling gethostbyaddr() > | >(not necessarily at the sam

Re: gethostbyaddr() and threads.

1999-08-09 Thread Brian McGovern
[snip] gethostbyaddr... actually, most of the gethostby* functions... are not thread safe. They all use a static buffer in the library. Therefore, with threads, if you don't take precautions, I'd expect your results to be odd. -Brian To Unsubscribe: send mail to [EMAIL PROTECTED] with

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
---Brian McGovern said: > [snip] > > gethostbyaddr... actually, most of the gethostby* functions... are not > thread safe. They all use a static buffer in the library. > > Therefore, with threads, if you don't take precautions, I'd expect your > results to be odd. > -Brian > Couldn't this b

Re: gethostbyaddr() and threads.

1999-08-09 Thread Steve Tarkalson
y-To: [EMAIL PROTECTED] >To: [EMAIL PROTECTED] >CC: [EMAIL PROTECTED], [EMAIL PROTECTED] >Subject: Re: gethostbyaddr() and threads. >Date: Mon, 9 Aug 1999 14:21:38 -0700 (PDT) >MIME-Version: 1.0 >From [EMAIL PROTECTED] Mon Aug 9 14:22:43 1999 >Received: by hub.freebsd.org (Postf

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
---Steve Tarkalson said: > this is solved by one of two methods: >1-) require the caller of gethostbyaddr() to supply a pointer to >a hostent struct which will be filled. > or 2-) the library uses thread specific storage which is re-used in >each call. > You could malloc() a s

Re: gethostbyaddr() and threads.

1999-08-09 Thread Louis A. Mamakos
> ---Steve Tarkalson said: > > this is solved by one of two methods: > >1-) require the caller of gethostbyaddr() to supply a pointer to > >a hostent struct which will be filled. > > or 2-) the library uses thread specific storage which is re-used in > >each call. > > > You co

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
---Louis A. Mamakos said: >> You could malloc() a struct hostent for each call to >> gethostby*(), each time registering the hostent in some list along with the >> thread's PID. If the same thread calls gethostby*, use the same buffer, or >> allocate a new one if another thread calls it. Have a st

Re: gethostbyaddr() and threads.

1999-08-09 Thread Nate Williams
> > ---Steve Tarkalson said: > > > this is solved by one of two methods: > > >1-) require the caller of gethostbyaddr() to supply a pointer to > > >a hostent struct which will be filled. > > > or 2-) the library uses thread specific storage which is re-used in > > >each call. >

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
---Louis A. Mamakos said: >> ---Steve Tarkalson said: >> > this is solved by one of two methods: >> >1-) require the caller of gethostbyaddr() to supply a pointer to >> >a hostent struct which will be filled. >> > or 2-) the library uses thread specific storage which is re-used in >> >

Re: gethostbyaddr() and threads.

1999-08-09 Thread Dan Moschuk
| Well, I guess we might as well change the API, since everyone else does. Unless | someone comes up with a bettter idea, of course :) | | -Joe The API should not change. There is already enough descrepency between UNIXs to warrant programs like autoconf, we should not introduce another. We sh

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
---Dan Moschuk said: > > | Well, I guess we might as well change the API, since everyone else does. > Unless > | someone comes up with a bettter idea, of course :) > | > | -Joe > > The API should not change. There is already enough descrepency between UNIXs > to warrant programs like autoconf,

Re: gethostbyaddr() and threads.

1999-08-09 Thread Wes Peters
Joe Groff wrote: > > ---Louis A. Mamakos said: > >> You could malloc() a struct hostent for each call to > >> gethostby*(), each time registering the hostent in some list along with the > >> thread's PID. If the same thread calls gethostby*, use the same buffer, or > >> allocate a new one if anot

Re: gethostbyaddr() and threads.

1999-08-09 Thread Wes Peters
Joe Groff wrote: > > ---Dan Moschuk said: > > > > | Well, I guess we might as well change the API, since everyone else does. > > Unless > > | someone comes up with a bettter idea, of course :) > > | > > | -Joe > > > > The API should not change. There is already enough descrepency between UNIXs >

Re: gethostbyaddr() and threads.

1999-08-09 Thread Joe Groff
On Mon, 9 Aug 1999, Wes Peters wrote: > Here are the prototypes. Hosts: > > #include > #include > #include > #include > #include > > struct hostent *gethostbyname_r(const char *name, > struct hostent *result, char *buffer, int buflen, >

Re: gethostbyaddr() and threads.

1999-08-09 Thread Wes Peters
Joe Groff wrote: > > On Mon, 9 Aug 1999, Wes Peters wrote: > > > > struct rpcent *getrpcent_r(struct rpcent *result, > > char *buffer, int buflen); > > > > Any questions? > > Looks pretty close to the POSIX/GNU way. Good luck with it. ;^) Straight from the Solaris man pages. Sho

Re: gethostbyaddr() and threads.

1999-08-10 Thread Tony Finch
Dan Moschuk <[EMAIL PROTECTED]> wrote: > >A quicker fix would be just to enclose those global variables in >mutexes. God, no. The resolver is already stupidly unparallelizable -- there's no need to make it thread-resistant too. Tony. -- f.a.n.finch[EMAIL PROTECTED][EMAIL PROTECTED]e

Re: gethostbyaddr() and threads.

1999-08-10 Thread Don Lewis
On Aug 9, 9:21pm, Dan Moschuk wrote: } Subject: Re: gethostbyaddr() and threads. } } | Well, I guess we might as well change the API, since everyone else does. Unless } | someone comes up with a bettter idea, of course :) } | } | -Joe } } The API should not change. There is already enough

Re: gethostbyaddr() and threads.

1999-08-10 Thread Brian McGovern
>> gethostbyaddr... actually, most of the gethostby* functions... are not >> thread safe. They all use a static buffer in the library. >> >> Therefore, with threads, if you don't take precautions, I'd expect your >> results to be odd. >> -Brian >> >Couldn't this be easily fixed? I haven't lo

Re: gethostbyaddr() and threads.

1999-08-10 Thread Dan Moschuk
| > Yeah, that IS a horrible idea of mine. :) Changing the API should be a last | > resort, though, since we don't want to introduce to many FreeBSDisms into the | > already-fragmented-enough Unix world. | > | > Just a thought, how does Linux's GNU libc handle gethostby* in threaded apps? | | P

Re: gethostbyaddr() and threads.

1999-08-10 Thread Dan Moschuk
| } If no one has any objections, I'd like to start on this tomorrow. | | You might want to grab the latest BIND release from ftp.isc.org. One | of the comments in the CHANGES file from a while ago is: | | 384. [feature] there is now a nearly-thread-safe resolver API, with |

Re: gethostbyaddr() and threads.

1999-08-10 Thread Wes Peters
Dan Moschuk wrote: > > | > Yeah, that IS a horrible idea of mine. :) Changing the API should be a last > | > resort, though, since we don't want to introduce to many FreeBSDisms into the > | > already-fragmented-enough Unix world. > | > > | > Just a thought, how does Linux's GNU libc handle getho

Re: gethostbyaddr() and threads.

1999-08-10 Thread Kip Macy
On Tue, 10 Aug 1999, Wes Peters wrote: > Dan Moschuk wrote: > > > > | > Yeah, that IS a horrible idea of mine. :) Changing the API should be a last > > | > resort, though, since we don't want to introduce to many FreeBSDisms into the > > | > already-fragmented-enough Unix world. > > | > > > |

Re: gethostbyaddr() and threads.

1999-08-10 Thread Daniel C. Sobral
Dan Moschuk wrote: > > Does anyone have any issues with merging the new bind resolver API into > libc? Well, Terry does, though I don't quite recall his reasoning. :-) Notice, he objects the way FreeBSD is today, with the bind resolver API inside libc. Of foremost importance, though, check the

Re: gethostbyaddr() and threads.

1999-08-10 Thread Warner Losh
In message <[EMAIL PROTECTED]> "Daniel C. Sobral" writes: : Well, Terry does, though I don't quite recall his reasoning. :-) : Notice, he objects the way FreeBSD is today, with the bind resolver : API inside libc. The size of _res has changed. Although it starts with an _, it is officially part

Re: gethostbyaddr() and threads.

1999-08-10 Thread Assar Westerlund
"Daniel C. Sobral" <[EMAIL PROTECTED]> writes: > Of foremost importance, though, check the license. Are we still talking about irs? I don't find any particular strange licenses in src/lib/irs in recent bind distributions: /assar /* * Copyright (c) 1996,1999 by Internet Software Consortium. *

Re: gethostbyaddr() and threads.

1999-08-13 Thread Terry Lambert
> > Dan Moschuk wrote: > > > > Does anyone have any issues with merging the new bind resolver API into > > libc? > > Well, Terry does, though I don't quite recall his reasoning. :-) > Notice, he objects the way FreeBSD is today, with the bind resolver > API inside libc. I object because it per

Re: gethostbyaddr() and threads.

1999-08-15 Thread Doug
Terry Lambert wrote: > I object because it perpetuates a situation which has made it > take this long to get the issue addressed. > > I also object because BIND 9 is currently in the works, and there > is talk of replacing the records with A6 records in the DNSEXT > working group. > > The