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>


   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2011, Joyent, Inc. All rights reserved.
  25  * Copyright (c) 2012 by Delphix. All rights reserved.
  26  */
  27 
  28 #include <sys/sysmacros.h>
  29 #include <strings.h>
  30 #include <stdlib.h>
  31 #include <alloca.h>
  32 #include <assert.h>
  33 #include <ctype.h>
  34 #include <errno.h>
  35 #include <limits.h>
  36 #include <sys/socket.h>
  37 #include <netdb.h>
  38 #include <netinet/in.h>
  39 #include <arpa/inet.h>
  40 #include <arpa/nameser.h>
  41 
  42 #include <dt_printf.h>
  43 #include <dt_string.h>
  44 #include <dt_impl.h>
  45 


1031                 xyerror(D_PRINTF_FMT_EMPTY,
1032                     "%s( ) format string is empty\n", func);
1033         }
1034 
1035         pfv->pfv_flags = flags;
1036 
1037         /*
1038          * We fake up a parse node representing the type that can be used with
1039          * an aggregation result conversion, which -- for all but count() --
1040          * is a signed quantity.
1041          */
1042         if (kind != DTRACEAGG_COUNT)
1043                 aggtype = "int64_t";
1044         else
1045                 aggtype = "uint64_t";
1046 
1047         if (dt_type_lookup(aggtype, &dtt) != 0)
1048                 xyerror(D_TYPE_ERR, "failed to lookup agg type %s\n", aggtype);
1049 
1050         bzero(&aggnode, sizeof (aggnode));
1051         dt_node_type_assign(&aggnode, dtt.dtt_ctfp, dtt.dtt_type);
1052 
1053         for (i = 0, j = 0; i < pfv->pfv_argc; i++, pfd = pfd->pfd_next) {
1054                 const dt_pfconv_t *pfc = pfd->pfd_conv;
1055                 const char *dyns[2];
1056                 int dync = 0;
1057 
1058                 char vname[64];
1059                 dt_node_t *vnp;
1060 
1061                 if (pfc == NULL)
1062                         continue; /* no checking if argd is just a prefix */
1063 
1064                 if (pfc->pfc_print == &pfprint_pct) {
1065                         (void) strcat(pfd->pfd_fmt, pfc->pfc_ofmt);
1066                         continue;
1067                 }
1068 
1069                 if (pfd->pfd_flags & DT_PFCONV_DYNPREC)
1070                         dyns[dync++] = ".*";
1071                 if (pfd->pfd_flags & DT_PFCONV_DYNWIDTH)




   4  * The contents of this file are subject to the terms of the
   5  * Common Development and Distribution License (the "License").
   6  * You may not use this file except in compliance with the License.
   7  *
   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 (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright (c) 2013, Joyent, Inc. All rights reserved.
  25  * Copyright (c) 2013 by Delphix. All rights reserved.
  26  */
  27 
  28 #include <sys/sysmacros.h>
  29 #include <strings.h>
  30 #include <stdlib.h>
  31 #include <alloca.h>
  32 #include <assert.h>
  33 #include <ctype.h>
  34 #include <errno.h>
  35 #include <limits.h>
  36 #include <sys/socket.h>
  37 #include <netdb.h>
  38 #include <netinet/in.h>
  39 #include <arpa/inet.h>
  40 #include <arpa/nameser.h>
  41 
  42 #include <dt_printf.h>
  43 #include <dt_string.h>
  44 #include <dt_impl.h>
  45 


1031                 xyerror(D_PRINTF_FMT_EMPTY,
1032                     "%s( ) format string is empty\n", func);
1033         }
1034 
1035         pfv->pfv_flags = flags;
1036 
1037         /*
1038          * We fake up a parse node representing the type that can be used with
1039          * an aggregation result conversion, which -- for all but count() --
1040          * is a signed quantity.
1041          */
1042         if (kind != DTRACEAGG_COUNT)
1043                 aggtype = "int64_t";
1044         else
1045                 aggtype = "uint64_t";
1046 
1047         if (dt_type_lookup(aggtype, &dtt) != 0)
1048                 xyerror(D_TYPE_ERR, "failed to lookup agg type %s\n", aggtype);
1049 
1050         bzero(&aggnode, sizeof (aggnode));
1051         dt_node_type_assign(&aggnode, dtt.dtt_ctfp, dtt.dtt_type, B_FALSE);
1052 
1053         for (i = 0, j = 0; i < pfv->pfv_argc; i++, pfd = pfd->pfd_next) {
1054                 const dt_pfconv_t *pfc = pfd->pfd_conv;
1055                 const char *dyns[2];
1056                 int dync = 0;
1057 
1058                 char vname[64];
1059                 dt_node_t *vnp;
1060 
1061                 if (pfc == NULL)
1062                         continue; /* no checking if argd is just a prefix */
1063 
1064                 if (pfc->pfc_print == &pfprint_pct) {
1065                         (void) strcat(pfd->pfd_fmt, pfc->pfc_ofmt);
1066                         continue;
1067                 }
1068 
1069                 if (pfd->pfd_flags & DT_PFCONV_DYNPREC)
1070                         dyns[dync++] = ".*";
1071                 if (pfd->pfd_flags & DT_PFCONV_DYNWIDTH)