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>


   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 /*
  27  * Copyright (c) 2012 by Delphix. All rights reserved.

  28  */
  29 
  30 #include <sys/types.h>
  31 #include <sys/stat.h>
  32 #include <sys/wait.h>
  33 
  34 #include <dtrace.h>
  35 #include <stdlib.h>
  36 #include <stdarg.h>
  37 #include <stdio.h>
  38 #include <strings.h>
  39 #include <unistd.h>
  40 #include <limits.h>
  41 #include <fcntl.h>
  42 #include <errno.h>
  43 #include <signal.h>
  44 #include <alloca.h>
  45 #include <libgen.h>
  46 #include <libproc.h>
  47 


 471         if (nmods >= sizeof (mods) / sizeof (char *))
 472                 fatal("unexpectedly large number of modules!");
 473 
 474         mods[nmods++] = "dtrace";
 475 
 476         for (line = 0; line < nmods; line++)
 477                 oprintf("forceload: drv/%s\n", mods[line]);
 478 
 479         oprintf("%s\n", g_etcend);
 480 
 481         if (fclose(g_ofp) == EOF)
 482                 fatal("failed to close output file '%s'", g_ofile);
 483 
 484         error("added forceload directives to %s\n", g_ofile);
 485 }
 486 
 487 static void
 488 print_probe_info(const dtrace_probeinfo_t *p)
 489 {
 490         char buf[BUFSIZ];

 491         int i;
 492 
 493         oprintf("\n\tProbe Description Attributes\n");
 494 
 495         oprintf("\t\tIdentifier Names: %s\n",
 496             dtrace_stability_name(p->dtp_attr.dtat_name));
 497         oprintf("\t\tData Semantics:   %s\n",
 498             dtrace_stability_name(p->dtp_attr.dtat_data));
 499         oprintf("\t\tDependency Class: %s\n",
 500             dtrace_class_name(p->dtp_attr.dtat_class));
 501 
 502         oprintf("\n\tArgument Attributes\n");
 503 
 504         oprintf("\t\tIdentifier Names: %s\n",
 505             dtrace_stability_name(p->dtp_arga.dtat_name));
 506         oprintf("\t\tData Semantics:   %s\n",
 507             dtrace_stability_name(p->dtp_arga.dtat_data));
 508         oprintf("\t\tDependency Class: %s\n",
 509             dtrace_class_name(p->dtp_arga.dtat_class));
 510 
 511         oprintf("\n\tArgument Types\n");
 512 
 513         for (i = 0; i < p->dtp_argc; i++) {




 514                 if (ctf_type_name(p->dtp_argv[i].dtt_ctfp,
 515                     p->dtp_argv[i].dtt_type, buf, sizeof (buf)) == NULL)
 516                         (void) strlcpy(buf, "(unknown)", sizeof (buf));
 517                 oprintf("\t\targs[%d]: %s\n", i, buf);
 518         }
 519 
 520         if (p->dtp_argc == 0)
 521                 oprintf("\t\tNone\n");
 522 
 523         oprintf("\n");
 524 }
 525 
 526 /*ARGSUSED*/
 527 static int
 528 info_stmt(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
 529     dtrace_stmtdesc_t *stp, dtrace_ecbdesc_t **last)
 530 {
 531         dtrace_ecbdesc_t *edp = stp->dtsd_ecbdesc;
 532         dtrace_probedesc_t *pdp = &edp->dted_probe;
 533         dtrace_probeinfo_t p;
 534 
 535         if (edp == *last)
 536                 return (0);
 537 




   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 
  22 /*
  23  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 /*
  27  * Copyright (c) 2012 by Delphix. All rights reserved.
  28  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  29  */
  30 
  31 #include <sys/types.h>
  32 #include <sys/stat.h>
  33 #include <sys/wait.h>
  34 
  35 #include <dtrace.h>
  36 #include <stdlib.h>
  37 #include <stdarg.h>
  38 #include <stdio.h>
  39 #include <strings.h>
  40 #include <unistd.h>
  41 #include <limits.h>
  42 #include <fcntl.h>
  43 #include <errno.h>
  44 #include <signal.h>
  45 #include <alloca.h>
  46 #include <libgen.h>
  47 #include <libproc.h>
  48 


 472         if (nmods >= sizeof (mods) / sizeof (char *))
 473                 fatal("unexpectedly large number of modules!");
 474 
 475         mods[nmods++] = "dtrace";
 476 
 477         for (line = 0; line < nmods; line++)
 478                 oprintf("forceload: drv/%s\n", mods[line]);
 479 
 480         oprintf("%s\n", g_etcend);
 481 
 482         if (fclose(g_ofp) == EOF)
 483                 fatal("failed to close output file '%s'", g_ofile);
 484 
 485         error("added forceload directives to %s\n", g_ofile);
 486 }
 487 
 488 static void
 489 print_probe_info(const dtrace_probeinfo_t *p)
 490 {
 491         char buf[BUFSIZ];
 492         char *user;
 493         int i;
 494 
 495         oprintf("\n\tProbe Description Attributes\n");
 496 
 497         oprintf("\t\tIdentifier Names: %s\n",
 498             dtrace_stability_name(p->dtp_attr.dtat_name));
 499         oprintf("\t\tData Semantics:   %s\n",
 500             dtrace_stability_name(p->dtp_attr.dtat_data));
 501         oprintf("\t\tDependency Class: %s\n",
 502             dtrace_class_name(p->dtp_attr.dtat_class));
 503 
 504         oprintf("\n\tArgument Attributes\n");
 505 
 506         oprintf("\t\tIdentifier Names: %s\n",
 507             dtrace_stability_name(p->dtp_arga.dtat_name));
 508         oprintf("\t\tData Semantics:   %s\n",
 509             dtrace_stability_name(p->dtp_arga.dtat_data));
 510         oprintf("\t\tDependency Class: %s\n",
 511             dtrace_class_name(p->dtp_arga.dtat_class));
 512 
 513         oprintf("\n\tArgument Types\n");
 514 
 515         for (i = 0; i < p->dtp_argc; i++) {
 516                 if (p->dtp_argv[i].dtt_flags & DTT_FL_USER)
 517                         user = "userland ";
 518                 else
 519                         user = "";
 520                 if (ctf_type_name(p->dtp_argv[i].dtt_ctfp,
 521                     p->dtp_argv[i].dtt_type, buf, sizeof (buf)) == NULL)
 522                         (void) strlcpy(buf, "(unknown)", sizeof (buf));
 523                 oprintf("\t\targs[%d]: %s%s\n", i, user, buf);
 524         }
 525 
 526         if (p->dtp_argc == 0)
 527                 oprintf("\t\tNone\n");
 528 
 529         oprintf("\n");
 530 }
 531 
 532 /*ARGSUSED*/
 533 static int
 534 info_stmt(dtrace_hdl_t *dtp, dtrace_prog_t *pgp,
 535     dtrace_stmtdesc_t *stp, dtrace_ecbdesc_t **last)
 536 {
 537         dtrace_ecbdesc_t *edp = stp->dtsd_ecbdesc;
 538         dtrace_probedesc_t *pdp = &edp->dted_probe;
 539         dtrace_probeinfo_t p;
 540 
 541         if (edp == *last)
 542                 return (0);
 543