Moved stime, time, times POSIX calls from FS to PM. Removed child time
accounting from kernel (now in PM). Large amount of files in this commit is due to system time problems during development.
This commit is contained in:
@@ -13,7 +13,7 @@ CC = exec cc
|
||||
CFLAGS = -I$i
|
||||
LDFLAGS = -i
|
||||
|
||||
OBJ = main.o forkexit.o break.o exec.o dmp.o \
|
||||
OBJ = main.o forkexit.o break.o exec.o dmp.o time.o \
|
||||
signal.o alloc.o utility.o table.o trace.o getset.o misc.o
|
||||
|
||||
# build local binary
|
||||
|
||||
@@ -133,6 +133,7 @@ int exit_status; /* the process' exit status (for parent) */
|
||||
int parent_waiting, right_child;
|
||||
pid_t pidarg, procgrp;
|
||||
struct mproc *p_mp;
|
||||
clock_t t[5];
|
||||
|
||||
proc_nr = (int) (rmp - mproc); /* get process slot number */
|
||||
|
||||
@@ -142,6 +143,12 @@ int exit_status; /* the process' exit status (for parent) */
|
||||
/* If the exited process has a timer pending, kill it. */
|
||||
if (rmp->mp_flags & ALARM_ON) set_alarm(proc_nr, (unsigned) 0);
|
||||
|
||||
/* Do accounting: fetch usage times and accumulate at parent. */
|
||||
sys_times(proc_nr, t);
|
||||
p_mp = &mproc[rmp->mp_parent]; /* process' parent */
|
||||
p_mp->mp_child_utime = t[2];
|
||||
p_mp->mp_child_stime = t[3];
|
||||
|
||||
/* Tell the kernel and FS that the process is no longer runnable. */
|
||||
tell_fs(EXIT, proc_nr, 0, 0); /* file system can free the proc slot */
|
||||
sys_xit(rmp->mp_parent, proc_nr);
|
||||
@@ -161,7 +168,6 @@ int exit_status; /* the process' exit status (for parent) */
|
||||
/* The process slot can only be freed if the parent has done a WAIT. */
|
||||
rmp->mp_exitstatus = (char) exit_status;
|
||||
|
||||
p_mp = &mproc[rmp->mp_parent]; /* process' parent */
|
||||
pidarg = p_mp->mp_wpid; /* who's being waited for? */
|
||||
parent_waiting = p_mp->mp_flags & WAITING;
|
||||
|
||||
@@ -271,8 +277,10 @@ register struct mproc *child; /* tells which process is exiting */
|
||||
setreply(child->mp_parent, child->mp_pid);
|
||||
parent->mp_flags &= ~WAITING; /* parent no longer waiting */
|
||||
|
||||
/* Release the process table entry. */
|
||||
/* Release the process table entry and reinitialize some field. */
|
||||
child->mp_flags = 0;
|
||||
child->mp_child_utime = 0;
|
||||
child->mp_child_stime = 0;
|
||||
procs_in_use--;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ PUBLIC int do_getset()
|
||||
if (rmp->mp_procgrp == rmp->mp_pid) return(EPERM);
|
||||
rmp->mp_procgrp = rmp->mp_pid;
|
||||
tell_fs(SETSID, who, 0, 0);
|
||||
/*FALL THROUGH*/
|
||||
/* fall through */
|
||||
|
||||
case GETPGRP:
|
||||
r = rmp->mp_procgrp;
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "mproc.h"
|
||||
#include "param.h"
|
||||
|
||||
#include "../../kernel/const.h"
|
||||
#include "../../kernel/type.h"
|
||||
|
||||
FORWARD _PROTOTYPE( void get_work, (void) );
|
||||
|
||||
@@ -14,6 +14,10 @@ EXTERN struct mproc {
|
||||
pid_t mp_wpid; /* pid this process is waiting for */
|
||||
int mp_parent; /* index of parent process */
|
||||
|
||||
/* Child user and system times. Accounting done on child exit. */
|
||||
clock_t mp_child_utime; /* cumulative user time of children */
|
||||
clock_t mp_child_stime; /* cumulative sys time of children */
|
||||
|
||||
/* Real and effective uids and gids. */
|
||||
uid_t mp_realuid; /* process' real uid */
|
||||
uid_t mp_effuid; /* process' effective uid */
|
||||
@@ -61,3 +65,4 @@ EXTERN struct mproc {
|
||||
#define DONT_SWAP 0x1000 /* never swap out this process */
|
||||
|
||||
#define NIL_MPROC ((struct mproc *) 0)
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#define reboot_size m1_i2
|
||||
#define svrctl_req m2_i1
|
||||
#define svrctl_argp m2_p1
|
||||
#define stime m2_l1
|
||||
|
||||
/* The following names are synonyms for the variables in a reply message. */
|
||||
#define reply_res m_type
|
||||
@@ -39,6 +40,12 @@
|
||||
#define reply_ptr m2_p1
|
||||
#define reply_mask m2_l1
|
||||
#define reply_trace m2_l2
|
||||
#define reply_time m2_l1
|
||||
#define reply_t1 m4_l1
|
||||
#define reply_t2 m4_l2
|
||||
#define reply_t3 m4_l3
|
||||
#define reply_t4 m4_l4
|
||||
#define reply_t5 m4_l5
|
||||
|
||||
/* The following names are used to inform the FS about certain events. */
|
||||
#define tell_fs_arg1 m1_i1
|
||||
|
||||
@@ -79,6 +79,11 @@ _PROTOTYPE( int do_sigreturn, (void) );
|
||||
_PROTOTYPE( int do_sigsuspend, (void) );
|
||||
_PROTOTYPE( void check_pending, (struct mproc *rmp) );
|
||||
|
||||
/* time.c */
|
||||
_PROTOTYPE( int do_stime, (void) );
|
||||
_PROTOTYPE( int do_time, (void) );
|
||||
_PROTOTYPE( int do_times, (void) );
|
||||
|
||||
/* trace.c */
|
||||
_PROTOTYPE( int do_trace, (void) );
|
||||
_PROTOTYPE( void stop_proc, (struct mproc *rmp, int sig_nr) );
|
||||
|
||||
@@ -27,7 +27,7 @@ _PROTOTYPE (int (*call_vec[NCALLS]), (void) ) = {
|
||||
no_sys, /* 10 = unlink */
|
||||
do_waitpid, /* 11 = waitpid */
|
||||
no_sys, /* 12 = chdir */
|
||||
no_sys, /* 13 = time */
|
||||
do_time, /* 13 = time */
|
||||
no_sys, /* 14 = mknod */
|
||||
no_sys, /* 15 = chmod */
|
||||
no_sys, /* 16 = chown */
|
||||
@@ -39,7 +39,7 @@ _PROTOTYPE (int (*call_vec[NCALLS]), (void) ) = {
|
||||
no_sys, /* 22 = umount */
|
||||
do_getset, /* 23 = setuid */
|
||||
do_getset, /* 24 = getuid */
|
||||
no_sys, /* 25 = stime */
|
||||
do_stime, /* 25 = stime */
|
||||
do_trace, /* 26 = ptrace */
|
||||
do_alarm, /* 27 = alarm */
|
||||
no_sys, /* 28 = fstat */
|
||||
@@ -57,7 +57,7 @@ _PROTOTYPE (int (*call_vec[NCALLS]), (void) ) = {
|
||||
no_sys, /* 40 = rmdir */
|
||||
no_sys, /* 41 = dup */
|
||||
no_sys, /* 42 = pipe */
|
||||
no_sys, /* 43 = times */
|
||||
do_times, /* 43 = times */
|
||||
no_sys, /* 44 = (prof) */
|
||||
no_sys, /* 45 = unused */
|
||||
do_getset, /* 46 = setgid */
|
||||
|
||||
@@ -134,6 +134,7 @@ int what, p1, p2, p3;
|
||||
* tell_fs(SETSID, proc, 0, 0)
|
||||
* tell_fs(SETUID, proc, realuid, effuid)
|
||||
* tell_fs(UNPAUSE, proc, signr, 0)
|
||||
* tell_fs(STIME, time, 0, 0)
|
||||
*/
|
||||
message m;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user