Re: HOST_NAME_MAX not defined in unistd.h

2016-10-03 Thread Garrett Wollman
In article <20161002111719.6e22f...@x220.alogt.com>, 
erichsfreebsdl...@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

___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"


HOST_NAME_MAX not defined in unistd.h

2016-10-01 Thread Erich Dollansky
Hi,

there is a discrepancy in the documentation:

sys/syslimits.h says:

'/*
 * We leave the following values undefined to force applications to
either
 * assume conservative values or call sysconf() to get the current
value. *
 * HOST_NAME_MAX
 *
 * (We should do this for most of the values currently defined here,
 * but many programs are not prepared to deal with this yet.)
 */'

man gethostname says:

#include 

and

'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.

What is the real idea? Keep gethostname compatible to the rest or force
users to call sysconf? 

Should I file a bug report?

Erich
___
freebsd-stable@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stable-unsubscr...@freebsd.org"