diff options
author | dg <dg@FreeBSD.org> | 1994-08-06 09:06:31 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1994-08-06 09:06:31 +0000 |
commit | edb74877fe59af8008b23d2137302c9ad64c15d2 (patch) | |
tree | 0a5f89efe3b7dd0cb8fd0c7891c20d284b1ad9a4 /sys | |
parent | f35b3c52c8c76e6ce5ef4d69f5dce9bcc02415ba (diff) | |
download | FreeBSD-src-edb74877fe59af8008b23d2137302c9ad64c15d2.zip FreeBSD-src-edb74877fe59af8008b23d2137302c9ad64c15d2.tar.gz |
Implemented support for the "ps_strings" structure (grrrr...) for use in
the userland library libkvm.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_exec.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 6717e4e..b54e09b 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++); |