Merge "Define MAXHOSTNAMELEN explicitly in source files."
diff --git a/libc/dns/include/resolv_private.h b/libc/dns/include/resolv_private.h
index 4a832d0..0dab3d8 100644
--- a/libc/dns/include/resolv_private.h
+++ b/libc/dns/include/resolv_private.h
@@ -63,6 +63,13 @@
/* Despite this file's name, it's part of libresolv. On Android, that means it's part of libc :-( */
#pragma GCC visibility push(default)
+// Linux defines MAXHOSTNAMELEN as 64, while the domain name limit in
+// RFC 1034 and RFC 1035 is 255 octets.
+#ifdef MAXHOSTNAMELEN
+#undef MAXHOSTNAMELEN
+#endif
+#define MAXHOSTNAMELEN 256
+
/*
* Revision information. This is the release date in YYYYMMDD format.
* It can change every day so the right thing to do with it is use it
diff --git a/libc/include/netdb.h b/libc/include/netdb.h
index e165376..3bb973c 100644
--- a/libc/include/netdb.h
+++ b/libc/include/netdb.h
@@ -73,9 +73,6 @@
#define _PATH_PROTOCOLS "/system/etc/protocols"
#define _PATH_SERVICES "/system/etc/services"
-#define MAXHOSTNAMELEN 256
-
-
/*
* Structures returned by network data base library. All addresses are
* supplied in host order, and returned in network order (suitable for
diff --git a/libc/include/sys/param.h b/libc/include/sys/param.h
index 03a462e..e64d6ce 100644
--- a/libc/include/sys/param.h
+++ b/libc/include/sys/param.h
@@ -29,8 +29,8 @@
#define _SYS_PARAM_H_
#include <limits.h>
+#include <linux/param.h>
-#define HZ 100
#define MAXPATHLEN PATH_MAX
#define MAXSYMLINKS 8
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index 2efd455..8aba998 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -118,10 +118,8 @@
# the generated files.
#
kernel_ignored_macros = set(
- [ "MAXHOSTNAMELEN", # for some reason, Linux defines it to 64
- # while most of the BSD code expects this to be 256
- # so ignore the kernel-provided definition and
- # define it in the Bionic headers instead
+ [
+
]
)
diff --git a/libc/kernel/uapi/asm-generic/param.h b/libc/kernel/uapi/asm-generic/param.h
index aa21864..6bde154 100644
--- a/libc/kernel/uapi/asm-generic/param.h
+++ b/libc/kernel/uapi/asm-generic/param.h
@@ -29,5 +29,6 @@
#ifndef NOGROUP
#define NOGROUP (- 1)
#endif
-#endif
+#define MAXHOSTNAMELEN 64
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
+#endif