[RFC PATCH 06/18] ipc: declare copyinmsg / copyoutmsg in <ipc/copy_user.h>

Paulo Duarte <[email protected]>
Newsgroups gmane.os.hurd.bugs
Message-ID <[email protected]>
The copyinmsg() and copyoutmsg() routines are defined per-arch (in
i386/i386/locore.S and friends) but have never had cross-arch
declarations.  Each kern/ caller has historically picked them up
through an arch-specific header, or via implicit declaration.

Declare them in <ipc/copy_user.h> alongside the other copy_user
helpers, with copyoutmsg becoming an alias for copyout when not
building a 64-bit kernel with a 32-bit userland (the only case
where the two diverge today).  Add the missing include to
kern/exception.c which uses both.
---
 ipc/copy_user.h  | 15 +++++++++++++++
 kern/exception.c |  1 +
 2 files changed, 16 insertions(+)

diff --git a/ipc/copy_user.h b/ipc/copy_user.h
index a57b3ee5..33beacd0 100644
--- a/ipc/copy_user.h
+++ b/ipc/copy_user.h
@@ -25,6 +25,21 @@
 #include <machine/locore.h>
 #include <mach/message.h>
 
+int copyinmsg(
+	const void	*userbuf,
+	void		*kernelbuf,
+	size_t		usize,
+	size_t		ksize);
+
+#ifdef USER32
+int copyoutmsg(
+	const void	*kernelbuf,
+	void		*userbuf,
+	size_t		ksize);
+#else
+#define copyoutmsg	copyout
+#endif
+
 /*
  * The copyin_32to64() and copyout_64to32() routines are meant for data types
  * that have different size in kernel and user space. They should be independent
diff --git a/kern/exception.c b/kern/exception.c
index 7139b466..cc023d45 100644
--- a/kern/exception.c
+++ b/kern/exception.c
@@ -30,6 +30,7 @@
 #include <mach/port.h>
 #include <mach/mig_errors.h>
 #include <machine/locore.h>
+#include <ipc/copy_user.h>
 #include <ipc/port.h>
 #include <ipc/ipc_entry.h>
 #include <ipc/ipc_notify.h>
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.