mailing list of musl libc
 help / color / mirror / code / Atom feed
* maybe a smaller HOST_NAME_MAX?
@ 2019-02-14  8:59 He X
  2019-02-14 16:32 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: He X @ 2019-02-14  8:59 UTC (permalink / raw)
  To: musl

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

in limits.h, glibc defines it as 64, musl has a valueof 255.

according a man page:
http://man7.org/linux/man-pages/man2/gethostname.2.html. HOST_NAME_MAX is
defined as 64 since linux 1.0. include/uapi/asm-generic/param.h could
verify that.

as musl targeted on linux-based devices, i think it makes sense to use a
smaller HOST_NAME_MAX.

-- 
Best regards,
xhe

[-- Attachment #2: Type: text/html, Size: 794 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: maybe a smaller HOST_NAME_MAX?
  2019-02-14  8:59 maybe a smaller HOST_NAME_MAX? He X
@ 2019-02-14 16:32 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2019-02-14 16:32 UTC (permalink / raw)
  To: musl

On Thu, Feb 14, 2019 at 04:59:05PM +0800, He X wrote:
> in limits.h, glibc defines it as 64, musl has a valueof 255.
> 
> according a man page:
> http://man7.org/linux/man-pages/man2/gethostname.2.html. HOST_NAME_MAX is
> defined as 64 since linux 1.0. include/uapi/asm-generic/param.h could
> verify that.
> 
> as musl targeted on linux-based devices, i think it makes sense to use a
> smaller HOST_NAME_MAX.

HOST_NAME_MAX>=255 is a POSIX requirement, and also a common-sense one
since it's the length of DNS hostnames. Linux defining it as 64 is a
historical bug. I'm not sure if the modern kernel interfaces let you
set a larger one or not, but from an API standpoint, applications need
to be prepared for the possibility of receiving a name up to the
standard length, not the buggy Linux limitation.

Rich


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-14 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-14  8:59 maybe a smaller HOST_NAME_MAX? He X
2019-02-14 16:32 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).