bug-gnulib
[Top][All Lists]
Advanced

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

Re: HOST_NAME_MAX


From: Simon Josefsson
Subject: Re: HOST_NAME_MAX
Date: Thu, 06 Aug 2009 15:13:21 +0200
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux)

"Tom G. Christensen" <address@hidden> writes:

> 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>.

Right, it seems clear that gnulib should define HOST_NAME_MAX on more
systems.

I note that a Solaris 10 I have access to defines _POSIX_HOST_NAME_MAX:

/usr/include/limits.h:#define   _POSIX_HOST_NAME_MAX                    255

But I can't find HOST_NAME_MAX.  Indeed MAXHOSTNAMELEN exists:

/usr/include/netdb.h:#define    MAXHOSTNAMELEN  256

According to the POSIX spec, 255 is the safe minimum value.

/Simon




reply via email to

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