summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/compat/freebsd32/freebsd32_proto.h7
-rw-r--r--sys/compat/freebsd32/freebsd32_syscall.h4
-rw-r--r--sys/compat/freebsd32/freebsd32_syscalls.c4
-rw-r--r--sys/compat/freebsd32/freebsd32_sysent.c4
-rw-r--r--sys/compat/freebsd32/syscalls.master2
-rw-r--r--sys/kern/kern_module.c81
6 files changed, 94 insertions, 8 deletions
diff --git a/sys/compat/freebsd32/freebsd32_proto.h b/sys/compat/freebsd32/freebsd32_proto.h
index e74348123343..d215badf5b12 100644
--- a/sys/compat/freebsd32/freebsd32_proto.h
+++ b/sys/compat/freebsd32/freebsd32_proto.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.44 2005/01/04 18:53:32 jhb Exp
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.45 2005/01/19 17:44:59 ps Exp
*/
#ifndef _FREEBSD32_SYSPROTO_H_
@@ -183,6 +183,10 @@ struct freebsd32_nanosleep_args {
char rqtp_l_[PADL_(const struct timespec *)]; const struct timespec * rqtp; char rqtp_r_[PADR_(const struct timespec *)];
char rmtp_l_[PADL_(struct timespec *)]; struct timespec * rmtp; char rmtp_r_[PADR_(struct timespec *)];
};
+struct freebsd32_modstat_args {
+ char modid_l_[PADL_(int)]; int modid; char modid_r_[PADR_(int)];
+ char stat_l_[PADL_(struct module_stat32 *)]; struct module_stat32 * stat; char stat_r_[PADR_(struct module_stat32 *)];
+};
struct freebsd32_kevent_args {
char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)];
char changelist_l_[PADL_(const struct kevent *)]; const struct kevent * changelist; char changelist_r_[PADR_(const struct kevent *)];
@@ -236,6 +240,7 @@ int freebsd32_truncate(struct thread *, struct freebsd32_truncate_args *);
int freebsd32_ftruncate(struct thread *, struct freebsd32_ftruncate_args *);
int freebsd32_sysctl(struct thread *, struct freebsd32_sysctl_args *);
int freebsd32_nanosleep(struct thread *, struct freebsd32_nanosleep_args *);
+int freebsd32_modstat(struct thread *, struct freebsd32_modstat_args *);
int freebsd32_kevent(struct thread *, struct freebsd32_kevent_args *);
int freebsd32_sendfile(struct thread *, struct freebsd32_sendfile_args *);
int freebsd32_sigaction(struct thread *, struct freebsd32_sigaction_args *);
diff --git a/sys/compat/freebsd32/freebsd32_syscall.h b/sys/compat/freebsd32/freebsd32_syscall.h
index 21e1e3ed9fd4..42ef192d7183 100644
--- a/sys/compat/freebsd32/freebsd32_syscall.h
+++ b/sys/compat/freebsd32/freebsd32_syscall.h
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.44 2005/01/04 18:53:32 jhb Exp
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.45 2005/01/19 17:44:59 ps Exp
*/
#define FREEBSD32_SYS_syscall 0
@@ -219,7 +219,7 @@
#define FREEBSD32_SYS_fhopen 298
#define FREEBSD32_SYS_fhstat 299
#define FREEBSD32_SYS_modnext 300
-#define FREEBSD32_SYS_modstat 301
+#define FREEBSD32_SYS_freebsd32_modstat 301
#define FREEBSD32_SYS_modfnext 302
#define FREEBSD32_SYS_modfind 303
#define FREEBSD32_SYS_kldload 304
diff --git a/sys/compat/freebsd32/freebsd32_syscalls.c b/sys/compat/freebsd32/freebsd32_syscalls.c
index 854d512b7e74..bc5b27de6c68 100644
--- a/sys/compat/freebsd32/freebsd32_syscalls.c
+++ b/sys/compat/freebsd32/freebsd32_syscalls.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.44 2005/01/04 18:53:32 jhb Exp
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.45 2005/01/19 17:44:59 ps Exp
*/
const char *freebsd32_syscallnames[] = {
@@ -308,7 +308,7 @@ const char *freebsd32_syscallnames[] = {
"fhopen", /* 298 = fhopen */
"fhstat", /* 299 = fhstat */
"modnext", /* 300 = modnext */
- "modstat", /* 301 = modstat */
+ "freebsd32_modstat", /* 301 = freebsd32_modstat */
"modfnext", /* 302 = modfnext */
"modfind", /* 303 = modfind */
"kldload", /* 304 = kldload */
diff --git a/sys/compat/freebsd32/freebsd32_sysent.c b/sys/compat/freebsd32/freebsd32_sysent.c
index 87ab73a7f4ba..3bc59aa90a1a 100644
--- a/sys/compat/freebsd32/freebsd32_sysent.c
+++ b/sys/compat/freebsd32/freebsd32_sysent.c
@@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
- * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.44 2005/01/04 18:53:32 jhb Exp
+ * created from FreeBSD: src/sys/compat/freebsd32/syscalls.master,v 1.45 2005/01/19 17:44:59 ps Exp
*/
#include "opt_compat.h"
@@ -326,7 +326,7 @@ struct sysent freebsd32_sysent[] = {
{ AS(fhopen_args), (sy_call_t *)fhopen }, /* 298 = fhopen */
{ AS(fhstat_args), (sy_call_t *)fhstat }, /* 299 = fhstat */
{ SYF_MPSAFE | AS(modnext_args), (sy_call_t *)modnext }, /* 300 = modnext */
- { SYF_MPSAFE | AS(modstat_args), (sy_call_t *)modstat }, /* 301 = modstat */
+ { SYF_MPSAFE | AS(freebsd32_modstat_args), (sy_call_t *)freebsd32_modstat }, /* 301 = freebsd32_modstat */
{ SYF_MPSAFE | AS(modfnext_args), (sy_call_t *)modfnext }, /* 302 = modfnext */
{ SYF_MPSAFE | AS(modfind_args), (sy_call_t *)modfind }, /* 303 = modfind */
{ SYF_MPSAFE | AS(kldload_args), (sy_call_t *)kldload }, /* 304 = kldload */
diff --git a/sys/compat/freebsd32/syscalls.master b/sys/compat/freebsd32/syscalls.master
index 6ee58758c412..c72a1e7e2b60 100644
--- a/sys/compat/freebsd32/syscalls.master
+++ b/sys/compat/freebsd32/syscalls.master
@@ -421,7 +421,7 @@
299 NOPROTO { int fhstat(const struct fhandle *u_fhp, struct stat *sb); }
; syscall numbers for FreeBSD
300 MNOPROTO { int modnext(int modid); }
-301 MNOPROTO { int modstat(int modid, struct module_stat* stat); }
+301 MSTD { int freebsd32_modstat(int modid, struct module_stat32* stat); }
302 MNOPROTO { int modfnext(int modid); }
303 MNOPROTO { int modfind(const char *name); }
304 MNOPROTO { int kldload(const char *file); }
diff --git a/sys/kern/kern_module.c b/sys/kern/kern_module.c
index cecb2e1beeac..e101e6b6b2cc 100644
--- a/sys/kern/kern_module.c
+++ b/sys/kern/kern_module.c
@@ -24,6 +24,8 @@
* SUCH DAMAGE.
*/
+#include "opt_compat.h"
+
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -410,3 +412,82 @@ modfind(struct thread *td, struct modfind_args *uap)
MOD_SUNLOCK;
return (error);
}
+
+#ifdef COMPAT_IA32
+#include <sys/mount.h>
+#include <compat/freebsd32/freebsd32_util.h>
+#include <compat/freebsd32/freebsd32.h>
+#include <compat/freebsd32/freebsd32_proto.h>
+
+typedef union modspecific32 {
+ int intval;
+ u_int32_t uintval;
+ int longval;
+ u_int32_t ulongval;
+} modspecific32_t;
+
+struct module_stat32 {
+ int version;
+ char name[MAXMODNAME];
+ int refs;
+ int id;
+ modspecific32_t data;
+};
+
+/*
+ * MPSAFE
+ */
+int
+freebsd32_modstat(struct thread *td, struct freebsd32_modstat_args *uap)
+{
+ module_t mod;
+ modspecific32_t data32;
+ int error = 0;
+ int id, namelen, refs, version;
+ struct module_stat32 *stat32;
+ char *name;
+
+ MOD_SLOCK;
+ mod = module_lookupbyid(uap->modid);
+ if (mod == NULL) {
+ MOD_SUNLOCK;
+ return (ENOENT);
+ }
+
+ id = mod->id;
+ refs = mod->refs;
+ name = mod->name;
+ CP(data32, mod->data, intval);
+ CP(data32, mod->data, uintval);
+ CP(data32, mod->data, longval);
+ CP(data32, mod->data, ulongval);
+ MOD_SUNLOCK;
+ stat32 = uap->stat;
+
+ if ((error = copyin(&stat32->version, &version, sizeof(version))) != 0)
+ return (error);
+ if (version != sizeof(struct module_stat_v1)
+ && version != sizeof(struct module_stat32))
+ return (EINVAL);
+ namelen = strlen(mod->name) + 1;
+ if (namelen > MAXMODNAME)
+ namelen = MAXMODNAME;
+ if ((error = copyout(name, &stat32->name[0], namelen)) != 0)
+ return (error);
+
+ if ((error = copyout(&refs, &stat32->refs, sizeof(int))) != 0)
+ return (error);
+ if ((error = copyout(&id, &stat32->id, sizeof(int))) != 0)
+ return (error);
+
+ /*
+ * >v1 stat includes module data.
+ */
+ if (version == sizeof(struct module_stat32))
+ if ((error = copyout(&data32, &stat32->data,
+ sizeof(data32))) != 0)
+ return (error);
+ td->td_retval[0] = 0;
+ return (error);
+}
+#endif