From nobody@FreeBSD.org  Tue Feb  2 09:20:37 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0204C1065672
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  2 Feb 2010 09:20:37 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id CC4C78FC08
	for <freebsd-gnats-submit@FreeBSD.org>; Tue,  2 Feb 2010 09:20:36 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o129KajI032659
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 2 Feb 2010 09:20:36 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o129Ka9S032658;
	Tue, 2 Feb 2010 09:20:36 GMT
	(envelope-from nobody)
Message-Id: <201002020920.o129Ka9S032658@www.freebsd.org>
Date: Tue, 2 Feb 2010 09:20:36 GMT
From: Jeremy Huddleston <jeremyhu@apple.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: gethostname(3) references undefined value: HOST_NAME_MAX
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         143472
>Category:       docs
>Synopsis:       gethostname(3) references undefined value: HOST_NAME_MAX
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-doc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          doc-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 02 09:30:01 UTC 2010
>Closed-Date:    
>Last-Modified:  Sun Sep 02 03:09:12 UTC 2012
>Originator:     Jeremy Huddleston
>Release:        8.0
>Organization:
Apple
>Environment:
NA
>Description:
HOST_NAME_MAX is intentionally left undefined.  The man page should probably use _POSIX_HOST_NAME_MAX or reference sysconf(_SC_HOST_NAME_MAX)

>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-doc->freebsd-standards 
Responsible-Changed-By: brucec 
Responsible-Changed-When: Sat Feb 12 21:07:39 UTC 2011 
Responsible-Changed-Why:  
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.  

http://www.freebsd.org/cgi/query-pr.cgi?pr=143472 

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: docs/143472
Date: Sat, 12 Feb 2011 21:34:14 +0000

 --Boundary-00=_WzvVNhmY4S2KrEV
 Content-Type: Text/Plain;
   charset="us-ascii"
 Content-Transfer-Encoding: 7bit
 
 I've attached a patch which should fix the issue.
 
 -- 
 Bruce Cran
 
 --Boundary-00=_WzvVNhmY4S2KrEV
 Content-Type: text/plain;
   charset="ISO-8859-1";
   name="gethostname.diff.txt"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: attachment;
 	filename="gethostname.diff.txt"
 
 Index: gen/gethostname.3
 ===================================================================
 --- gen/gethostname.3	(revision 218613)
 +++ gen/gethostname.3	(working copy)
 @@ -47,7 +47,7 @@
  The
  .Fn gethostname
  function
 -returns the standard host name for the current processor, as
 +returns the standard host name for the current machine, as
  previously set by
  .Fn sethostname .
  The
 @@ -68,9 +68,9 @@
  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
 -characters, not including the trailing null, currently 255.
 +Applications should use
 +.Fn sysconf _SC_HOST_NAME_MAX
 +to find the maximum length of a host name (not including the terminating null).
  .Sh RETURN VALUES
  .Rv -std
  .Sh ERRORS
 
 --Boundary-00=_WzvVNhmY4S2KrEV--
Responsible-Changed-From-To: freebsd-standards->eadler 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Sat Mar 3 18:09:56 UTC 2012 
Responsible-Changed-Why:  
I'll take it. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=143472 

From: Jilles Tjoelker <jilles@stack.nl>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: docs/143472: gethostname(3) references undefined value:
 HOST_NAME_MAX
Date: Fri, 16 Mar 2012 23:59:24 +0100

 > [{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 
Responsible-Changed-By: eadler 
Responsible-Changed-When: Sun Sep 2 03:09:11 UTC 2012 
Responsible-Changed-Why:  
I won't be looking at this PR for a while and I need to clear some out 
of my queue 

http://www.freebsd.org/cgi/query-pr.cgi?pr=143472 
>Unformatted:
