Module Name: src Committed By: martin Date: Sun Jun 21 08:47:15 UTC 2015
Modified Files: src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_mqueue.c Log Message: Move compat calls, requested by mrg@ To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/compat/netbsd32/netbsd32_compat_50.c cvs rdiff -u -r1.2 -r1.3 src/sys/compat/netbsd32/netbsd32_mqueue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/compat/netbsd32/netbsd32_compat_50.c diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.28 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.29 --- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.28 Mon Oct 27 19:10:21 2014 +++ src/sys/compat/netbsd32/netbsd32_compat_50.c Sun Jun 21 08:47:15 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_compat_50.c,v 1.28 2014/10/27 19:10:21 christos Exp $ */ +/* $NetBSD: netbsd32_compat_50.c,v 1.29 2015/06/21 08:47:15 martin Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -36,7 +36,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.28 2014/10/27 19:10:21 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.29 2015/06/21 08:47:15 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_sysv.h" @@ -1078,3 +1078,73 @@ compat_50_netbsd32_quotactl(struct lwp * NETBSD32TOP_UAP(arg, void *); return (compat_50_sys_quotactl(l, &ua, retval)); } + +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; +} + Index: src/sys/compat/netbsd32/netbsd32_mqueue.c diff -u src/sys/compat/netbsd32/netbsd32_mqueue.c:1.2 src/sys/compat/netbsd32/netbsd32_mqueue.c:1.3 --- src/sys/compat/netbsd32/netbsd32_mqueue.c:1.2 Sun Jun 21 08:32:36 2015 +++ src/sys/compat/netbsd32/netbsd32_mqueue.c Sun Jun 21 08:47:15 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_mqueue.c,v 1.2 2015/06/21 08:32:36 martin Exp $ */ +/* $NetBSD: netbsd32_mqueue.c,v 1.3 2015/06/21 08:47:15 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.2 2015/06/21 08:32:36 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_mqueue.c,v 1.3 2015/06/21 08:47:15 martin Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -321,74 +321,4 @@ netbsd32___mq_timedreceive50(struct lwp 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