summaryrefslogtreecommitdiff
path: root/sys/compat
diff options
context:
space:
mode:
Diffstat (limited to 'sys/compat')
-rw-r--r--sys/compat/ibcs2/ibcs2_fcntl.c42
-rw-r--r--sys/compat/ibcs2/ibcs2_misc.c42
-rw-r--r--sys/compat/ibcs2/ibcs2_syscall.h2
-rw-r--r--sys/compat/ibcs2/ibcs2_syscallargs.h12
-rw-r--r--sys/compat/ibcs2/ibcs2_syscalls.c4
-rw-r--r--sys/compat/ibcs2/ibcs2_sysent.c8
-rw-r--r--sys/compat/ibcs2/ibcs2_sysi86.h42
-rw-r--r--sys/compat/ibcs2/syscalls.master6
8 files changed, 148 insertions, 10 deletions
diff --git a/sys/compat/ibcs2/ibcs2_fcntl.c b/sys/compat/ibcs2/ibcs2_fcntl.c
index c299034e76a..a40d91b72e7 100644
--- a/sys/compat/ibcs2/ibcs2_fcntl.c
+++ b/sys/compat/ibcs2/ibcs2_fcntl.c
@@ -37,9 +37,11 @@
#include <sys/mount.h>
#include <sys/malloc.h>
#include <sys/syscallargs.h>
+#include <sys/vnode.h>
#include <compat/ibcs2/ibcs2_types.h>
#include <compat/ibcs2/ibcs2_fcntl.h>
+#include <compat/ibcs2/ibcs2_unistd.h>
#include <compat/ibcs2/ibcs2_signal.h>
#include <compat/ibcs2/ibcs2_syscallargs.h>
#include <compat/ibcs2/ibcs2_util.h>
@@ -222,6 +224,46 @@ ibcs2_sys_access(p, v, retval)
}
int
+ibcs2_sys_eaccess(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ register struct ibcs2_sys_eaccess_args /* {
+ syscallarg(char *) path;
+ syscallarg(int) flags;
+ } */ *uap = v;
+ register struct ucred *cred = p->p_ucred;
+ register struct vnode *vp;
+ int error, flags;
+ struct nameidata nd;
+ caddr_t sg = stackgap_init(p->p_emul);
+
+ IBCS2_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
+
+ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE,
+ SCARG(uap, path), p);
+ if (error = namei(&nd))
+ return error;
+ vp = nd.ni_vp;
+
+ /* Flags == 0 means only check for existence. */
+ if (SCARG(uap, flags)) {
+ flags = 0;
+ if (SCARG(uap, flags) & IBCS2_R_OK)
+ flags |= VREAD;
+ if (SCARG(uap, flags) & IBCS2_W_OK)
+ flags |= VWRITE;
+ if (SCARG(uap, flags) & IBCS2_X_OK)
+ flags |= VEXEC;
+ if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
+ error = VOP_ACCESS(vp, flags, cred, p);
+ }
+ vput(vp);
+ return error;
+}
+
+int
ibcs2_sys_fcntl(p, v, retval)
struct proc *p;
void *v;
diff --git a/sys/compat/ibcs2/ibcs2_misc.c b/sys/compat/ibcs2/ibcs2_misc.c
index 223348f457f..0f667f9c4be 100644
--- a/sys/compat/ibcs2/ibcs2_misc.c
+++ b/sys/compat/ibcs2/ibcs2_misc.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ibcs2_misc.c,v 1.11 1995/10/09 11:24:01 mycroft Exp $ */
+/* $NetBSD: ibcs2_misc.c,v 1.13 1996/01/06 03:23:49 scottb Exp $ */
/*
* Copyright (c) 1994, 1995 Scott Bartram
@@ -101,6 +101,7 @@
#include <compat/ibcs2/ibcs2_util.h>
#include <compat/ibcs2/ibcs2_utime.h>
#include <compat/ibcs2/ibcs2_syscallargs.h>
+#include <compat/ibcs2/ibcs2_sysi86.h>
int
@@ -1396,3 +1397,42 @@ ibcs2_sys_readlink(p, v, retval)
IBCS2_CHECK_ALT_EXIST(p, &sg, SCARG(uap, path));
return sys_readlink(p, uap, retval);
}
+
+int
+ibcs2_sysi86(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct ibcs2_sysi86_args /* {
+ syscallarg(int) cmd;
+ syscallarg(int) arg;
+ } */ *uap = v;
+ int val, error;
+
+ switch (SCARG(uap, cmd)) {
+ case IBCS2_SI86FPHW:
+ val = IBCS2_FP_NO;
+#ifdef MATH_EMULATE
+ val = IBCS2_FP_SW;
+#else
+ val = IBCS2_FP_387; /* a real coprocessor */
+#endif
+ if ((error = copyout((caddr_t)&val, (caddr_t)SCARG(uap, arg),
+ sizeof(val))))
+ return error;
+ break;
+
+ case IBCS2_SI86STIME: /* XXX - not used much, if at all */
+ case IBCS2_SI86SETNAME:
+ return EINVAL;
+
+ case IBCS2_SI86PHYSMEM:
+ *retval = ctob(physmem);
+ break;
+
+ default:
+ return EINVAL;
+ }
+ return 0;
+}
diff --git a/sys/compat/ibcs2/ibcs2_syscall.h b/sys/compat/ibcs2/ibcs2_syscall.h
index ed8fef24186..314cfa6eb8d 100644
--- a/sys/compat/ibcs2/ibcs2_syscall.h
+++ b/sys/compat/ibcs2/ibcs2_syscall.h
@@ -50,6 +50,7 @@
#define IBCS2_SYS_getgid 47
#define IBCS2_SYS_sigsys 48
#define IBCS2_SYS_msgsys 49
+#define IBCS2_SYS_ibcs2_sysi86 50
#define IBCS2_SYS_shmsys 52
#define IBCS2_SYS_semsys 53
#define IBCS2_SYS_ioctl 54
@@ -84,6 +85,7 @@
#define IBCS2_SYS_ftime 139
#define IBCS2_SYS_nap 140
#define IBCS2_SYS_select 164
+#define IBCS2_SYS_eaccess 165
#define IBCS2_SYS_sigaction 167
#define IBCS2_SYS_sigprocmask 168
#define IBCS2_SYS_sigpending 169
diff --git a/sys/compat/ibcs2/ibcs2_syscallargs.h b/sys/compat/ibcs2/ibcs2_syscallargs.h
index c9df53df8b4..e9dbc371633 100644
--- a/sys/compat/ibcs2/ibcs2_syscallargs.h
+++ b/sys/compat/ibcs2/ibcs2_syscallargs.h
@@ -165,6 +165,11 @@ struct ibcs2_sys_msgsys_args {
syscallarg(int) a6;
};
+struct ibcs2_sysi86_args {
+ syscallarg(int) cmd;
+ syscallarg(int) arg;
+};
+
struct ibcs2_sys_shmsys_args {
syscallarg(int) which;
syscallarg(int) a2;
@@ -289,6 +294,11 @@ struct xenix_sys_nap_args {
syscallarg(int) millisec;
};
+struct ibcs2_sys_eaccess_args {
+ syscallarg(char *) path;
+ syscallarg(int) flags;
+};
+
struct ibcs2_sys_sigaction_args {
syscallarg(int) signum;
syscallarg(struct ibcs2_sigaction *) nsa;
@@ -390,6 +400,7 @@ int ibcs2_sys_sigsys __P((struct proc *, void *, register_t *));
int ibcs2_sys_msgsys __P((struct proc *, void *, register_t *));
#else
#endif
+int ibcs2_sysi86 __P((struct proc *, void *, register_t *));
#ifdef SYSVSHM
int ibcs2_sys_shmsys __P((struct proc *, void *, register_t *));
#else
@@ -422,6 +433,7 @@ int xenix_sys_chsize __P((struct proc *, void *, register_t *));
int xenix_sys_ftime __P((struct proc *, void *, register_t *));
int xenix_sys_nap __P((struct proc *, void *, register_t *));
int sys_select __P((struct proc *, void *, register_t *));
+int ibcs2_sys_eaccess __P((struct proc *, void *, register_t *));
int ibcs2_sys_sigaction __P((struct proc *, void *, register_t *));
int ibcs2_sys_sigprocmask __P((struct proc *, void *, register_t *));
int ibcs2_sys_sigpending __P((struct proc *, void *, register_t *));
diff --git a/sys/compat/ibcs2/ibcs2_syscalls.c b/sys/compat/ibcs2/ibcs2_syscalls.c
index 256012fc268..eb74dea8987 100644
--- a/sys/compat/ibcs2/ibcs2_syscalls.c
+++ b/sys/compat/ibcs2/ibcs2_syscalls.c
@@ -60,7 +60,7 @@ char *ibcs2_syscallnames[] = {
#else
"#49 (unimplemented msgsys)", /* 49 = unimplemented msgsys */
#endif
- "#50 (unimplemented ibcs2_sys3b)", /* 50 = unimplemented ibcs2_sys3b */
+ "ibcs2_sysi86", /* 50 = ibcs2_sysi86 */
"#51 (unimplemented ibcs2_acct)", /* 51 = unimplemented ibcs2_acct */
#ifdef SYSVSHM
"shmsys", /* 52 = shmsys */
@@ -183,7 +183,7 @@ char *ibcs2_syscallnames[] = {
"#162 (unimplemented xenix_unexecseg)", /* 162 = unimplemented xenix_unexecseg */
"#163 (unimplemented)", /* 163 = unimplemented */
"select", /* 164 = select */
- "#165 (unimplemented xenix_eaccess)", /* 165 = unimplemented xenix_eaccess */
+ "eaccess", /* 165 = eaccess */
"#166 (unimplemented xenix_paccess)", /* 166 = unimplemented xenix_paccess */
"sigaction", /* 167 = sigaction */
"sigprocmask", /* 168 = sigprocmask */
diff --git a/sys/compat/ibcs2/ibcs2_sysent.c b/sys/compat/ibcs2/ibcs2_sysent.c
index 01ec246e72b..e03c3e1838b 100644
--- a/sys/compat/ibcs2/ibcs2_sysent.c
+++ b/sys/compat/ibcs2/ibcs2_sysent.c
@@ -141,8 +141,8 @@ struct sysent ibcs2_sysent[] = {
{ 0, 0,
sys_nosys }, /* 49 = unimplemented msgsys */
#endif
- { 0, 0,
- sys_nosys }, /* 50 = unimplemented ibcs2_sys3b */
+ { 2, s(struct ibcs2_sysi86_args),
+ ibcs2_sysi86 }, /* 50 = ibcs2_sysi86 */
{ 0, 0,
sys_nosys }, /* 51 = unimplemented ibcs2_acct */
#ifdef SYSVSHM
@@ -381,8 +381,8 @@ struct sysent ibcs2_sysent[] = {
sys_nosys }, /* 163 = unimplemented */
{ 5, s(struct sys_select_args),
sys_select }, /* 164 = select */
- { 0, 0,
- sys_nosys }, /* 165 = unimplemented xenix_eaccess */
+ { 2, s(struct ibcs2_sys_eaccess_args),
+ ibcs2_sys_eaccess }, /* 165 = eaccess */
{ 0, 0,
sys_nosys }, /* 166 = unimplemented xenix_paccess */
{ 3, s(struct ibcs2_sys_sigaction_args),
diff --git a/sys/compat/ibcs2/ibcs2_sysi86.h b/sys/compat/ibcs2/ibcs2_sysi86.h
new file mode 100644
index 00000000000..7cbf9b9f9df
--- /dev/null
+++ b/sys/compat/ibcs2/ibcs2_sysi86.h
@@ -0,0 +1,42 @@
+/* $NetBSD: ibcs2_sysi86.h,v 1.1 1996/01/06 03:23:54 scottb Exp $ */
+
+/*
+ * Copyright (c) 1996 Scott Bartram
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. The name of the author may not be used to endorse or promote products
+ * derived from this software without specific prior written permission
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _IBCS2_SYSI86_H
+#define _IBCS2_SYSI86_H
+
+#define IBCS2_SI86FPHW 40 /* check floating-point support */
+#define IBCS2_SI86STIME 54 /* set system time */
+#define IBCS2_SI86SETNAME 56 /* set hostname */
+#define IBCS2_SI86PHYSMEM 65 /* get physical memory size */
+
+/* from sys/fp.h */
+#define IBCS2_FP_NO 0
+#define IBCS2_FP_SW 1
+#define IBCS2_FP_HW 2
+#define IBCS2_FP_287 2
+#define IBCS2_FP_387 3
+
+#endif /* _IBCS2_SYSI86_H */
diff --git a/sys/compat/ibcs2/syscalls.master b/sys/compat/ibcs2/syscalls.master
index b661d89bfca..32ff059aa64 100644
--- a/sys/compat/ibcs2/syscalls.master
+++ b/sys/compat/ibcs2/syscalls.master
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.6 1995/10/07 06:26:56 mycroft Exp $
+ $NetBSD: syscalls.master,v 1.7 1996/01/06 03:23:55 scottb Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -103,7 +103,7 @@
#else
49 UNIMPL msgsys
#endif
-50 UNIMPL ibcs2_sys3b
+50 STD { int ibcs2_sysi86(int cmd, int arg); }
51 UNIMPL ibcs2_acct
#ifdef SYSVSHM
52 STD { int ibcs2_sys_shmsys(int which, int a2, int a3, \
@@ -239,7 +239,7 @@
163 UNIMPL
164 NOARGS { int sys_select(u_int nd, fd_set *in, fd_set *ou, \
fd_set *ex, struct timeval *tv); }
-165 UNIMPL xenix_eaccess
+165 STD { int ibcs2_sys_eaccess(char *path, int flags); }
166 UNIMPL xenix_paccess
167 STD { int ibcs2_sys_sigaction(int signum, \
struct ibcs2_sigaction *nsa, \