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,67 +39,71 @@ sysacct()
} *uap; } *uap;
uap = (struct a *)u.u_ap; uap = (struct a *)u.u_ap;
if (suser()) { if (!suser())
if((!u.u_segmented && ((long)uap->fname==(USEGW << 16))) || return;
( u.u_segmented && (uap->fname==NULL))) { if((!u.u_segmented && ((long)uap->fname==(USEGW << 16))) ||
if (acctp) { ( u.u_segmented && (uap->fname==NULL))) {
plock(acctp);
iput(acctp);
acctp = NULL;
}
return;
}
if (acctp) { if (acctp) {
u.u_error = EBUSY; plock(acctp);
return; iput(acctp);
acctp = NULL;
} }
ip = namei(uchar, 0); return;
if(ip == NULL)
return;
if((ip->i_mode & IFMT) != IFREG) {
u.u_error = EACCES;
iput(ip);
return;
}
acctp = ip;
prele(ip);
} }
if (acctp) {
u.u_error = EBUSY;
return;
}
ip = namei(uchar, 0);
if(ip == NULL)
return;
if((ip->i_mode & IFMT) != IFREG) {
u.u_error = EACCES;
iput(ip);
return;
}
acctp = 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)
plock(ip); return;
for (i=0; i<sizeof(acctbuf.ac_comm); i++) plock(ip);
acctbuf.ac_comm[i] = u.u_comm[i]; for (i=0; i<sizeof(acctbuf.ac_comm); i++)
acctbuf.ac_utime = compress(u.u_utime); acctbuf.ac_comm[i] = u.u_comm[i];
acctbuf.ac_stime = compress(u.u_stime); acctbuf.ac_btime = u.u_start;
acctbuf.ac_etime = compress(time - u.u_start); acctbuf.ac_utime = compress(u.u_utime);
acctbuf.ac_btime = u.u_start; acctbuf.ac_stime = compress(u.u_stime);
acctbuf.ac_uid = u.u_ruid; acctbuf.ac_etime = compress(lbolt - u.u_ticks);
acctbuf.ac_gid = u.u_rgid; acctbuf.ac_mem = compress(u.u_mem);
acctbuf.ac_mem = 0; acctbuf.ac_io = compress(u.u_ioch);
acctbuf.ac_io = 0; acctbuf.ac_rw = compress(u.u_ior+u.u_iow);
acctbuf.ac_tty = u.u_ttyd; acctbuf.ac_uid = u.u_ruid;
acctbuf.ac_flag = u.u_acflag; acctbuf.ac_gid = u.u_rgid;
siz = ip->i_size; acctbuf.ac_tty = u.u_ttyp ? u.u_ttyd : NODEV;
u.u_offset = siz; acctbuf.ac_stat = st;
u.u_base.l = (caddr_t)&acctbuf; acctbuf.ac_flag = u.u_acflag;
u.u_count = sizeof(acctbuf); siz = ip->i_size;
u.u_segflg = 1; u.u_offset = siz;
u.u_error = 0; u.u_base.l = (caddr_t)&acctbuf;
writei(ip); u.u_count = sizeof(acctbuf);
if(u.u_error) u.u_segflg = 1;
ip->i_size = siz; u.u_error = 0;
prele(ip); u.u_limit = (daddr_t)5000;
} writei(ip);
u.u_segflg = 0;
if(u.u_error)
ip->i_size = siz;
prele(ip);
} }
/* /*