Added support for ibcs2_sigcode.
Added new emulation structure, emul_ibcs2_xout, for XENIX. Modified some syscalls to differentiate between XENIX and UNIX. Fixed major bug in semaphore structure emulation size and conversion. Check and cleanup copyin/copyout usage. Add xenix_sys_locking patches from Andreas Wrede <andreas@planix.com>.
This commit is contained in:
parent
498bb9530b
commit
9273595150
@ -1,7 +1,25 @@
|
||||
$NetBSD: TODO,v 1.4 1998/02/09 02:30:45 scottb Exp $
|
||||
$NetBSD: TODO,v 1.5 1998/03/05 04:36:07 scottb Exp $
|
||||
|
||||
* figure out semantics of sysi86(0x72, ...)
|
||||
|
||||
* figure out why some network programs with shared libsocket don't get
|
||||
linked correctly
|
||||
dynloaded correctly
|
||||
|
||||
* finish resolver emulation
|
||||
|
||||
* check {f}stat16/32 emulation
|
||||
|
||||
* finish implementing missing syscalls:
|
||||
|
||||
ibcs2_ptrace(26), profil(44), ibcs2_acct(51), sigaltstack(97),
|
||||
getcontext/setcontext/sigsetjmp(100), waitid(107), sigsendset(108),
|
||||
priocntl(112), vfork(119), xstat(123), lxstat(124), fxstat(125),
|
||||
setrlimit(128), getrlimit(129), lchown(130),
|
||||
getpmsg(132), putpmsg(133), setegid(136), adjtime(138), seteuid(141),
|
||||
xenix_creatsem(202), xenix_opensem(203), xenix_sigsem(204),
|
||||
xenix_waitsem(205), xenix_nbwaitsem(206), xenix_sdget(213),
|
||||
xenix_sdfree(214), xenix_sdenter(215), xenix_sdleave(216),
|
||||
xenix_sdgetv(217), xenix_sdwaitv(218), xenix_proctl(232),
|
||||
xenix_execseg(233), xenix_unexecseg(234), xenix_paccess(238),
|
||||
getitimer(255), setitimer(256), setreuid(258), setregid(259)
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ibcs2_exec.c,v 1.14 1998/02/09 02:30:46 scottb Exp $ */
|
||||
/* $NetBSD: ibcs2_exec.c,v 1.15 1998/03/05 04:36:07 scottb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1998 Scott Bartram
|
||||
@ -100,8 +100,7 @@ static int ibcs2_elf32_signature __P((struct proc *p, struct exec_package *,
|
||||
extern int bsd2ibcs_errno[];
|
||||
extern struct sysent ibcs2_sysent[];
|
||||
extern char *ibcs2_syscallnames[];
|
||||
extern void ibcs2_sendsig __P((sig_t, int, int, u_long));
|
||||
extern char sigcode[], esigcode[];
|
||||
extern char ibcs2_sigcode[], ibcs2_esigcode[];
|
||||
|
||||
const char ibcs2_emul_path[] = "/emul/ibcs2";
|
||||
|
||||
@ -116,8 +115,23 @@ struct emul emul_ibcs2_coff = {
|
||||
0,
|
||||
copyargs,
|
||||
ibcs2_setregs,
|
||||
sigcode,
|
||||
esigcode,
|
||||
ibcs2_sigcode,
|
||||
ibcs2_esigcode,
|
||||
};
|
||||
|
||||
struct emul emul_ibcs2_xout = {
|
||||
"ibcs2",
|
||||
bsd2ibcs_errno,
|
||||
ibcs2_sendsig,
|
||||
0,
|
||||
IBCS2_SYS_MAXSYSCALL,
|
||||
ibcs2_sysent,
|
||||
ibcs2_syscallnames,
|
||||
0,
|
||||
copyargs,
|
||||
ibcs2_setregs,
|
||||
ibcs2_sigcode,
|
||||
ibcs2_esigcode,
|
||||
};
|
||||
|
||||
struct emul emul_ibcs2_elf = {
|
||||
@ -131,8 +145,8 @@ struct emul emul_ibcs2_elf = {
|
||||
IBCS2_ELF_AUX_ARGSIZ,
|
||||
elf32_copyargs,
|
||||
ibcs2_setregs,
|
||||
sigcode,
|
||||
esigcode,
|
||||
ibcs2_sigcode,
|
||||
ibcs2_esigcode,
|
||||
};
|
||||
|
||||
|
||||
@ -703,7 +717,7 @@ exec_ibcs2_xout_makecmds(p, epp)
|
||||
error = exec_ibcs2_xout_prep_nmagic(p, epp, xp, xep);
|
||||
|
||||
if (error == 0)
|
||||
epp->ep_emul = &emul_ibcs2_coff; /* not really COFF but WTF */
|
||||
epp->ep_emul = &emul_ibcs2_xout;
|
||||
|
||||
if (error)
|
||||
kill_vmcmds(&epp->ep_vmcmds);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ibcs2_ioctl.c,v 1.13 1997/09/19 21:57:10 jtk Exp $ */
|
||||
/* $NetBSD: ibcs2_ioctl.c,v 1.14 1998/03/05 04:36:07 scottb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995 Scott Bartram
|
||||
@ -159,6 +159,7 @@ stios2btios(st, bt)
|
||||
if (l & IBCS2_HUPCL) r |= HUPCL;
|
||||
if (l & IBCS2_CLOCAL) r |= CLOCAL;
|
||||
bt->c_cflag = r;
|
||||
bt->c_ispeed = bt->c_ospeed = s2btab[l & 0x0f];
|
||||
|
||||
l = st->c_lflag; r = 0;
|
||||
if (l & IBCS2_ISIG) r |= ISIG;
|
||||
@ -171,8 +172,6 @@ stios2btios(st, bt)
|
||||
if (l & IBCS2_TOSTOP) r |= TOSTOP;
|
||||
bt->c_lflag = r;
|
||||
|
||||
bt->c_ispeed = bt->c_ospeed = s2btab[l & 0x0000000f];
|
||||
|
||||
bt->c_cc[VINTR] =
|
||||
st->c_cc[IBCS2_VINTR] ? st->c_cc[IBCS2_VINTR] : _POSIX_VDISABLE;
|
||||
bt->c_cc[VQUIT] =
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ibcs2_ipc.c,v 1.7 1997/01/18 01:51:41 mycroft Exp $ */
|
||||
/* $NetBSD: ibcs2_ipc.c,v 1.8 1998/03/05 04:36:07 scottb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995 Scott Bartram
|
||||
@ -195,11 +195,21 @@ ibcs2_sys_msgsys(p, v, retval)
|
||||
* iBCS2 semsys call
|
||||
*/
|
||||
|
||||
struct ibcs2_ipc_perm {
|
||||
ibcs2_uid_t uid;
|
||||
ibcs2_gid_t gid;
|
||||
ibcs2_uid_t cuid;
|
||||
ibcs2_gid_t cgid;
|
||||
ibcs2_mode_t mode;
|
||||
u_short seq;
|
||||
ibcs2_key_t key;
|
||||
};
|
||||
|
||||
struct ibcs2_semid_ds {
|
||||
struct ipc_perm sem_perm;
|
||||
struct ibcs2_ipc_perm sem_perm;
|
||||
struct ibcs2_sem *sem_base;
|
||||
u_short sem_nsems;
|
||||
int pad1;
|
||||
u_short pad1;
|
||||
ibcs2_time_t sem_otime;
|
||||
ibcs2_time_t sem_ctime;
|
||||
};
|
||||
@ -247,7 +257,13 @@ cvt_semid2isemid(bp, ibp)
|
||||
struct semid_ds *bp;
|
||||
struct ibcs2_semid_ds *ibp;
|
||||
{
|
||||
ibp->sem_perm = bp->sem_perm;
|
||||
ibp->sem_perm.cuid = bp->sem_perm.cuid;
|
||||
ibp->sem_perm.cgid = bp->sem_perm.cgid;
|
||||
ibp->sem_perm.uid = bp->sem_perm.uid;
|
||||
ibp->sem_perm.gid = bp->sem_perm.gid;
|
||||
ibp->sem_perm.mode = bp->sem_perm.mode;
|
||||
ibp->sem_perm.seq = bp->sem_perm.seq;
|
||||
ibp->sem_perm.key = bp->sem_perm.key;
|
||||
ibp->sem_base = (struct ibcs2_sem *)bp->sem_base;
|
||||
ibp->sem_nsems = bp->sem_nsems;
|
||||
ibp->sem_otime = bp->sem_otime;
|
||||
@ -260,7 +276,13 @@ cvt_isemid2semid(ibp, bp)
|
||||
struct ibcs2_semid_ds *ibp;
|
||||
struct semid_ds *bp;
|
||||
{
|
||||
bp->sem_perm = ibp->sem_perm;
|
||||
bp->sem_perm.cuid = ibp->sem_perm.cuid;
|
||||
bp->sem_perm.cgid = ibp->sem_perm.cgid;
|
||||
bp->sem_perm.uid = ibp->sem_perm.uid;
|
||||
bp->sem_perm.gid = ibp->sem_perm.gid;
|
||||
bp->sem_perm.mode = ibp->sem_perm.mode;
|
||||
bp->sem_perm.seq = ibp->sem_perm.seq;
|
||||
bp->sem_perm.key = ibp->sem_perm.key;
|
||||
bp->sem_base = (struct sem *)ibp->sem_base;
|
||||
bp->sem_nsems = ibp->sem_nsems;
|
||||
bp->sem_otime = ibp->sem_otime;
|
||||
@ -289,39 +311,42 @@ ibcs2_sys_semsys(p, v, retval)
|
||||
switch(SCARG(uap, a4)) {
|
||||
case IBCS2_IPC_STAT:
|
||||
{
|
||||
struct ibcs2_semid_ds *isp;
|
||||
struct semid_ds *sp;
|
||||
caddr_t sg = stackgap_init(p->p_emul);
|
||||
|
||||
isp = (struct ibcs2_semid_ds *)SCARG(uap, a5);
|
||||
sp = stackgap_alloc(&sg, sizeof(struct semid_ds));
|
||||
SCARG(uap, a5) = (int)sp;
|
||||
error = compat_10_sys_semsys(p, uap, retval);
|
||||
if (!error) {
|
||||
SCARG(uap, a5) = (int)isp;
|
||||
isp = stackgap_alloc(&sg, sizeof(*isp));
|
||||
cvt_semid2isemid(sp, isp);
|
||||
error = copyout((caddr_t)isp,
|
||||
(caddr_t)SCARG(uap, a5),
|
||||
sizeof(*isp));
|
||||
}
|
||||
return error;
|
||||
struct ibcs2_semid_ds *isp, isi;
|
||||
struct semid_ds *sp, s;
|
||||
caddr_t sg = stackgap_init(p->p_emul);
|
||||
|
||||
isp = (struct ibcs2_semid_ds *)SCARG(uap, a5);
|
||||
sp = stackgap_alloc(&sg, sizeof(struct semid_ds));
|
||||
SCARG(uap, a5) = (int)sp;
|
||||
error = compat_10_sys_semsys(p, uap, retval);
|
||||
if (error)
|
||||
return error;
|
||||
error = copyin((caddr_t)sp, (caddr_t)&s,
|
||||
sizeof(s));
|
||||
if (error)
|
||||
return error;
|
||||
cvt_semid2isemid(&s, &isi);
|
||||
return copyout((caddr_t)&isi, (caddr_t)isp,
|
||||
sizeof(isi));
|
||||
}
|
||||
case IBCS2_IPC_SET:
|
||||
{
|
||||
struct ibcs2_semid_ds *isp;
|
||||
struct semid_ds *sp;
|
||||
caddr_t sg = stackgap_init(p->p_emul);
|
||||
|
||||
isp = stackgap_alloc(&sg, sizeof(*isp));
|
||||
sp = stackgap_alloc(&sg, sizeof(*sp));
|
||||
error = copyin((caddr_t)SCARG(uap, a5), (caddr_t)isp,
|
||||
sizeof(*isp));
|
||||
if (error)
|
||||
return error;
|
||||
cvt_isemid2semid(isp, sp);
|
||||
SCARG(uap, a5) = (int)sp;
|
||||
return compat_10_sys_semsys(p, uap, retval);
|
||||
struct ibcs2_semid_ds isp;
|
||||
struct semid_ds *sp, s;
|
||||
caddr_t sg = stackgap_init(p->p_emul);
|
||||
|
||||
error = copyin((caddr_t)SCARG(uap, a5),
|
||||
(caddr_t)&isp, sizeof(isp));
|
||||
if (error)
|
||||
return error;
|
||||
cvt_isemid2semid(&isp, &s);
|
||||
sp = stackgap_alloc(&sg, sizeof(s));
|
||||
error = copyout((caddr_t)&s, (caddr_t)sp,
|
||||
sizeof(s));
|
||||
if (error)
|
||||
return error;
|
||||
SCARG(uap, a5) = (int)sp;
|
||||
return compat_10_sys_semsys(p, uap, retval);
|
||||
}
|
||||
}
|
||||
return compat_10_sys_semsys(p, uap, retval);
|
||||
@ -418,39 +443,42 @@ ibcs2_sys_shmsys(p, v, retval)
|
||||
switch(SCARG(uap, a3)) {
|
||||
case IBCS2_IPC_STAT:
|
||||
{
|
||||
struct ibcs2_shmid_ds *isp;
|
||||
struct shmid_ds *sp;
|
||||
caddr_t sg = stackgap_init(p->p_emul);
|
||||
|
||||
isp = (struct ibcs2_shmid_ds *)SCARG(uap, a4);
|
||||
sp = stackgap_alloc(&sg, sizeof(*sp));
|
||||
SCARG(uap, a4) = (int)sp;
|
||||
error = compat_10_sys_shmsys(p, uap, retval);
|
||||
if (!error) {
|
||||
SCARG(uap, a4) = (int)isp;
|
||||
isp = stackgap_alloc(&sg, sizeof(*isp));
|
||||
cvt_shmid2ishmid(sp, isp);
|
||||
error = copyout((caddr_t)isp,
|
||||
(caddr_t)SCARG(uap, a4),
|
||||
sizeof(*isp));
|
||||
}
|
||||
return error;
|
||||
struct ibcs2_shmid_ds *isp, is;
|
||||
struct shmid_ds *sp, s;
|
||||
caddr_t sg = stackgap_init(p->p_emul);
|
||||
|
||||
isp = (struct ibcs2_shmid_ds *)SCARG(uap, a4);
|
||||
sp = stackgap_alloc(&sg, sizeof(*sp));
|
||||
SCARG(uap, a4) = (int)sp;
|
||||
error = compat_10_sys_shmsys(p, uap, retval);
|
||||
if (error)
|
||||
return error;
|
||||
error = copyin((caddr_t)sp, (caddr_t)&s,
|
||||
sizeof(s));
|
||||
if (error)
|
||||
return error;
|
||||
cvt_shmid2ishmid(&s, &is);
|
||||
return copyout((caddr_t)&is, (caddr_t)isp,
|
||||
sizeof(is));
|
||||
}
|
||||
case IBCS2_IPC_SET:
|
||||
{
|
||||
struct ibcs2_shmid_ds *isp;
|
||||
struct shmid_ds *sp;
|
||||
caddr_t sg = stackgap_init(p->p_emul);
|
||||
|
||||
isp = stackgap_alloc(&sg, sizeof(*isp));
|
||||
sp = stackgap_alloc(&sg, sizeof(*sp));
|
||||
error = copyin((caddr_t)SCARG(uap, a4), (caddr_t)isp,
|
||||
sizeof(*isp));
|
||||
if (error)
|
||||
return error;
|
||||
cvt_ishmid2shmid(isp, sp);
|
||||
SCARG(uap, a4) = (int)sp;
|
||||
return compat_10_sys_shmsys(p, uap, retval);
|
||||
struct ibcs2_shmid_ds is;
|
||||
struct shmid_ds *sp, s;
|
||||
caddr_t sg = stackgap_init(p->p_emul);
|
||||
|
||||
error = copyin((caddr_t)SCARG(uap, a4),
|
||||
(caddr_t)&is, sizeof(is));
|
||||
if (error)
|
||||
return error;
|
||||
cvt_ishmid2shmid(&is, &s);
|
||||
sp = stackgap_alloc(&sg, sizeof(*sp));
|
||||
SCARG(uap, a4) = (int)sp;
|
||||
error = copyout((caddr_t)&s, (caddr_t)sp,
|
||||
sizeof(s));
|
||||
if (error)
|
||||
return error;
|
||||
return compat_10_sys_shmsys(p, uap, retval);
|
||||
}
|
||||
}
|
||||
return compat_10_sys_shmsys(p, uap, retval);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ibcs2_misc.c,v 1.34 1998/03/03 13:47:48 fvdl Exp $ */
|
||||
/* $NetBSD: ibcs2_misc.c,v 1.35 1998/03/05 04:36:07 scottb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1998 Scott Bartram
|
||||
@ -104,6 +104,8 @@
|
||||
#include <compat/ibcs2/ibcs2_syscallargs.h>
|
||||
#include <compat/ibcs2/ibcs2_sysi86.h>
|
||||
|
||||
extern struct emul emul_ibcs2_coff, emul_ibcs2_xout, emul_ibcs2_elf;
|
||||
|
||||
|
||||
int
|
||||
ibcs2_sys_ulimit(p, v, retval)
|
||||
@ -732,7 +734,7 @@ ibcs2_sys_time(p, v, retval)
|
||||
|
||||
microtime(&tv);
|
||||
*retval = tv.tv_sec;
|
||||
if (SCARG(uap, tp))
|
||||
if (p->p_emul != &emul_ibcs2_xout && SCARG(uap, tp))
|
||||
return copyout((caddr_t)&tv.tv_sec, (caddr_t)SCARG(uap, tp),
|
||||
sizeof(ibcs2_time_t));
|
||||
else
|
||||
@ -1643,28 +1645,54 @@ xenix_sys_locking(p, v, retval)
|
||||
syscallarg(int) blk;
|
||||
syscallarg(int) size;
|
||||
} */ *uap = v;
|
||||
struct sys_flock_args fl;
|
||||
struct sys_fcntl_args fa;
|
||||
struct flock *flp;
|
||||
struct filedesc *fdp = p->p_fd;
|
||||
struct file *fp;
|
||||
int cmd;
|
||||
off_t off;
|
||||
caddr_t sg = stackgap_init(p->p_emul);
|
||||
|
||||
SCARG(&fl, fd) = SCARG(uap, fd);
|
||||
switch SCARG(uap, blk) {
|
||||
case X_LK_UNLCK:
|
||||
SCARG(&fl, how) = LOCK_UN;
|
||||
break;
|
||||
case X_LK_NBLCK:
|
||||
SCARG(&fl, how) = LOCK_NB | LOCK_EX;
|
||||
break;
|
||||
case X_LK_NBRLCK:
|
||||
SCARG(&fl, how) = LOCK_NB | LOCK_SH;
|
||||
break;
|
||||
case X_LK_LOCK:
|
||||
SCARG(&fl, how) = LOCK_EX;
|
||||
break;
|
||||
case X_LK_GETLK:
|
||||
case X_LK_SETLK:
|
||||
case X_LK_SETLKW:
|
||||
SCARG(&fl, how) = LOCK_EX;
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
return ibcs2_sys_fcntl(p, v, retval);
|
||||
}
|
||||
|
||||
return sys_flock(p, &fl, retval);
|
||||
if ((u_int)SCARG(uap, fd) >= fdp->fd_nfiles ||
|
||||
(fp = fdp->fd_ofiles[SCARG(uap, fd)]) == NULL)
|
||||
return (EBADF);
|
||||
off = fp->f_offset;
|
||||
|
||||
flp = stackgap_alloc(&sg, sizeof(*flp));
|
||||
flp->l_start = off;
|
||||
switch SCARG(uap, blk) {
|
||||
case X_LK_UNLCK:
|
||||
cmd = F_SETLK;
|
||||
flp->l_type = F_UNLCK;
|
||||
break;
|
||||
case X_LK_LOCK:
|
||||
cmd = F_SETLKW;
|
||||
flp->l_type = F_WRLCK;
|
||||
break;
|
||||
case X_LK_NBRLCK:
|
||||
cmd = F_SETLK;
|
||||
flp->l_type = F_RDLCK;
|
||||
break;
|
||||
case X_LK_NBLCK:
|
||||
cmd = F_SETLK;
|
||||
flp->l_type = F_WRLCK;
|
||||
break;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
flp->l_len = SCARG(uap, size);
|
||||
flp->l_whence = SEEK_SET;
|
||||
|
||||
SCARG(&fa, fd) = SCARG(uap, fd);
|
||||
SCARG(&fa, cmd) = cmd;
|
||||
SCARG(&fa, arg) = (void *)flp;
|
||||
|
||||
return sys_fcntl(p, &fa, retval);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ibcs2_stat.c,v 1.8 1998/02/09 02:30:51 scottb Exp $ */
|
||||
/* $NetBSD: ibcs2_stat.c,v 1.9 1998/03/05 04:36:08 scottb Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1995, 1998 Scott Bartram
|
||||
* All rights reserved.
|
||||
@ -54,6 +54,7 @@
|
||||
|
||||
static void bsd_stat2ibcs_stat __P((struct stat *, struct ibcs2_stat *));
|
||||
static int cvt_statfs __P((struct statfs *, caddr_t, int));
|
||||
static int cvt_statvfs __P((struct statfs *, caddr_t, int));
|
||||
|
||||
static void
|
||||
bsd_stat2ibcs_stat(st, st4)
|
||||
@ -98,6 +99,30 @@ cvt_statfs(sp, buf, len)
|
||||
return copyout((caddr_t)&ssfs, buf, len);
|
||||
}
|
||||
|
||||
static int
|
||||
cvt_statvfs(sp, buf, len)
|
||||
struct statfs *sp;
|
||||
caddr_t buf;
|
||||
int len;
|
||||
{
|
||||
struct ibcs2_statvfs ssvfs;
|
||||
|
||||
bzero(&ssvfs, sizeof ssvfs);
|
||||
ssvfs.f_frsize = ssvfs.f_bsize = sp->f_bsize;
|
||||
ssvfs.f_blocks = sp->f_blocks;
|
||||
ssvfs.f_bfree = sp->f_bfree;
|
||||
ssvfs.f_bavail = sp->f_bavail;
|
||||
ssvfs.f_files = sp->f_files;
|
||||
ssvfs.f_ffree = sp->f_ffree;
|
||||
ssvfs.f_favail = sp->f_ffree;
|
||||
ssvfs.f_fsid = sp->f_fsid.val[0];
|
||||
strncpy(ssvfs.f_basetype, sp->f_fstypename, 15);
|
||||
ssvfs.f_flag = 0;
|
||||
ssvfs.f_namemax = PATH_MAX;
|
||||
ssvfs.f_fstr[0] = 0;
|
||||
return copyout((caddr_t)&ssvfs, buf, len);
|
||||
}
|
||||
|
||||
int
|
||||
ibcs2_sys_statfs(p, v, retval)
|
||||
struct proc *p;
|
||||
@ -156,6 +181,62 @@ ibcs2_sys_fstatfs(p, v, retval)
|
||||
return cvt_statfs(sp, (caddr_t)SCARG(uap, buf), SCARG(uap, len));
|
||||
}
|
||||
|
||||
int
|
||||
ibcs2_sys_statvfs(p, v, retval)
|
||||
struct proc *p;
|
||||
void *v;
|
||||
register_t *retval;
|
||||
{
|
||||
struct ibcs2_sys_statvfs_args /* {
|
||||
syscallarg(char *) path;
|
||||
syscallarg(struct ibcs2_statvfs *) buf;
|
||||
} */ *uap = v;
|
||||
register struct mount *mp;
|
||||
register struct statfs *sp;
|
||||
int error;
|
||||
struct nameidata nd;
|
||||
caddr_t sg = stackgap_init(p->p_emul);
|
||||
|
||||
IBCS2_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
|
||||
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
|
||||
if ((error = namei(&nd)) != 0)
|
||||
return (error);
|
||||
mp = nd.ni_vp->v_mount;
|
||||
sp = &mp->mnt_stat;
|
||||
vrele(nd.ni_vp);
|
||||
if ((error = VFS_STATFS(mp, sp, p)) != 0)
|
||||
return (error);
|
||||
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
|
||||
return cvt_statvfs(sp, (caddr_t)SCARG(uap, buf),
|
||||
sizeof(struct ibcs2_statvfs));
|
||||
}
|
||||
|
||||
int
|
||||
ibcs2_sys_fstatvfs(p, v, retval)
|
||||
struct proc *p;
|
||||
void *v;
|
||||
register_t *retval;
|
||||
{
|
||||
struct ibcs2_sys_fstatvfs_args /* {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(struct ibcs2_statvfs *) buf;
|
||||
} */ *uap = v;
|
||||
struct file *fp;
|
||||
struct mount *mp;
|
||||
register struct statfs *sp;
|
||||
int error;
|
||||
|
||||
if ((error = getvnode(p->p_fd, SCARG(uap, fd), &fp)) != 0)
|
||||
return (error);
|
||||
mp = ((struct vnode *)fp->f_data)->v_mount;
|
||||
sp = &mp->mnt_stat;
|
||||
if ((error = VFS_STATFS(mp, sp, p)) != 0)
|
||||
return (error);
|
||||
sp->f_flags = mp->mnt_flag & MNT_VISFLAGMASK;
|
||||
return cvt_statvfs(sp, (caddr_t)SCARG(uap, buf),
|
||||
sizeof(struct ibcs2_statvfs));
|
||||
}
|
||||
|
||||
int
|
||||
ibcs2_sys_stat(p, v, retval)
|
||||
struct proc *p;
|
||||
@ -273,7 +354,7 @@ ibcs2_sys_utssys(p, v, retval)
|
||||
{
|
||||
struct ibcs2_ustat xu;
|
||||
|
||||
xu.f_tfree = 10000; /* XXX fixme */
|
||||
xu.f_tfree = 20000; /* XXX fixme */
|
||||
xu.f_tinode = 32000;
|
||||
xu.f_fname[0] = 0;
|
||||
xu.f_fpack[0] = 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ibcs2_statfs.h,v 1.2 1994/10/26 02:53:06 cgd Exp $ */
|
||||
/* $NetBSD: ibcs2_statfs.h,v 1.3 1998/03/05 04:36:08 scottb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Scott Bartram
|
||||
* Copyright (c) 1994, 1998 Scott Bartram
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -45,4 +45,21 @@ struct ibcs2_statfs {
|
||||
char f_fpack[6];
|
||||
};
|
||||
|
||||
struct ibcs2_statvfs {
|
||||
u_long f_bsize;
|
||||
u_long f_frsize;
|
||||
u_long f_blocks;
|
||||
u_long f_bfree;
|
||||
u_long f_bavail;
|
||||
u_long f_files;
|
||||
u_long f_ffree;
|
||||
u_long f_favail;
|
||||
u_long f_fsid;
|
||||
char f_basetype[16];
|
||||
u_long f_flag;
|
||||
u_long f_namemax;
|
||||
char f_fstr[32];
|
||||
u_long pad[16];
|
||||
};
|
||||
|
||||
#endif /* _IBCS2_STATFS_H */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ibcs2_syscall.h,v 1.17 1998/02/19 03:34:17 thorpej Exp $ */
|
||||
/* $NetBSD: ibcs2_syscall.h,v 1.18 1998/03/05 04:36:08 scottb Exp $ */
|
||||
|
||||
/*
|
||||
* System call numbers.
|
||||
@ -222,6 +222,15 @@
|
||||
/* syscall: "__posix_fchown" ret: "int" args: "int" "int" "int" */
|
||||
#define IBCS2_SYS___posix_fchown 94
|
||||
|
||||
/* syscall: "sigreturn" ret: "int" args: "struct sigcontext *" */
|
||||
#define IBCS2_SYS_sigreturn 96
|
||||
|
||||
/* syscall: "statvfs" ret: "int" args: "char *" "struct ibcs2_statvfs *" */
|
||||
#define IBCS2_SYS_statvfs 103
|
||||
|
||||
/* syscall: "fstatvfs" ret: "int" args: "int" "struct ibcs2_statvfs *" */
|
||||
#define IBCS2_SYS_fstatvfs 104
|
||||
|
||||
/* syscall: "mmap" ret: "ibcs2_caddr_t" args: "ibcs2_caddr_t" "ibcs2_size_t" "int" "int" "int" "ibcs2_off_t" */
|
||||
#define IBCS2_SYS_mmap 115
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ibcs2_syscallargs.h,v 1.16 1998/02/19 03:34:17 thorpej Exp $ */
|
||||
/* $NetBSD: ibcs2_syscallargs.h,v 1.17 1998/03/05 04:36:08 scottb Exp $ */
|
||||
|
||||
/*
|
||||
* System call argument lists.
|
||||
@ -273,6 +273,16 @@ struct ibcs2_sys_readlink_args {
|
||||
syscallarg(int) count;
|
||||
};
|
||||
|
||||
struct ibcs2_sys_statvfs_args {
|
||||
syscallarg(char *) path;
|
||||
syscallarg(struct ibcs2_statvfs *) buf;
|
||||
};
|
||||
|
||||
struct ibcs2_sys_fstatvfs_args {
|
||||
syscallarg(int) fd;
|
||||
syscallarg(struct ibcs2_statvfs *) buf;
|
||||
};
|
||||
|
||||
struct ibcs2_sys_mmap_args {
|
||||
syscallarg(ibcs2_caddr_t) addr;
|
||||
syscallarg(ibcs2_size_t) len;
|
||||
@ -463,6 +473,9 @@ int ibcs2_sys_lstat __P((struct proc *, void *, register_t *));
|
||||
int ibcs2_sys_readlink __P((struct proc *, void *, register_t *));
|
||||
int sys_fchmod __P((struct proc *, void *, register_t *));
|
||||
int sys___posix_fchown __P((struct proc *, void *, register_t *));
|
||||
int sys_sigreturn __P((struct proc *, void *, register_t *));
|
||||
int ibcs2_sys_statvfs __P((struct proc *, void *, register_t *));
|
||||
int ibcs2_sys_fstatvfs __P((struct proc *, void *, register_t *));
|
||||
int ibcs2_sys_mmap __P((struct proc *, void *, register_t *));
|
||||
int sys_mprotect __P((struct proc *, void *, register_t *));
|
||||
int sys_munmap __P((struct proc *, void *, register_t *));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ibcs2_syscalls.c,v 1.16 1998/02/19 03:34:17 thorpej Exp $ */
|
||||
/* $NetBSD: ibcs2_syscalls.c,v 1.17 1998/03/05 04:36:08 scottb Exp $ */
|
||||
|
||||
/*
|
||||
* System call names.
|
||||
@ -128,15 +128,15 @@ char *ibcs2_syscallnames[] = {
|
||||
"fchmod", /* 93 = fchmod */
|
||||
"__posix_fchown", /* 94 = __posix_fchown */
|
||||
"#95 (unimplemented)", /* 95 = unimplemented */
|
||||
"#96 (unimplemented)", /* 96 = unimplemented */
|
||||
"sigreturn", /* 96 = sigreturn */
|
||||
"#97 (unimplemented sigaltstack)", /* 97 = unimplemented sigaltstack */
|
||||
"#98 (unimplemented)", /* 98 = unimplemented */
|
||||
"#99 (unimplemented)", /* 99 = unimplemented */
|
||||
"#100 (unimplemented getcontext/setcontext/sigsetjmp)", /* 100 = unimplemented getcontext/setcontext/sigsetjmp */
|
||||
"#101 (unimplemented)", /* 101 = unimplemented */
|
||||
"#102 (unimplemented)", /* 102 = unimplemented */
|
||||
"#103 (unimplemented statvfs)", /* 103 = unimplemented statvfs */
|
||||
"#104 (unimplemented fstatvfs)", /* 104 = unimplemented fstatvfs */
|
||||
"statvfs", /* 103 = statvfs */
|
||||
"fstatvfs", /* 104 = fstatvfs */
|
||||
"#105 (unimplemented)", /* 105 = unimplemented */
|
||||
"#106 (unimplemented)", /* 106 = unimplemented */
|
||||
"#107 (unimplemented waitid)", /* 107 = unimplemented waitid */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ibcs2_sysent.c,v 1.17 1998/02/19 03:34:17 thorpej Exp $ */
|
||||
/* $NetBSD: ibcs2_sysent.c,v 1.18 1998/03/05 04:36:08 scottb Exp $ */
|
||||
|
||||
/*
|
||||
* System call switch table.
|
||||
@ -245,8 +245,8 @@ struct sysent ibcs2_sysent[] = {
|
||||
sys___posix_fchown }, /* 94 = __posix_fchown */
|
||||
{ 0, 0,
|
||||
sys_nosys }, /* 95 = unimplemented */
|
||||
{ 0, 0,
|
||||
sys_nosys }, /* 96 = unimplemented */
|
||||
{ 1, s(struct sys_sigreturn_args),
|
||||
sys_sigreturn }, /* 96 = sigreturn */
|
||||
{ 0, 0,
|
||||
sys_nosys }, /* 97 = unimplemented sigaltstack */
|
||||
{ 0, 0,
|
||||
@ -259,10 +259,10 @@ struct sysent ibcs2_sysent[] = {
|
||||
sys_nosys }, /* 101 = unimplemented */
|
||||
{ 0, 0,
|
||||
sys_nosys }, /* 102 = unimplemented */
|
||||
{ 0, 0,
|
||||
sys_nosys }, /* 103 = unimplemented statvfs */
|
||||
{ 0, 0,
|
||||
sys_nosys }, /* 104 = unimplemented fstatvfs */
|
||||
{ 2, s(struct ibcs2_sys_statvfs_args),
|
||||
ibcs2_sys_statvfs }, /* 103 = statvfs */
|
||||
{ 2, s(struct ibcs2_sys_fstatvfs_args),
|
||||
ibcs2_sys_fstatvfs }, /* 104 = fstatvfs */
|
||||
{ 0, 0,
|
||||
sys_nosys }, /* 105 = unimplemented */
|
||||
{ 0, 0,
|
||||
|
@ -1,4 +1,4 @@
|
||||
$NetBSD: syscalls.master,v 1.13 1998/02/19 00:40:25 thorpej Exp $
|
||||
$NetBSD: syscalls.master,v 1.14 1998/03/05 04:36:08 scottb Exp $
|
||||
|
||||
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
|
||||
|
||||
@ -169,15 +169,17 @@
|
||||
93 NOARGS { int sys_fchmod(int fd, int mode); }
|
||||
94 NOARGS { int sys___posix_fchown(int fd, int uid, int gid); }
|
||||
95 UNIMPL
|
||||
96 UNIMPL
|
||||
96 NOARGS { int sys_sigreturn(struct sigcontext *sigcntxp); }
|
||||
97 UNIMPL sigaltstack
|
||||
98 UNIMPL
|
||||
99 UNIMPL
|
||||
100 UNIMPL getcontext/setcontext/sigsetjmp
|
||||
101 UNIMPL
|
||||
102 UNIMPL
|
||||
103 UNIMPL statvfs
|
||||
104 UNIMPL fstatvfs
|
||||
103 STD { int ibcs2_sys_statvfs(char *path, \
|
||||
struct ibcs2_statvfs *buf); }
|
||||
104 STD { int ibcs2_sys_fstatvfs(int fd, \
|
||||
struct ibcs2_statvfs *buf); }
|
||||
105 UNIMPL
|
||||
106 UNIMPL
|
||||
107 UNIMPL waitid
|
||||
|
Loading…
Reference in New Issue
Block a user