Print this page
OS-279 #pragma D option zone= does not work on installed, halted zones
OS-208 DTrace needs to use zone_did to match zone-limited enablings
INTRO-118 enabling USDT probes in zones should be more scalable

*** 39,48 **** --- 39,50 ---- #include <unistd.h> #include <limits.h> #include <alloca.h> #include <errno.h> #include <fcntl.h> + #include <zone.h> + #include <libzonecfg.h> #include <dt_impl.h> #include <dt_string.h> static int
*** 852,861 **** --- 854,901 ---- dtp->dt_options[DTRACEOPT_BUFRESIZE] = policy; return (0); } + /*ARGSUSED*/ + static int + dt_opt_zone(dtrace_hdl_t *dtp, const char *arg, uintptr_t option) + { + zoneid_t z, did; + + if (arg == NULL) + return (dt_set_errno(dtp, EDT_BADOPTVAL)); + + /* + * If the specified zone is currently running, we'll query the kernel + * for its debugger ID. If it doesn't appear to be running, we'll look + * for it for among all installed zones (thereby allowing a zdefs + * enabling against a halted zone). + */ + if ((z = getzoneidbyname(arg)) != -1) { + if (zone_getattr(z, ZONE_ATTR_DID, &did, sizeof (did)) < 0) + return (dt_set_errno(dtp, EDT_BADOPTVAL)); + } else { + zone_dochandle_t handle; + + if ((handle = zonecfg_init_handle()) == NULL) + return (dt_set_errno(dtp, errno)); + + if (zonecfg_get_handle(arg, handle) != Z_OK) { + zonecfg_fini_handle(handle); + return (dt_set_errno(dtp, EDT_BADOPTVAL)); + } + + did = zonecfg_get_did(handle); + zonecfg_fini_handle(handle); + } + + dtp->dt_options[DTRACEOPT_ZONE] = did; + + return (0); + } + int dt_options_load(dtrace_hdl_t *dtp) { dof_hdr_t hdr, *dof; dof_sec_t *sec;
*** 992,1001 **** --- 1032,1042 ---- { "stackframes", dt_opt_runtime, DTRACEOPT_STACKFRAMES }, { "statusrate", dt_opt_rate, DTRACEOPT_STATUSRATE }, { "strsize", dt_opt_strsize, DTRACEOPT_STRSIZE }, { "ustackframes", dt_opt_runtime, DTRACEOPT_USTACKFRAMES }, { "temporal", dt_opt_runtime, DTRACEOPT_TEMPORAL }, + { "zone", dt_opt_zone, DTRACEOPT_ZONE }, { NULL } }; /* * Dynamic run-time options.