diff options
author | jkoshy <jkoshy@FreeBSD.org> | 2005-04-19 04:01:25 +0000 |
---|---|---|
committer | jkoshy <jkoshy@FreeBSD.org> | 2005-04-19 04:01:25 +0000 |
commit | dc3444cd91762fa913e417f7f7a7a0484872f54e (patch) | |
tree | 3175e06cfbec643ca7426d756f2362160f9309d4 /sys/kern/kern_exec.c | |
parent | 8c509864f2dd0cdcc6116de38bf9137583c4ab2f (diff) | |
download | FreeBSD-src-dc3444cd91762fa913e417f7f7a7a0484872f54e.zip FreeBSD-src-dc3444cd91762fa913e417f7f7a7a0484872f54e.tar.gz |
Bring a working snapshot of hwpmc(4), its associated libraries, userland utilities
and documentation into -CURRENT.
Bump FreeBSD_version.
Reviewed by: alc, jhb (kernel changes)
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r-- | sys/kern/kern_exec.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 7a15f75..9783615 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -72,6 +72,10 @@ __FBSDID("$FreeBSD$"); #include <vm/vm_object.h> #include <vm/vm_pager.h> +#ifdef HWPMC_HOOKS +#include <sys/pmckern.h> +#endif + #include <machine/reg.h> MALLOC_DEFINE(M_PARGS, "proc-args", "Process arguments"); @@ -662,7 +666,25 @@ interpret: p->p_args = newargs; newargs = NULL; } + +#ifdef HWPMC_HOOKS + /* + * Check if the process is using PMCs and if so do exec() time + * processing. This processing needs to happen AFTER the + * P_INEXEC flag is cleared. + * + * The proc lock needs to be released before taking the PMC + * SX. + */ + if (PMC_PROC_IS_USING_PMCS(p)) { + PROC_UNLOCK(p); + PMC_CALL_HOOK_X(td, PMC_FN_PROCESS_EXEC, + (void *) &credential_changing); + } else + PROC_UNLOCK(p); +#else /* !HWPMC_HOOKS */ PROC_UNLOCK(p); +#endif /* Set values passed into the program in registers. */ if (p->p_sysent->sv_setregs) |