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

Mike Frysinger vapier at gentoo.org
Sun Sep 6 15:32:54 UTC 2009


On Sunday 06 September 2009 07:11:53 Denys Vlasenko wrote:
> 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?

i agree it sucks, but for an interface that:
 - we dont really want to extend anymore
 - doesnt really have any official interface documentation
 - has a lot of backdoor symbols
 - coding style blows
i think we should just let it lie
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20090906/746d0d72/attachment.pgp>


More information about the uClibc mailing list