diff options
-rw-r--r-- | sys/kern/kern_priv.c | 8 | ||||
-rw-r--r-- | sys/security/mac/mac_framework.c | 15 | ||||
-rw-r--r-- | sys/sys/sdt.h | 36 |
3 files changed, 41 insertions, 18 deletions
diff --git a/sys/kern/kern_priv.c b/sys/kern/kern_priv.c index beee245..6dd7d4b 100644 --- a/sys/kern/kern_priv.c +++ b/sys/kern/kern_priv.c @@ -61,12 +61,8 @@ SYSCTL_INT(_security_bsd, OID_AUTO, suser_enabled, CTLFLAG_RW, TUNABLE_INT("security.bsd.suser_enabled", &suser_enabled); SDT_PROVIDER_DEFINE(priv); - -SDT_PROBE_DEFINE(priv, kernel, priv_check, priv_ok); -SDT_PROBE_ARGTYPE(priv, kernel, priv_check, priv_ok, 0, "int"); - -SDT_PROBE_DEFINE(priv, kernel, priv_check, priv_err); -SDT_PROBE_ARGTYPE(priv, kernel, priv_check, priv_err, 0, "int"); +SDT_PROBE_DEFINE1(priv, kernel, priv_check, priv_ok, "int"); +SDT_PROBE_DEFINE1(priv, kernel, priv_check, priv_err, "int"); /* * Check a credential for privilege. Lots of good reasons to deny privilege; diff --git a/sys/security/mac/mac_framework.c b/sys/security/mac/mac_framework.c index 26d391c..c1e2e21 100644 --- a/sys/security/mac/mac_framework.c +++ b/sys/security/mac/mac_framework.c @@ -88,19 +88,10 @@ __FBSDID("$FreeBSD$"); * DTrace SDT provider for MAC. */ SDT_PROVIDER_DEFINE(mac); - -SDT_PROBE_DEFINE(mac, kernel, policy, modevent); -SDT_PROBE_ARGTYPE(mac, kernel, policy, modevent, 0, "int"); -SDT_PROBE_ARGTYPE(mac, kernel, policy, modevent, 1, +SDT_PROBE_DEFINE2(mac, kernel, policy, modevent, "int", "struct mac_policy_conf *mpc"); - -SDT_PROBE_DEFINE(mac, kernel, policy, register); -SDT_PROBE_ARGTYPE(mac, kernel, policy, register, 0, - "struct mac_policy_conf *"); - -SDT_PROBE_DEFINE(mac, kernel, policy, unregister); -SDT_PROBE_ARGTYPE(mac, kernel, policy, unregister, 0, - "struct mac_policy_conf *"); +SDT_PROBE_DEFINE1(mac, kernel, policy, register, "struct mac_policy_conf *"); +SDT_PROBE_DEFINE1(mac, kernel, policy, unregister, "struct mac_policy_conf *"); /* * Root sysctl node for all MAC and MAC policy controls. diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h index 2bf2f2d..b2717b1 100644 --- a/sys/sys/sdt.h +++ b/sys/sys/sdt.h @@ -53,6 +53,12 @@ #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type) +#define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0) +#define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1) +#define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2) +#define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) +#define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) + #else /* @@ -156,6 +162,36 @@ struct sdt_provider { SI_SUB_KDTRACE, SI_ORDER_SECOND + 2, sdt_argtype_deregister, \ sdt_##prov##_##mod##_##func##_##name##num ) +#define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) + +#define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) + +#define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) + +#define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3) + +#define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \ + SDT_PROBE_DEFINE(prov, mod, func, name); \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3) \ + SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4) + typedef int (*sdt_argtype_listall_func_t)(struct sdt_argtype *, void *); typedef int (*sdt_probe_listall_func_t)(struct sdt_probe *, void *); typedef int (*sdt_provider_listall_func_t)(struct sdt_provider *, void *); |