Print this page
4474 DTrace Userland CTF Support
4475 DTrace userland Keyword
4476 DTrace tests should be better citizens
4479 pid provider types
4480 dof emulation missing checks
Reviewed by: Bryan Cantrill <bryan@joyent.com>

@@ -21,12 +21,13 @@
 
 /*
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
-
-#pragma ident   "%Z%%M% %I%     %E% SMI"
+/*
+ * Copyright (c) 2013, Joyent, Inc.  All rights reserved.
+ */
 
 #include <sys/types.h>
 #include <sys/sysmacros.h>
 
 #include <assert.h>

@@ -39,10 +40,12 @@
 
 #include <dt_provider.h>
 #include <dt_module.h>
 #include <dt_string.h>
 #include <dt_list.h>
+#include <dt_pid.h>
+#include <dtrace.h>
 
 static dt_provider_t *
 dt_provider_insert(dtrace_hdl_t *dtp, dt_provider_t *pvp, uint_t h)
 {
         dt_list_append(&dtp->dt_provlist, pvp);

@@ -267,10 +270,25 @@
 
         xc = i;
         nc++;
 
         /*
+         * The pid provider believes in giving the kernel a break. No reason to
+         * give the kernel all the ctf containers that we're keeping ourselves
+         * just to get it back from it. So if we're coming from a pid provider
+         * probe and the kernel gave us no argument information we'll get some
+         * here. If for some crazy reason the kernel knows about our userland
+         * types then we just ignore this.
+         */
+        if (xc == 0 && nc == 0 &&
+            strncmp(pvp->pv_desc.dtvd_name, "pid", 3) == 0) {
+                nc = adc;
+                dt_pid_get_types(dtp, pdp, adv, &nc);
+                xc = nc;
+        }
+
+        /*
          * Now that we have discovered the number of native and translated
          * arguments from the argument descriptions, allocate a new probe ident
          * and corresponding dt_probe_t and hash it into the provider.
          */
         xargs = dt_probe_alloc_args(pvp, xc);

@@ -312,11 +330,12 @@
                         dtt.dtt_object = NULL;
                         dtt.dtt_ctfp = NULL;
                         dtt.dtt_type = CTF_ERR;
                 } else {
                         dt_node_type_assign(prp->pr_nargv[adp->dtargd_mapping],
-                            dtt.dtt_ctfp, dtt.dtt_type);
+                            dtt.dtt_ctfp, dtt.dtt_type,
+                            dtt.dtt_flags & DTT_FL_USER ? B_TRUE : B_FALSE);
                 }
 
                 if (dtt.dtt_type != CTF_ERR && (adp->dtargd_xlate[0] == '\0' ||
                     strcmp(adp->dtargd_native, adp->dtargd_xlate) == 0)) {
                         dt_node_type_propagate(prp->pr_nargv[

@@ -331,11 +350,11 @@
                         dtt.dtt_object = NULL;
                         dtt.dtt_ctfp = NULL;
                         dtt.dtt_type = CTF_ERR;
                 } else {
                         dt_node_type_assign(prp->pr_xargv[i],
-                            dtt.dtt_ctfp, dtt.dtt_type);
+                            dtt.dtt_ctfp, dtt.dtt_type, B_FALSE);
                 }
 
                 prp->pr_mapping[i] = adp->dtargd_mapping;
                 prp->pr_argv[i] = dtt;
         }

@@ -632,11 +651,11 @@
         }
 
         bzero(dnp, sizeof (dt_node_t));
         dnp->dn_kind = DT_NODE_TYPE;
 
-        dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type);
+        dt_node_type_assign(dnp, dtt.dtt_ctfp, dtt.dtt_type, B_FALSE);
         dt_node_attr_assign(dnp, _dtrace_defattr);
 
         return (dnp);
 }