From owner-freebsd-stable@freebsd.org Mon Oct 3 15:02:08 2016 Return-Path: Delivered-To: freebsd-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F79FAF3DA5 for ; Mon, 3 Oct 2016 15:02:08 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (wollman-1-pt.tunnel.tserv4.nyc4.ipv6.he.net [IPv6:2001:470:1f06:ccb::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57F1D328 for ; Mon, 3 Oct 2016 15:02:08 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (localhost [127.0.0.1]) by hergotha.csail.mit.edu (8.15.2/8.15.2) with ESMTP id u93F1Nn8079788; Mon, 3 Oct 2016 11:01:23 -0400 (EDT) (envelope-from wollman@hergotha.csail.mit.edu) Received: (from wollman@localhost) by hergotha.csail.mit.edu (8.15.2/8.14.4/Submit) id u93F1NoA079787; Mon, 3 Oct 2016 11:01:23 -0400 (EDT) (envelope-from wollman) Date: Mon, 3 Oct 2016 11:01:23 -0400 (EDT) From: Garrett Wollman Message-Id: <201610031501.u93F1NoA079787@hergotha.csail.mit.edu> To: erichsfreebsdlist@alogt.com Subject: Re: HOST_NAME_MAX not defined in unistd.h X-Newsgroups: mit.lcs.mail.freebsd-stable References: <20161002111719.6e22f670@X220.alogt.com> Organization: none Cc: freebsd-stable@freebsd.org X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (hergotha.csail.mit.edu [127.0.0.1]); Mon, 03 Oct 2016 11:01:23 -0400 (EDT) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on hergotha.csail.mit.edu X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2016 15:02:08 -0000 In article <20161002111719.6e22f670@X220.alogt.com>, erichsfreebsdlist@alogt.com writes: >'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. It should not make them assume that. {SOME_LIMIT}, in curly braces, means the value of the limit, determined in the usual POSIX way: by checking whether a macro is defined, and if not, calling sysconf() to determine what the run-time value of the limit is, and if sysconf() returns -1 with errno unchanged, doing whatever makes sense when the system does not impose any limit (which depends on the semantics of the limit in question). Having a typographical convention avoids having to repeat the usual description with all of its caveats every time a limit is referenced. For most limits defined by POSIX, there is a macro _POSIX_LIMIT_NAME which must be defined to a specific value set out in the standard, and which indicates the minimum permissible value of the limit. This value isn't necessarily useful for what any given program needs, although it might serve as a reasonable guess. -GAWollman