sync with WEGA 3.2 kernel

This commit is contained in:
Oliver Lehmann 2008-05-18 10:42:59 +00:00
parent 8d8dafd919
commit 888532c466
1 changed files with 54 additions and 50 deletions

View File

@ -13,7 +13,7 @@
******************************************************************************* *******************************************************************************
******************************************************************************/ ******************************************************************************/
char acctwstr[] = "@[$]acct.c Rev : 4.1 08/27/83 11:53:34"; char whatstr[] = "@[$]acct.c Rev : 4.1 08/27/83 11:53:34";
#include <sys/param.h> #include <sys/param.h>
@ -39,7 +39,8 @@ sysacct()
} *uap; } *uap;
uap = (struct a *)u.u_ap; uap = (struct a *)u.u_ap;
if (suser()) { if (!suser())
return;
if((!u.u_segmented && ((long)uap->fname==(USEGW << 16))) || if((!u.u_segmented && ((long)uap->fname==(USEGW << 16))) ||
( u.u_segmented && (uap->fname==NULL))) { ( u.u_segmented && (uap->fname==NULL))) {
if (acctp) { if (acctp) {
@ -63,31 +64,33 @@ sysacct()
} }
acctp = ip; acctp = ip;
prele(ip); prele(ip);
}
} }
/* /*
* On exit, write a record on the accounting file. * On exit, write a record on the accounting file.
*/ */
acct() acct(st)
{ {
register struct inode *ip; register struct inode *ip;
register int i;
off_t siz; off_t siz;
int i;
if ((ip=acctp)) { if ((ip=acctp)==NULL)
return;
plock(ip); plock(ip);
for (i=0; i<sizeof(acctbuf.ac_comm); i++) for (i=0; i<sizeof(acctbuf.ac_comm); i++)
acctbuf.ac_comm[i] = u.u_comm[i]; acctbuf.ac_comm[i] = u.u_comm[i];
acctbuf.ac_btime = u.u_start;
acctbuf.ac_utime = compress(u.u_utime); acctbuf.ac_utime = compress(u.u_utime);
acctbuf.ac_stime = compress(u.u_stime); acctbuf.ac_stime = compress(u.u_stime);
acctbuf.ac_etime = compress(time - u.u_start); acctbuf.ac_etime = compress(lbolt - u.u_ticks);
acctbuf.ac_btime = u.u_start; acctbuf.ac_mem = compress(u.u_mem);
acctbuf.ac_io = compress(u.u_ioch);
acctbuf.ac_rw = compress(u.u_ior+u.u_iow);
acctbuf.ac_uid = u.u_ruid; acctbuf.ac_uid = u.u_ruid;
acctbuf.ac_gid = u.u_rgid; acctbuf.ac_gid = u.u_rgid;
acctbuf.ac_mem = 0; acctbuf.ac_tty = u.u_ttyp ? u.u_ttyd : NODEV;
acctbuf.ac_io = 0; acctbuf.ac_stat = st;
acctbuf.ac_tty = u.u_ttyd;
acctbuf.ac_flag = u.u_acflag; acctbuf.ac_flag = u.u_acflag;
siz = ip->i_size; siz = ip->i_size;
u.u_offset = siz; u.u_offset = siz;
@ -95,11 +98,12 @@ acct()
u.u_count = sizeof(acctbuf); u.u_count = sizeof(acctbuf);
u.u_segflg = 1; u.u_segflg = 1;
u.u_error = 0; u.u_error = 0;
u.u_limit = (daddr_t)5000;
writei(ip); writei(ip);
u.u_segflg = 0;
if(u.u_error) if(u.u_error)
ip->i_size = siz; ip->i_size = siz;
prele(ip); prele(ip);
}
} }
/* /*