Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/netbsd32 Fix compat/versioning confusion and add ...



details:   https://anonhg.NetBSD.org/src/rev/b02f9b692141
branches:  trunk
changeset: 809127:b02f9b692141
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Jun 21 08:32:36 2015 +0000

description:
Fix compat/versioning confusion and add the missing new versioned ones.

diffstat:

 sys/compat/netbsd32/netbsd32_mqueue.c |  90 ++++++++++++++++++++++++++++++----
 1 files changed, 78 insertions(+), 12 deletions(-)

diffs (136 lines):

diff -r 3c996270a3f2 -r b02f9b692141 sys/compat/netbsd32/netbsd32_mqueue.c
--- a/sys/compat/netbsd32/netbsd32_mqueue.c     Sun Jun 21 08:29:52 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_mqueue.c     Sun Jun 21 08:32:36 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_mqueue.c,v 1.1 2015/06/20 19:58:40 martin Exp $       */
+/*     $NetBSD: netbsd32_mqueue.c,v 1.2 2015/06/21 08:32:36 martin Exp $       */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_mqueue.c,v 1.1 2015/06/20 19:58:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mqueue.c,v 1.2 2015/06/21 08:32:36 martin Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -255,19 +255,16 @@
        return error;
 }
 
-#ifdef COMPAT_50
-
 int
-compat_50_netbsd32_mq_timedsend(struct lwp *l,
-    const struct compat_50_netbsd32_mq_timedsend_args *uap,
-    register_t *retval)
+netbsd32___mq_timedsend50(struct lwp *l,
+     const struct netbsd32___mq_timedsend50_args *uap, register_t *retval)
 {
        /* {
                syscallarg(mqd_t) mqdes;
                syscallarg(const netbsd32_charp) msg_ptr;
                syscallarg(netbsd32_size_t) msg_len;
                syscallarg(unsigned) msg_prio;
-               syscallarg(const netbsd32_timespec50p_t) abs_timeout;
+               syscallarg(const netbsd32_timespecp_t) abs_timeout;
        } */
        struct timespec ts, *tsp;
        struct netbsd32_timespec ts32;
@@ -290,16 +287,15 @@
 }
 
 int
-compat_50_netbsd32_mq_timedreceive(struct lwp *l,
-    const struct compat_50_netbsd32_mq_timedreceive_args *uap,
-    register_t *retval)
+netbsd32___mq_timedreceive50(struct lwp *l,
+    const struct netbsd32___mq_timedreceive50_args *uap, register_t *retval)
 {
        /* {
                syscallarg(mqd_t) mqdes;
                syscallarg(netbsd32_charp) msg_ptr;
                syscallarg(netbsd32_size_t) msg_len;
                syscallarg(netbsd32_uintp) msg_prio;
-               syscallarg(const netbsd32_timespec50p_t) abs_timeout;
+               syscallarg(const netbsd32_timespecp_t) abs_timeout;
        } */
        struct timespec ts, *tsp;
        struct netbsd32_timespec ts32;
@@ -325,4 +321,74 @@
 
        return error;
 }
+ 
+#ifdef COMPAT_50
+int
+compat_50_netbsd32_mq_timedsend(struct lwp *l,
+    const struct compat_50_netbsd32_mq_timedsend_args *uap,
+    register_t *retval)
+{
+       /* {
+               syscallarg(mqd_t) mqdes;
+               syscallarg(const netbsd32_charp) msg_ptr;
+               syscallarg(netbsd32_size_t) msg_len;
+               syscallarg(unsigned) msg_prio;
+               syscallarg(const netbsd32_timespec50p_t) abs_timeout;
+       } */
+       struct timespec ts, *tsp;
+       struct netbsd32_timespec50 ts32;
+       int error;
+
+       /* Get and convert time value */
+       if (SCARG_P32(uap, abs_timeout)) {
+               error = copyin(SCARG_P32(uap, abs_timeout), &ts32,
+                    sizeof(ts32));
+               if (error)
+                       return error;
+               netbsd32_to_timespec50(&ts32, &ts);
+               tsp = &ts;
+       } else {
+               tsp = NULL;
+       }
+
+       return mq_send1(SCARG(uap, mqdes), SCARG_P32(uap, msg_ptr),
+           SCARG(uap, msg_len), SCARG(uap, msg_prio), tsp);
+}
+
+int
+compat_50_netbsd32_mq_timedreceive(struct lwp *l,
+    const struct compat_50_netbsd32_mq_timedreceive_args *uap,
+    register_t *retval)
+{
+       /* {
+               syscallarg(mqd_t) mqdes;
+               syscallarg(netbsd32_charp) msg_ptr;
+               syscallarg(netbsd32_size_t) msg_len;
+               syscallarg(netbsd32_uintp) msg_prio;
+               syscallarg(const netbsd32_timespec50p_t) abs_timeout;
+       } */
+       struct timespec ts, *tsp;
+       struct netbsd32_timespec50 ts32;
+       ssize_t mlen;
+       int error;
+
+       /* Get and convert time value */
+       if (SCARG_P32(uap, abs_timeout)) {
+               error = copyin(SCARG_P32(uap, abs_timeout), &ts32,
+                   sizeof(ts32));
+               if (error)
+                       return error;
+               netbsd32_to_timespec50(&ts32, &ts);
+               tsp = &ts;
+       } else {
+               tsp = NULL;
+       }
+
+       error = mq_recv1(SCARG(uap, mqdes), SCARG_P32(uap, msg_ptr),
+           SCARG(uap, msg_len), SCARG_P32(uap, msg_prio), tsp, &mlen);
+       if (error == 0)
+               *retval = mlen;
+
+       return error;
+}
 #endif



Home | Main Index | Thread Index | Old Index