Date: Sat, 4 Jun 2016 17:39:42 +0000 (UTC) From: Bryan Drewery <bdrewery@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r301404 - head/sys/dev/filemon Message-ID: <201606041739.u54HdgnQ064296@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bdrewery Date: Sat Jun 4 17:39:42 2016 New Revision: 301404 URL: https://svnweb.freebsd.org/changeset/base/301404 Log: Support all architectures by just using sysent. PowerPC64 has two different ABIs, neither of which is elf64_freebsd_sysvec. Using sysent and freebsd32_sysent achieves the same effect. X-MFC-With: r301130 MFC after: 1 week Sponsored by: EMC / Isilon Storage Division Modified: head/sys/dev/filemon/filemon_wrapper.c Modified: head/sys/dev/filemon/filemon_wrapper.c ============================================================================== --- head/sys/dev/filemon/filemon_wrapper.c Sat Jun 4 17:38:17 2016 (r301403) +++ head/sys/dev/filemon/filemon_wrapper.c Sat Jun 4 17:39:42 2016 (r301404) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include <sys/imgact.h> #include <sys/priv.h> #include <sys/sx.h> +#include <sys/sysent.h> #include <sys/vnode.h> #include "opt_compat.h" @@ -414,32 +415,25 @@ filemon_event_process_fork(void *arg __u static void filemon_wrapper_install(void) { -#if defined(__LP64__) - struct sysent *sv_table = elf64_freebsd_sysvec.sv_table; -#else - struct sysent *sv_table = elf32_freebsd_sysvec.sv_table; -#endif - - sv_table[SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir; - sv_table[SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open; - sv_table[SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat; - sv_table[SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename; - sv_table[SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink; - sv_table[SYS_link].sy_call = (sy_call_t *) filemon_wrapper_link; - sv_table[SYS_symlink].sy_call = (sy_call_t *) filemon_wrapper_symlink; - sv_table[SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat; -#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) - sv_table = ia32_freebsd_sysvec.sv_table; + sysent[SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir; + sysent[SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open; + sysent[SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat; + sysent[SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename; + sysent[SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink; + sysent[SYS_link].sy_call = (sy_call_t *) filemon_wrapper_link; + sysent[SYS_symlink].sy_call = (sy_call_t *) filemon_wrapper_symlink; + sysent[SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat; - sv_table[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir; - sv_table[FREEBSD32_SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open; - sv_table[FREEBSD32_SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat; - sv_table[FREEBSD32_SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename; - sv_table[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink; - sv_table[FREEBSD32_SYS_link].sy_call = (sy_call_t *) filemon_wrapper_link; - sv_table[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *) filemon_wrapper_symlink; - sv_table[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat; +#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) + freebsd32_sysent[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir; + freebsd32_sysent[FREEBSD32_SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open; + freebsd32_sysent[FREEBSD32_SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat; + freebsd32_sysent[FREEBSD32_SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename; + freebsd32_sysent[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink; + freebsd32_sysent[FREEBSD32_SYS_link].sy_call = (sy_call_t *) filemon_wrapper_link; + freebsd32_sysent[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *) filemon_wrapper_symlink; + freebsd32_sysent[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat; #endif /* COMPAT_ARCH32 */ filemon_exec_tag = EVENTHANDLER_REGISTER(process_exec, @@ -453,32 +447,25 @@ filemon_wrapper_install(void) static void filemon_wrapper_deinstall(void) { -#if defined(__LP64__) - struct sysent *sv_table = elf64_freebsd_sysvec.sv_table; -#else - struct sysent *sv_table = elf32_freebsd_sysvec.sv_table; -#endif - - sv_table[SYS_chdir].sy_call = (sy_call_t *)sys_chdir; - sv_table[SYS_open].sy_call = (sy_call_t *)sys_open; - sv_table[SYS_openat].sy_call = (sy_call_t *)sys_openat; - sv_table[SYS_rename].sy_call = (sy_call_t *)sys_rename; - sv_table[SYS_unlink].sy_call = (sy_call_t *)sys_unlink; - sv_table[SYS_link].sy_call = (sy_call_t *)sys_link; - sv_table[SYS_symlink].sy_call = (sy_call_t *)sys_symlink; - sv_table[SYS_linkat].sy_call = (sy_call_t *)sys_linkat; -#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) - sv_table = ia32_freebsd_sysvec.sv_table; + sysent[SYS_chdir].sy_call = (sy_call_t *)sys_chdir; + sysent[SYS_open].sy_call = (sy_call_t *)sys_open; + sysent[SYS_openat].sy_call = (sy_call_t *)sys_openat; + sysent[SYS_rename].sy_call = (sy_call_t *)sys_rename; + sysent[SYS_unlink].sy_call = (sy_call_t *)sys_unlink; + sysent[SYS_link].sy_call = (sy_call_t *)sys_link; + sysent[SYS_symlink].sy_call = (sy_call_t *)sys_symlink; + sysent[SYS_linkat].sy_call = (sy_call_t *)sys_linkat; - sv_table[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *)sys_chdir; - sv_table[FREEBSD32_SYS_open].sy_call = (sy_call_t *)sys_open; - sv_table[FREEBSD32_SYS_openat].sy_call = (sy_call_t *)sys_openat; - sv_table[FREEBSD32_SYS_rename].sy_call = (sy_call_t *)sys_rename; - sv_table[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *)sys_unlink; - sv_table[FREEBSD32_SYS_link].sy_call = (sy_call_t *)sys_link; - sv_table[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *)sys_symlink; - sv_table[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *)sys_linkat; +#if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32) + freebsd32_sysent[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *)sys_chdir; + freebsd32_sysent[FREEBSD32_SYS_open].sy_call = (sy_call_t *)sys_open; + freebsd32_sysent[FREEBSD32_SYS_openat].sy_call = (sy_call_t *)sys_openat; + freebsd32_sysent[FREEBSD32_SYS_rename].sy_call = (sy_call_t *)sys_rename; + freebsd32_sysent[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *)sys_unlink; + freebsd32_sysent[FREEBSD32_SYS_link].sy_call = (sy_call_t *)sys_link; + freebsd32_sysent[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *)sys_symlink; + freebsd32_sysent[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *)sys_linkat; #endif /* COMPAT_ARCH32 */ EVENTHANDLER_DEREGISTER(process_exec, filemon_exec_tag);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606041739.u54HdgnQ064296>