#include <sys/cdefs.h>
#if !defined(_ANSI_SOURCE)
+
+/* max bytes for an exec function */
+#ifdef XNU_KERNEL_PRIVATE
+#if defined(XNU_TARGET_OS_OSX)
+#define ARG_MAX (1024 * 1024)
+#else
+#define ARG_MAX (256 * 1024)
+#endif
+#else /* XNU_KERNEL_PRIVATE */
+#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__)
+#define ARG_MAX (1024 * 1024)
+#else
+#define ARG_MAX (256 * 1024)
+#endif
+#endif /* XNU_KERNEL_PRIVATE */
+
/*
* Note: CHILD_MAX *must* be less than hard_maxproc, which is set at
* compile time; you *cannot* set it higher than the hard limit!!
*/
-#define ARG_MAX (256 * 1024) /* max bytes for an exec function */
+
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
#define CHILD_MAX 266 /* max simultaneous processes */
#define GID_MAX 2147483647U /* max value for a gid_t (2^31-2) */