From cdcf242896502a01c42a947107b6dcf80cf09fae Mon Sep 17 00:00:00 2001 From: Mateusz Guzik Date: Sat, 1 Nov 2014 22:36:40 +0000 Subject: [PATCH] Fix up module unload for syscall_module_handler consumers. After r273707 it was registering syscalls as static. This fixes hwpmc module unload. Reported by: markj --- sys/dev/hwpmc/hwpmc_mod.c | 3 ++- sys/kern/kern_syscalls.c | 2 +- sys/sys/sysent.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index 901561a6640e..42dd66cee064 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -320,7 +320,8 @@ static struct syscall_module_data pmc_syscall_mod = { NULL, &pmc_syscall_num, &pmc_sysent, - { 0, NULL } + { 0, NULL }, + SY_THR_STATIC_KLD, }; static moduledata_t pmc_mod = { diff --git a/sys/kern/kern_syscalls.c b/sys/kern/kern_syscalls.c index 78d2a852cfb2..dada746df2da 100644 --- a/sys/kern/kern_syscalls.c +++ b/sys/kern/kern_syscalls.c @@ -160,7 +160,7 @@ syscall_module_handler(struct module *mod, int what, void *arg) switch (what) { case MOD_LOAD: error = syscall_register(data->offset, data->new_sysent, - &data->old_sysent, SY_THR_STATIC_KLD); + &data->old_sysent, data->flags); if (error) { /* Leave a mark so we know to safely unload below. */ data->offset = NULL; diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index dabc8e843300..bef27ceeb995 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -175,6 +175,7 @@ struct syscall_module_data { int *offset; /* offset into sysent */ struct sysent *new_sysent; /* new sysent */ struct sysent old_sysent; /* old sysent */ + int flags; /* flags for syscall_register */ }; #define MAKE_SYSENT(syscallname) \