diff options
author | netchild <netchild@FreeBSD.org> | 2012-05-05 19:42:38 +0000 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2012-05-05 19:42:38 +0000 |
commit | 9895b5ca9df1f0d045ee00e77007e80d4c202ca4 (patch) | |
tree | 2c944ca220ef9f94f80b967133cbd2ab53caa81c /sys/compat/linux/linux_mib.c | |
parent | 096ede817a595e57dafce2910385344f389c8dbd (diff) | |
download | FreeBSD-src-9895b5ca9df1f0d045ee00e77007e80d4c202ca4.zip FreeBSD-src-9895b5ca9df1f0d045ee00e77007e80d4c202ca4.tar.gz |
- >500 static DTrace probes for the linuxulator
- DTrace scripts to check for errors, performance, ...
they serve mostly as examples of what you can do with the static probe;s
with moderate load the scripts may be overwhelmed, excessive lock-tracing
may influence program behavior (see the last design decission)
Design decissions:
- use "linuxulator" as the provider for the native bitsize; add the
bitsize for the non-native emulation (e.g. "linuxuator32" on amd64)
- Add probes only for locks which are acquired in one function and released
in another function. Locks which are aquired and released in the same
function should be easy to pair in the code, inter-function
locking is more easy to verify in DTrace.
- Probes for locks should be fired after locking and before releasing to
prevent races (to provide data/function stability in DTrace, see the
man-page of "dtrace -v ..." and the corresponding DTrace docs).
Diffstat (limited to 'sys/compat/linux/linux_mib.c')
-rw-r--r-- | sys/compat/linux/linux_mib.c | 314 |
1 files changed, 280 insertions, 34 deletions
diff --git a/sys/compat/linux/linux_mib.c b/sys/compat/linux/linux_mib.c index 16f9ac3..0856662 100644 --- a/sys/compat/linux/linux_mib.c +++ b/sys/compat/linux/linux_mib.c @@ -29,8 +29,12 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_compat.h" +#include "opt_kdtrace.h" + #include <sys/param.h> #include <sys/kernel.h> +#include <sys/sdt.h> #include <sys/systm.h> #include <sys/sysctl.h> #include <sys/proc.h> @@ -41,15 +45,81 @@ __FBSDID("$FreeBSD$"); #include <sys/mutex.h> #include <sys/sx.h> -#include "opt_compat.h" - #ifdef COMPAT_LINUX32 #include <machine/../linux32/linux.h> #else #include <machine/../linux/linux.h> #endif +#include <compat/linux/linux_dtrace.h> #include <compat/linux/linux_mib.h> +/* DTrace init */ +LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); + +/** + * DTrace probes in this module. + */ +LIN_SDT_PROBE_DEFINE0(mib, linux_sysctl_osname, entry); +LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_osname, sysctl_string_error, "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_osname, return, "int"); + +LIN_SDT_PROBE_DEFINE0(mib, linux_sysctl_osrelease, entry); +LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_osrelease, sysctl_string_error, "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_osrelease, return, "int"); +LIN_SDT_PROBE_DEFINE0(mib, linux_sysctl_oss_version, entry); +LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_oss_version, sysctl_string_error, + "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_sysctl_oss_version, return, "int"); +LIN_SDT_PROBE_DEFINE2(mib, linux_map_osrel, entry, "char *", "int *"); +LIN_SDT_PROBE_DEFINE1(mib, linux_map_osrel, return, "int"); +LIN_SDT_PROBE_DEFINE2(mib, linux_get_prison, entry, "struct prison *", + "struct prison **"); +LIN_SDT_PROBE_DEFINE1(mib, linux_get_prison, return, "struct linux_prison *"); +LIN_SDT_PROBE_DEFINE2(mib, linux_alloc_prison, entry, "struct prison *", + "struct linux_prison **"); +LIN_SDT_PROBE_DEFINE1(mib, linux_alloc_prison, return, "int"); +LIN_SDT_PROBE_DEFINE2(mib, linux_prison_create, entry, "void *", "void *"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_create, vfs_copyopt_error, "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_create, return, "int"); +LIN_SDT_PROBE_DEFINE2(mib, linux_prison_check, entry, "void *", "void *"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_check, vfs_copyopt_error, "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_check, vfs_getopt_error, "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_check, return, "int"); +LIN_SDT_PROBE_DEFINE2(mib, linux_prison_set, entry, "void *", "void *"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_set, vfs_copyopt_error, "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_set, vfs_getopt_error, "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_set, return, "int"); +LIN_SDT_PROBE_DEFINE2(mib, linux_prison_get, entry, "void *", "void *"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_get, vfs_setopt_error, "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_get, vfs_setopts_error, "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_get, return, "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_prison_destructor, entry, "void *"); +LIN_SDT_PROBE_DEFINE0(mib, linux_prison_destructor, return); +LIN_SDT_PROBE_DEFINE0(mib, linux_osd_jail_register, entry); +LIN_SDT_PROBE_DEFINE0(mib, linux_osd_jail_register, return); +LIN_SDT_PROBE_DEFINE0(mib, linux_osd_jail_deregister, entry); +LIN_SDT_PROBE_DEFINE0(mib, linux_osd_jail_deregister, return); +LIN_SDT_PROBE_DEFINE2(mib, linux_get_osname, entry, "struct thread *", + "char *"); +LIN_SDT_PROBE_DEFINE0(mib, linux_get_osname, return); +LIN_SDT_PROBE_DEFINE2(mib, linux_set_osname, entry, "struct thread *", + "char *"); +LIN_SDT_PROBE_DEFINE1(mib, linux_set_osname, return, "int"); +LIN_SDT_PROBE_DEFINE2(mib, linux_get_osrelease, entry, "struct thread *", + "char *"); +LIN_SDT_PROBE_DEFINE0(mib, linux_get_osrelease, return); +LIN_SDT_PROBE_DEFINE1(mib, linux_kernver, entry, "struct thread *"); +LIN_SDT_PROBE_DEFINE1(mib, linux_kernver, return, "int"); +LIN_SDT_PROBE_DEFINE2(mib, linux_set_osrelease, entry, "struct thread *", + "char *"); +LIN_SDT_PROBE_DEFINE1(mib, linux_set_osrelease, return, "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_get_oss_version, entry, "struct thread *"); +LIN_SDT_PROBE_DEFINE1(mib, linux_get_oss_version, return, "int"); + +LIN_SDT_PROBE_DEFINE2(mib, linux_set_oss_version, entry, "struct thread *", + "int"); +LIN_SDT_PROBE_DEFINE1(mib, linux_set_oss_version, return, "int"); + struct linux_prison { char pr_osname[LINUX_MAX_UTSNAME]; char pr_osrelease[LINUX_MAX_UTSNAME]; @@ -79,11 +149,19 @@ linux_sysctl_osname(SYSCTL_HANDLER_ARGS) char osname[LINUX_MAX_UTSNAME]; int error; + LIN_SDT_PROBE0(mib, linux_sysctl_osname, entry); + linux_get_osname(req->td, osname); error = sysctl_handle_string(oidp, osname, LINUX_MAX_UTSNAME, req); - if (error || req->newptr == NULL) + if (error != 0 || req->newptr == NULL) { + LIN_SDT_PROBE1(mib, linux_sysctl_osname, sysctl_string_error, + error); + LIN_SDT_PROBE1(mib, linux_sysctl_osname, return, error); return (error); + } error = linux_set_osname(req->td, osname); + + LIN_SDT_PROBE1(mib, linux_sysctl_osname, return, error); return (error); } @@ -98,11 +176,19 @@ linux_sysctl_osrelease(SYSCTL_HANDLER_ARGS) char osrelease[LINUX_MAX_UTSNAME]; int error; + LIN_SDT_PROBE0(mib, linux_sysctl_osrelease, entry); + linux_get_osrelease(req->td, osrelease); error = sysctl_handle_string(oidp, osrelease, LINUX_MAX_UTSNAME, req); - if (error || req->newptr == NULL) + if (error != 0 || req->newptr == NULL) { + LIN_SDT_PROBE1(mib, linux_sysctl_osrelease, sysctl_string_error, + error); + LIN_SDT_PROBE1(mib, linux_sysctl_osrelease, return, error); return (error); + } error = linux_set_osrelease(req->td, osrelease); + + LIN_SDT_PROBE1(mib, linux_sysctl_osrelease, return, error); return (error); } @@ -117,11 +203,19 @@ linux_sysctl_oss_version(SYSCTL_HANDLER_ARGS) int oss_version; int error; + LIN_SDT_PROBE0(mib, linux_sysctl_oss_version, entry); + oss_version = linux_get_oss_version(req->td); error = sysctl_handle_int(oidp, &oss_version, 0, req); - if (error || req->newptr == NULL) + if (error != 0 || req->newptr == NULL) { + LIN_SDT_PROBE1(mib, linux_sysctl_oss_version, + sysctl_string_error, error); + LIN_SDT_PROBE1(mib, linux_sysctl_oss_version, return, error); return (error); + } error = linux_set_oss_version(req->td, oss_version); + + LIN_SDT_PROBE1(mib, linux_sysctl_oss_version, return, error); return (error); } @@ -139,25 +233,37 @@ linux_map_osrel(char *osrelease, int *osrel) char *sep, *eosrelease; int len, v0, v1, v2, v; + LIN_SDT_PROBE2(mib, linux_map_osrel, entry, osrelease, osrel); + len = strlen(osrelease); eosrelease = osrelease + len; v0 = strtol(osrelease, &sep, 10); - if (osrelease == sep || sep + 1 >= eosrelease || *sep != '.') + if (osrelease == sep || sep + 1 >= eosrelease || *sep != '.') { + LIN_SDT_PROBE1(mib, linux_map_osrel, return, EINVAL); return (EINVAL); + } osrelease = sep + 1; v1 = strtol(osrelease, &sep, 10); - if (osrelease == sep || sep + 1 >= eosrelease || *sep != '.') + if (osrelease == sep || sep + 1 >= eosrelease || *sep != '.') { + LIN_SDT_PROBE1(mib, linux_map_osrel, return, EINVAL); return (EINVAL); + } osrelease = sep + 1; v2 = strtol(osrelease, &sep, 10); - if (osrelease == sep || sep != eosrelease) + if (osrelease == sep || sep != eosrelease) { + LIN_SDT_PROBE1(mib, linux_map_osrel, return, EINVAL); return (EINVAL); + } v = v0 * 1000000 + v1 * 1000 + v2; - if (v < 1000000) + if (v < 1000000) { + LIN_SDT_PROBE1(mib, linux_map_osrel, return, EINVAL); return (EINVAL); + } *osrel = v; + + LIN_SDT_PROBE1(mib, linux_map_osrel, return, 0); return (0); } @@ -171,6 +277,8 @@ linux_find_prison(struct prison *spr, struct prison **prp) struct prison *pr; struct linux_prison *lpr; + LIN_SDT_PROBE2(mib, linux_get_prison, entry, spr, prp); + if (!linux_osd_jail_slot) /* In case osd_register failed. */ spr = &prison0; @@ -184,6 +292,8 @@ linux_find_prison(struct prison *spr, struct prison **prp) mtx_unlock(&pr->pr_mtx); } *prp = pr; + + LIN_SDT_PROBE1(mib, linux_get_prison, return, lpr); return (lpr); } @@ -198,6 +308,8 @@ linux_alloc_prison(struct prison *pr, struct linux_prison **lprp) struct linux_prison *lpr, *nlpr; int error; + LIN_SDT_PROBE2(mib, linux_alloc_prison, entry, pr, lprp); + /* If this prison already has Linux info, return that. */ error = 0; lpr = linux_find_prison(pr, &ppr); @@ -230,6 +342,8 @@ linux_alloc_prison(struct prison *pr, struct linux_prison **lprp) *lprp = lpr; else mtx_unlock(&pr->pr_mtx); + + LIN_SDT_PROBE1(mib, linux_alloc_prison, return, error); return (error); } @@ -241,16 +355,26 @@ linux_prison_create(void *obj, void *data) { struct prison *pr = obj; struct vfsoptlist *opts = data; - int jsys; + int jsys, error; + + LIN_SDT_PROBE2(mib, linux_prison_create, entry, obj, data); - if (vfs_copyopt(opts, "linux", &jsys, sizeof(jsys)) == 0 && - jsys == JAIL_SYS_INHERIT) + error = vfs_copyopt(opts, "linux", &jsys, sizeof(jsys)); + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_create, vfs_copyopt_error, + error); + } else if (jsys == JAIL_SYS_INHERIT) { + LIN_SDT_PROBE1(mib, linux_prison_create, return, 0); return (0); + } /* * Inherit a prison's initial values from its parent * (different from JAIL_SYS_INHERIT which also inherits changes). */ - return linux_alloc_prison(pr, NULL); + error = linux_alloc_prison(pr, NULL); + + LIN_SDT_PROBE1(mib, linux_prison_create, return, error); + return (error); } static int @@ -260,44 +384,81 @@ linux_prison_check(void *obj __unused, void *data) char *osname, *osrelease; int error, jsys, len, osrel, oss_version; + LIN_SDT_PROBE2(mib, linux_prison_check, entry, obj, data); + /* Check that the parameters are correct. */ error = vfs_copyopt(opts, "linux", &jsys, sizeof(jsys)); + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_check, vfs_copyopt_error, + error); + } if (error != ENOENT) { - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_check, return, error); return (error); - if (jsys != JAIL_SYS_NEW && jsys != JAIL_SYS_INHERIT) + } + if (jsys != JAIL_SYS_NEW && jsys != JAIL_SYS_INHERIT) { + LIN_SDT_PROBE1(mib, linux_prison_check, return, EINVAL); return (EINVAL); + } } error = vfs_getopt(opts, "linux.osname", (void **)&osname, &len); + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_check, vfs_getopt_error, + error); + } if (error != ENOENT) { - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_check, return, error); return (error); - if (len == 0 || osname[len - 1] != '\0') + } + if (len == 0 || osname[len - 1] != '\0') { + LIN_SDT_PROBE1(mib, linux_prison_check, return, EINVAL); return (EINVAL); + } if (len > LINUX_MAX_UTSNAME) { vfs_opterror(opts, "linux.osname too long"); + LIN_SDT_PROBE1(mib, linux_prison_check, return, + ENAMETOOLONG); return (ENAMETOOLONG); } } error = vfs_getopt(opts, "linux.osrelease", (void **)&osrelease, &len); + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_check, vfs_getopt_error, + error); + } if (error != ENOENT) { - if (error != 0) + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_check, return, error); return (error); - if (len == 0 || osrelease[len - 1] != '\0') + } + if (len == 0 || osrelease[len - 1] != '\0') { + LIN_SDT_PROBE1(mib, linux_prison_check, return, EINVAL); return (EINVAL); + } if (len > LINUX_MAX_UTSNAME) { vfs_opterror(opts, "linux.osrelease too long"); + LIN_SDT_PROBE1(mib, linux_prison_check, return, + ENAMETOOLONG); return (ENAMETOOLONG); } error = linux_map_osrel(osrelease, &osrel); if (error != 0) { vfs_opterror(opts, "linux.osrelease format error"); + LIN_SDT_PROBE1(mib, linux_prison_check, return, error); return (error); } } error = vfs_copyopt(opts, "linux.oss_version", &oss_version, sizeof(oss_version)); - return (error == ENOENT ? 0 : error); + if (error != 0) + LIN_SDT_PROBE1(mib, linux_prison_check, vfs_copyopt_error, error); + + if (error == ENOENT) + error = 0; + LIN_SDT_PROBE1(mib, linux_prison_check, return, error); + return (error); } static int @@ -309,22 +470,32 @@ linux_prison_set(void *obj, void *data) char *osname, *osrelease; int error, gotversion, jsys, len, oss_version; + LIN_SDT_PROBE2(mib, linux_prison_set, entry, obj, data); + /* Set the parameters, which should be correct. */ error = vfs_copyopt(opts, "linux", &jsys, sizeof(jsys)); + if (error != 0) + LIN_SDT_PROBE1(mib, linux_prison_set, vfs_copyopt_error, error); if (error == ENOENT) jsys = -1; error = vfs_getopt(opts, "linux.osname", (void **)&osname, &len); + if (error != 0) + LIN_SDT_PROBE1(mib, linux_prison_set, vfs_getopt_error, error); if (error == ENOENT) osname = NULL; else jsys = JAIL_SYS_NEW; error = vfs_getopt(opts, "linux.osrelease", (void **)&osrelease, &len); + if (error != 0) + LIN_SDT_PROBE1(mib, linux_prison_set, vfs_getopt_error, error); if (error == ENOENT) osrelease = NULL; else jsys = JAIL_SYS_NEW; error = vfs_copyopt(opts, "linux.oss_version", &oss_version, sizeof(oss_version)); + if (error != 0) + LIN_SDT_PROBE1(mib, linux_prison_set, vfs_copyopt_error, error); if (error == ENOENT) gotversion = 0; else { @@ -346,12 +517,15 @@ linux_prison_set(void *obj, void *data) error = linux_alloc_prison(pr, &lpr); if (error) { mtx_unlock(&pr->pr_mtx); + LIN_SDT_PROBE1(mib, linux_prison_set, return, error); return (error); } if (osrelease) { error = linux_map_osrel(osrelease, &lpr->pr_osrel); if (error) { mtx_unlock(&pr->pr_mtx); + LIN_SDT_PROBE1(mib, linux_prison_set, return, + error); return (error); } strlcpy(lpr->pr_osrelease, osrelease, @@ -363,6 +537,8 @@ linux_prison_set(void *obj, void *data) lpr->pr_oss_version = oss_version; mtx_unlock(&pr->pr_mtx); } + + LIN_SDT_PROBE1(mib, linux_prison_set, return, 0); return (0); } @@ -385,43 +561,74 @@ linux_prison_get(void *obj, void *data) static int version0; + LIN_SDT_PROBE2(mib, linux_prison_get, entry, obj, data); + /* See if this prison is the one with the Linux info. */ lpr = linux_find_prison(pr, &ppr); i = (ppr == pr) ? JAIL_SYS_NEW : JAIL_SYS_INHERIT; error = vfs_setopt(opts, "linux", &i, sizeof(i)); - if (error != 0 && error != ENOENT) - goto done; + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopt_error, error); + if (error != ENOENT) + goto done; + } if (i) { error = vfs_setopts(opts, "linux.osname", lpr->pr_osname); - if (error != 0 && error != ENOENT) - goto done; + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopts_error, + error); + if (error != ENOENT) + goto done; + } error = vfs_setopts(opts, "linux.osrelease", lpr->pr_osrelease); - if (error != 0 && error != ENOENT) - goto done; + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopts_error, + error); + if (error != ENOENT) + goto done; + } error = vfs_setopt(opts, "linux.oss_version", &lpr->pr_oss_version, sizeof(lpr->pr_oss_version)); - if (error != 0 && error != ENOENT) - goto done; + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopt_error, + error); + if(error != ENOENT) + goto done; + } } else { /* * If this prison is inheriting its Linux info, report * empty/zero parameters. */ error = vfs_setopts(opts, "linux.osname", ""); - if (error != 0 && error != ENOENT) - goto done; + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopts_error, + error); + if(error != ENOENT) + goto done; + } error = vfs_setopts(opts, "linux.osrelease", ""); - if (error != 0 && error != ENOENT) - goto done; + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopts_error, + error); + if(error != ENOENT) + goto done; + } error = vfs_setopt(opts, "linux.oss_version", &version0, sizeof(lpr->pr_oss_version)); - if (error != 0 && error != ENOENT) - goto done; + if (error != 0) { + LIN_SDT_PROBE1(mib, linux_prison_get, vfs_setopt_error, + error); + if(error != ENOENT) + goto done; + } } error = 0; done: mtx_unlock(&ppr->pr_mtx); + + LIN_SDT_PROBE1(mib, linux_prison_get, return, error); return (error); } @@ -429,7 +636,9 @@ static void linux_prison_destructor(void *data) { + LIN_SDT_PROBE1(mib, linux_prison_destructor, entry, data); free(data, M_PRISON); + LIN_SDT_PROBE0(mib, linux_prison_destructor, return); } void @@ -443,6 +652,8 @@ linux_osd_jail_register(void) [PR_METHOD_CHECK] = linux_prison_check }; + LIN_SDT_PROBE0(mib, linux_osd_jail_register, entry); + linux_osd_jail_slot = osd_jail_register(linux_prison_destructor, methods); if (linux_osd_jail_slot > 0) { @@ -452,14 +663,20 @@ linux_osd_jail_register(void) (void)linux_alloc_prison(pr, NULL); sx_xunlock(&allprison_lock); } + + LIN_SDT_PROBE0(mib, linux_osd_jail_register, return); } void linux_osd_jail_deregister(void) { + LIN_SDT_PROBE0(mib, linux_osd_jail_register, entry); + if (linux_osd_jail_slot) osd_jail_deregister(linux_osd_jail_slot); + + LIN_SDT_PROBE0(mib, linux_osd_jail_register, return); } void @@ -468,9 +685,13 @@ linux_get_osname(struct thread *td, char *dst) struct prison *pr; struct linux_prison *lpr; + LIN_SDT_PROBE2(mib, linux_get_osname, entry, td, dst); + lpr = linux_find_prison(td->td_ucred->cr_prison, &pr); bcopy(lpr->pr_osname, dst, LINUX_MAX_UTSNAME); mtx_unlock(&pr->pr_mtx); + + LIN_SDT_PROBE0(mib, linux_get_osname, return); } static int @@ -479,9 +700,13 @@ linux_set_osname(struct thread *td, char *osname) struct prison *pr; struct linux_prison *lpr; + LIN_SDT_PROBE2(mib, linux_set_osname, entry, td, osname); + lpr = linux_find_prison(td->td_ucred->cr_prison, &pr); strlcpy(lpr->pr_osname, osname, LINUX_MAX_UTSNAME); mtx_unlock(&pr->pr_mtx); + + LIN_SDT_PROBE1(mib, linux_set_osname, return, 0); return (0); } @@ -491,9 +716,13 @@ linux_get_osrelease(struct thread *td, char *dst) struct prison *pr; struct linux_prison *lpr; + LIN_SDT_PROBE2(mib, linux_get_osrelease, entry, td, dst); + lpr = linux_find_prison(td->td_ucred->cr_prison, &pr); bcopy(lpr->pr_osrelease, dst, LINUX_MAX_UTSNAME); mtx_unlock(&pr->pr_mtx); + + LIN_SDT_PROBE0(mib, linux_get_osrelease, return); } int @@ -503,9 +732,13 @@ linux_kernver(struct thread *td) struct linux_prison *lpr; int osrel; + LIN_SDT_PROBE1(mib, linux_kernver, entry, td); + lpr = linux_find_prison(td->td_ucred->cr_prison, &pr); osrel = lpr->pr_osrel; mtx_unlock(&pr->pr_mtx); + + LIN_SDT_PROBE1(mib, linux_kernver, return, osrel); return (osrel); } @@ -516,11 +749,15 @@ linux_set_osrelease(struct thread *td, char *osrelease) struct linux_prison *lpr; int error; + LIN_SDT_PROBE2(mib, linux_set_osrelease, entry, td, osrelease); + lpr = linux_find_prison(td->td_ucred->cr_prison, &pr); error = linux_map_osrel(osrelease, &lpr->pr_osrel); if (error == 0) strlcpy(lpr->pr_osrelease, osrelease, LINUX_MAX_UTSNAME); mtx_unlock(&pr->pr_mtx); + + LIN_SDT_PROBE1(mib, linux_set_osrelease, return, error); return (error); } @@ -531,9 +768,13 @@ linux_get_oss_version(struct thread *td) struct linux_prison *lpr; int version; + LIN_SDT_PROBE1(mib, linux_get_oss_version, entry, td); + lpr = linux_find_prison(td->td_ucred->cr_prison, &pr); version = lpr->pr_oss_version; mtx_unlock(&pr->pr_mtx); + + LIN_SDT_PROBE1(mib, linux_get_oss_version, return, version); return (version); } @@ -543,13 +784,18 @@ linux_set_oss_version(struct thread *td, int oss_version) struct prison *pr; struct linux_prison *lpr; + LIN_SDT_PROBE2(mib, linux_set_oss_version, entry, td, oss_version); + lpr = linux_find_prison(td->td_ucred->cr_prison, &pr); lpr->pr_oss_version = oss_version; mtx_unlock(&pr->pr_mtx); + + LIN_SDT_PROBE1(mib, linux_set_oss_version, return, 0); return (0); } #if defined(DEBUG) || defined(KTR) +/* XXX: can be removed when every ldebug(...) and KTR stuff are removed. */ u_char linux_debug_map[howmany(LINUX_SYS_MAXSYSCALL, sizeof(u_char))]; |