Date: Mon, 3 Oct 2016 11:01:23 -0400 (EDT) From: Garrett Wollman <wollman@hergotha.csail.mit.edu> To: erichsfreebsdlist@alogt.com Cc: freebsd-stable@freebsd.org Subject: Re: HOST_NAME_MAX not defined in unistd.h Message-ID: <201610031501.u93F1NoA079787@hergotha.csail.mit.edu> References: <20161002111719.6e22f670@X220.alogt.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201610031501.u93F1NoA079787>