Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/osf1 start at (new) sendmsg and recvmsg. right n...
details: https://anonhg.NetBSD.org/src/rev/fffaa401475a
branches: trunk
changeset: 472861:fffaa401475a
user: cgd <cgd%NetBSD.org@localhost>
date: Mon May 10 05:58:44 1999 +0000
description:
start at (new) sendmsg and recvmsg. right now, the former doesn't
handle control messages and the latter is just a stub.
diffstat:
sys/compat/osf1/osf1_cvt.c | 34 +++++++++++++++-
sys/compat/osf1/osf1_cvt.h | 4 +-
sys/compat/osf1/osf1_socket.c | 90 ++++++++++++++++++++++++++++++++++++++++-
sys/compat/osf1/syscalls.master | 8 ++-
4 files changed, 130 insertions(+), 6 deletions(-)
diffs (199 lines):
diff -r 7b7c76f3dd64 -r fffaa401475a sys/compat/osf1/osf1_cvt.c
--- a/sys/compat/osf1/osf1_cvt.c Mon May 10 04:52:34 1999 +0000
+++ b/sys/compat/osf1/osf1_cvt.c Mon May 10 05:58:44 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_cvt.c,v 1.5 1999/05/05 00:57:43 cgd Exp $ */
+/* $NetBSD: osf1_cvt.c,v 1.6 1999/05/10 05:58:44 cgd Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -308,6 +308,38 @@
};
int
+osf1_cvt_msghdr_xopen_to_native(omh, bmh)
+ const struct osf1_msghdr_xopen *omh;
+ struct msghdr *bmh;
+{
+ unsigned long leftovers;
+
+ memset(bmh, 0, sizeof bmh);
+ bmh->msg_name = omh->msg_name; /* XXX sockaddr translation */
+ bmh->msg_namelen = omh->msg_namelen;
+ bmh->msg_iov = NULL; /* iovec xlation separate */
+ bmh->msg_iovlen = omh->msg_iovlen;
+
+ /* XXX we don't translate control messages (yet) */
+ if (bmh->msg_control != NULL || bmh->msg_controllen != 0)
+{
+printf("osf1_cvt_msghdr_xopen_to_native: control\n");
+ return (EINVAL);
+}
+
+ /* translate flags */
+ bmh->msg_flags = emul_flags_translate(osf1_sendrecv_msg_flags_xtab,
+ omh->msg_flags, &leftovers);
+ if (leftovers != 0)
+{
+printf("osf1_cvt_msghdr_xopen_to_native: leftovers 0x%lx\n", leftovers);
+ return (EINVAL);
+}
+
+ return (0);
+}
+
+int
osf1_cvt_pathconf_name_to_native(oname, bnamep)
int oname, *bnamep;
{
diff -r 7b7c76f3dd64 -r fffaa401475a sys/compat/osf1/osf1_cvt.h
--- a/sys/compat/osf1/osf1_cvt.h Mon May 10 04:52:34 1999 +0000
+++ b/sys/compat/osf1/osf1_cvt.h Mon May 10 05:58:44 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_cvt.h,v 1.4 1999/05/04 02:12:15 cgd Exp $ */
+/* $NetBSD: osf1_cvt.h,v 1.5 1999/05/10 05:58:44 cgd Exp $ */
/*
* Copyright (c) 1999 Christopher G. Demetriou. All rights reserved.
@@ -47,6 +47,8 @@
#define osf1_cvt_dev_to_native(dev) \
makedev(osf1_major(dev), osf1_minor(dev))
+int osf1_cvt_msghdr_xopen_to_native(const struct osf1_msghdr_xopen *omh,
+ struct msghdr *nmh);
int osf1_cvt_pathconf_name_to_native(int oname, int *bnamep);
void osf1_cvt_rusage_from_native(const struct rusage *nru,
struct osf1_rusage *oru);
diff -r 7b7c76f3dd64 -r fffaa401475a sys/compat/osf1/osf1_socket.c
--- a/sys/compat/osf1/osf1_socket.c Mon May 10 04:52:34 1999 +0000
+++ b/sys/compat/osf1/osf1_socket.c Mon May 10 05:58:44 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: osf1_socket.c,v 1.4 1999/05/10 01:58:37 cgd Exp $ */
+/* $NetBSD: osf1_socket.c,v 1.5 1999/05/10 05:58:44 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;
diff -r 7b7c76f3dd64 -r fffaa401475a sys/compat/osf1/syscalls.master
--- a/sys/compat/osf1/syscalls.master Mon May 10 04:52:34 1999 +0000
+++ b/sys/compat/osf1/syscalls.master Mon May 10 05:58:44 1999 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.29 1999/05/10 03:33:04 cgd Exp $
+ $NetBSD: syscalls.master,v 1.30 1999/05/10 05:58:44 cgd Exp $
; @(#)syscalls.master 8.1 (Berkeley) 7/19/93
@@ -77,8 +77,10 @@
24 NOARGS { uid_t sys_getuid(void); }
25 UNIMPL exec_with_loader
26 UNIMPL ptrace
-27 UNIMPL recvmsg
-28 UNIMPL sendmsg
+27 STD { int osf1_sys_recvmsg_xopen(int s, \
+ struct osf1_msghdr_xopen *msg, int flags); }
+28 STD { int osf1_sys_sendmsg_xopen(int s, \
+ const struct osf1_msghdr_xopen *msg, int flags); }
29 UNIMPL recvfrom
30 UNIMPL accept
31 UNIMPL getpeername
- Prev by Date:
[src/trunk]: src/sys/arch/pmax/conf Change {cfb, mfb, sfb, px}0 to {cfb, mfb, sfb, ...
- Next by Date:
[src/trunk]: src/sys/compat/osf1 regen
- Previous by Thread:
[src/trunk]: src/sys/arch/pmax/conf Change {cfb, mfb, sfb, px}0 to {cfb, mfb, sfb, ...
- Next by Thread:
[src/trunk]: src/sys/compat/osf1 regen
- Indexes:
Home |
Main Index |
Thread Index |
Old Index