summaryrefslogtreecommitdiff
path: root/sys/compat/ultrix/ultrix_misc.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-04-21 22:33:19 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-04-21 22:33:19 +0000
commit67d88b0a9910a68bb666b448d2dac29cb4d3d8c2 (patch)
tree967b89f6e07398a22bd8c76d30179b648776542d /sys/compat/ultrix/ultrix_misc.c
parentba95d3c1d69cdb251d15a12ebf70f50b0ea2019b (diff)
partial sync with netbsd 960418, more to come
Diffstat (limited to 'sys/compat/ultrix/ultrix_misc.c')
-rw-r--r--sys/compat/ultrix/ultrix_misc.c96
1 files changed, 75 insertions, 21 deletions
diff --git a/sys/compat/ultrix/ultrix_misc.c b/sys/compat/ultrix/ultrix_misc.c
index 212453ec3ab..314bef3d360 100644
--- a/sys/compat/ultrix/ultrix_misc.c
+++ b/sys/compat/ultrix/ultrix_misc.c
@@ -1,5 +1,33 @@
-/* $OpenBSD: ultrix_misc.c,v 1.6 1996/04/18 21:21:50 niklas Exp $ */
-/* $NetBSD: ultrix_misc.c,v 1.21 1996/02/19 15:41:38 pk Exp $ */
+/* $OpenBSD: ultrix_misc.c,v 1.7 1996/04/21 22:18:48 deraadt Exp $ */
+/* $NetBSD: ultrix_misc.c,v 1.23 1996/04/07 17:23:04 jonathan Exp $ */
+
+/*
+ * Copyright (c) 1995
+ * Jonathan Stone (hereinafter referred to as the author)
+ *
+ * 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. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. 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.
+ */
/*
* Copyright (c) 1992, 1993
@@ -96,9 +124,25 @@
#include <vm/vm.h>
+#include <sys/conf.h> /* iszerodev() */
+#include <sys/socketvar.h> /* sosetopt() */
+
extern struct sysent ultrix_sysent[];
extern char *ultrix_syscallnames[];
-extern void cpu_exec_ecoff_setregs __P((struct proc *, struct exec_package *,
+
+/*
+ * Select the appropriate setregs callback for the target architecture.
+ */
+#ifdef mips
+#define ULTRIX_EXEC_SETREGS cpu_exec_ecoff_setregs
+#endif /* mips */
+
+#ifdef vax
+#define ULTRIX_EXEC_SETREGS setregs
+#endif /* mips */
+
+
+extern void ULTRIX_EXEC_SETREGS __P((struct proc *, struct exec_package *,
u_long, register_t *));
extern char sigcode[], esigcode[];
@@ -112,13 +156,14 @@ struct emul emul_ultrix = {
ultrix_syscallnames,
0,
copyargs,
- cpu_exec_ecoff_setregs,
+ ULTRIX_EXEC_SETREGS,
sigcode,
esigcode,
};
#define GSI_PROG_ENV 1
+int
ultrix_sys_getsysinfo(p, v, retval)
struct proc *p;
void *v;
@@ -140,16 +185,22 @@ ultrix_sys_getsysinfo(p, v, retval)
}
}
+int
ultrix_sys_setsysinfo(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
+
+#ifdef notyet
struct ultrix_sys_setsysinfo_args *uap = v;
+#endif
+
*retval = 0;
return 0;
}
+int
ultrix_sys_waitpid(p, v, retval)
struct proc *p;
void *v;
@@ -166,6 +217,7 @@ ultrix_sys_waitpid(p, v, retval)
return (sys_wait4(p, &ua, retval));
}
+int
ultrix_sys_wait3(p, v, retval)
struct proc *p;
void *v;
@@ -184,16 +236,19 @@ ultrix_sys_wait3(p, v, retval)
/*
* Ultrix binaries pass in FD_MAX as the first arg to select().
- * On Ultrix, that is 4096, which is more than the NetBSD sys_select()
+ * On Ultrix, FD_MAX is 4096, which is more than the NetBSD sys_select()
* can handle.
+ * Since we can't have more than the (native) FD_MAX descriptors open,
+ * limit nfds to at most FD_MAX.
*/
+int
ultrix_sys_select(p, v, retval)
struct proc *p;
void *v;
register_t *retval;
{
struct sys_select_args *uap = v;
- struct timeval atv, *tvp;
+ struct timeval atv;
int error;
/* Limit number of FDs selected on to the native maximum */
@@ -210,7 +265,7 @@ ultrix_sys_select(p, v, retval)
#ifdef DEBUG
/* Ultrix clients sometimes give negative timeouts? */
if (atv.tv_sec < 0 || atv.tv_usec < 0)
- printf("ultrix select( %d, %d)\n",
+ printf("ultrix select( %ld, %ld): negative timeout\n",
atv.tv_sec, atv.tv_usec);
/*tvp = (timeval *)STACKGAPBASE;*/
#endif
@@ -225,6 +280,7 @@ done:
}
#if defined(NFSCLIENT)
+int
async_daemon(p, v, retval)
struct proc *p;
void *v;
@@ -239,15 +295,6 @@ async_daemon(p, v, retval)
}
#endif /* NFSCLIENT */
-#if 0
-/* XXX: Temporary until sys/dir.h, include/dirent.h and sys/dirent.h are fixed */
-struct dirent {
- u_long d_fileno; /* file number of entry */
- u_short d_reclen; /* length of this record */
- u_short d_namlen; /* length of string in d_name */
- char d_name[255 + 1]; /* name must be no longer than this */
-};
-#endif
#define SUN__MAP_NEW 0x80000000 /* if not, old mmap & cannot handle */
@@ -301,6 +348,7 @@ ultrix_sys_mmap(p, v, retval)
return (sys_mmap(p, &ouap, retval));
}
+int
ultrix_sys_setsockopt(p, v, retval)
struct proc *p;
void *v;
@@ -311,7 +359,7 @@ ultrix_sys_setsockopt(p, v, retval)
struct mbuf *m = NULL;
int error;
- if (error = getsock(p->p_fd, SCARG(uap, s), &fp))
+ if ((error = getsock(p->p_fd, SCARG(uap, s), &fp)) != 0)
return (error);
#define SO_DONTLINGER (~SO_LINGER)
if (SCARG(uap, name) == SO_DONTLINGER) {
@@ -329,8 +377,8 @@ ultrix_sys_setsockopt(p, v, retval)
m = m_get(M_WAIT, MT_SOOPTS);
if (m == NULL)
return (ENOBUFS);
- if (error = copyin(SCARG(uap, val), mtod(m, caddr_t),
- (u_int)SCARG(uap, valsize))) {
+ if ((error = copyin(SCARG(uap, val), mtod(m, caddr_t),
+ (u_int)SCARG(uap, valsize))) != 0) {
(void) m_free(m);
return (error);
}
@@ -400,13 +448,14 @@ ultrix_sys_nfssvc(p, v, retval)
void *v;
register_t *retval;
{
+
+#if 0 /* XXX */
struct ultrix_sys_nfssvc_args *uap = v;
struct emul *e = p->p_emul;
struct sys_nfssvc_args outuap;
struct sockaddr sa;
int error;
-#if 0
bzero(&outuap, sizeof outuap);
SCARG(&outuap, fd) = SCARG(uap, fd);
SCARG(&outuap, mskval) = STACKGAPBASE;
@@ -451,7 +500,7 @@ ultrix_sys_ustat(p, v, retval)
* How do we translate dev -> fstat? (and then to ultrix_ustat)
*/
- if (error = copyout(&us, SCARG(uap, buf), sizeof us))
+ if ((error = copyout(&us, SCARG(uap, buf), sizeof us)) != 0)
return (error);
return 0;
}
@@ -462,7 +511,10 @@ ultrix_sys_quotactl(p, v, retval)
void *v;
register_t *retval;
{
+
+#ifdef notyet
struct ultrix_sys_quotactl_args *uap = v;
+#endif
return EINVAL;
}
@@ -483,7 +535,9 @@ ultrix_sys_exportfs(p, v, retval)
void *v;
register_t *retval;
{
+#ifdef notyet
struct ultrix_sys_exportfs_args *uap = v;
+#endif
/*
* XXX: should perhaps translate into a mount(2)