Page MenuHomeFreeBSD

D19257.diff
No OneTemporary

D19257.diff

Index: head/sys/compat/linuxkpi/common/include/linux/compat.h
===================================================================
--- head/sys/compat/linuxkpi/common/include/linux/compat.h
+++ head/sys/compat/linuxkpi/common/include/linux/compat.h
@@ -41,18 +41,19 @@
extern int linux_alloc_current(struct thread *, int flags);
extern void linux_free_current(struct task_struct *);
+
static inline void
linux_set_current(struct thread *td)
{
if (__predict_false(td->td_lkpi_task == NULL))
- linux_alloc_current(td, M_WAITOK);
+ lkpi_alloc_current(td, M_WAITOK);
}
static inline int
linux_set_current_flags(struct thread *td, int flags)
{
if (__predict_false(td->td_lkpi_task == NULL))
- return (linux_alloc_current(td, flags));
+ return (lkpi_alloc_current(td, flags));
return (0);
}
Index: head/sys/compat/linuxkpi/common/src/linux_current.c
===================================================================
--- head/sys/compat/linuxkpi/common/src/linux_current.c
+++ head/sys/compat/linuxkpi/common/src/linux_current.c
@@ -218,6 +218,7 @@
static void
linux_current_init(void *arg __unused)
{
+ lkpi_alloc_current = linux_alloc_current;
linuxkpi_thread_dtor_tag = EVENTHANDLER_REGISTER(thread_dtor,
linuxkpi_thread_dtor, NULL, EVENTHANDLER_PRI_ANY);
}
@@ -242,7 +243,7 @@
PROC_UNLOCK(p);
}
sx_sunlock(&allproc_lock);
-
EVENTHANDLER_DEREGISTER(thread_dtor, linuxkpi_thread_dtor_tag);
+ lkpi_alloc_current = linux_alloc_current_noop;
}
SYSUNINIT(linux_current, SI_SUB_EVENTHANDLER, SI_ORDER_SECOND, linux_current_uninit, NULL);
Index: head/sys/kern/init_main.c
===================================================================
--- head/sys/kern/init_main.c
+++ head/sys/kern/init_main.c
@@ -107,6 +107,14 @@
struct vmspace vmspace0;
struct proc *initproc;
+int
+linux_alloc_current_noop(struct thread *td __unused, int flags __unused)
+{
+ return (0);
+}
+int (*lkpi_alloc_current)(struct thread *, int) = linux_alloc_current_noop;
+
+
#ifndef BOOTHOWTO
#define BOOTHOWTO 0
#endif
@@ -454,7 +462,7 @@
GIANT_REQUIRED;
p = &proc0;
td = &thread0;
-
+
/*
* Initialize magic number and osrel.
*/
Index: head/sys/sys/systm.h
===================================================================
--- head/sys/sys/systm.h
+++ head/sys/sys/systm.h
@@ -237,6 +237,13 @@
void init_static_kenv(char *, size_t);
void tablefull(const char *);
+/*
+ * Allocate per-thread "current" state in the linuxkpi
+ */
+extern int (*lkpi_alloc_current)(struct thread *, int);
+int linux_alloc_current_noop(struct thread *, int);
+
+
#if defined(KLD_MODULE) || defined(KTR_CRITICAL) || !defined(_KERNEL) || defined(GENOFFSET)
#define critical_enter() critical_enter_KBI()
#define critical_exit() critical_exit_KBI()

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 19, 9:29 AM (8 h, 34 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
25616467
Default Alt Text
D19257.diff (2 KB)

Event Timeline