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:
Brooks Davis 2018-02-11 18:37:08 +00:00
parent 38c35fec7a
commit ad704a34bc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=329128

View file

@ -56,39 +56,33 @@ MALLOC_DEFINE(M_GSSAPI, "GSS-API", "GSS-API");
/*
* Syscall hooks
*/
static int gssd_syscall_offset = SYS_gssd_syscall;
static struct sysent gssd_syscall_prev_sysent;
MAKE_SYSENT(gssd_syscall);
static bool_t gssd_syscall_registered = FALSE;
static struct syscall_helper_data gssd_syscalls[] = {
SYSCALL_INIT_HELPER(gssd_syscall),
SYSCALL_INIT_LAST
};
struct kgss_mech_list kgss_mechs;
CLIENT *kgss_gssd_handle;
struct mtx kgss_gssd_lock;
static void
kgss_init(void *dummy)
static int
kgss_load(void)
{
int error;
LIST_INIT(&kgss_mechs);
error = syscall_register(&gssd_syscall_offset, &gssd_syscall_sysent,
&gssd_syscall_prev_sysent, SY_THR_STATIC_KLD);
if (error)
printf("Can't register GSSD syscall\n");
else
gssd_syscall_registered = TRUE;
error = syscall_helper_register(gssd_syscalls, SY_THR_STATIC_KLD);
if (error != 0)
return (error);
return (0);
}
SYSINIT(kgss_init, SI_SUB_LOCK, SI_ORDER_FIRST, kgss_init, NULL);
static void
kgss_uninit(void *dummy)
kgss_unload(void)
{
if (gssd_syscall_registered)
syscall_deregister(&gssd_syscall_offset,
&gssd_syscall_prev_sysent);
syscall_helper_unregister(gssd_syscalls);
}
SYSUNINIT(kgss_uninit, SI_SUB_LOCK, SI_ORDER_FIRST, kgss_uninit, NULL);
int
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) {
case MOD_LOAD:
if (error != 0)
return (error);
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_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_svc_max_data_length;
mtx_init(&kgss_gssd_lock, "kgss_gssd_lock", NULL, MTX_DEF);
error = kgss_load();
break;
case MOD_UNLOAD:
kgss_unload();
mtx_destroy(&kgss_gssd_lock);
/*
* Unloading of the kgssapi module is not currently supported.
* If somebody wants this, we would need to keep track of