Fix sysconf(_SC_ARG_MAX).
ARG_MAX hasn't been a constant since Linux 2.6.23.
Bug: http://lists.landley.net/pipermail/toybox-landley.net/2016-August/008592.html
Change-Id: I1eddb562751604c75b89fa610d79be0655c53693
Test: ran the bionic tests on device and against glibc
diff --git a/libc/kernel/tools/defaults.py b/libc/kernel/tools/defaults.py
index 773d22f..340af13 100644
--- a/libc/kernel/tools/defaults.py
+++ b/libc/kernel/tools/defaults.py
@@ -53,9 +53,10 @@
"x86": {},
}
-# Replace tokens in the output according to this mapping
+# Replace tokens in the output according to this mapping.
kernel_token_replacements = {
- "asm": "__asm__",
+ # The kernel's ARG_MAX is actually the "minimum" maximum (see fs/exec.c).
+ "ARG_MAX": "_KERNEL_ARG_MAX",
# The kernel usage of __unused for unused struct fields conflicts with the macro defined in <sys/cdefs.h>.
"__unused": "__linux_unused",
# The kernel's _NSIG/NSIG are one less than the userspace value, so we need to move them aside.
diff --git a/libc/kernel/uapi/linux/limits.h b/libc/kernel/uapi/linux/limits.h
index 406d175..4441592 100644
--- a/libc/kernel/uapi/linux/limits.h
+++ b/libc/kernel/uapi/linux/limits.h
@@ -21,7 +21,7 @@
#define NR_OPEN 1024
#define NGROUPS_MAX 65536
/* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */
-#define ARG_MAX 131072
+#define _KERNEL_ARG_MAX 131072
#define LINK_MAX 127
#define MAX_CANON 255
#define MAX_INPUT 255