Bug 143472 - gethostname(3) references undefined value: HOST_NAME_MAX
Summary: gethostname(3) references undefined value: HOST_NAME_MAX
Status: Closed FIXED
Alias: None
Product: Documentation
Classification: Unclassified
Component: Manual Pages (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Gordon Bergling
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-02 09:30 UTC by Jeremy Huddleston
Modified: 2020-07-20 16:52 UTC (History)
2 users (show)

See Also:


Attachments
gethostname.diff (799 bytes, patch)
2011-02-12 21:34 UTC, Rebecca Cran
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Huddleston 2010-02-02 09:30:01 UTC
HOST_NAME_MAX is intentionally left undefined.  The man page should probably use _POSIX_HOST_NAME_MAX or reference sysconf(_SC_HOST_NAME_MAX)
Comment 1 Bruce Cran freebsd_committer 2011-02-12 21:07:39 UTC
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.
Comment 2 Rebecca Cran freebsd_committer 2011-02-12 21:34:14 UTC
I've attached a patch which should fix the issue.

-- 
Bruce Cran
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2012-03-03 18:09:56 UTC
Responsible Changed
From-To: freebsd-standards->eadler

I'll take it.
Comment 4 Jilles Tjoelker freebsd_committer 2012-03-16 22:59:24 UTC
> [{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
Comment 5 Eitan Adler freebsd_committer freebsd_triage 2012-09-02 04:09:11 UTC
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
Comment 6 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:37 UTC
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
Comment 7 commit-hook freebsd_committer 2020-07-13 15:17:43 UTC
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
Comment 8 commit-hook freebsd_committer 2020-07-20 16:51:56 UTC
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