bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HOST_NAME_MAX


From: Tom G. Christensen
Subject: Re: HOST_NAME_MAX
Date: Thu, 6 Aug 2009 13:21:19 +0200
User-agent: Mutt/1.4.2.2i

On Sun, Aug 02, 2009 at 03:31:24PM +0200, Bruno Haible wrote:
> > 2009-08-02  Simon Josefsson  <address@hidden>
> >             Bruno Haible  <address@hidden>
> > 
> >     Ensure HOST_NAME_MAX as part of the gethostname module.
> >     * m4/gethostname.m4 (gl_FUNC_GETHOSTNAME): On native Windows platforms,
> >     define also HOST_NAME_MAX.
> >     * tests/test-gethostname.c (main): Check also HOST_NAME_MAX.
> >     * doc/posix-headers/limits.texi: Document the mingw problem.
> 
> Well, that led to a compilation error on Linux:
> 
> test-gethostname.c: In function ‘main’:
> test-gethostname.c:31: error: ‘HOST_NAME_MAX’ undeclared (first use in this 
> function)
> test-gethostname.c:31: error: (Each undeclared identifier is reported only 
> once
> test-gethostname.c:31: error: for each function it appears in.)
> 
> Fixed as follows:
> 
It assumes that only win32 lacks HOST_NAME_MAX which is not
true.

The daily gnulib snapshot from Simon fails thusly on
sparc-sun-solaris2.6:
test-gethostname.c: In function 'main':
test-gethostname.c:34: error: 'HOST_NAME_MAX' undeclared (first use in this 
function)
test-gethostname.c:34: error: (Each undeclared identifier is reported only once
test-gethostname.c:34: error: for each function it appears in.)

After googling a bit and checking some of the hosts I have access to it
seems atleast IRIX, Solaris, OS X 10.5 and FreeBSD does not define
HOST_NAME_MAX directly.

On Solaris 10 the value is available from getconf:
$ getconf HOST_NAME_MAX
255

On Solaris < 10 there is MAXHOSTNAMELEN in <netdb.h> that could perhaps
be used to define HOST_NAME_MAX.
IRIX also defines MAXHOSTNAMELEN but in <sys/param.h>.

-tgc




reply via email to

[Prev in Thread] Current Thread [Next in Thread]