In preparation for switching linuxulator to the use the native 1:1
threads add a hook for cleaning thread resources before the thread die. Differential Revision: https://reviews.freebsd.org/D1038
This commit is contained in:
parent
8c032af773
commit
91d1786f65
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=283382
@ -82,6 +82,7 @@ struct sysentvec elf64_freebsd_sysvec = {
|
||||
.sv_shared_page_base = SHAREDPAGE,
|
||||
.sv_shared_page_len = PAGE_SIZE,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
|
||||
|
||||
|
@ -81,6 +81,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
|
||||
static Elf32_Brandinfo freebsd_brand_info = {
|
||||
|
@ -136,6 +136,7 @@ struct sysentvec ia32_freebsd_sysvec = {
|
||||
.sv_shared_page_base = FREEBSD32_SHAREDPAGE,
|
||||
.sv_shared_page_len = PAGE_SIZE,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
INIT_SYSENTVEC(elf_ia32_sysvec, &ia32_freebsd_sysvec);
|
||||
|
||||
|
@ -196,6 +196,7 @@ struct sysentvec svr4_sysvec = {
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = NULL,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
|
||||
const char svr4_emul_path[] = "/compat/svr4";
|
||||
|
@ -88,6 +88,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
||||
.sv_shared_page_base = SHAREDPAGE,
|
||||
.sv_shared_page_len = PAGE_SIZE,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
|
||||
|
||||
|
@ -89,6 +89,7 @@ struct sysentvec ibcs2_svr3_sysvec = {
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = NULL,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
|
||||
static int
|
||||
|
@ -99,6 +99,7 @@ struct sysentvec aout_sysvec = {
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
|
||||
#elif defined(__amd64__)
|
||||
|
@ -411,6 +411,7 @@ struct sysentvec null_sysvec = {
|
||||
.sv_fetch_syscall_args = null_fetch_syscall_args,
|
||||
.sv_syscallnames = NULL,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
|
||||
#include <sys/sched.h>
|
||||
#include <sys/sleepqueue.h>
|
||||
#include <sys/selinfo.h>
|
||||
#include <sys/sysent.h>
|
||||
#include <sys/turnstile.h>
|
||||
#include <sys/ktr.h>
|
||||
#include <sys/rwlock.h>
|
||||
@ -884,6 +885,14 @@ thread_suspend_check(int return_instead)
|
||||
if ((p->p_flag & P_SINGLE_EXIT) && (p->p_singlethread != td)) {
|
||||
PROC_UNLOCK(p);
|
||||
tidhash_remove(td);
|
||||
|
||||
/*
|
||||
* Allow Linux emulation layer to do some work
|
||||
* before thread suicide.
|
||||
*/
|
||||
if (__predict_false(p->p_sysent->sv_thread_detach != NULL))
|
||||
(p->p_sysent->sv_thread_detach)(td);
|
||||
|
||||
PROC_LOCK(p);
|
||||
tdsigcleanup(td);
|
||||
umtx_thread_exit(td);
|
||||
|
@ -83,6 +83,7 @@ struct sysentvec elf64_freebsd_sysvec = {
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
|
||||
static Elf64_Brandinfo freebsd_brand_info = {
|
||||
@ -139,6 +140,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
|
||||
static Elf32_Brandinfo freebsd_brand_info = {
|
||||
|
@ -106,6 +106,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = freebsd32_syscallnames,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
|
||||
|
||||
|
@ -108,6 +108,7 @@ struct sysentvec elf32_freebsd_sysvec = {
|
||||
.sv_shared_page_base = FREEBSD32_SHAREDPAGE,
|
||||
.sv_shared_page_len = PAGE_SIZE,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
INIT_SYSENTVEC(elf32_sysvec, &elf32_freebsd_sysvec);
|
||||
|
||||
|
@ -84,6 +84,7 @@ struct sysentvec elf64_freebsd_sysvec = {
|
||||
.sv_shared_page_base = SHAREDPAGE,
|
||||
.sv_shared_page_len = PAGE_SIZE,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
INIT_SYSENTVEC(elf64_sysvec, &elf64_freebsd_sysvec);
|
||||
|
||||
|
@ -87,6 +87,7 @@ static struct sysentvec elf64_freebsd_sysvec = {
|
||||
.sv_fetch_syscall_args = cpu_fetch_syscall_args,
|
||||
.sv_syscallnames = syscallnames,
|
||||
.sv_schedtail = NULL,
|
||||
.sv_thread_detach = NULL,
|
||||
};
|
||||
|
||||
static Elf64_Brandinfo freebsd_brand_info = {
|
||||
|
@ -136,6 +136,7 @@ struct sysentvec {
|
||||
uint32_t sv_timekeep_gen;
|
||||
void *sv_shared_page_obj;
|
||||
void (*sv_schedtail)(struct thread *);
|
||||
void (*sv_thread_detach)(struct thread *);
|
||||
};
|
||||
|
||||
#define SV_ILP32 0x000100
|
||||
|
Loading…
Reference in New Issue
Block a user