aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Greenman <dg@FreeBSD.org>1994-08-06 09:06:31 +0000
committerDavid Greenman <dg@FreeBSD.org>1994-08-06 09:06:31 +0000
commit93f6448c49b379ad2f15b1e0e4c86217164c1f36 (patch)
tree0a5f89efe3b7dd0cb8fd0c7891c20d284b1ad9a4 /sys
parentf720dc2ceb50291432f989098220a093d9eaaef6 (diff)
Notes
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_exec.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 6717e4e53b6b..b54e09b042a7 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -28,7 +28,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kern_execve.c,v 1.20 1994/03/26 12:24:27 davidg Exp $
+ * $Id: kern_exec.c,v 1.2 1994/05/25 09:03:03 rgrimes Exp $
*/
#include <sys/param.h>
@@ -418,12 +418,13 @@ exec_copyout_strings(iparams)
char *stringp, *destp;
int *stack_base;
int vect_table_size, string_table_size;
+ struct ps_strings *arginfo;
/*
* Calculate string base and vector table pointers.
*/
- destp = (caddr_t) ((caddr_t)USRSTACK -
- roundup((ARG_MAX - iparams->stringspace), sizeof(char *)));
+ arginfo = PS_STRINGS;
+ destp = (caddr_t)arginfo - roundup((ARG_MAX - iparams->stringspace), sizeof(char *));
/*
* The '+ 2' is for the null pointers at the end of each of the
* arg and env vector sets
@@ -440,6 +441,15 @@ exec_copyout_strings(iparams)
argc = iparams->argc;
envc = iparams->envc;
+ /*
+ * Fill in "ps_strings" struct for ps, w, etc.
+ */
+ arginfo->ps_argvstr = destp;
+ arginfo->ps_nargvstr = argc;
+
+ /*
+ * Copy the arg strings and fill in vector table as we go.
+ */
for (; argc > 0; --argc) {
*(vectp++) = destp;
while (*destp++ = *stringp++);
@@ -448,6 +458,12 @@ exec_copyout_strings(iparams)
/* a null vector table pointer seperates the argp's from the envp's */
*(vectp++) = NULL;
+ arginfo->ps_envstr = destp;
+ arginfo->ps_nenvstr = envc;
+
+ /*
+ * Copy the env strings and fill in vector table as we go.
+ */
for (; envc > 0; --envc) {
*(vectp++) = destp;
while (*destp++ = *stringp++);