TODO: first version - it just compiles

0000 T _gtime		compatible
    000e T _ftime		not existent
    00a4 T _stime		not 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		not compatible (small difference at the end)
    038e T _chdir		compatible
    0398 T _chroot		compatible
    03ac T _chdirec		compatible
    042a T _chmod		not compatible (contains a bit to much code)
    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		not existent
    09f8 T _nullsys		not existent
    09fa T _bpt			not existent
    0a0a T _utssys		not existent
    0b0a T _ulimit		not compatible
This commit is contained in:
Oliver Lehmann 2008-05-18 22:29:39 +00:00
parent 613146c959
commit 3c2a73daf3
1 changed files with 62 additions and 41 deletions

View File

@ -1,12 +1,34 @@
#include "sys/param.h" /******************************************************************************
#include "sys/systm.h" *******************************************************************************
#include "sys/dir.h"
#include "sys/user.h" W E G A - Quelle
#include "sys/inode.h"
#include "sys/proc.h" KERN 3.2 Modul: sys4.c
#include "sys/var.h"
#include "sys/mtpr.h"
#include "sys/clock.h" Bearbeiter: O. Lehmann
Datum: 19.05.08
Version: 1.0
*******************************************************************************
******************************************************************************/
char sys4wstr[] = "@[$]sys4.c Rev : 4.2 09/26/83 22:15:02";
#include <sys/param.h>
#include <sys/sysinfo.h>
#include <sys/sysparm.h>
#include <sys/systm.h>
#include <sys/file.h>
#include <sys/inode.h>
#include <sys/dir.h>
#include <sys/mmu.h>
#include <sys/buf.h>
#include <sys/conf.h>
#include <sys/proc.h>
#include <sys/s.out.h>
#include <sys/user.h>
/* /*
* Everything in this file is a routine implementing a system call. * Everything in this file is a routine implementing a system call.
@ -14,7 +36,7 @@
gtime() gtime()
{ {
u.u_rtime = time; u.u_r.r_time = time;
} }
stime() stime()
@ -28,12 +50,6 @@ stime()
if (suser()) { if (suser()) {
logtchg(uap->time); logtchg(uap->time);
time = uap->time; time = uap->time;
/*
* In addition to setting software time
* also set VAX TODR.
*/
i = urem(time, SECYR);
mtpr(TODR,i*100) ; /* 10 ms. clicks */
} }
} }
@ -60,8 +76,8 @@ setuid()
getuid() getuid()
{ {
u.u_rval1 = u.u_ruid; u.u_r.r_val1 = u.u_ruid;
u.u_rval2 = u.u_uid; u.u_r.r_val2 = u.u_uid;
} }
setgid() setgid()
@ -86,14 +102,14 @@ setgid()
getgid() getgid()
{ {
u.u_rval1 = u.u_rgid; u.u_r.r_val1 = u.u_rgid;
u.u_rval2 = u.u_gid; u.u_r.r_val2 = u.u_gid;
} }
getpid() getpid()
{ {
u.u_rval1 = u.u_procp->p_pid; u.u_r.r_val1 = u.u_procp->p_pid;
u.u_rval2 = u.u_procp->p_ppid; u.u_r.r_val2 = u.u_procp->p_ppid;
} }
setpgrp() setpgrp()
@ -107,7 +123,7 @@ setpgrp()
u.u_procp->p_pgrp = u.u_procp->p_pid; u.u_procp->p_pgrp = u.u_procp->p_pid;
u.u_ttyp = NULL; u.u_ttyp = NULL;
} }
u.u_rval1 = u.u_procp->p_pgrp; u.u_r.r_val1 = u.u_procp->p_pgrp;
} }
sync() sync()
@ -133,7 +149,7 @@ nice()
if (n < 0) if (n < 0)
n = 0; n = 0;
u.u_procp->p_nice = n; u.u_procp->p_nice = n;
u.u_rval1 = n - NZERO; u.u_r.r_val1 = n - NZERO;
} }
/* /*
@ -178,7 +194,7 @@ unlink()
goto out; goto out;
} }
u.u_offset -= sizeof(struct direct); u.u_offset -= sizeof(struct direct);
u.u_base = (caddr_t)&u.u_dent; u.u_base.l = (caddr_t)&u.u_dent;
u.u_count = sizeof(struct direct); u.u_count = sizeof(struct direct);
u.u_dent.d_ino = 0; u.u_dent.d_ino = 0;
u.u_segflg = 1; u.u_segflg = 1;
@ -294,12 +310,12 @@ ssig()
u.u_error = EINVAL; u.u_error = EINVAL;
return; return;
} }
u.u_rval1 = u.u_signal[a-1]; u.u_r.r_val1 = u.u_signal[a-1];
u.u_signal[a-1] = uap->fun; u.u_signal[a-1] = uap->fun;
u.u_procp->p_sig &= ~(1L<<(a-1)); u.u_procp->p_sig &= ~(1L<<(a-1));
if (a == SIGCLD) { if (a == SIGCLD) {
a = u.u_procp->p_pid; a = u.u_procp->p_pid;
for (p = &proc[1]; p < (struct proc *)v.ve_proc; p++) { for (p = &proc[1]; p < &proc[NPROC] ; p++) {
if (a == p->p_ppid && p->p_stat == SZOMB) if (a == p->p_ppid && p->p_stat == SZOMB)
psignal(u.u_procp, SIGCLD); psignal(u.u_procp, SIGCLD);
} }
@ -332,7 +348,7 @@ kill()
u.u_error = ESRCH; u.u_error = ESRCH;
return; return;
} }
for(; p < (struct proc *)v.ve_proc; p++) { for(; p < &proc[NPROC]; p++) {
if (p->p_stat == NULL) if (p->p_stat == NULL)
continue; continue;
if (arg > 0 && p->p_pid != arg) if (arg > 0 && p->p_pid != arg)
@ -366,25 +382,24 @@ times()
uap = (struct a *)u.u_ap; uap = (struct a *)u.u_ap;
if (copyout((caddr_t)&u.u_utime, (caddr_t)uap->times, sizeof(*uap->times))) if (copyout((caddr_t)&u.u_utime, (caddr_t)uap->times, sizeof(*uap->times)))
u.u_error = EFAULT; u.u_error = EFAULT;
spl7(); dvi();
u.u_rtime = lbolt; u.u_r.r_time = lbolt;
spl0();
} }
profil() profil()
{ {
register struct a { register struct a {
short *bufbase; long bufbase;
unsigned bufsize; unsigned bufsize;
unsigned pcoffset; unsigned pcoffset;
unsigned pcscale; unsigned pcscale;
} *uap; } *uap;
uap = (struct a *)u.u_ap; uap = (struct a *)u.u_ap;
u.u_prof.pr_base = uap->bufbase; u.u_prof[0].pr_base = uap->bufbase;
u.u_prof.pr_size = uap->bufsize; u.u_prof[0].pr_size = uap->bufsize;
u.u_prof.pr_off = uap->pcoffset; u.u_prof[0].pr_off = uap->pcoffset;
u.u_prof.pr_scale = uap->pcscale; u.u_prof[0].pr_scale = uap->pcscale;
} }
/* /*
@ -402,7 +417,7 @@ alarm()
p = u.u_procp; p = u.u_procp;
c = p->p_clktim; c = p->p_clktim;
p->p_clktim = uap->deltat; p->p_clktim = uap->deltat;
u.u_rval1 = c; u.u_r.r_val1 = c;
} }
/* /*
@ -429,7 +444,7 @@ umask()
uap = (struct a *)u.u_ap; uap = (struct a *)u.u_ap;
t = u.u_cmask; t = u.u_cmask;
u.u_cmask = uap->mask & 0777; u.u_cmask = uap->mask & 0777;
u.u_rval1 = t; u.u_r.r_val1 = t;
} }
/* /*
@ -476,7 +491,8 @@ ulimit()
int cmd; int cmd;
long arg; long arg;
} *uap; } *uap;
register brk, stk;
uap = (struct a *)u.u_ap; uap = (struct a *)u.u_ap;
switch(uap->cmd) { switch(uap->cmd) {
case 2: case 2:
@ -484,11 +500,16 @@ ulimit()
return; return;
u.u_limit = uap->arg; u.u_limit = uap->arg;
case 1: case 1:
u.u_roff = u.u_limit; u.u_r.r_off = u.u_limit;
break; break;
case 3: case 3:
u.u_roff = ctob(maxmem - UPAGES - MAXUMEM/128); brk = 1024 - u.u_dsize
- ((u.u_ssize + btoct(8*1024) - 1)/btoct(8*1024))
* btoct(8*1024);
if ((stk = btoct(8*1024) - u.u_ssize % btoct(8*1024)) < USIZE)
brk -= USIZE - stk;
u.u_r.r_off = ctob((long)brk);
break; break;
} }
} }