Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/compat/netbsd32 Prepare for new compat_netbsd32_mqueue m...
details: https://anonhg.NetBSD.org/src/rev/4a46adcffbd7
branches: trunk
changeset: 341989:4a46adcffbd7
user: pgoyette <pgoyette%NetBSD.org@localhost>
date: Tue Dec 01 23:56:43 2015 +0000
description:
Prepare for new compat_netbsd32_mqueue module to be split out of
compat_netbsd32. Refactor the COMPAT_50 code related to mqueue,
and update the syscall definitions. Remove dependency on mqueue
from the compat_netbsd32 module (the new module will gain this
dependency).
Continuation of work on PR kern/50489
diffstat:
sys/compat/netbsd32/netbsd32_compat_50.c | 73 +------------------
sys/compat/netbsd32/netbsd32_mod.c | 6 +-
sys/compat/netbsd32/netbsd32_mqueue.c | 122 ++++++++++++++++++++++++++++++-
sys/compat/netbsd32/syscalls.master | 38 ++++++---
4 files changed, 150 insertions(+), 89 deletions(-)
diffs (truncated from 348 to 300 lines):
diff -r 0b94bf8079b9 -r 4a46adcffbd7 sys/compat/netbsd32/netbsd32_compat_50.c
--- a/sys/compat/netbsd32/netbsd32_compat_50.c Tue Dec 01 23:38:34 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_compat_50.c Tue Dec 01 23:56:43 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_compat_50.c,v 1.30 2015/07/24 13:02:52 maxv Exp $ */
+/* $NetBSD: netbsd32_compat_50.c,v 1.31 2015/12/01 23:56:43 pgoyette 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.30 2015/07/24 13:02:52 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.31 2015/12/01 23:56:43 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_sysv.h"
@@ -1079,72 +1079,3 @@
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;
-}
-
diff -r 0b94bf8079b9 -r 4a46adcffbd7 sys/compat/netbsd32/netbsd32_mod.c
--- a/sys/compat/netbsd32/netbsd32_mod.c Tue Dec 01 23:38:34 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_mod.c Tue Dec 01 23:56:43 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_mod.c,v 1.11 2015/12/01 09:12:23 pgoyette Exp $ */
+/* $NetBSD: netbsd32_mod.c,v 1.12 2015/12/01 23:56:43 pgoyette Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.11 2015/12/01 09:12:23 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.12 2015/12/01 23:56:43 pgoyette Exp $");
#ifdef _KERNEL_OPT
#include "opt_execfmt.h"
@@ -48,7 +48,7 @@
#include <compat/netbsd32/netbsd32_sysctl.h>
#include <compat/netbsd32/netbsd32_exec.h>
-# define DEPS1 "compat,compat_sysv,mqueue,ksem"
+# define DEPS1 "compat,compat_sysv,ksem"
#if defined(EXEC_ELF32)
# define DEPS2 ",exec_elf32"
diff -r 0b94bf8079b9 -r 4a46adcffbd7 sys/compat/netbsd32/netbsd32_mqueue.c
--- a/sys/compat/netbsd32/netbsd32_mqueue.c Tue Dec 01 23:38:34 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_mqueue.c Tue Dec 01 23:56:43 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_mqueue.c,v 1.5 2015/06/30 11:56:27 christos Exp $ */
+/* $NetBSD: netbsd32_mqueue.c,v 1.6 2015/12/01 23:56:43 pgoyette 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.5 2015/06/30 11:56:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mqueue.c,v 1.6 2015/12/01 23:56:43 pgoyette Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -40,12 +40,14 @@
#include <sys/filedesc.h>
#include <sys/fcntl.h>
#include <sys/module.h>
+#include <sys/syscallvar.h>
#include <compat/netbsd32/netbsd32.h>
#include <compat/netbsd32/netbsd32_syscall.h>
#include <compat/netbsd32/netbsd32_syscallargs.h>
#include <compat/netbsd32/netbsd32_conv.h>
+extern struct emul emul_netbsd32;
int
netbsd32_mq_open(struct lwp *l, const struct netbsd32_mq_open_args *uap,
@@ -322,3 +324,119 @@
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 /* COMPAT_50 */
+
+#define _PKG_ENTRY(name) \
+ { NETBSD32_SYS_ ## name, 0, (sy_call_t *)name }
+
+static const struct syscall_package compat_mqueue_syscalls[] = {
+ _PKG_ENTRY(netbsd32_mq_open),
+ _PKG_ENTRY(netbsd32_mq_close),
+ _PKG_ENTRY(netbsd32_mq_unlink),
+ _PKG_ENTRY(netbsd32_mq_getattr),
+ _PKG_ENTRY(netbsd32_mq_setattr),
+ _PKG_ENTRY(netbsd32_mq_notify),
+ _PKG_ENTRY(netbsd32_mq_send),
+ _PKG_ENTRY(netbsd32_mq_receive),
+ _PKG_ENTRY(netbsd32___mq_timedsend50),
+ _PKG_ENTRY(netbsd32___mq_timedreceive50),
+#ifdef COMPAT_50
+ _PKG_ENTRY(compat_50_netbsd32_mq_timedsend),
+ _PKG_ENTRY(compat_50_netbsd32_mq_timedreceive),
+#endif
+ {0, 0, NULL}
+};
+
+MODULE(MODULE_CLASS_EXEC, compat_netbsd32_mqueue, "mqueue,compat_netbsd32");
+
+static int
+compat_netbsd32_mqueue_modcmd(modcmd_t cmd, void *arg)
+{
+ int error;
+
+ switch (cmd) {
+ case MODULE_CMD_INIT:
+ error = syscall_establish(&emul_netbsd32,
+ compat_mqueue_syscalls);
+ break;
+ case MODULE_CMD_FINI:
+ error = syscall_disestablish(&emul_netbsd32,
+ compat_mqueue_syscalls);
+ break;
+ default:
+ error = ENOTTY;
+ break;
+ }
+ return error;
+}
diff -r 0b94bf8079b9 -r 4a46adcffbd7 sys/compat/netbsd32/syscalls.master
--- a/sys/compat/netbsd32/syscalls.master Tue Dec 01 23:38:34 2015 +0000
+++ b/sys/compat/netbsd32/syscalls.master Tue Dec 01 23:56:43 2015 +0000
@@ -1,4 +1,4 @@
- $NetBSD: syscalls.master,v 1.110 2015/12/01 09:10:03 pgoyette Exp $
+ $NetBSD: syscalls.master,v 1.111 2015/12/01 23:56:43 pgoyette Exp $
; from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
@@ -534,30 +534,40 @@
255 STD { int|netbsd32||_ksem_destroy(netbsd32_intptr_t id); }
256 STD { int|netbsd32||_ksem_timedwait(intptr_t id, \
const netbsd32_timespecp_t abstime); }
-257 STD { mqd_t|netbsd32||mq_open(const netbsd32_charp name, \
+257 STD MODULAR compat_netbsd32_mqueue \
+ { mqd_t|netbsd32||mq_open(const netbsd32_charp name, \
int oflag, mode_t mode, \
netbsd32_mq_attrp_t attr); }
-258 STD { int|netbsd32||mq_close(mqd_t mqdes); }
-259 STD { int|netbsd32||mq_unlink(const netbsd32_charp name); }
-260 STD { int|netbsd32||mq_getattr(mqd_t mqdes, \
+258 STD MODULAR compat_netbsd32_mqueue \
+ { int|netbsd32||mq_close(mqd_t mqdes); }
+259 STD MODULAR compat_netbsd32_mqueue \
+ { int|netbsd32||mq_unlink(const netbsd32_charp name); }
+260 STD MODULAR compat_netbsd32_mqueue \
+ { int|netbsd32||mq_getattr(mqd_t mqdes, \
netbsd32_mq_attrp_t mqstat); }
-261 STD { int|netbsd32||mq_setattr(mqd_t mqdes, \
Home |
Main Index |
Thread Index |
Old Index