diff options
author | kib <kib@FreeBSD.org> | 2010-03-19 10:56:30 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2010-03-19 10:56:30 +0000 |
commit | d19a162142eef526ef1ad29b8939ef0b7a92d04c (patch) | |
tree | c3b82f25093a43e8d9ad116599e3b6d881c14e85 /sys/sys/sysent.h | |
parent | 7932a1f757993966de97162cc026b99b93fd4d1c (diff) | |
download | FreeBSD-src-d19a162142eef526ef1ad29b8939ef0b7a92d04c.zip FreeBSD-src-d19a162142eef526ef1ad29b8939ef0b7a92d04c.tar.gz |
Introduce SYSCALL_INIT_HELPER and SYSCALL32_INIT_HELPER macros and
neccessary support functions to allow registering dynamically loaded
syscalls from the MOD_LOAD handlers. Helpers handle registration
failures semi-automatically.
Reviewed by: jhb
MFC after: 2 weeks
Diffstat (limited to 'sys/sys/sysent.h')
-rw-r--r-- | sys/sys/sysent.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/sys/sys/sysent.h b/sys/sys/sysent.h index 76cd5bd..707c00b 100644 --- a/sys/sys/sysent.h +++ b/sys/sys/sysent.h @@ -166,10 +166,34 @@ SYSCALL_MODULE(syscallname, \ (sysent[SYS_##syscallname].sy_call != (sy_call_t *)lkmnosys && \ sysent[SYS_##syscallname].sy_call != (sy_call_t *)lkmressys) +/* + * Syscall registration helpers with resource allocation handling. + */ +struct syscall_helper_data { + struct sysent new_sysent; + struct sysent old_sysent; + int syscall_no; + int registered; +}; +#define SYSCALL_INIT_HELPER(syscallname) { \ + .new_sysent = { \ + .sy_narg = (sizeof(struct syscallname ## _args ) \ + / sizeof(register_t)), \ + .sy_call = (sy_call_t *)& syscallname, \ + .sy_auevent = SYS_AUE_##syscallname \ + }, \ + .syscall_no = SYS_##syscallname \ +} +#define SYSCALL_INIT_LAST { \ + .syscall_no = NO_SYSCALL \ +} + int syscall_register(int *offset, struct sysent *new_sysent, struct sysent *old_sysent); int syscall_deregister(int *offset, struct sysent *old_sysent); int syscall_module_handler(struct module *mod, int what, void *arg); +int syscall_helper_register(struct syscall_helper_data *sd); +int syscall_helper_unregister(struct syscall_helper_data *sd); /* Special purpose system call functions. */ struct nosys_args; |