Use syscall_helper_register(9) rather than syscall_register().
The usage is simpler, documented, and more common. Reviewed by: cem Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14227
This commit is contained in:
parent
908bb2c3cc
commit
73867e4fb2
@ -56,39 +56,33 @@ MALLOC_DEFINE(M_GSSAPI, "GSS-API", "GSS-API");
|
|||||||
/*
|
/*
|
||||||
* Syscall hooks
|
* Syscall hooks
|
||||||
*/
|
*/
|
||||||
static int gssd_syscall_offset = SYS_gssd_syscall;
|
static struct syscall_helper_data gssd_syscalls[] = {
|
||||||
static struct sysent gssd_syscall_prev_sysent;
|
SYSCALL_INIT_HELPER(gssd_syscall),
|
||||||
MAKE_SYSENT(gssd_syscall);
|
SYSCALL_INIT_LAST
|
||||||
static bool_t gssd_syscall_registered = FALSE;
|
};
|
||||||
|
|
||||||
struct kgss_mech_list kgss_mechs;
|
struct kgss_mech_list kgss_mechs;
|
||||||
CLIENT *kgss_gssd_handle;
|
CLIENT *kgss_gssd_handle;
|
||||||
struct mtx kgss_gssd_lock;
|
struct mtx kgss_gssd_lock;
|
||||||
|
|
||||||
static void
|
static int
|
||||||
kgss_init(void *dummy)
|
kgss_load(void)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
LIST_INIT(&kgss_mechs);
|
LIST_INIT(&kgss_mechs);
|
||||||
error = syscall_register(&gssd_syscall_offset, &gssd_syscall_sysent,
|
error = syscall_helper_register(gssd_syscalls, SY_THR_STATIC_KLD);
|
||||||
&gssd_syscall_prev_sysent, SY_THR_STATIC_KLD);
|
if (error != 0)
|
||||||
if (error)
|
return (error);
|
||||||
printf("Can't register GSSD syscall\n");
|
return (0);
|
||||||
else
|
|
||||||
gssd_syscall_registered = TRUE;
|
|
||||||
}
|
}
|
||||||
SYSINIT(kgss_init, SI_SUB_LOCK, SI_ORDER_FIRST, kgss_init, NULL);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
kgss_uninit(void *dummy)
|
kgss_unload(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (gssd_syscall_registered)
|
syscall_helper_unregister(gssd_syscalls);
|
||||||
syscall_deregister(&gssd_syscall_offset,
|
|
||||||
&gssd_syscall_prev_sysent);
|
|
||||||
}
|
}
|
||||||
SYSUNINIT(kgss_uninit, SI_SUB_LOCK, SI_ORDER_FIRST, kgss_uninit, NULL);
|
|
||||||
|
|
||||||
int
|
int
|
||||||
sys_gssd_syscall(struct thread *td, struct gssd_syscall_args *uap)
|
sys_gssd_syscall(struct thread *td, struct gssd_syscall_args *uap)
|
||||||
@ -293,6 +287,8 @@ kgssapi_modevent(module_t mod, int type, void *data)
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case MOD_LOAD:
|
case MOD_LOAD:
|
||||||
|
if (error != 0)
|
||||||
|
return (error);
|
||||||
rpc_gss_entries.rpc_gss_refresh_auth = rpc_gss_refresh_auth;
|
rpc_gss_entries.rpc_gss_refresh_auth = rpc_gss_refresh_auth;
|
||||||
rpc_gss_entries.rpc_gss_secfind = rpc_gss_secfind;
|
rpc_gss_entries.rpc_gss_secfind = rpc_gss_secfind;
|
||||||
rpc_gss_entries.rpc_gss_secpurge = rpc_gss_secpurge;
|
rpc_gss_entries.rpc_gss_secpurge = rpc_gss_secpurge;
|
||||||
@ -317,8 +313,11 @@ kgssapi_modevent(module_t mod, int type, void *data)
|
|||||||
rpc_gss_entries.rpc_gss_svc_max_data_length =
|
rpc_gss_entries.rpc_gss_svc_max_data_length =
|
||||||
rpc_gss_svc_max_data_length;
|
rpc_gss_svc_max_data_length;
|
||||||
mtx_init(&kgss_gssd_lock, "kgss_gssd_lock", NULL, MTX_DEF);
|
mtx_init(&kgss_gssd_lock, "kgss_gssd_lock", NULL, MTX_DEF);
|
||||||
|
error = kgss_load();
|
||||||
break;
|
break;
|
||||||
case MOD_UNLOAD:
|
case MOD_UNLOAD:
|
||||||
|
kgss_unload();
|
||||||
|
mtx_destroy(&kgss_gssd_lock);
|
||||||
/*
|
/*
|
||||||
* Unloading of the kgssapi module is not currently supported.
|
* Unloading of the kgssapi module is not currently supported.
|
||||||
* If somebody wants this, we would need to keep track of
|
* If somebody wants this, we would need to keep track of
|
||||||
|
Loading…
Reference in New Issue
Block a user