Change ARG_MAX/_SC_ARG_MAX back to a constant.
As per the lkml thread https://lkml.org/lkml/2017/11/1/946.
Bug: http://b/65818597
Test: ran tests
Change-Id: I7a0610e6903e6761f2b31416e2f5017bd7a60659
diff --git a/libc/bionic/sysconf.cpp b/libc/bionic/sysconf.cpp
index d45cb38..2442fd9 100644
--- a/libc/bionic/sysconf.cpp
+++ b/libc/bionic/sysconf.cpp
@@ -52,9 +52,16 @@
// Things we actually have to calculate...
//
case _SC_ARG_MAX:
- // Not a constant since Linux 2.6.23; see fs/exec.c for details.
- // At least 32 pages, otherwise a quarter of the stack limit.
- return MAX(__sysconf_rlimit(RLIMIT_STACK) / 4, _KERNEL_ARG_MAX);
+ // https://lkml.org/lkml/2017/11/15/813...
+ //
+ // I suspect a 128kB sysconf(_SC_ARG_MAX) is the sanest bet, simply
+ // because of that "conservative is better than aggressive".
+ //
+ // Especially since _technically_ we're still limiting things to that
+ // 128kB due to the single-string limit.
+ //
+ // Linus
+ return ARG_MAX;
case _SC_AVPHYS_PAGES: return get_avphys_pages();
case _SC_CHILD_MAX: return __sysconf_rlimit(RLIMIT_NPROC);