> > just a suggestion, to make things more readable
> > - always use (in DLLs like winsock) the reentrant functions
> > (get???by???_r)
>
> Only gethostbyname_r and gethostbyaddr_r are known to me. Solaris
> provides functions by the same names but with different arguments.
>
> That only these two are re-entrant makes sense as they possibly cause
> a DNS query, multithreaded queries may save time. The others are local
> lookups in some /etc files.
agreed (was just too lazzy to type)
> > - implement those in misc/port.c when not provided by C lib (this can be
> > done using get???by??? and a crit sect around)
>
> Data returned is a hostent structure + the data that entries in this
> structure. You would need to follow linked list to copy these,
> possibly several times when the databuffer's size is insufficient. A
> little bit to much work IMO especiallly if it is not needed.
well, it's just a job you already partly do in __ws_gethostby??? (doubling
buffer size when needed). and for the rest, that's not linked list, but
just an array (last entry is NULL)
in all cases, relying on a #ifdef myOS is a BAD thing (read the GNU doc about
this), so you'd better use a HAVE_GETHOSTBYNAME_5 and checking in config
if the specific function (with the right proto) is available on the system
that's the minimal thing to do (as Patrik already pointed out)
> > that would make the whole winsock more readable IMO
>
> Yes, winsock is not pretty and my patch doen't help much :-(((
>
> Some reorganization of sock.c and async.c, unifying lots of redundant
> code in them, might help this a lot more.
anyway, this rises another issue. some code in misc/port.c would need
to be linked to some DLLs when the needed functions are not supported
by the native libc. perhaps, on some systems, there'll be a need to
create a libwineport.so library for the "missing but expected" functions
by wine.
A+
--
---------------
Eric Pouech (http://perso.wanadoo.fr/eric.pouech/)
"The future will be better tomorrow", Vice President Dan Quayle