[Top][All Lists]
[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: |
Mon, 10 Aug 2009 17:29:43 +0200 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.1.50 (gnu/linux) |
Bruno Haible <address@hidden> writes:
>> It seems clear that FreeBSD isn't POSIX compliant here since
>> HOST_NAME_MAX needs to be provided, as far as I can tell.
>
> So, FreeBSD is POSIX compliant. See [1]: HOST_NAME_MAX is inside a section
> that begins with:
> "A definition of one of the symbolic constants in the following list
> shall be omitted from <limits.h> on specific implementations where the
> corresponding value is equal to or greater than the stated minimum, but
> is unspecified.
> This indetermination might depend on the amount of available memory space
> on a specific instance of a specific implementation. The actual value
> supported by a specific instance shall be provided by the sysconf()
> function."
Hmm, I didn't notice that. Then I'm less sure that it makes sense for
gnulib's limit.h to define HOST_NAME_MAX -- programs written against
POSIX should not assume that symbol exists.
The rationale for adding the symbol was to make the self-test
test-gethostname.c build. It uses HOST_NAME_MAX, which is my fault.
The proper fix appears to use sysconf if it is available, and otherwise
fall back on HOST_NAME_MAX, and otherwise just fail. What do you think?
Do sysconf work under mingw? Gnulib could provide a replacement if not.
>> I guess looking into FreeBSD libc would answer this.
>
> [2] simply makes a system call. In the kernel, it's really an access of
> an array of size MAXHOSTNAMELEN [3][4].
Thanks, so at least adding it wouldn't hurt, but it doesn't seem like
The Right Thing anyway.
/Simon
> [1] http://www.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
> [2] http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/gen/gethostname.c
> [3] http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/kern/kern_mib.c
> [4] http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/sys/jail.h
- Re: HOST_NAME_MAX, Bruno Haible, 2009/08/02
- Re: HOST_NAME_MAX, Bruno Haible, 2009/08/02
- Re: HOST_NAME_MAX, Tom G. Christensen, 2009/08/06
- Re: HOST_NAME_MAX, Simon Josefsson, 2009/08/06
- Re: HOST_NAME_MAX, Bruno Haible, 2009/08/08
- Re: HOST_NAME_MAX, Simon Josefsson, 2009/08/10
- Re: HOST_NAME_MAX, Bruno Haible, 2009/08/10
- Re: HOST_NAME_MAX,
Simon Josefsson <=
- Re: HOST_NAME_MAX, Bruno Haible, 2009/08/10
- Re: HOST_NAME_MAX, Simon Josefsson, 2009/08/11
Re: HOST_NAME_MAX, Simon Josefsson, 2009/08/03