--- /usr/src/sys/alpha/osf1/osf1_sysvec.c Sun Sep 1 23:41:22 2002 +++ /usr/src/sys/alpha/osf1/osf1_sysvec.c Thu Oct 30 01:25:25 2003 @@ -121,7 +121,7 @@ sz = *(imgp->proc->p_sysent->sv_szsigcode); destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - - roundup((ARG_MAX - imgp->stringspace), sizeof(char *)); + roundup((argmax - imgp->stringspace), sizeof(char *)); destp -= imgp->stringspace; --- /usr/src/sys/ia64/ia32/ia32_sysvec.c Sun Sep 1 23:41:23 2002 +++ /usr/src/sys/ia64/ia32/ia32_sysvec.c Thu Oct 30 01:25:25 2003 @@ -146,7 +146,7 @@ arginfo = (struct ia32_ps_strings *)IA32_PS_STRINGS; szsigcode = *(imgp->proc->p_sysent->sv_szsigcode); destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - - roundup((ARG_MAX - imgp->stringspace), sizeof(char *)); + roundup((argmax - imgp->stringspace), sizeof(char *)); /* * install sigcode @@ -194,7 +194,7 @@ /* * Copy out strings - arguments and environment. */ - copyout(stringp, destp, ARG_MAX - imgp->stringspace); + copyout(stringp, destp, argmax - imgp->stringspace); /* * Fill in "ps_strings" struct for ps, w, etc. --- /usr/src/sys/kern/kern_exec.c Thu Dec 19 10:40:10 2002 +++ /usr/src/sys/kern/kern_exec.c Thu Oct 30 01:27:26 2003 @@ -235,7 +235,7 @@ * Allocate temporary demand zeroed space for argument and * environment strings */ - imgp->stringbase = (char *)kmem_alloc_wait(exec_map, ARG_MAX + + imgp->stringbase = (char *)kmem_alloc_wait(exec_map, argmax + PAGE_SIZE); if (imgp->stringbase == NULL) { error = ENOMEM; @@ -243,8 +243,8 @@ goto exec_fail; } imgp->stringp = imgp->stringbase; - imgp->stringspace = ARG_MAX; - imgp->image_header = imgp->stringbase + ARG_MAX; + imgp->stringspace = argmax; + imgp->image_header = imgp->stringbase + argmax; /* * Translate the file name. namei() returns a vnode pointer @@ -260,7 +260,7 @@ error = namei(ndp); if (error) { kmem_free_wakeup(exec_map, (vm_offset_t)imgp->stringbase, - ARG_MAX + PAGE_SIZE); + argmax + PAGE_SIZE); goto exec_fail; } @@ -633,7 +633,7 @@ if (imgp->stringbase != NULL) kmem_free_wakeup(exec_map, (vm_offset_t)imgp->stringbase, - ARG_MAX + PAGE_SIZE); + argmax + PAGE_SIZE); if (imgp->object) vm_object_deallocate(imgp->object); @@ -987,7 +987,7 @@ if (p->p_sysent->sv_szsigcode != NULL) szsigcode = *(p->p_sysent->sv_szsigcode); destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - - roundup((ARG_MAX - imgp->stringspace), sizeof(char *)); + roundup((argmax - imgp->stringspace), sizeof(char *)); /* * install sigcode @@ -1035,7 +1035,7 @@ /* * Copy out strings - arguments and environment. */ - copyout(stringp, destp, ARG_MAX - imgp->stringspace); + copyout(stringp, destp, argmax - imgp->stringspace); /* * Fill in "ps_strings" struct for ps, w, etc. --- /usr/src/sys/kern/kern_mib.c Fri Nov 8 00:57:17 2002 +++ /usr/src/sys/kern/kern_mib.c Thu Oct 30 01:27:27 2003 @@ -111,7 +111,7 @@ &maxusers, 0, "Hint for kernel tuning"); SYSCTL_INT(_kern, KERN_ARGMAX, argmax, CTLFLAG_RD, - 0, ARG_MAX, "Maximum bytes of argument to execve(2)"); + &argmax, 0, "Maximum bytes of argument to execve(2)"); SYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD, 0, _POSIX_VERSION, "Version of POSIX attempting to comply to"); --- /usr/src/sys/kern/subr_param.c Fri Aug 30 06:04:35 2002 +++ /usr/src/sys/kern/subr_param.c Thu Oct 30 01:27:28 2003 @@ -75,6 +75,7 @@ int nswbuf; int maxswzone; /* max swmeta KVA storage */ int maxbcache; /* max buffer cache KVA storage */ +int argmax; /* max bytes of argument to exec */ u_quad_t maxtsiz; /* max text size */ u_quad_t dfldsiz; /* initial data size limit */ u_quad_t maxdsiz; /* max data size */ @@ -166,4 +167,7 @@ ncallout = 16 + maxproc + maxfiles; TUNABLE_INT_FETCH("kern.ncallout", &ncallout); + + argmax = ARG_MAX; + TUNABLE_INT_FETCH("kern.argmax", &argmax); } --- /usr/src/sys/sys/proc.h Tue Dec 10 03:33:45 2002 +++ /usr/src/sys/sys/proc.h Thu Oct 30 01:27:29 2003 @@ -827,6 +827,7 @@ extern int hogticks; /* Limit on kernel cpu hogs. */ extern int nprocs, maxproc; /* Current and max number of procs. */ extern int maxprocperuid; /* Max procs per uid. */ +extern int argmax; /* Max bytes of argument to exec. */ extern u_long ps_arg_cache_limit; extern int ps_argsopen; extern int ps_showallprocs; --- /usr/src/sys/vm/vm_init.c Fri Nov 8 00:57:17 2002 +++ /usr/src/sys/vm/vm_init.c Thu Oct 30 01:25:25 2003 @@ -193,7 +193,7 @@ (nswbuf*MAXPHYS) + pager_map_size); pager_map->system_map = 1; exec_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, - (16*(ARG_MAX+(PAGE_SIZE*3)))); + (16*(argmax+(PAGE_SIZE*3)))); /* * XXX: Mbuf system machine-specific initializations should