From 7763fd67c7789175b8e7e008e39b87d1e6e473ea Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Tue, 14 Sep 2010 21:21:54 +0000 Subject: [PATCH] PM: save process frame length --- commands/ps/ps.c | 2 +- servers/pm/exec.c | 9 +++++---- servers/pm/mproc.h | 5 ++++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/commands/ps/ps.c b/commands/ps/ps.c index 3be292482..bd6f10e71 100644 --- a/commands/ps/ps.c +++ b/commands/ps/ps.c @@ -562,7 +562,7 @@ int pstat(int p_nr, struct pstat *bufp, int endpoints) bufp->ps_utime = ps_proc[p_ki].p_user_time; bufp->ps_stime = ps_proc[p_ki].p_sys_time; - bufp->ps_procargs = ps_mproc[p_nr].mp_procargs; + bufp->ps_procargs = ps_mproc[p_nr].mp_frame_addr; if (bufp->ps_state == Z_STATE) bufp->ps_args = ""; diff --git a/servers/pm/exec.c b/servers/pm/exec.c index 0b9b0df13..de58d4a0f 100644 --- a/servers/pm/exec.c +++ b/servers/pm/exec.c @@ -8,7 +8,7 @@ * - take care of setuid and setgid bits * - fix up 'mproc' table * - tell kernel about EXEC - * - save offset to initial argc (for ps) + * - save offset to initial argc (for procfs) * * The entry points into this file are: * do_exec: perform the EXEC system call @@ -95,8 +95,9 @@ PUBLIC int do_exec_newmem() strncpy(rmp->mp_name, args.progname, PROC_NAME_LEN-1); rmp->mp_name[PROC_NAME_LEN-1] = '\0'; - /* Save offset to initial argc (for ps) */ - rmp->mp_procargs = (vir_bytes) stack_top - args.args_bytes; + /* Save offset to initial argc (for procfs) */ + rmp->mp_frame_addr = (vir_bytes) stack_top - args.args_bytes; + rmp->mp_frame_len = args.args_bytes; /* Kill process if something goes wrong after this point. */ rmp->mp_flags |= PARTIAL_EXEC; @@ -183,7 +184,7 @@ vir_bytes pc; check_sig(rmp->mp_pid, sn, FALSE /* ksig */); } - new_sp= (char *)rmp->mp_procargs; + new_sp= (char *)rmp->mp_frame_addr; r= sys_exec(rmp->mp_endpoint, new_sp, rmp->mp_name, pc); if (r != OK) panic("sys_exec failed: %d", r); } diff --git a/servers/pm/mproc.h b/servers/pm/mproc.h index b75264bca..f207a01a5 100644 --- a/servers/pm/mproc.h +++ b/servers/pm/mproc.h @@ -50,9 +50,12 @@ EXTERN struct mproc { unsigned mp_flags; /* flag bits */ unsigned mp_trace_flags; /* trace options */ - vir_bytes mp_procargs; /* ptr to proc's initial stack arguments */ message mp_reply; /* reply message to be sent to one */ + /* Process execution frame. Both fields are used by procfs. */ + vir_bytes mp_frame_addr; /* ptr to proc's initial stack arguments */ + size_t mp_frame_len; /* size of proc's initial stack arguments */ + /* Scheduling priority. */ signed int mp_nice; /* nice is PRIO_MIN..PRIO_MAX, standard 0. */ -- 2.44.0