we have #define MAXHOSTNAMELEN 64, but #define NI_MAXHOST 1025

Denys Vlasenko vda.linux at googlemail.com
Sun Sep 6 11:11:53 UTC 2009


On Sunday 06 September 2009 08:26, Mike Frysinger wrote:
> On Saturday 05 September 2009 18:45:41 Denys Vlasenko wrote:
> > include/rpc/types.h declares
> > #ifndef MAXHOSTNAMELEN
> > #define        MAXHOSTNAMELEN  64
> > #endif
> >
> > while include/netdb.h declares
> > # define NI_MAXHOST      1025
> >
> > (1) It probably would be better if we have internally consistent
> > idea how big a hostname we allow.
> >
> > (2) NI_MAXHOST is too big. Do we really need to support
> > hostnames which are about ten times longer than avevare
> > screen line? We have a global data object in libc/inet/rpc/rexec.c
> > declared as "char ahostbuf[NI_MAXHOST]". This eats 1kb of bss.
> >
> > I think we can set NI_MAXHOST to 128 with no danger
> > of breaking things, or maybe even to 64.
> 
> i dont think these defines really mean the same thing.  things to consider:
>  - rexec (rpc) code is taken from glibc
>  - the defines we have match glibc
>  - rpc code in the C library is a dead concept (use libtirpc)
>  - really shouldnt bother "improving" dead code
> 
> with these in mind, i think the code remain the same.  if you concerned about 
> RPC bloat on your system, move over to libtirpc.
> -mike

I just don't want shared uclibc to put 1k hostname buffer into bss
of every running program. 1k for a *hostname*? that's nuts.

Maybe we can leave NI_MAXHOST as-is,  but cheat a bit
and make char ahostbuf[] smaller than NI_MAXHOST?

--
vda



More information about the uClibc mailing list