HOST_NAME_MAX is intentionally left undefined. The man page should probably use _POSIX_HOST_NAME_MAX or reference sysconf(_SC_HOST_NAME_MAX)
Responsible Changed From-To: freebsd-doc->freebsd-standards Standards PR. The specification is slightly confusing between gethostname and limits.h but ultimately clear that HOST_NAME_MAX can be ommitted and and that sysconf should be used.
I've attached a patch which should fix the issue. -- Bruce Cran
Responsible Changed From-To: freebsd-standards->eadler I'll take it.
> [{HOST_NAME_MAX} in man pages is considered unclear] The {limit} notation is from POSIX and typically means: - if limit is a #define, the value of the limit is known at compile time and equal to the defined value - a #define _POSIX_limit or _XOPEN_limit may exist with the most constrained value POSIX or XSI applications must cope with - sysconf(_SC_limit) or pathconf(_PC_limit) will return the value of the limit (or -1 with unchanged errno if the value is indeterminate) - getconf limit [pathname] will return the value of the limit In this particular case, only the sysconf() part is indeed really interesting, but perhaps a more general approach to {limit} can be found. -- Jilles Tjoelker
Responsible Changed From-To: eadler->freebsd-doc I won't be looking at this PR for a while and I need to clear some out of my queue
For bugs matching the following criteria: Status: In Progress Changed: (is less than) 2014-06-01 Reset to default assignee and clear in-progress tags. Mail being skipped
A commit references this bug: Author: gbe Date: Mon Jul 13 15:17:29 UTC 2020 New revision: 363147 URL: https://svnweb.freebsd.org/changeset/base/363147 Log: gethostname(3): Correct the reference of the undefined value HOST_NAME_MAX PR: 143472 Submitted by: bcran@ Reported by: Jeremy Huddleston <jeremyhu at apple dot com> Reviewed by: bcr (mentor) Approved by: bcr (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D25647 Changes: head/lib/libc/gen/gethostname.3
A commit references this bug: Author: gbe Date: Mon Jul 20 16:51:19 UTC 2020 New revision: 363371 URL: https://svnweb.freebsd.org/changeset/base/363371 Log: MFC r363147: gethostname(3): Correct the reference of the undefined value HOST_NAME_MAX PR: 143472 Submitted by: bcran@ Reported by: Jeremy Huddleston <jeremyhu at apple dot com> Reviewed by: bcr (mentor) Approved by: bcr (mentor) Differential Revision: https://reviews.freebsd.org/D25647 Changes: _U stable/12/ stable/12/lib/libc/gen/gethostname.3