UPAGES 8; dumpstack 96; msgbufmap; kernacc rounding bug fixed
[unix-history] / usr / src / sys / kern / kern_resource.c
index 54820f2..f348846 100644 (file)
@@ -1,4 +1,4 @@
-/*     kern_resource.c 3.1     %H%     */
+/*     kern_resource.c 4.2     %G%     */
 
 #include "../h/param.h"
 #include "../h/systm.h"
 
 #include "../h/param.h"
 #include "../h/systm.h"
@@ -61,14 +61,16 @@ acct()
        plock(ip);
        for (i=0; i<sizeof(acctbuf.ac_comm); i++)
                acctbuf.ac_comm[i] = u.u_comm[i];
        plock(ip);
        for (i=0; i<sizeof(acctbuf.ac_comm); i++)
                acctbuf.ac_comm[i] = u.u_comm[i];
-       acctbuf.ac_utime = compress(u.u_vm.vm_utime);
-       acctbuf.ac_stime = compress(u.u_vm.vm_stime);
-       acctbuf.ac_etime = compress(time - u.u_start);
+       acctbuf.ac_utime = compress((long)u.u_vm.vm_utime);
+       acctbuf.ac_stime = compress((long)u.u_vm.vm_stime);
+       acctbuf.ac_etime = compress((long)(time - u.u_start));
        acctbuf.ac_btime = u.u_start;
        acctbuf.ac_uid = u.u_ruid;
        acctbuf.ac_gid = u.u_rgid;
        acctbuf.ac_mem = 0;
        acctbuf.ac_btime = u.u_start;
        acctbuf.ac_uid = u.u_ruid;
        acctbuf.ac_gid = u.u_rgid;
        acctbuf.ac_mem = 0;
-       acctbuf.ac_io = 0;
+       if (i = u.u_vm.vm_utime + u.u_vm.vm_stime)
+               acctbuf.ac_mem = (u.u_vm.vm_ixrss + u.u_vm.vm_idsrss) / i;
+       acctbuf.ac_io = compress((long)(u.u_vm.vm_inblk + u.u_vm.vm_oublk));
        acctbuf.ac_tty = u.u_ttyd;
        acctbuf.ac_flag = u.u_acflag;
        siz = ip->i_size;
        acctbuf.ac_tty = u.u_ttyd;
        acctbuf.ac_flag = u.u_acflag;
        siz = ip->i_size;
@@ -88,7 +90,7 @@ acct()
  * with 3 bits base-8 exponent, 13 bits fraction.
  */
 compress(t)
  * with 3 bits base-8 exponent, 13 bits fraction.
  */
 compress(t)
-register time_t t;
+register long t;
 {
        register exp = 0, round = 0;
 
 {
        register exp = 0, round = 0;