Re: Equivalent of gethostbyname_r for Mac OS X?
Re: Equivalent of gethostbyname_r for Mac OS X?
- Subject: Re: Equivalent of gethostbyname_r for Mac OS X?
- From: Marc Majka <email@hidden>
- Date: Wed, 3 May 2006 09:02:48 -0700
The following routines are all thread-safe. You may safely ignore
comments in the man pages that suggest otherwise.
- alias_getbyname alias_getent alias_setent alias_endent
- bootp_getbyether bootp_getbyip
- bootparams_getbyname bootparams_getent bootparams_setent
bootparams_endent
- getfsbyname getfsspec getfsfile getfsent setfsent endfsent
- initgroups getgrnam getgrgid getgrent setgrent endgrent
- gethostbyaddr gethostbyname gethostbyname2 gethostent sethostent
endhostent
- getipnodebyname getipnodebyaddr
- innetgr getnetgrent setnetgrent endnetgrent
- getnetbyaddr getnetbyname getnetent setnetent endnetent
- prdb_getbyname prdb_get prdb_set prdb_end
- getprotobyname getprotobynumber getprotoent setprotoent endprotoent
- getrpcbyname getrpcbynumber getrpcent setrpcent endrpcent
- getservbyport getservbyname getservent setservent endservent
- getpwnam getpwuid getpwent setpwent endpwent
They all cache returned data in per-thread storage. The threads
correctly release the cached structures on subsequent calls. Memory
is reclaimed when threads exit by a destructor routine. For those
with an interest in seeing the implementation, see the lu_utils.[ch]
files and any one of the lu_*.c routines (e.g. lu_host.c) in the
Libinfo project: http://www.opensource.apple.com/darwinsource/
10.4.6.ppc/Libinfo-222.1/lookup.subproj/lu_host.c
--
Marc Majka
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden