From 5ff6e8b5e01e3deda2e5bd75e0312c06c0ccb518 Mon Sep 17 00:00:00 2001 From: Oliver Lehmann Date: Mon, 19 May 2008 17:34:43 +0000 Subject: [PATCH] STATUS: 71% done 0000 T _gtime compatible 000e T _ftime not compatible 00a4 T _stime compatible 00d2 T _setuid compatible 012e T _getuid compatible 0148 T _setgid compatible 019a T _getgid compatible 01b4 T _getpid compatible 01d0 T _setpgrp compatible 0206 T _sync compatible 020e T _nice compatible 027c T _unlink compatible 038e T _chdir compatible 0398 T _chroot compatible 03ac T _chdirec compatible 042a T _chmod compatible 04a0 T _chown compatible 04fa T _ssig not compatible 0612 T _kill not compatible 0722 T _times not compatible 077a T _profil compatible 07ac T _sprofil not existent 0872 T _alarm compatible 08aa T _pause compatible 08bc T _umask compatible 08e0 T _utime not compatible 09ee T _nosys compatible 09f8 T _nullsys compatible 09fa T _bpt not existent 0a0a T _utssys not existent 0b0a T _ulimit not compatible --- WEGA/src/uts/sys/sys4.c | 105 +++++++++++++++++++++++++++++++++++----- 1 file changed, 93 insertions(+), 12 deletions(-) diff --git a/WEGA/src/uts/sys/sys4.c b/WEGA/src/uts/sys/sys4.c index 57e25f4..83d63e5 100644 --- a/WEGA/src/uts/sys/sys4.c +++ b/WEGA/src/uts/sys/sys4.c @@ -28,7 +28,10 @@ char sys4wstr[] = "@[$]sys4.c Rev : 4.2 09/26/83 22:15:02"; #include #include #include - +#include +#include +#include +#include /* * Everything in this file is a routine implementing a system call. @@ -39,20 +42,46 @@ gtime() u.u_r.r_time = time; } +/* + * New time entry-- return TOD with milliseconds, timezone, + * DST flag + */ +ftime() +{ + register struct a { + struct timeb *tp; + } *uap; + struct timeb t; + register unsigned ms; + + uap = (struct a *)u.u_ap; + dvi(); + t.time = time; + ms = lbolt; + if (ms > HZ) { + ms -= HZ; + t.time++; + } + t.millitm = (1000*ms)/HZ; + t.timezone = TIMEZONE; + t.dstflag = DSTFLAG; + if (copyout((caddr_t)&t, (caddr_t)uap->tp, sizeof(t)) < 0) + u.u_error = EFAULT; +} + +/* + * Set the time + */ stime() { - register unsigned i; register struct a { time_t time; } *uap; uap = (struct a *)u.u_ap; - if (suser()) { - logtchg(uap->time); + if(suser()) time = uap->time; - } } - setuid() { register uid; @@ -199,8 +228,7 @@ unlink() u.u_dent.d_ino = 0; u.u_segflg = 1; writei(pp); - if (u.u_error) - goto out; + u.u_segflg = 0; ip->i_nlink--; ip->i_flag |= ICHG; @@ -263,11 +291,8 @@ chmod() if ((ip = owner()) == NULL) return; ip->i_mode &= ~07777; - if (u.u_uid) { + if (u.u_uid) uap->fmode &= ~ISVTX; - if (u.u_gid != ip->i_gid) - uap->fmode &= ~ISGID; - } ip->i_mode |= uap->fmode&07777; ip->i_flag |= ICHG; if (ip->i_flag&ITEXT && (ip->i_mode&ISVTX)==0) @@ -485,6 +510,62 @@ utime() iput(ip); } +/* + * nonexistent system call-- signal bad system call. + */ +nosys() +{ + u.u_error = EINVAL; +} + +/* + * Ignored system call + */ +nullsys() +{ +} + +utssys() +{ + register i; + register struct a { + char *cbuf; + int mv; + int type; + } *uap; + + uap = (struct a *)u.u_ap; + switch(uap->type) { + +case 0: /* uname */ + if (copyout(&utsname, uap->cbuf, sizeof(struct utsname))) + u.u_error = EFAULT; + return; + +/* case 1 was umask */ + +case 2: /* ustat */ + for(i=0; im_flags == MINUSE && mp->m_dev==uap->mv) { + register struct filsys *fp; + + fp = mp->m_bufp->b_un.b_filsys; + if(copyout(&fp->s_tfree, uap->cbuf, 18)) + u.u_error = EFAULT; + return; + } + } + u.u_error = EINVAL; + return; + +default: + u.u_error = EFAULT; + } +} + ulimit() { register struct a {