replace Plexis versions by plain SYSIII versions
This commit is contained in:
parent
888532c466
commit
c1957b88e9
|
|
@ -1,4 +1,3 @@
|
||||||
#include "sys/plexus.h"
|
|
||||||
#include "sys/param.h"
|
#include "sys/param.h"
|
||||||
#include "sys/systm.h"
|
#include "sys/systm.h"
|
||||||
#include "sys/dir.h"
|
#include "sys/dir.h"
|
||||||
|
|
@ -9,6 +8,8 @@
|
||||||
#include "sys/text.h"
|
#include "sys/text.h"
|
||||||
#include "sys/seg.h"
|
#include "sys/seg.h"
|
||||||
#include "sys/var.h"
|
#include "sys/var.h"
|
||||||
|
#include "sys/mtpr.h"
|
||||||
|
#include "sys/page.h"
|
||||||
#include "sys/psl.h"
|
#include "sys/psl.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -185,7 +186,7 @@ fsig(p)
|
||||||
struct proc *p;
|
struct proc *p;
|
||||||
{
|
{
|
||||||
register i;
|
register i;
|
||||||
long n;
|
register n;
|
||||||
|
|
||||||
n = p->p_sig;
|
n = p->p_sig;
|
||||||
for(i=1; i<=NSIG; i++) {
|
for(i=1; i<=NSIG; i++) {
|
||||||
|
|
@ -206,18 +207,14 @@ struct proc *p;
|
||||||
core()
|
core()
|
||||||
{
|
{
|
||||||
register struct inode *ip;
|
register struct inode *ip;
|
||||||
register unsigned s;
|
register s;
|
||||||
extern schar();
|
extern schar();
|
||||||
|
|
||||||
if (u.u_uid != u.u_ruid)
|
if (u.u_uid != u.u_ruid)
|
||||||
return(0);
|
return(0);
|
||||||
u.u_error = 0;
|
u.u_error = 0;
|
||||||
u.u_dirp = "core";
|
u.u_dirp = "core";
|
||||||
#ifndef PNETDFS
|
|
||||||
ip = namei(schar, 1);
|
ip = namei(schar, 1);
|
||||||
#else
|
|
||||||
ip = namei(schar, 1, NULL);
|
|
||||||
#endif
|
|
||||||
if(ip == NULL) {
|
if(ip == NULL) {
|
||||||
if(u.u_error)
|
if(u.u_error)
|
||||||
return(0);
|
return(0);
|
||||||
|
|
@ -233,12 +230,13 @@ core()
|
||||||
u.u_segflg = 1;
|
u.u_segflg = 1;
|
||||||
u.u_limit = (daddr_t)ctod(MAXMEM);
|
u.u_limit = (daddr_t)ctod(MAXMEM);
|
||||||
writei(ip);
|
writei(ip);
|
||||||
s = u.u_procp->p_size - USIZE;
|
u.u_base = (char *)ctob(u.u_tsize);
|
||||||
estabur((unsigned)0, s, (unsigned)0, 0, RO);
|
u.u_count = ctob(u.u_dsize);
|
||||||
u.u_base = 0;
|
|
||||||
u.u_count = ctob(s);
|
|
||||||
u.u_segflg = 0;
|
u.u_segflg = 0;
|
||||||
writei(ip);
|
writei(ip);
|
||||||
|
u.u_base = (char *)(0x80000000 - ctob(u.u_ssize));
|
||||||
|
u.u_count = ctob(u.u_ssize);
|
||||||
|
writei(ip);
|
||||||
} else
|
} else
|
||||||
u.u_error = EACCES;
|
u.u_error = EACCES;
|
||||||
iput(ip);
|
iput(ip);
|
||||||
|
|
@ -255,23 +253,21 @@ unsigned sp;
|
||||||
{
|
{
|
||||||
register si, i;
|
register si, i;
|
||||||
register struct proc *p;
|
register struct proc *p;
|
||||||
register a;
|
|
||||||
|
|
||||||
si = btoc(USRSTACK-sp) - u.u_ssize;
|
if(sp >= USRSTACK-ctob(u.u_ssize))
|
||||||
|
return(0);
|
||||||
|
mtpr(TBIS, sp);
|
||||||
|
mtpr(TBIS, ((int *)&u) + 128*USIZE - u.u_ssize - 1);
|
||||||
|
si = btoc((USRSTACK-sp)) - u.u_ssize + SINCR;
|
||||||
if(si <= 0)
|
if(si <= 0)
|
||||||
return(0);
|
return(0);
|
||||||
if(estabur(u.u_tsize, u.u_dsize, u.u_ssize+si, u.u_sep, RO))
|
if(chksize(u.u_tsize, u.u_dsize, u.u_ssize+si))
|
||||||
return(0);
|
return(0);
|
||||||
p = u.u_procp;
|
p = u.u_procp;
|
||||||
expand(p->p_size+si);
|
|
||||||
a = p->p_addr + p->p_size;
|
|
||||||
for(i=u.u_ssize; i; i--) {
|
|
||||||
a--;
|
|
||||||
copyseg(a-si, a);
|
|
||||||
}
|
|
||||||
for(i=si; i; i--)
|
|
||||||
clearseg(--a);
|
|
||||||
u.u_ssize += si;
|
u.u_ssize += si;
|
||||||
|
expand(si, P1BR);
|
||||||
|
for(i=si; --i>=0;)
|
||||||
|
clearseg(((int *)&u)[128*USIZE - u.u_ssize + i] & PG_PFNUM);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,10 +278,10 @@ ptrace()
|
||||||
{
|
{
|
||||||
register struct proc *p;
|
register struct proc *p;
|
||||||
register struct a {
|
register struct a {
|
||||||
int data;
|
int req;
|
||||||
int pid;
|
int pid;
|
||||||
int *addr;
|
int *addr;
|
||||||
int req;
|
int data;
|
||||||
} *uap;
|
} *uap;
|
||||||
|
|
||||||
uap = (struct a *)u.u_ap;
|
uap = (struct a *)u.u_ap;
|
||||||
|
|
@ -319,6 +315,7 @@ ptrace()
|
||||||
wakeup((caddr_t)&ipc);
|
wakeup((caddr_t)&ipc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ipcreg[] = {R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, AP, FP, SP, PC};
|
||||||
/*
|
/*
|
||||||
* Code that the child process
|
* Code that the child process
|
||||||
* executes to implement the command
|
* executes to implement the command
|
||||||
|
|
@ -352,7 +349,7 @@ procxmt()
|
||||||
i = (int)ipc.ip_addr;
|
i = (int)ipc.ip_addr;
|
||||||
if (i<0 || i >= ctob(USIZE))
|
if (i<0 || i >= ctob(USIZE))
|
||||||
goto error;
|
goto error;
|
||||||
ipc.ip_data = ((physadr)&u)->r[i>>1];
|
ipc.ip_data = ((physadr)&u)->r[i>>2];
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* write user I */
|
/* write user I */
|
||||||
|
|
@ -366,10 +363,10 @@ procxmt()
|
||||||
goto error;
|
goto error;
|
||||||
xp->x_iptr->i_flag &= ~ITEXT;
|
xp->x_iptr->i_flag &= ~ITEXT;
|
||||||
}
|
}
|
||||||
estabur(u.u_tsize, u.u_dsize, u.u_ssize, u.u_sep, RW);
|
chgprot(RW, 0, 0);
|
||||||
i = suiword((caddr_t)ipc.ip_addr, 0);
|
i = suiword((caddr_t)ipc.ip_addr, 0);
|
||||||
suiword((caddr_t)ipc.ip_addr, ipc.ip_data);
|
suiword((caddr_t)ipc.ip_addr, ipc.ip_data);
|
||||||
estabur(u.u_tsize, u.u_dsize, u.u_ssize, u.u_sep, RO);
|
chgprot(RO, 0, 0);
|
||||||
if (i<0)
|
if (i<0)
|
||||||
goto error;
|
goto error;
|
||||||
if (xp)
|
if (xp)
|
||||||
|
|
@ -386,15 +383,13 @@ procxmt()
|
||||||
/* write u */
|
/* write u */
|
||||||
case 6:
|
case 6:
|
||||||
i = (int)ipc.ip_addr;
|
i = (int)ipc.ip_addr;
|
||||||
p = (int *)&((physadr)&u)->r[i>>1];
|
p = (int *)&((physadr)&u)->r[i>>2];
|
||||||
for (i=0; i<15; i++)
|
for (i=0; i<16; i++)
|
||||||
if (p == &u.u_ar0[regloc[i]])
|
if (p == &u.u_ar0[ipcreg[i]])
|
||||||
goto ok;
|
goto ok;
|
||||||
if (p == &u.u_ar0[PC])
|
if (p == &u.u_ar0[PS]) {
|
||||||
goto ok;
|
ipc.ip_data |= 0x3c00000; /* modes == user */
|
||||||
if (p == &u.u_ar0[FCW]) {
|
ipc.ip_data &= ~0x3c20ff00; /* IS, FPD, ... */
|
||||||
ipc.ip_data &= (M_FLGS << S_FLGS);
|
|
||||||
ipc.ip_data |= (B_VI | B_NVI);
|
|
||||||
goto ok;
|
goto ok;
|
||||||
}
|
}
|
||||||
goto error;
|
goto error;
|
||||||
|
|
@ -406,9 +401,11 @@ procxmt()
|
||||||
/* set signal and continue */
|
/* set signal and continue */
|
||||||
/* one version causes a trace-trap */
|
/* one version causes a trace-trap */
|
||||||
case 9:
|
case 9:
|
||||||
u.u_ar0[FCW] |= B_SINGL;
|
u.u_ar0[PS] |= PS_T;
|
||||||
case 7:
|
case 7:
|
||||||
u.u_procp->p_sig = 0;
|
if ((int)ipc.ip_addr != 1)
|
||||||
|
u.u_ar0[PC] = (int)ipc.ip_addr;
|
||||||
|
u.u_procp->p_sig = 0L;
|
||||||
if (ipc.ip_data)
|
if (ipc.ip_data)
|
||||||
psignal(u.u_procp, ipc.ip_data);
|
psignal(u.u_procp, ipc.ip_data);
|
||||||
return(1);
|
return(1);
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,6 @@
|
||||||
#include "sys/file.h"
|
#include "sys/file.h"
|
||||||
#include "sys/inode.h"
|
#include "sys/inode.h"
|
||||||
#include "sys/sysinfo.h"
|
#include "sys/sysinfo.h"
|
||||||
#ifdef PNETDFS
|
|
||||||
extern ddbug;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* read system call
|
* read system call
|
||||||
|
|
@ -55,26 +52,14 @@ register mode;
|
||||||
u.u_segflg = 0;
|
u.u_segflg = 0;
|
||||||
u.u_fmode = fp->f_flag;
|
u.u_fmode = fp->f_flag;
|
||||||
ip = fp->f_inode;
|
ip = fp->f_inode;
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( ip->i_flag & IRMT ) {
|
|
||||||
rrdwr( ip, uap->fdes, mode );
|
|
||||||
goto dfsout;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
type = ip->i_mode&IFMT;
|
type = ip->i_mode&IFMT;
|
||||||
if (type==IFREG || type==IFDIR) {
|
if (type==IFREG || type==IFDIR) {
|
||||||
|
plock(ip);
|
||||||
if ((u.u_fmode&FAPPEND) && (mode == FWRITE))
|
if ((u.u_fmode&FAPPEND) && (mode == FWRITE))
|
||||||
fp->f_offset = ip->i_size;
|
fp->f_offset = ip->i_size;
|
||||||
if (ip->i_locklist &&
|
|
||||||
locked(1, ip, fp->f_offset, fp->f_offset + u.u_count))
|
|
||||||
return;
|
|
||||||
plock(ip);
|
|
||||||
} else if (type == IFIFO) {
|
} else if (type == IFIFO) {
|
||||||
fp->f_offset = 0;
|
|
||||||
if (ip->i_locklist &&
|
|
||||||
locked(1, ip, fp->f_offset, fp->f_offset + u.u_count))
|
|
||||||
return;
|
|
||||||
plock(ip);
|
plock(ip);
|
||||||
|
fp->f_offset = 0;
|
||||||
}
|
}
|
||||||
u.u_offset = fp->f_offset;
|
u.u_offset = fp->f_offset;
|
||||||
if (mode == FREAD)
|
if (mode == FREAD)
|
||||||
|
|
@ -83,9 +68,6 @@ register mode;
|
||||||
writei(ip);
|
writei(ip);
|
||||||
if (type==IFREG || type==IFDIR || type==IFIFO)
|
if (type==IFREG || type==IFDIR || type==IFIFO)
|
||||||
prele(ip);
|
prele(ip);
|
||||||
#ifdef PNETDFS
|
|
||||||
dfsout:
|
|
||||||
#endif
|
|
||||||
fp->f_offset += uap->count-u.u_count;
|
fp->f_offset += uap->count-u.u_count;
|
||||||
u.u_rval1 = uap->count-u.u_count;
|
u.u_rval1 = uap->count-u.u_count;
|
||||||
u.u_ioch += u.u_rval1;
|
u.u_ioch += u.u_rval1;
|
||||||
|
|
@ -141,11 +123,7 @@ register mode;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (mode&FCREAT) {
|
if (mode&FCREAT) {
|
||||||
#ifndef PNETDFS
|
|
||||||
ip = namei(uchar, 1);
|
ip = namei(uchar, 1);
|
||||||
#else
|
|
||||||
ip = namei(uchar, 1, NULL);
|
|
||||||
#endif
|
|
||||||
if (ip == NULL) {
|
if (ip == NULL) {
|
||||||
if (u.u_error)
|
if (u.u_error)
|
||||||
return;
|
return;
|
||||||
|
|
@ -154,12 +132,6 @@ register mode;
|
||||||
return;
|
return;
|
||||||
mode &= ~FTRUNC;
|
mode &= ~FTRUNC;
|
||||||
} else {
|
} else {
|
||||||
if (ip->i_locklist != NULL &&
|
|
||||||
(ip->i_flag & IFMT) == IFREG &&
|
|
||||||
locked(2, ip, (long)(0L), (long)(1L<<30))) {
|
|
||||||
iput(ip);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (mode&FEXCL) {
|
if (mode&FEXCL) {
|
||||||
u.u_error = EEXIST;
|
u.u_error = EEXIST;
|
||||||
iput(ip);
|
iput(ip);
|
||||||
|
|
@ -168,11 +140,7 @@ register mode;
|
||||||
mode &= ~FCREAT;
|
mode &= ~FCREAT;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
#ifndef PNETDFS
|
|
||||||
ip = namei(uchar, 0);
|
ip = namei(uchar, 0);
|
||||||
#else
|
|
||||||
ip = namei(uchar, 0, NULL);
|
|
||||||
#endif
|
|
||||||
if (ip == NULL)
|
if (ip == NULL)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -196,12 +164,10 @@ register mode;
|
||||||
fp->f_inode = ip;
|
fp->f_inode = ip;
|
||||||
i = u.u_rval1;
|
i = u.u_rval1;
|
||||||
if (setjmp(u.u_qsav)) { /* catch half-opens */
|
if (setjmp(u.u_qsav)) { /* catch half-opens */
|
||||||
if (u.u_abreq)
|
|
||||||
(*u.u_abreq)();
|
|
||||||
if (u.u_error == 0)
|
if (u.u_error == 0)
|
||||||
u.u_error = EINTR;
|
u.u_error = EINTR;
|
||||||
closef(fp);
|
|
||||||
u.u_ofile[i] = NULL;
|
u.u_ofile[i] = NULL;
|
||||||
|
closef(fp);
|
||||||
} else {
|
} else {
|
||||||
openi(ip, mode);
|
openi(ip, mode);
|
||||||
if (u.u_error == 0)
|
if (u.u_error == 0)
|
||||||
|
|
@ -226,8 +192,8 @@ close()
|
||||||
fp = getf(uap->fdes);
|
fp = getf(uap->fdes);
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
return;
|
return;
|
||||||
closef(fp);
|
|
||||||
u.u_ofile[uap->fdes] = NULL;
|
u.u_ofile[uap->fdes] = NULL;
|
||||||
|
closef(fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -252,16 +218,6 @@ seek()
|
||||||
u.u_error = ESPIPE;
|
u.u_error = ESPIPE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( ip->i_flag & IRMT ) {
|
|
||||||
if ( ddbug ) {
|
|
||||||
printf( "remote seek %x\n", ip );
|
|
||||||
debug();
|
|
||||||
}
|
|
||||||
rseek( uap->fdes, uap->off, uap->sbase );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (uap->sbase == 1)
|
if (uap->sbase == 1)
|
||||||
uap->off += fp->f_offset;
|
uap->off += fp->f_offset;
|
||||||
else if (uap->sbase == 2)
|
else if (uap->sbase == 2)
|
||||||
|
|
@ -291,11 +247,7 @@ link()
|
||||||
} *uap;
|
} *uap;
|
||||||
|
|
||||||
uap = (struct a *)u.u_ap;
|
uap = (struct a *)u.u_ap;
|
||||||
#ifndef PNETDFS
|
|
||||||
ip = namei(uchar, 0);
|
ip = namei(uchar, 0);
|
||||||
#else
|
|
||||||
ip = namei(uchar, 0, NULL);
|
|
||||||
#endif
|
|
||||||
if (ip == NULL)
|
if (ip == NULL)
|
||||||
return;
|
return;
|
||||||
if (ip->i_nlink >= MAXLINK) {
|
if (ip->i_nlink >= MAXLINK) {
|
||||||
|
|
@ -314,11 +266,7 @@ link()
|
||||||
*/
|
*/
|
||||||
prele(ip);
|
prele(ip);
|
||||||
u.u_dirp = (caddr_t)uap->linkname;
|
u.u_dirp = (caddr_t)uap->linkname;
|
||||||
#ifndef PNETDFS
|
|
||||||
xp = namei(uchar, 1);
|
xp = namei(uchar, 1);
|
||||||
#else
|
|
||||||
xp = namei(uchar, 1, NULL);
|
|
||||||
#endif
|
|
||||||
if (xp != NULL) {
|
if (xp != NULL) {
|
||||||
u.u_error = EEXIST;
|
u.u_error = EEXIST;
|
||||||
iput(xp);
|
iput(xp);
|
||||||
|
|
@ -326,15 +274,6 @@ link()
|
||||||
}
|
}
|
||||||
if (u.u_error)
|
if (u.u_error)
|
||||||
goto out;
|
goto out;
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( u.u_pdir && u.u_pdir->i_flag & IRMT ) {
|
|
||||||
printf( "link on remote dfs, not there yet\n" );
|
|
||||||
debug();
|
|
||||||
u.u_error = EXDEV;
|
|
||||||
iput( u.u_pdir );
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (u.u_pdir->i_dev != ip->i_dev) {
|
if (u.u_pdir->i_dev != ip->i_dev) {
|
||||||
iput(u.u_pdir);
|
iput(u.u_pdir);
|
||||||
u.u_error = EXDEV;
|
u.u_error = EXDEV;
|
||||||
|
|
@ -361,30 +300,17 @@ mknod()
|
||||||
int fmode;
|
int fmode;
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
} *uap;
|
} *uap;
|
||||||
#ifdef PNETDFS
|
|
||||||
struct inode *rmaknode();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
uap = (struct a *)u.u_ap;
|
uap = (struct a *)u.u_ap;
|
||||||
if ((uap->fmode&IFMT) != IFIFO && !suser())
|
if ((uap->fmode&IFMT) != IFIFO && !suser())
|
||||||
return;
|
return;
|
||||||
#ifndef PNETDFS
|
|
||||||
ip = namei(uchar, 1);
|
ip = namei(uchar, 1);
|
||||||
#else
|
|
||||||
ip = namei(uchar, 1, NULL);
|
|
||||||
#endif
|
|
||||||
if (ip != NULL) {
|
if (ip != NULL) {
|
||||||
u.u_error = EEXIST;
|
u.u_error = EEXIST;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
if (u.u_error)
|
if (u.u_error)
|
||||||
return;
|
return;
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( u.u_pdir->i_flag & IRMT ) {
|
|
||||||
ip = rmaknode( uap->fmode );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ip = maknode(uap->fmode);
|
ip = maknode(uap->fmode);
|
||||||
if (ip == NULL)
|
if (ip == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
@ -416,11 +342,7 @@ saccess()
|
||||||
svgid = u.u_gid;
|
svgid = u.u_gid;
|
||||||
u.u_uid = u.u_ruid;
|
u.u_uid = u.u_ruid;
|
||||||
u.u_gid = u.u_rgid;
|
u.u_gid = u.u_rgid;
|
||||||
#ifndef PNETDFS
|
|
||||||
ip = namei(uchar, 0);
|
ip = namei(uchar, 0);
|
||||||
#else
|
|
||||||
ip = namei(uchar, 0, NULL);
|
|
||||||
#endif
|
|
||||||
if (ip != NULL) {
|
if (ip != NULL) {
|
||||||
if (uap->fmode&(IREAD>>6))
|
if (uap->fmode&(IREAD>>6))
|
||||||
access(ip, IREAD);
|
access(ip, IREAD);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
#include "sys/param.h"
|
#include "sys/param.h"
|
||||||
#include "sys/systm.h"
|
#include "sys/systm.h"
|
||||||
#include "sys/stat.h"
|
|
||||||
#include "sys/mount.h"
|
#include "sys/mount.h"
|
||||||
#include "sys/ino.h"
|
#include "sys/ino.h"
|
||||||
#include "sys/buf.h"
|
#include "sys/buf.h"
|
||||||
|
|
@ -10,11 +9,9 @@
|
||||||
#include "sys/inode.h"
|
#include "sys/inode.h"
|
||||||
#include "sys/file.h"
|
#include "sys/file.h"
|
||||||
#include "sys/conf.h"
|
#include "sys/conf.h"
|
||||||
|
#include "sys/stat.h"
|
||||||
#include "sys/ioctl.h"
|
#include "sys/ioctl.h"
|
||||||
#include "sys/var.h"
|
#include "sys/var.h"
|
||||||
#ifdef PNETDFS
|
|
||||||
extern ddbug;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the fstat system call.
|
* the fstat system call.
|
||||||
|
|
@ -46,11 +43,7 @@ stat()
|
||||||
} *uap;
|
} *uap;
|
||||||
|
|
||||||
uap = (struct a *)u.u_ap;
|
uap = (struct a *)u.u_ap;
|
||||||
#ifndef PNETDFS
|
|
||||||
ip = namei(uchar, 0);
|
ip = namei(uchar, 0);
|
||||||
#else
|
|
||||||
ip = namei(uchar, 0, NULL);
|
|
||||||
#endif
|
|
||||||
if(ip == NULL)
|
if(ip == NULL)
|
||||||
return;
|
return;
|
||||||
stat1(ip, uap->sb);
|
stat1(ip, uap->sb);
|
||||||
|
|
@ -65,16 +58,10 @@ stat1(ip, ub)
|
||||||
register struct inode *ip;
|
register struct inode *ip;
|
||||||
struct stat *ub;
|
struct stat *ub;
|
||||||
{
|
{
|
||||||
|
register struct dinode *dp;
|
||||||
register struct buf *bp;
|
register struct buf *bp;
|
||||||
struct stat ds;
|
struct stat ds;
|
||||||
|
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( ip->i_flag & IRMT ) {
|
|
||||||
rstat1( ip, ub );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if(ip->i_flag&(IACC|IUPD|ICHG))
|
if(ip->i_flag&(IACC|IUPD|ICHG))
|
||||||
iupdat(ip, &time, &time);
|
iupdat(ip, &time, &time);
|
||||||
/*
|
/*
|
||||||
|
|
@ -92,9 +79,11 @@ struct stat *ub;
|
||||||
* next the dates in the disk
|
* next the dates in the disk
|
||||||
*/
|
*/
|
||||||
bp = bread(ip->i_dev, itod(ip->i_number));
|
bp = bread(ip->i_dev, itod(ip->i_number));
|
||||||
copyio(paddr(bp)+itoo(ip->i_number)*sizeof(struct dinode)
|
dp = bp->b_un.b_dino;
|
||||||
+(long)(&((struct dinode *)0)->di_atime),
|
dp += itoo(ip->i_number);
|
||||||
&ds.st_atime, 3*sizeof(time_t), U_RKD);
|
ds.st_atime = dp->di_atime;
|
||||||
|
ds.st_mtime = dp->di_mtime;
|
||||||
|
ds.st_ctime = dp->di_ctime;
|
||||||
brelse(bp);
|
brelse(bp);
|
||||||
if (copyout((caddr_t)&ds, (caddr_t)ub, sizeof(ds)) < 0)
|
if (copyout((caddr_t)&ds, (caddr_t)ub, sizeof(ds)) < 0)
|
||||||
u.u_error = EFAULT;
|
u.u_error = EFAULT;
|
||||||
|
|
@ -102,43 +91,24 @@ struct stat *ub;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the dup system call.
|
* the dup system call.
|
||||||
*
|
|
||||||
* dup2 has been added to the stock SYSTEM III code for compatibility
|
|
||||||
* with v7.
|
|
||||||
*/
|
*/
|
||||||
dup()
|
dup()
|
||||||
{
|
{
|
||||||
register struct file *fp;
|
register struct file *fp;
|
||||||
|
register i;
|
||||||
register struct a {
|
register struct a {
|
||||||
int fdes;
|
int fdes;
|
||||||
int fdes2;
|
|
||||||
} *uap;
|
} *uap;
|
||||||
register i,m;
|
|
||||||
|
|
||||||
uap = (struct a *)u.u_ap;
|
uap = (struct a *)u.u_ap;
|
||||||
m = uap->fdes & ~077;
|
|
||||||
uap->fdes &= 077;
|
|
||||||
fp = getf(uap->fdes);
|
fp = getf(uap->fdes);
|
||||||
if(fp == NULL)
|
if(fp == NULL)
|
||||||
return;
|
return;
|
||||||
if ((m&0100) == 0) {
|
|
||||||
if ((i = ufalloc(0)) < 0)
|
if ((i = ufalloc(0)) < 0)
|
||||||
return;
|
return;
|
||||||
} else {
|
|
||||||
i = uap->fdes2;
|
|
||||||
if (i<0 || i>=NOFILE) {
|
|
||||||
u.u_error = EBADF;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
u.u_rval1 = i;
|
|
||||||
}
|
|
||||||
if (i!=uap->fdes) {
|
|
||||||
if (u.u_ofile[i]!=NULL)
|
|
||||||
closef(u.u_ofile[i]);
|
|
||||||
u.u_ofile[i] = fp;
|
u.u_ofile[i] = fp;
|
||||||
fp->f_count++;
|
fp->f_count++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the file control system call.
|
* the file control system call.
|
||||||
|
|
@ -166,15 +136,6 @@ fcntl()
|
||||||
}
|
}
|
||||||
if ((i = ufalloc(i)) < 0)
|
if ((i = ufalloc(i)) < 0)
|
||||||
return;
|
return;
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( fp->f_inode->i_flag & IRMT ) {
|
|
||||||
if ( ddbug ) {
|
|
||||||
printf( "fcntl dup on remote file %x\n", fp );
|
|
||||||
debug();
|
|
||||||
}
|
|
||||||
rfcntl( uap->fdes, i, 0, uap->arg );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
u.u_ofile[i] = fp;
|
u.u_ofile[i] = fp;
|
||||||
fp->f_count++;
|
fp->f_count++;
|
||||||
break;
|
break;
|
||||||
|
|
@ -193,15 +154,6 @@ if ( ddbug ) {
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
fp->f_flag &= (FREAD|FWRITE);
|
fp->f_flag &= (FREAD|FWRITE);
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( fp->f_inode->i_flag & IRMT ) {
|
|
||||||
if ( ddbug ) {
|
|
||||||
printf( "fcntl setfl on remote file %x\n", fp );
|
|
||||||
debug();
|
|
||||||
}
|
|
||||||
rfcntl( uap->fdes, i, 4, uap->arg );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
fp->f_flag |= (uap->arg-FOPEN) & ~(FREAD|FWRITE);
|
fp->f_flag |= (uap->arg-FOPEN) & ~(FREAD|FWRITE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -232,13 +184,6 @@ ioctl()
|
||||||
u.u_error = ENOTTY;
|
u.u_error = ENOTTY;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
u.u_rval1 = 0;
|
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( ip->i_flag & IRMT ) {
|
|
||||||
rioctl( uap->fdes, uap->cmd, uap->arg );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
dev = (dev_t)ip->i_rdev;
|
dev = (dev_t)ip->i_rdev;
|
||||||
(*cdevsw[major(dev)].d_ioctl)(minor(dev),uap->cmd,uap->arg,fp->f_flag);
|
(*cdevsw[major(dev)].d_ioctl)(minor(dev),uap->cmd,uap->arg,fp->f_flag);
|
||||||
}
|
}
|
||||||
|
|
@ -298,11 +243,7 @@ smount()
|
||||||
if(u.u_error)
|
if(u.u_error)
|
||||||
return;
|
return;
|
||||||
u.u_dirp = (caddr_t)uap->freg;
|
u.u_dirp = (caddr_t)uap->freg;
|
||||||
#ifndef PNETDFS
|
|
||||||
ip = namei(uchar, 0);
|
ip = namei(uchar, 0);
|
||||||
#else
|
|
||||||
ip = namei(uchar, 0, NULL);
|
|
||||||
#endif
|
|
||||||
if(ip == NULL)
|
if(ip == NULL)
|
||||||
return;
|
return;
|
||||||
if ((ip->i_mode&IFMT) != IFDIR) {
|
if ((ip->i_mode&IFMT) != IFDIR) {
|
||||||
|
|
@ -336,9 +277,9 @@ smount()
|
||||||
goto out1;
|
goto out1;
|
||||||
}
|
}
|
||||||
mp->m_inodp = ip;
|
mp->m_inodp = ip;
|
||||||
mp->m_bufp = getablk(1);
|
mp->m_bufp = geteblk();
|
||||||
fp = (struct filsys *)paddr(mp->m_bufp);
|
bcopy((caddr_t)bp->b_un.b_addr, mp->m_bufp->b_un.b_addr, BSIZE);
|
||||||
copyio(paddr(bp), fp, sizeof(struct filsys), U_RKD);
|
fp = mp->m_bufp->b_un.b_filsys;
|
||||||
mp->m_flags = MINUSE;
|
mp->m_flags = MINUSE;
|
||||||
fp->s_ilock = 0;
|
fp->s_ilock = 0;
|
||||||
fp->s_flock = 0;
|
fp->s_flock = 0;
|
||||||
|
|
@ -411,11 +352,7 @@ getmdev()
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
register struct inode *ip;
|
register struct inode *ip;
|
||||||
|
|
||||||
#ifndef PNETDFS
|
|
||||||
ip = namei(uchar, 0);
|
ip = namei(uchar, 0);
|
||||||
#else
|
|
||||||
ip = namei(uchar, 0, NULL);
|
|
||||||
#endif
|
|
||||||
if(ip == NULL)
|
if(ip == NULL)
|
||||||
return(NODEV);
|
return(NODEV);
|
||||||
if((ip->i_mode&IFMT) != IFBLK)
|
if((ip->i_mode&IFMT) != IFBLK)
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,13 @@
|
||||||
#include "sys/param.h"
|
#include "sys/param.h"
|
||||||
#include "sys/plexus.h"
|
|
||||||
#include "sys/systm.h"
|
#include "sys/systm.h"
|
||||||
#include "sys/dir.h"
|
#include "sys/dir.h"
|
||||||
#include "sys/user.h"
|
#include "sys/user.h"
|
||||||
#include "sys/inode.h"
|
#include "sys/inode.h"
|
||||||
#include "sys/proc.h"
|
#include "sys/proc.h"
|
||||||
#include "sys/var.h"
|
#include "sys/var.h"
|
||||||
|
#include "sys/mtpr.h"
|
||||||
|
#include "sys/clock.h"
|
||||||
|
|
||||||
#ifdef PNETDFS
|
|
||||||
extern int ddbug;
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* Everything in this file is a routine implementing a system call.
|
* Everything in this file is a routine implementing a system call.
|
||||||
*/
|
*/
|
||||||
|
|
@ -21,6 +19,7 @@ gtime()
|
||||||
|
|
||||||
stime()
|
stime()
|
||||||
{
|
{
|
||||||
|
register unsigned i;
|
||||||
register struct a {
|
register struct a {
|
||||||
time_t time;
|
time_t time;
|
||||||
} *uap;
|
} *uap;
|
||||||
|
|
@ -29,7 +28,12 @@ stime()
|
||||||
if (suser()) {
|
if (suser()) {
|
||||||
logtchg(uap->time);
|
logtchg(uap->time);
|
||||||
time = uap->time;
|
time = uap->time;
|
||||||
puttod(time);
|
/*
|
||||||
|
* In addition to setting software time
|
||||||
|
* also set VAX TODR.
|
||||||
|
*/
|
||||||
|
i = urem(time, SECYR);
|
||||||
|
mtpr(TODR,i*100) ; /* 10 ms. clicks */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -144,22 +148,9 @@ unlink()
|
||||||
char *fname;
|
char *fname;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef PNETDFS
|
|
||||||
pp = namei(uchar, 2);
|
pp = namei(uchar, 2);
|
||||||
#else
|
|
||||||
pp = namei(uchar, 2, NULL);
|
|
||||||
#endif
|
|
||||||
if (pp == NULL)
|
if (pp == NULL)
|
||||||
return;
|
return;
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( pp->i_flag & IRMT ) {
|
|
||||||
if ( ddbug ) {
|
|
||||||
printf( "remote unlink, not there yet\n" );
|
|
||||||
debug();
|
|
||||||
}
|
|
||||||
goto out1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* Check for unlink(".")
|
* Check for unlink(".")
|
||||||
* to avoid hanging on the iget
|
* to avoid hanging on the iget
|
||||||
|
|
@ -223,11 +214,7 @@ register struct inode **ipp;
|
||||||
char *fname;
|
char *fname;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifndef PNETDFS
|
|
||||||
ip = namei(uchar, 0);
|
ip = namei(uchar, 0);
|
||||||
#else
|
|
||||||
ip = namei(uchar, 0, NULL);
|
|
||||||
#endif
|
|
||||||
if (ip == NULL)
|
if (ip == NULL)
|
||||||
return;
|
return;
|
||||||
if ((ip->i_mode&IFMT) != IFDIR) {
|
if ((ip->i_mode&IFMT) != IFDIR) {
|
||||||
|
|
@ -265,12 +252,6 @@ chmod()
|
||||||
if (u.u_gid != ip->i_gid)
|
if (u.u_gid != ip->i_gid)
|
||||||
uap->fmode &= ~ISGID;
|
uap->fmode &= ~ISGID;
|
||||||
}
|
}
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( ip->i_flag & IRMT ) {
|
|
||||||
rchmod( ip, uap->fmode );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ip->i_mode |= uap->fmode&07777;
|
ip->i_mode |= uap->fmode&07777;
|
||||||
ip->i_flag |= ICHG;
|
ip->i_flag |= ICHG;
|
||||||
if (ip->i_flag&ITEXT && (ip->i_mode&ISVTX)==0)
|
if (ip->i_flag&ITEXT && (ip->i_mode&ISVTX)==0)
|
||||||
|
|
@ -290,12 +271,6 @@ chown()
|
||||||
uap = (struct a *)u.u_ap;
|
uap = (struct a *)u.u_ap;
|
||||||
if ((ip = owner()) == NULL)
|
if ((ip = owner()) == NULL)
|
||||||
return;
|
return;
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( ip->i_flag & IRMT ) {
|
|
||||||
rchown( ip, uap->uid, uap->gid );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ip->i_uid = uap->uid;
|
ip->i_uid = uap->uid;
|
||||||
ip->i_gid = uap->gid;
|
ip->i_gid = uap->gid;
|
||||||
if (u.u_uid != 0)
|
if (u.u_uid != 0)
|
||||||
|
|
@ -479,11 +454,7 @@ utime()
|
||||||
tv[0] = time;
|
tv[0] = time;
|
||||||
tv[1] = time;
|
tv[1] = time;
|
||||||
}
|
}
|
||||||
#ifndef
|
|
||||||
ip = namei(uchar, 0);
|
ip = namei(uchar, 0);
|
||||||
#else
|
|
||||||
ip = namei(uchar, 0, NULL);
|
|
||||||
#endif
|
|
||||||
if (ip == NULL)
|
if (ip == NULL)
|
||||||
return;
|
return;
|
||||||
if (u.u_uid != ip->i_uid && u.u_uid != 0) {
|
if (u.u_uid != ip->i_uid && u.u_uid != 0) {
|
||||||
|
|
@ -493,12 +464,6 @@ utime()
|
||||||
access(ip, IWRITE);
|
access(ip, IWRITE);
|
||||||
}
|
}
|
||||||
if (!u.u_error) {
|
if (!u.u_error) {
|
||||||
#ifdef PNETDFS
|
|
||||||
if ( ip->i_flag & IRMT ) {
|
|
||||||
rutime( ip, &tv[0], &tv[1] );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ip->i_flag |= IACC|IUPD|ICHG;
|
ip->i_flag |= IACC|IUPD|ICHG;
|
||||||
iupdat(ip, &tv[0], &tv[1]);
|
iupdat(ip, &tv[0], &tv[1]);
|
||||||
}
|
}
|
||||||
|
|
@ -512,8 +477,6 @@ ulimit()
|
||||||
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:
|
||||||
|
|
@ -525,7 +488,7 @@ ulimit()
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
u.u_roff = ctob((long)(NUMLOGPAGE - u.u_ssize));
|
u.u_roff = ctob(maxmem - UPAGES - MAXUMEM/128);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue