svn commit: r266663 - in user/dchagin/lemul/sys: amd64/linux amd64/linux32 compat/linux modules/linux modules/linux64 modules/linux_common
Dmitry Chagin
dchagin at FreeBSD.org
Sun May 25 18:06:31 UTC 2014
Author: dchagin
Date: Sun May 25 18:06:28 2014
New Revision: 266663
URL: http://svnweb.freebsd.org/changeset/base/266663
Log:
As we can have both 64 & 32 bit Linuxulator running, any eventhandler
can be called twice for us. To prevent this move eventhandlers code
from linux_emul.c to the linux_common.ko module.
Modified:
user/dchagin/lemul/sys/amd64/linux/linux_sysvec.c
user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c
user/dchagin/lemul/sys/compat/linux/linux_common.c
user/dchagin/lemul/sys/compat/linux/linux_emul.c
user/dchagin/lemul/sys/compat/linux/linux_event.c
user/dchagin/lemul/sys/compat/linux/linux_event.h
user/dchagin/lemul/sys/compat/linux/linux_fork.c
user/dchagin/lemul/sys/compat/linux/linux_misc.c
user/dchagin/lemul/sys/modules/linux/Makefile
user/dchagin/lemul/sys/modules/linux64/Makefile
user/dchagin/lemul/sys/modules/linux_common/Makefile
Modified: user/dchagin/lemul/sys/amd64/linux/linux_sysvec.c
==============================================================================
--- user/dchagin/lemul/sys/amd64/linux/linux_sysvec.c Sun May 25 18:05:26 2014 (r266662)
+++ user/dchagin/lemul/sys/amd64/linux/linux_sysvec.c Sun May 25 18:06:28 2014 (r266663)
@@ -131,10 +131,6 @@ static void linux_exec_setregs(struct th
u_long stack);
static int linux_vsyscall(struct thread *td, struct trapframe *tf);
-static eventhandler_tag linux_exec_tag;
-static eventhandler_tag linux_thread_dtor_tag;
-static eventhandler_tag linux_exit_tag;
-
/*
* Linux syscalls return negative errno's, we do positive and map them
* Reference:
@@ -965,12 +961,6 @@ linux64_elf_modevent(module_t mod, int t
linux_device_register_handler(*ldhp);
LIST_INIT(&futex_list);
mtx_init(&futex_mtx, "ftllk64", NULL, MTX_DEF);
- linux_exit_tag = EVENTHANDLER_REGISTER(process_exit,
- linux_proc_exit, (void *) (long) elf_linux_sysvec.sv_flags, 1000);
- linux_exec_tag = EVENTHANDLER_REGISTER(process_exec,
- linux_proc_exec, (void *) (long)elf_linux_sysvec.sv_flags, 1000);
- linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor,
- linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY);
stclohz = (stathz ? stathz : hz);
if (bootverbose)
printf("Linux x86-64 ELF exec handler installed\n");
@@ -994,9 +984,6 @@ linux64_elf_modevent(module_t mod, int t
SET_FOREACH(ldhp, linux_device_handler_set)
linux_device_unregister_handler(*ldhp);
mtx_destroy(&futex_mtx);
- EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
- EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
- EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag);
if (bootverbose)
printf("Linux ELF exec handler removed\n");
} else
Modified: user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c Sun May 25 18:05:26 2014 (r266662)
+++ user/dchagin/lemul/sys/amd64/linux32/linux32_sysvec.c Sun May 25 18:06:28 2014 (r266663)
@@ -131,10 +131,6 @@ static boolean_t linux32_trans_osrel(con
static void linux_vdso_install(void *param);
static void linux_vdso_deinstall(void *param);
-static eventhandler_tag linux_exec_tag;
-static eventhandler_tag linux_thread_dtor_tag;
-static eventhandler_tag linux_exit_tag;
-
/*
* Linux syscalls return negative errno's, we do positive and map them
* Reference:
@@ -1175,12 +1171,6 @@ linux_elf_modevent(module_t mod, int typ
linux_device_register_handler(*ldhp);
LIST_INIT(&futex_list);
mtx_init(&futex_mtx, "ftllk", NULL, MTX_DEF);
- linux_exit_tag = EVENTHANDLER_REGISTER(process_exit,
- linux_proc_exit, (void *) (long) elf_linux_sysvec.sv_flags, 1000);
- linux_exec_tag = EVENTHANDLER_REGISTER(process_exec,
- linux_proc_exec, (void *) (long)elf_linux_sysvec.sv_flags, 1000);
- linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor,
- linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY);
stclohz = (stathz ? stathz : hz);
if (bootverbose)
printf("Linux ELF exec handler installed\n");
@@ -1204,9 +1194,6 @@ linux_elf_modevent(module_t mod, int typ
SET_FOREACH(ldhp, linux_device_handler_set)
linux_device_unregister_handler(*ldhp);
mtx_destroy(&futex_mtx);
- EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
- EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
- EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag);
if (bootverbose)
printf("Linux ELF exec handler removed\n");
} else
Modified: user/dchagin/lemul/sys/compat/linux/linux_common.c
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_common.c Sun May 25 18:05:26 2014 (r266662)
+++ user/dchagin/lemul/sys/compat/linux/linux_common.c Sun May 25 18:06:28 2014 (r266663)
@@ -28,18 +28,25 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
-#include <sys/module.h>
-#include <sys/malloc.h>
-#include <sys/module.h>
-#include <sys/types.h>
+#include <sys/systm.h>
+#include <sys/exec.h>
+#include <sys/imgact.h>
+#include <sys/imgact_elf.h>
#include <sys/kernel.h>
-#include <sys/proc.h>
+#include <sys/malloc.h>
+#include <sys/eventhandler.h>
+#include <compat/linux/linux_emul.h>
#include <compat/linux/linux_mib.h>
MODULE_VERSION(linux_common, 1);
+static eventhandler_tag linux_exec_tag;
+static eventhandler_tag linux_thread_dtor_tag;
+static eventhandler_tag linux_exit_tag;
+
+
static int
linux_common_modevent(module_t mod, int type, void *data)
{
@@ -47,9 +54,18 @@ linux_common_modevent(module_t mod, int
switch(type) {
case MOD_LOAD:
linux_osd_jail_register();
+ linux_exit_tag = EVENTHANDLER_REGISTER(process_exit,
+ linux_proc_exit, NULL, 1000);
+ linux_exec_tag = EVENTHANDLER_REGISTER(process_exec,
+ linux_proc_exec, NULL, 1000);
+ linux_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor,
+ linux_thread_dtor, NULL, EVENTHANDLER_PRI_ANY);
break;
case MOD_UNLOAD:
linux_osd_jail_deregister();
+ EVENTHANDLER_DEREGISTER(process_exit, linux_exit_tag);
+ EVENTHANDLER_DEREGISTER(process_exec, linux_exec_tag);
+ EVENTHANDLER_DEREGISTER(thread_dtor, linux_thread_dtor_tag);
break;
default:
return (EOPNOTSUPP);
Modified: user/dchagin/lemul/sys/compat/linux/linux_emul.c
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_emul.c Sun May 25 18:05:26 2014 (r266662)
+++ user/dchagin/lemul/sys/compat/linux/linux_emul.c Sun May 25 18:06:28 2014 (r266663)
@@ -30,8 +30,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_compat.h"
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/imgact.h>
@@ -40,66 +38,15 @@ __FBSDID("$FreeBSD$");
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
-#include <sys/sdt.h>
#include <sys/sx.h>
#include <sys/proc.h>
#include <sys/syscallsubr.h>
#include <sys/sysent.h>
-#include <sys/sysproto.h>
-#include <sys/unistd.h>
-
-#ifdef COMPAT_LINUX32
-#include <machine/../linux32/linux.h>
-#include <machine/../linux32/linux32_proto.h>
-#else
-#include <machine/../linux/linux.h>
-#include <machine/../linux/linux_proto.h>
-#endif
-#include <compat/linux/linux_dtrace.h>
#include <compat/linux/linux_emul.h>
-#include <compat/linux/linux_event.h>
-#include <compat/linux/linux_futex.h>
#include <compat/linux/linux_misc.h>
#include <compat/linux/linux_util.h>
-/**
- * Special DTrace provider for the linuxulator.
- *
- * In this file we define the provider for the entire linuxulator. All
- * modules (= files of the linuxulator) use it.
- *
- * We define a different name depending on the emulated bitsize, see
- * ../../<ARCH>/linux{,32}/linux.h, e.g.:
- * native bitsize = linuxulator
- * amd64, 32bit emulation = linuxulator32
- */
-LIN_SDT_PROVIDER_DEFINE(LINUX_DTRACE);
-
-/**
- * DTrace probes in this module.
- */
-LIN_SDT_PROBE_DEFINE1(emul, em_find, entry, "struct thread *");
-LIN_SDT_PROBE_DEFINE0(emul, em_find, return);
-LIN_SDT_PROBE_DEFINE3(emul, proc_init, entry, "struct thread *",
- "struct thread *", "int");
-LIN_SDT_PROBE_DEFINE0(emul, proc_init, create_thread);
-LIN_SDT_PROBE_DEFINE0(emul, proc_init, fork);
-LIN_SDT_PROBE_DEFINE0(emul, proc_init, exec);
-LIN_SDT_PROBE_DEFINE0(emul, proc_init, return);
-LIN_SDT_PROBE_DEFINE1(emul, linux_thread_detach, entry, "struct thread *");
-LIN_SDT_PROBE_DEFINE0(emul, linux_thread_detach, futex_failed);
-LIN_SDT_PROBE_DEFINE1(emul, linux_thread_detach, child_clear_tid_error, "int");
-LIN_SDT_PROBE_DEFINE0(emul, linux_thread_detach, return);
-LIN_SDT_PROBE_DEFINE2(emul, proc_exec, entry, "struct proc *",
- "struct image_params *");
-LIN_SDT_PROBE_DEFINE0(emul, proc_exec, return);
-LIN_SDT_PROBE_DEFINE0(emul, linux_schedtail, entry);
-LIN_SDT_PROBE_DEFINE1(emul, linux_schedtail, copyout_error, "int");
-LIN_SDT_PROBE_DEFINE0(emul, linux_schedtail, return);
-LIN_SDT_PROBE_DEFINE1(emul, linux_set_tid_address, entry, "int *");
-LIN_SDT_PROBE_DEFINE0(emul, linux_set_tid_address, return);
-
/*
* This returns reference to the thread emuldata entry (if found)
*
@@ -110,12 +57,8 @@ em_find(struct thread *td)
{
struct linux_emuldata *em;
- LIN_SDT_PROBE1(emul, em_find, entry, td);
-
em = td->td_emuldata;
- LIN_SDT_PROBE1(emul, em_find, return, em);
-
return (em);
}
@@ -140,8 +83,7 @@ linux_proc_init(struct thread *td, struc
{
struct linux_emuldata *em;
struct linux_pemuldata *pem;
-
- LIN_SDT_PROBE3(emul, proc_init, entry, td, newtd, flags);
+ struct epoll_emuldata *emd;
if (newtd != NULL) {
/* non-exec call */
@@ -149,13 +91,11 @@ linux_proc_init(struct thread *td, struc
em->pdeath_signal = 0;
em->robust_futexes = NULL;
if (flags & LINUX_CLONE_THREAD) {
- LIN_SDT_PROBE0(emul, proc_init, create_thread);
LINUX_CTR1(proc_init, "thread newtd(%d)",
newtd->td_tid);
em->em_tid = newtd->td_tid;
} else {
- LIN_SDT_PROBE0(emul, proc_init, fork);
LINUX_CTR1(proc_init, "fork newtd(%d)",
newtd->td_proc->p_pid);
@@ -168,7 +108,6 @@ linux_proc_init(struct thread *td, struc
newtd->td_emuldata = em;
} else {
/* exec */
- LIN_SDT_PROBE0(emul, proc_init, exec);
LINUX_CTR1(proc_init, "exec newtd(%d)",
td->td_proc->p_pid);
@@ -181,19 +120,23 @@ linux_proc_init(struct thread *td, struc
/* epoll should be destroyed in a case of exec. */
pem = pem_find(td->td_proc);
KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n"));
- epoll_destroy_emuldata(pem);
+
+ if (pem->epoll != NULL) {
+ emd = pem->epoll;
+ pem->epoll = NULL;
+ free(emd, M_EPOLL);
+ }
}
em->child_clear_tid = NULL;
em->child_set_tid = NULL;
-
- LIN_SDT_PROBE0(emul, proc_init, return);
}
int
linux_common_execve(struct thread *td, struct image_args *eargs)
{
struct linux_pemuldata *pem;
+ struct epoll_emuldata *emd;
struct linux_emuldata *em;
struct proc *p;
int error;
@@ -218,7 +161,11 @@ linux_common_execve(struct thread *td, s
KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n"));
p->p_emuldata = NULL;
- epoll_destroy_emuldata(pem);
+ if (pem->epoll != NULL) {
+ emd = pem->epoll;
+ pem->epoll = NULL;
+ free(emd, M_EPOLL);
+ }
sx_destroy(&pem->pem_sx);
free(pem, M_LINUX);
@@ -231,7 +178,6 @@ void
linux_proc_exec(void *arg, struct proc *p, struct image_params *imgp)
{
struct thread *td = curthread;
- int sv_flags;
/*
* In a case of execing to linux binary we create linux
@@ -240,80 +186,14 @@ linux_proc_exec(void *arg, struct proc *
if (__predict_false((imgp->sysent->sv_flags & SV_ABI_MASK) ==
SV_ABI_LINUX)) {
- /*
- * We can have both 64 & 32 bit Linuxulator running,
- * so eventhandler is called twice for us. To prevent this
- * we will check that proc is handled by corresponding module.
- */
- sv_flags = (int) arg;
- if ((sv_flags & SV_IS_MASK) != SV_PROC_IS(p))
- return;
-
- LIN_SDT_PROBE2(emul, proc_exec, entry, p, imgp);
if (SV_PROC_ABI(p) == SV_ABI_LINUX)
linux_proc_init(td, NULL, 0);
else
linux_proc_init(td, td, 0);
-
- LIN_SDT_PROBE0(emul, proc_exec, return);
}
}
void
-linux_thread_detach(struct thread *td)
-{
- struct linux_sys_futex_args cup;
- struct linux_emuldata *em;
- int *child_clear_tid;
- int null = 0;
- int error;
-
- LIN_SDT_PROBE1(emul, linux_thread_detach, entry, td);
-
- em = em_find(td);
- KASSERT(em != NULL, ("thread_detach: thread emuldata not found.\n"));
-
- LINUX_CTR1(exit, "thread detach(%d)", em->em_tid);
-
- release_futexes(td, em);
-
- child_clear_tid = em->child_clear_tid;
-
- if (child_clear_tid != NULL) {
-
- LINUX_CTR2(exit, "thread detach(%d) %p",
- em->em_tid, child_clear_tid);
-
- error = copyout(&null, child_clear_tid, sizeof(null));
- if (error) {
- LIN_SDT_PROBE1(emul, linux_thread_detach,
- child_clear_tid_error, error);
-
- LIN_SDT_PROBE0(emul, linux_thread_detach, return);
- return;
- }
-
- cup.uaddr = child_clear_tid;
- cup.op = LINUX_FUTEX_WAKE;
- cup.val = 1; /* wake one */
- cup.timeout = NULL;
- cup.uaddr2 = NULL;
- cup.val3 = 0;
- error = linux_sys_futex(td, &cup);
- /*
- * this cannot happen at the moment and if this happens it
- * probably means there is a user space bug
- */
- if (error) {
- LIN_SDT_PROBE0(emul, linux_thread_detach, futex_failed);
- printf(LMSG("futex stuff in thread_detach failed.\n"));
- }
- }
-
- LIN_SDT_PROBE0(emul, linux_thread_detach, return);
-}
-
-void
linux_thread_dtor(void *arg __unused, struct thread *td)
{
struct linux_emuldata *em;
@@ -336,8 +216,6 @@ linux_schedtail(struct thread *td)
int error = 0;
int *child_set_tid;
- LIN_SDT_PROBE1(emul, linux_schedtail, entry, td);
-
p = td->td_proc;
em = em_find(td);
@@ -349,63 +227,29 @@ linux_schedtail(struct thread *td)
sizeof(em->em_tid));
LINUX_CTR4(clone, "schedtail(%d) %p stored %d error %d",
td->td_tid, child_set_tid, em->em_tid, error);
-
- if (error != 0) {
- LIN_SDT_PROBE1(emul, linux_schedtail, copyout_error,
- error);
- }
} else
LINUX_CTR1(clone, "schedtail(%d)", em->em_tid);
-
- LIN_SDT_PROBE0(emul, linux_schedtail, return);
-}
-
-int
-linux_set_tid_address(struct thread *td, struct linux_set_tid_address_args *args)
-{
- struct linux_emuldata *em;
-
- LIN_SDT_PROBE1(emul, linux_set_tid_address, entry, args->tidptr);
-
- em = em_find(td);
- KASSERT(em != NULL, ("set_tid_address: emuldata not found.\n"));
-
- em->child_clear_tid = args->tidptr;
-
- td->td_retval[0] = em->em_tid;
-
- LINUX_CTR3(set_tid_address, "tidptr(%d) %p, returns %d",
- em->em_tid, args->tidptr, td->td_retval[0]);
-
- LIN_SDT_PROBE0(emul, linux_set_tid_address, return);
- return (0);
}
void
linux_proc_exit(void *arg, struct proc *p)
{
struct linux_pemuldata *pem;
- int sv_flags;
+ struct epoll_emuldata *emd;
if (__predict_true(SV_PROC_ABI(p) != SV_ABI_LINUX))
return;
- /*
- * We can have both 64 & 32 bit Linuxulator running,
- * so eventhandler is called twice for us. To prevent this
- * we will check that proc is handled by corresponding module.
- */
- sv_flags = (int) arg;
- if ((sv_flags & SV_IS_MASK) != SV_PROC_IS(p))
- return;
-
pem = pem_find(p);
KASSERT(pem != NULL, ("proc_exit: proc emuldata not found.\n"));
p->p_emuldata = NULL;
- epoll_destroy_emuldata(pem);
+ if (pem->epoll != NULL) {
+ emd = pem->epoll;
+ pem->epoll = NULL;
+ free(emd, M_EPOLL);
+ }
sx_destroy(&pem->pem_sx);
free(pem, M_LINUX);
}
-
Modified: user/dchagin/lemul/sys/compat/linux/linux_event.c
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_event.c Sun May 25 18:05:26 2014 (r266662)
+++ user/dchagin/lemul/sys/compat/linux/linux_event.c Sun May 25 18:06:28 2014 (r266663)
@@ -550,17 +550,6 @@ epoll_delete_all_events(struct thread *t
return (error1 == 0 ? error2 : error1);
}
-void
-epoll_destroy_emuldata(struct linux_pemuldata *pem)
-{
- struct epoll_emuldata *emd;
-
- if (pem->epoll == NULL)
- return;
- emd = pem->epoll;
- free(emd, M_EPOLL);
-}
-
static int
eventfd_create(struct thread *td, uint32_t initval, int flags)
{
Modified: user/dchagin/lemul/sys/compat/linux/linux_event.h
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_event.h Sun May 25 18:05:26 2014 (r266662)
+++ user/dchagin/lemul/sys/compat/linux/linux_event.h Sun May 25 18:06:28 2014 (r266663)
@@ -57,6 +57,4 @@
#define LINUX_EFD_SEMAPHORE (1 << 0)
-void epoll_destroy_emuldata(struct linux_pemuldata *pem);
-
#endif /* !_LINUX_EVENT_H_ */
Modified: user/dchagin/lemul/sys/compat/linux/linux_fork.c
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_fork.c Sun May 25 18:05:26 2014 (r266662)
+++ user/dchagin/lemul/sys/compat/linux/linux_fork.c Sun May 25 18:06:28 2014 (r266663)
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
#endif
#include <compat/linux/linux_signal.h>
#include <compat/linux/linux_emul.h>
+#include <compat/linux/linux_futex.h>
#include <compat/linux/linux_misc.h>
#include <compat/linux/linux_util.h>
@@ -414,3 +415,64 @@ linux_exit(struct thread *td, struct lin
exit1(td, W_EXITCODE(args->rval, 0));
/* NOTREACHED */
}
+
+int
+linux_set_tid_address(struct thread *td, struct linux_set_tid_address_args *args)
+{
+ struct linux_emuldata *em;
+
+ em = em_find(td);
+ KASSERT(em != NULL, ("set_tid_address: emuldata not found.\n"));
+
+ em->child_clear_tid = args->tidptr;
+
+ td->td_retval[0] = em->em_tid;
+
+ LINUX_CTR3(set_tid_address, "tidptr(%d) %p, returns %d",
+ em->em_tid, args->tidptr, td->td_retval[0]);
+
+ return (0);
+}
+
+void
+linux_thread_detach(struct thread *td)
+{
+ struct linux_sys_futex_args cup;
+ struct linux_emuldata *em;
+ int *child_clear_tid;
+ int null = 0;
+ int error;
+
+ em = em_find(td);
+ KASSERT(em != NULL, ("thread_detach: thread emuldata not found.\n"));
+
+ LINUX_CTR1(exit, "thread detach(%d)", em->em_tid);
+
+ release_futexes(td, em);
+
+ child_clear_tid = em->child_clear_tid;
+
+ if (child_clear_tid != NULL) {
+
+ LINUX_CTR2(exit, "thread detach(%d) %p",
+ em->em_tid, child_clear_tid);
+
+ error = copyout(&null, child_clear_tid, sizeof(null));
+ if (error)
+ return;
+
+ cup.uaddr = child_clear_tid;
+ cup.op = LINUX_FUTEX_WAKE;
+ cup.val = 1; /* wake one */
+ cup.timeout = NULL;
+ cup.uaddr2 = NULL;
+ cup.val3 = 0;
+ error = linux_sys_futex(td, &cup);
+ /*
+ * this cannot happen at the moment and if this happens it
+ * probably means there is a user space bug
+ */
+ if (error)
+ printf(LMSG("futex stuff in thread_detach failed.\n"));
+ }
+}
Modified: user/dchagin/lemul/sys/compat/linux/linux_misc.c
==============================================================================
--- user/dchagin/lemul/sys/compat/linux/linux_misc.c Sun May 25 18:05:26 2014 (r266662)
+++ user/dchagin/lemul/sys/compat/linux/linux_misc.c Sun May 25 18:06:28 2014 (r266663)
@@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$");
#include <sys/racct.h>
#include <sys/resourcevar.h>
#include <sys/sched.h>
+#include <sys/sdt.h>
#include <sys/signalvar.h>
#include <sys/stat.h>
#include <sys/syscallsubr.h>
@@ -83,6 +84,7 @@ __FBSDID("$FreeBSD$");
#include <machine/../linux/linux_proto.h>
#endif
+#include <compat/linux/linux_dtrace.h>
#include <compat/linux/linux_file.h>
#include <compat/linux/linux_mib.h>
#include <compat/linux/linux_signal.h>
@@ -91,6 +93,19 @@ __FBSDID("$FreeBSD$");
#include <compat/linux/linux_emul.h>
#include <compat/linux/linux_misc.h>
+/**
+ * Special DTrace provider for the linuxulator.
+ *
+ * In this file we define the provider for the entire linuxulator. All
+ * modules (= files of the linuxulator) use it.
+ *
+ * We define a different name depending on the emulated bitsize, see
+ * ../../<ARCH>/linux{,32}/linux.h, e.g.:
+ * native bitsize = linuxulator
+ * amd64, 32bit emulation = linuxulator32
+ */
+LIN_SDT_PROVIDER_DEFINE(LINUX_DTRACE);
+
int stclohz; /* Statistics clock frequency */
static unsigned int linux_to_bsd_resource[LINUX_RLIM_NLIMITS] = {
Modified: user/dchagin/lemul/sys/modules/linux/Makefile
==============================================================================
--- user/dchagin/lemul/sys/modules/linux/Makefile Sun May 25 18:05:26 2014 (r266662)
+++ user/dchagin/lemul/sys/modules/linux/Makefile Sun May 25 18:06:28 2014 (r266663)
@@ -8,7 +8,7 @@ CFLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINU
.PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_CPUARCH}/linux${SFX}
KMOD= linux
-SRCS= linux_fork.c linux${SFX}_dummy.c linux_emul.c linux_file.c \
+SRCS= linux_fork.c linux${SFX}_dummy.c linux_file.c \
linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c linux_vdso.c \
linux${SFX}_machdep.c linux_misc.c linux_signal.c \
linux_socket.c linux_stats.c linux_sysctl.c linux${SFX}_sysent.c \
@@ -27,7 +27,8 @@ VDSO= linux${SFX}_vdso
OBJS= linux${SFX}_support.o ${VDSO}.so
.if ${MACHINE_CPUARCH} == "i386"
-SRCS+= linux_ptrace.c imgact_linux.c linux_util.c linux_mib.c opt_cpu.h
+SRCS+= linux_ptrace.c imgact_linux.c linux_util.c linux_mib.c \
+ linux_emul.c opt_cpu.h
.endif
.if ${MACHINE_CPUARCH} == "i386"
Modified: user/dchagin/lemul/sys/modules/linux64/Makefile
==============================================================================
--- user/dchagin/lemul/sys/modules/linux64/Makefile Sun May 25 18:05:26 2014 (r266662)
+++ user/dchagin/lemul/sys/modules/linux64/Makefile Sun May 25 18:06:28 2014 (r266663)
@@ -3,7 +3,7 @@
.PATH: ${.CURDIR}/../../compat/linux ${.CURDIR}/../../${MACHINE_ARCH}/linux
KMOD= linux64
-SRCS= linux_fork.c linux_dummy.c linux_emul.c linux_file.c \
+SRCS= linux_fork.c linux_dummy.c linux_file.c \
linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \
linux_machdep.c linux_misc.c linux_signal.c \
linux_socket.c linux_stats.c linux_sysctl.c linux_sysent.c \
Modified: user/dchagin/lemul/sys/modules/linux_common/Makefile
==============================================================================
--- user/dchagin/lemul/sys/modules/linux_common/Makefile Sun May 25 18:05:26 2014 (r266662)
+++ user/dchagin/lemul/sys/modules/linux_common/Makefile Sun May 25 18:06:28 2014 (r266663)
@@ -3,7 +3,7 @@
.PATH: ${.CURDIR}/../../compat/linux
KMOD= linux_common
-SRCS= linux_common.c linux_mib.c linux_util.c \
+SRCS= linux_common.c linux_mib.c linux_util.c linux_emul.c \
opt_compat.h device_if.h vnode_if.h bus_if.h
EXPORT_SYMS=
More information about the svn-src-user
mailing list