HOST_NAME_MAX not defined in unistd.h

Erich Dollansky erichsfreebsdlist at alogt.com
Sun Oct 2 03:17:34 UTC 2016


Hi,

there is a discrepancy in the documentation:

sys/syslimits.h says:

'/*
 * We leave the following values undefined to force applications to
either
 * assume conservative values or call sysconf() to get the current
value. *
 * HOST_NAME_MAX
 *
 * (We should do this for most of the values currently defined here,
 * but many programs are not prepared to deal with this yet.)
 */'

man gethostname says:

    #include <unistd.h>

and

'Host names are limited to {HOST_NAME_MAX} characters, not including
the trailing null, currently 255.'

which makes people assume that HOST_NAME_MAX is defined in unistd.h.

What is the real idea? Keep gethostname compatible to the rest or force
users to call sysconf? 

Should I file a bug report?

Erich


More information about the freebsd-stable mailing list