This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
RE: gethostbyname
- To: "Ecos-Discuss (E-mail)" <ecos-discuss at sources dot redhat dot com>
- Subject: RE: [ECOS] gethostbyname
- From: "Dan Conti" <danc at iobjects dot com>
- Date: Tue, 14 Aug 2001 00:34:17 -0700
> From: Andrew Lunn [mailto:andrew.lunn@ascom.ch]
> Subject: Re: [ECOS] gethostbyname
>
>
> On Mon, Aug 13, 2001 at 04:11:18PM -0700, Dan Conti wrote:
>
> Hi Dan
>
> I've done the same, implement a DNS client for eCos. Im currently
> waiting for Management to sign a copywrite release so it can be
> contributed to eCos.
>
> > i wrote a simple dns client for eCos and was looking at
> adding it into
> > the kernel and, naturally, populating gethostbyname()
>
> Its not part of the kernel, its part of the network stack. You should
> place it into packages/net/tcpip/current/src/lib/
Ahh that is what i meant. For me, anything under 'packages/' is the
'kernel'. Yes i have gracelessly inserted it into tcpip/current/src/lib.
> > i haven't been able to find an example of how gethostbyname() is
> > implemented. specifically, is it possible to implement
> without dynamic
> > memory.
>
> I looked at the resolver library that comes with bind. I then decided
> it was too complex for what i needed and did it a completly different
> way. Yes, you need some sort of dynamic memory. To make this work
> correctly in a multi threaded enviroment i used malloc and the per
> thread data index pool to hold the information that each threads
> need. Each call to gethostbyname frees the results from the previous
> call and then creates the state for the current call. This fits the
> BSD symantics
>
> > and can i assume endhostent() will be explicitely called?
>
> Nope. I've seen very few real programs call that. If you port
> something from Unix its unlikly to call this function. Something you
> hard craft yourself may.
So if you call gethostbyname() only once then you have leaked memory?
eww.
> > i'm
> > not too familiar with convention on these items. is
> gethostbyname() a
> > kernel fun in *bsd? i couldn't find it when i looked. pointers
> > appreciated :)
>
> No, its in libc. All the major Open Source Unix systems use the
> resolve library from bind.
Thanks for the info. I might dodge plugging it into the standard
interface just because it looks like a low return on a lot of extra
work. On a related note, when do you think your management team will ok
releasing your client? I'd be more interested in multiple people using
(and in turn testing) a single client than deploying mine only to find
it doesn't work with xyz dns server.
Thanks again,
-Dan
>
> Andrew
>