NetBSD: HOST_NAME_MAX Not Defined #2
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Telodendria/Telodendria#2
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Building on NetBSD fails because HOST_NAME_MAX is not defined. We need to figure out if HOST_NAME_MAX is POSIX or not, and if it is, then how to enable its visibility on NetBSD.
Just looked up about the HOST_NAME_MAX, and if GNU's manuals are to be believed, all of these platforms(versions included) don't have it defined(so it's not merely a NetBSD-specific issue):
Interesting. Let's take a look at the official POSIX standard: https://bancino.net/mirror/susv4-2018/basedefs/limits.h.html. It appears that
HOST_NAME_MAX
is a runtime invariant that may be omitted:So, at first glance, it looks like we need to use
sysconf()
to get the actual value if we want it. Otherwise, it looks like_POSIX_HOST_NAME_MAX
is required to be defined:In that case, this simple code should theoretically work:
Although I haven't tested it. We'll want to patch this into the file that uses
HOST_NAME_MAX
. Otherwise, if it is used in multiple places, we may want to add it to a different (possibly new) header.