mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-16 15:11:52 +00:00
Implemented support for the "ps_strings" structure (grrrr...) for use in
the userland library libkvm.
This commit is contained in:
parent
f720dc2ceb
commit
93f6448c49
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=1886
@ -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++);
|
||||
|
Loading…
Reference in New Issue
Block a user