.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
-.\" 3. All advertising materials mentioning features or use of this software
-.\" must display the following acknowledgement:
-.\" This product includes software developed by the University of
-.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\" SUCH DAMAGE.
.\"
.\" @(#)gethostname.3 8.1 (Berkeley) 6/4/93
-.\" $FreeBSD: src/lib/libc/gen/gethostname.3,v 1.16 2004/07/03 22:30:08 ru Exp $
+.\" $FreeBSD: src/lib/libc/gen/gethostname.3,v 1.17 2007/01/09 00:27:54 imp Exp $
.\"
.Dd August 18, 2003
.Dt GETHOSTNAME 3
specifies the size of the
.Fa name
array.
-The returned name is null-terminated unless insufficient space is provided.
+The returned name is null-terminated, unless insufficient space is provided.
.Pp
The
.Fn sethostname
This call is restricted to the super-user and
is normally used only when the system is bootstrapped.
.Pp
-Host names are limited to
-.Brq Dv HOST_NAME_MAX
+Host names are limited in length to
+.Brq Dv sysconf(_SC_HOST_NAME_MAX)
characters, not including the trailing null, currently 255.
.Sh RETURN VALUES
.Rv -std
function conforms to
.St -p1003.1-2001 .
Callers should be aware that
-.Brq Dv HOST_NAME_MAX
+.Brq Dv sysconf(_SC_HOST_NAME_MAX)
may be variable or infinite, but is guaranteed to be no less than
.Brq Dv _POSIX_HOST_NAME_MAX .
On older systems, this limit was defined in the non-standard header