Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-4]: src/sys/compat/osf1 pull up rev 1.5 from trunk. (cgd)
details: https://anonhg.NetBSD.org/src/rev/3af8093f11a0
branches: netbsd-1-4
changeset: 469077:3af8093f11a0
user: cgd <cgd%NetBSD.org@localhost>
date: Sat Jun 26 01:52:34 1999 +0000
description:
pull up rev 1.5 from trunk. (cgd)
diffstat:
sys/compat/osf1/osf1_descrip.c | 40 ++++++++++++++++-
sys/compat/osf1/osf1_socket.c | 90 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 125 insertions(+), 5 deletions(-)
diffs (185 lines):
diff -r 2d7586ec0173 -r 3af8093f11a0 sys/compat/osf1/osf1_descrip.c
--- a/sys/compat/osf1/osf1_descrip.c Sat Jun 26 01:52:28 1999 +0000
+++ b/sys/compat/osf1/osf1_descrip.c Sat Jun 26 01:52:34 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_descrip.c,v 1.4.4.2 1999/06/21 19:25:34 cgd Exp $ */
+/* $NetBSD: osf1_descrip.c,v 1.4.4.3 1999/06/26 01:52:34 cgd Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -92,9 +92,14 @@
{
struct osf1_sys_fcntl_args *uap = v;
struct sys_fcntl_args a;
+ struct osf1_flock oflock;
+ struct flock nflock;
unsigned long xfl, leftovers;
+ caddr_t sg;
int error;
+ sg = stackgap_init(p->p_emul);
+
SCARG(&a, fd) = SCARG(uap, fd);
leftovers = 0;
@@ -132,12 +137,30 @@
case OSF1_F_GETOWN: /* XXX not yet supported */
case OSF1_F_SETOWN: /* XXX not yet supported */
- case OSF1_F_GETLK: /* XXX not yet supported */
- case OSF1_F_SETLK: /* XXX not yet supported */
- case OSF1_F_SETLKW: /* XXX not yet supported */
/* XXX translate. */
return (EINVAL);
+ case OSF1_F_GETLK:
+ case OSF1_F_SETLK:
+ case OSF1_F_SETLKW:
+ if (SCARG(uap, cmd) == OSF1_F_GETLK)
+ SCARG(&a, cmd) = F_GETLK;
+ else if (SCARG(uap, cmd) == OSF1_F_SETLK)
+ SCARG(&a, cmd) = F_SETLK;
+ else if (SCARG(uap, cmd) == OSF1_F_SETLKW)
+ SCARG(&a, cmd) = F_SETLKW;
+ SCARG(&a, arg) = stackgap_alloc(&sg, sizeof nflock);
+
+ error = copyin(SCARG(uap, arg), &oflock, sizeof oflock);
+ if (error == 0)
+ error = osf1_cvt_flock_to_native(&oflock, &nflock);
+ if (error == 0)
+ error = copyout(&nflock, SCARG(&a, arg),
+ sizeof nflock);
+ if (error != 0)
+ return (error);
+ break;
+
case OSF1_F_RGETLK: /* [lock mgr op] XXX not supported */
case OSF1_F_RSETLK: /* [lock mgr op] XXX not supported */
case OSF1_F_CNVT: /* [lock mgr op] XXX not supported */
@@ -169,6 +192,15 @@
leftovers, NULL);
retval[0] = xfl;
break;
+
+ case OSF1_F_GETLK:
+ error = copyin(SCARG(&a, arg), &nflock, sizeof nflock);
+ if (error == 0) {
+ osf1_cvt_flock_from_native(&nflock, &oflock);
+ error = copyout(&oflock, SCARG(uap, arg),
+ sizeof oflock);
+ }
+ break;
}
return error;
diff -r 2d7586ec0173 -r 3af8093f11a0 sys/compat/osf1/osf1_socket.c
--- a/sys/compat/osf1/osf1_socket.c Sat Jun 26 01:52:28 1999 +0000
+++ b/sys/compat/osf1/osf1_socket.c Sat Jun 26 01:52:34 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_socket.c,v 1.5.4.2 1999/06/21 19:28:19 cgd Exp $ */
+/* $NetBSD: osf1_socket.c,v 1.5.4.3 1999/06/26 01:52:41 cgd Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -65,6 +65,7 @@
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <sys/socketvar.h>
+#include <sys/exec.h>
#include <compat/osf1/osf1.h>
#include <compat/osf1/osf1_syscallargs.h>
@@ -72,6 +73,93 @@
#include <compat/osf1/osf1_cvt.h>
int
+osf1_sys_recvmsg_xopen(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+
+ /* XXX */
+ return (EINVAL);
+}
+
+int
+osf1_sys_sendmsg_xopen(p, v, retval)
+ struct proc *p;
+ void *v;
+ register_t *retval;
+{
+ struct osf1_sys_sendmsg_xopen_args *uap = v;
+ struct sys_sendmsg_args a;
+ struct osf1_msghdr_xopen osf_msghdr;
+ struct osf1_iovec_xopen osf_iovec, *osf_iovec_ptr;
+ struct msghdr bsd_msghdr;
+ struct iovec bsd_iovec, *bsd_iovec_ptr;
+ unsigned long leftovers;
+ caddr_t sg;
+ unsigned int i;
+ int error;
+
+ sg = stackgap_init(p->p_emul);
+
+ SCARG(&a, s) = SCARG(uap, s);
+
+ /*
+ * translate msghdr structure
+ */
+ if ((error = copyin(SCARG(uap, msg), &osf_msghdr,
+ sizeof osf_msghdr)) != 0)
+ return (error);
+
+ error = osf1_cvt_msghdr_xopen_to_native(&osf_msghdr, &bsd_msghdr);
+ if (error != 0)
+ return (error);
+
+ if (STACKGAPLEN < (bsd_msghdr.msg_iovlen * sizeof (struct iovec) +
+ sizeof (struct msghdr)))
+{
+printf("sendmsg space\n");
+ return (EINVAL);
+}
+
+ SCARG(&a, msg) = stackgap_alloc(&sg, sizeof bsd_msghdr);
+ bsd_msghdr.msg_iov = stackgap_alloc(&sg,
+ bsd_msghdr.msg_iovlen * sizeof (struct iovec));
+
+ if ((error = copyout(&bsd_msghdr, (caddr_t)SCARG(&a, msg),
+ sizeof bsd_msghdr)) != 0)
+ return (error);
+
+ osf_iovec_ptr = osf_msghdr.msg_iov;
+ bsd_iovec_ptr = bsd_msghdr.msg_iov;
+ for (i = 0; i < bsd_msghdr.msg_iovlen; i++) {
+ if ((error = copyin(&osf_iovec_ptr[i], &osf_iovec,
+ sizeof osf_iovec)) != 0)
+ return (error);
+
+ bsd_iovec.iov_base = osf_iovec.iov_base;
+ bsd_iovec.iov_len = osf_iovec.iov_len;
+
+ if ((error = copyout(&bsd_iovec, &bsd_iovec_ptr[i],
+ sizeof bsd_iovec)) != 0)
+ return (error);
+ }
+
+ /*
+ * translate flags
+ */
+ SCARG(&a, flags) = emul_flags_translate(osf1_sendrecv_msg_flags_xtab,
+ SCARG(uap, flags), &leftovers);
+ if (leftovers != 0)
+{
+printf("sendmsg flags leftover: 0x%lx\n", leftovers);
+ return (EINVAL);
+}
+
+ return sys_sendmsg(p, &a, retval);
+}
+
+int
osf1_sys_sendto(p, v, retval)
struct proc *p;
void *v;
Home |
Main Index |
Thread Index |
Old Index