The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/sdt.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright 2006-2008 John Birrell <jb@FreeBSD.org>
    3  *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
   10  *    notice, this list of conditions and the following disclaimer in the
   11  *    documentation and/or other materials provided with the distribution.
   12  * 
   13  * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   16  * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
   17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   23  * SUCH DAMAGE.
   24  *
   25  * $FreeBSD: releng/11.1/sys/sys/sdt.h 315389 2017-03-16 07:20:32Z mjg $
   26  *
   27  * Statically Defined Tracing (SDT) definitions.
   28  *
   29  */
   30 
   31 #ifndef _SYS_SDT_H
   32 #define _SYS_SDT_H
   33 
   34 #ifndef _KERNEL
   35 
   36 #define _DTRACE_VERSION 1
   37 
   38 #define DTRACE_PROBE(prov, name) {                              \
   39         extern void __dtrace_##prov##___##name(void);           \
   40         __dtrace_##prov##___##name();                           \
   41 }
   42 
   43 #define DTRACE_PROBE1(prov, name, arg1) {                       \
   44         extern void __dtrace_##prov##___##name(unsigned long);  \
   45         __dtrace_##prov##___##name((unsigned long)arg1);        \
   46 }
   47 
   48 #define DTRACE_PROBE2(prov, name, arg1, arg2) {                 \
   49         extern void __dtrace_##prov##___##name(unsigned long,   \
   50             unsigned long);                                     \
   51         __dtrace_##prov##___##name((unsigned long)arg1,         \
   52             (unsigned long)arg2);                               \
   53 }
   54 
   55 #define DTRACE_PROBE3(prov, name, arg1, arg2, arg3) {           \
   56         extern void __dtrace_##prov##___##name(unsigned long,   \
   57             unsigned long, unsigned long);                      \
   58         __dtrace_##prov##___##name((unsigned long)arg1,         \
   59             (unsigned long)arg2, (unsigned long)arg3);          \
   60 }
   61 
   62 #define DTRACE_PROBE4(prov, name, arg1, arg2, arg3, arg4) {     \
   63         extern void __dtrace_##prov##___##name(unsigned long,   \
   64             unsigned long, unsigned long, unsigned long);       \
   65         __dtrace_##prov##___##name((unsigned long)arg1,         \
   66             (unsigned long)arg2, (unsigned long)arg3,           \
   67             (unsigned long)arg4);                               \
   68 }
   69 
   70 #define DTRACE_PROBE5(prov, name, arg1, arg2, arg3, arg4, arg5) {       \
   71         extern void __dtrace_##prov##___##name(unsigned long,           \
   72             unsigned long, unsigned long, unsigned long, unsigned long);\
   73         __dtrace_##prov##___##name((unsigned long)arg1,                 \
   74             (unsigned long)arg2, (unsigned long)arg3,                   \
   75             (unsigned long)arg4, (unsigned long)arg5);                  \
   76 }
   77 
   78 #else /* _KERNEL */
   79 
   80 #include <sys/cdefs.h>
   81 #include <sys/linker_set.h>
   82 
   83 #ifndef KDTRACE_HOOKS
   84 
   85 #define SDT_PROVIDER_DEFINE(prov)
   86 #define SDT_PROVIDER_DECLARE(prov)
   87 #define SDT_PROBE_DEFINE(prov, mod, func, name)
   88 #define SDT_PROBE_DECLARE(prov, mod, func, name)
   89 #define SDT_PROBE_ENABLED(prov, mod, func, name)        0
   90 #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
   91 #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype)
   92 
   93 #define SDT_PROBE_DEFINE0(prov, mod, func, name)
   94 #define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0)
   95 #define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1)
   96 #define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2)
   97 #define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3)
   98 #define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
   99 #define SDT_PROBE_DEFINE6(prov, mod, func, name, arg0, arg1, arg2,      \
  100     arg3, arg4, arg5)
  101 #define SDT_PROBE_DEFINE7(prov, mod, func, name, arg0, arg1, arg2,      \
  102     arg3, arg4, arg5, arg6)
  103 
  104 #define SDT_PROBE0(prov, mod, func, name)
  105 #define SDT_PROBE1(prov, mod, func, name, arg0)
  106 #define SDT_PROBE2(prov, mod, func, name, arg0, arg1)
  107 #define SDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2)
  108 #define SDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3)
  109 #define SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
  110 #define SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5)
  111 #define SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5,  \
  112     arg6)
  113 
  114 #define SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name)
  115 #define SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, arg0, xarg0)
  116 #define SDT_PROBE_DEFINE2_XLATE(prov, mod, func, name, arg0, xarg0,     \
  117     arg1, xarg1)
  118 #define SDT_PROBE_DEFINE3_XLATE(prov, mod, func, name, arg0, xarg0,     \
  119     arg1, xarg1, arg2, xarg2)
  120 #define SDT_PROBE_DEFINE4_XLATE(prov, mod, func, name, arg0, xarg0,     \
  121     arg1, xarg1, arg2, xarg2, arg3, xarg3)
  122 #define SDT_PROBE_DEFINE5_XLATE(prov, mod, func, name, arg0, xarg0,     \
  123     arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4)
  124 #define SDT_PROBE_DEFINE6_XLATE(prov, mod, func, name, arg0, xarg0,     \
  125     arg1,  xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5)
  126 #define SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, arg0, xarg0,     \
  127     arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6,     \
  128     xarg6)
  129 
  130 #define DTRACE_PROBE(name)
  131 #define DTRACE_PROBE1(name, type0, arg0)
  132 #define DTRACE_PROBE2(name, type0, arg0, type1, arg1)
  133 #define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2)
  134 #define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3)
  135 #define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3,\
  136     type4, arg4)
  137 
  138 #else
  139 
  140 SET_DECLARE(sdt_providers_set, struct sdt_provider);
  141 SET_DECLARE(sdt_probes_set, struct sdt_probe);
  142 SET_DECLARE(sdt_argtypes_set, struct sdt_argtype);
  143 
  144 #define SDT_PROVIDER_DEFINE(prov)                                               \
  145         struct sdt_provider sdt_provider_##prov[1] = {                          \
  146                 { #prov, { NULL, NULL }, 0, 0 }                                 \
  147         };                                                                      \
  148         DATA_SET(sdt_providers_set, sdt_provider_##prov);
  149 
  150 #define SDT_PROVIDER_DECLARE(prov)                                              \
  151         extern struct sdt_provider sdt_provider_##prov[1]
  152 
  153 #define SDT_PROBE_DEFINE(prov, mod, func, name)                                 \
  154         struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1] = {            \
  155                 { sizeof(struct sdt_probe), sdt_provider_##prov,                \
  156                     { NULL, NULL }, { NULL, NULL }, #mod, #func, #name, 0, 0,   \
  157                     NULL }                                                      \
  158         };                                                                      \
  159         DATA_SET(sdt_probes_set, sdt_##prov##_##mod##_##func##_##name);
  160 
  161 #define SDT_PROBE_DECLARE(prov, mod, func, name)                                \
  162         extern struct sdt_probe sdt_##prov##_##mod##_##func##_##name[1]
  163 
  164 #define SDT_PROBE_ENABLED(prov, mod, func, name)                                \
  165         __predict_false((sdt_##prov##_##mod##_##func##_##name->id))
  166 
  167 #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)  do {    \
  168         if (__predict_false(sdt_##prov##_##mod##_##func##_##name->id))          \
  169                 (*sdt_probe_func)(sdt_##prov##_##mod##_##func##_##name->id,     \
  170                     (uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2,       \
  171                     (uintptr_t) arg3, (uintptr_t) arg4);                        \
  172 } while (0)
  173 
  174 #define SDT_PROBE_ARGTYPE(prov, mod, func, name, num, type, xtype)              \
  175         static struct sdt_argtype sdta_##prov##_##mod##_##func##_##name##num[1] \
  176             = { { num, type, xtype, { NULL, NULL },                             \
  177             sdt_##prov##_##mod##_##func##_##name }                              \
  178         };                                                                      \
  179         DATA_SET(sdt_argtypes_set, sdta_##prov##_##mod##_##func##_##name##num);
  180 
  181 #define SDT_PROBE_DEFINE0(prov, mod, func, name)                        \
  182         SDT_PROBE_DEFINE(prov, mod, func, name)
  183 
  184 #define SDT_PROBE_DEFINE1(prov, mod, func, name, arg0)                  \
  185         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  186         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL)
  187 
  188 #define SDT_PROBE_DEFINE2(prov, mod, func, name, arg0, arg1)            \
  189         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  190         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);        \
  191         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL)
  192 
  193 #define SDT_PROBE_DEFINE3(prov, mod, func, name, arg0, arg1, arg2)\
  194         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  195         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);        \
  196         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL);        \
  197         SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL)
  198 
  199 #define SDT_PROBE_DEFINE4(prov, mod, func, name, arg0, arg1, arg2, arg3) \
  200         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  201         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);        \
  202         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL);        \
  203         SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL);        \
  204         SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL)
  205 
  206 #define SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \
  207         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  208         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);        \
  209         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL);        \
  210         SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL);        \
  211         SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL);        \
  212         SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL)
  213 
  214 #define SDT_PROBE_DEFINE6(prov, mod, func, name, arg0, arg1, arg2, arg3,\
  215     arg4, arg5) \
  216         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  217         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);        \
  218         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL);        \
  219         SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL);        \
  220         SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL);        \
  221         SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL);        \
  222         SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL)
  223 
  224 #define SDT_PROBE_DEFINE7(prov, mod, func, name, arg0, arg1, arg2, arg3,\
  225     arg4, arg5, arg6) \
  226         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  227         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);        \
  228         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL);        \
  229         SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL);        \
  230         SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL);        \
  231         SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL);        \
  232         SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL);        \
  233         SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, NULL)
  234 
  235 #define SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name)          \
  236         SDT_PROBE_DEFINE(prov, mod, func, name)
  237 
  238 #define SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, arg0, xarg0) \
  239         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  240         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0)
  241 
  242 #define SDT_PROBE_DEFINE2_XLATE(prov, mod, func, name, arg0, xarg0, \
  243     arg1,  xarg1)                                                       \
  244         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  245         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);       \
  246         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1)
  247 
  248 #define SDT_PROBE_DEFINE3_XLATE(prov, mod, func, name, arg0, xarg0, \
  249     arg1, xarg1, arg2, xarg2)                                           \
  250         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  251         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);       \
  252         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1);       \
  253         SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2)
  254 
  255 #define SDT_PROBE_DEFINE4_XLATE(prov, mod, func, name, arg0, xarg0, \
  256     arg1, xarg1, arg2, xarg2, arg3, xarg3)                              \
  257         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  258         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);       \
  259         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1);       \
  260         SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2);       \
  261         SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3)
  262 
  263 #define SDT_PROBE_DEFINE5_XLATE(prov, mod, func, name, arg0, xarg0, \
  264     arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4)                 \
  265         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  266         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);       \
  267         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1);       \
  268         SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2);       \
  269         SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3);       \
  270         SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4)
  271 
  272 #define SDT_PROBE_DEFINE6_XLATE(prov, mod, func, name, arg0, xarg0, \
  273     arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5)    \
  274         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  275         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);       \
  276         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1);       \
  277         SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2);       \
  278         SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3);       \
  279         SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4);       \
  280         SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5)
  281 
  282 #define SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, arg0, xarg0, \
  283     arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \
  284     xarg6)                                                              \
  285         SDT_PROBE_DEFINE(prov, mod, func, name);                        \
  286         SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);       \
  287         SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1);       \
  288         SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2);       \
  289         SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3);       \
  290         SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4);       \
  291         SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5);       \
  292         SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, xarg6)
  293 
  294 #define SDT_PROBE0(prov, mod, func, name)                               \
  295         SDT_PROBE(prov, mod, func, name, 0, 0, 0, 0, 0)
  296 #define SDT_PROBE1(prov, mod, func, name, arg0)                         \
  297         SDT_PROBE(prov, mod, func, name, arg0, 0, 0, 0, 0)
  298 #define SDT_PROBE2(prov, mod, func, name, arg0, arg1)                   \
  299         SDT_PROBE(prov, mod, func, name, arg0, arg1, 0, 0, 0)
  300 #define SDT_PROBE3(prov, mod, func, name, arg0, arg1, arg2)             \
  301         SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2,  0, 0)
  302 #define SDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3)       \
  303         SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, 0)
  304 #define SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \
  305         SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)
  306 #define SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5)  \
  307         do {                                                                   \
  308                 if (sdt_##prov##_##mod##_##func##_##name->id)                  \
  309                         (*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \
  310                             uintptr_t, uintptr_t, uintptr_t))sdt_probe_func)(  \
  311                             sdt_##prov##_##mod##_##func##_##name->id,          \
  312                             (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \
  313                             (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5);\
  314         } while (0)
  315 #define SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5,  \
  316     arg6)                                                                      \
  317         do {                                                                   \
  318                 if (sdt_##prov##_##mod##_##func##_##name->id)                  \
  319                         (*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \
  320                             uintptr_t, uintptr_t, uintptr_t, uintptr_t))       \
  321                             sdt_probe_func)(                                   \
  322                             sdt_##prov##_##mod##_##func##_##name->id,          \
  323                             (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \
  324                             (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, \
  325                             (uintptr_t)arg6);                                  \
  326         } while (0)
  327 
  328 #define DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4)     do { \
  329         static SDT_PROBE_DEFINE(sdt, , , name);                              \
  330         SDT_PROBE(sdt, , , name, arg0, arg1, arg2, arg3, arg4);
  331 #define DTRACE_PROBE_IMPL_END   } while (0)
  332 
  333 #define DTRACE_PROBE(name)                                              \
  334         DTRACE_PROBE_IMPL_START(name, 0, 0, 0, 0, 0)                    \
  335         DTRACE_PROBE_IMPL_END
  336 
  337 #define DTRACE_PROBE1(name, type0, arg0)                                \
  338         DTRACE_PROBE_IMPL_START(name, arg0, 0, 0, 0, 0)                 \
  339         SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL);              \
  340         DTRACE_PROBE_IMPL_END
  341 
  342 #define DTRACE_PROBE2(name, type0, arg0, type1, arg1)                   \
  343         DTRACE_PROBE_IMPL_START(name, arg0, arg1, 0, 0, 0)              \
  344         SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL);              \
  345         SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL);              \
  346         DTRACE_PROBE_IMPL_END
  347 
  348 #define DTRACE_PROBE3(name, type0, arg0, type1, arg1, type2, arg2)      \
  349         DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, 0, 0)           \
  350         SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL);              \
  351         SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL);              \
  352         SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL);              \
  353         DTRACE_PROBE_IMPL_END
  354 
  355 #define DTRACE_PROBE4(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3) \
  356         DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, 0)        \
  357         SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL);              \
  358         SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL);              \
  359         SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL);              \
  360         SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL);              \
  361         DTRACE_PROBE_IMPL_END
  362 
  363 #define DTRACE_PROBE5(name, type0, arg0, type1, arg1, type2, arg2, type3, arg3, \
  364     type4, arg4)                                                                \
  365         DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4)     \
  366         SDT_PROBE_ARGTYPE(sdt, , , name, 0, #type0, NULL);              \
  367         SDT_PROBE_ARGTYPE(sdt, , , name, 1, #type1, NULL);              \
  368         SDT_PROBE_ARGTYPE(sdt, , , name, 2, #type2, NULL);              \
  369         SDT_PROBE_ARGTYPE(sdt, , , name, 3, #type3, NULL);              \
  370         SDT_PROBE_ARGTYPE(sdt, , , name, 4, #type4, NULL);              \
  371         DTRACE_PROBE_IMPL_END
  372 
  373 #endif /* KDTRACE_HOOKS */
  374 
  375 /*
  376  * This type definition must match that of dtrace_probe. It is defined this
  377  * way to avoid having to rely on CDDL code.
  378  */
  379 typedef void (*sdt_probe_func_t)(uint32_t, uintptr_t arg0, uintptr_t arg1,
  380     uintptr_t arg2, uintptr_t arg3, uintptr_t arg4);
  381 
  382 /*
  383  * The 'sdt' provider will set it to dtrace_probe when it loads.
  384  */
  385 extern sdt_probe_func_t sdt_probe_func;
  386 
  387 struct sdt_probe;
  388 struct sdt_provider;
  389 struct linker_file;
  390 
  391 struct sdt_argtype {
  392         int             ndx;            /* Argument index. */
  393         const char      *type;          /* Argument type string. */
  394         const char      *xtype;         /* Translated argument type. */
  395         TAILQ_ENTRY(sdt_argtype)
  396                         argtype_entry;  /* Argument type list entry. */
  397         struct sdt_probe *probe;        /* Ptr to the probe structure. */
  398 };
  399 
  400 struct sdt_probe {
  401         int             version;        /* Set to sizeof(struct sdt_probe). */
  402         struct sdt_provider *prov;      /* Ptr to the provider structure. */
  403         TAILQ_ENTRY(sdt_probe)
  404                         probe_entry;    /* SDT probe list entry. */
  405         TAILQ_HEAD(, sdt_argtype) argtype_list;
  406         const char      *mod;
  407         const char      *func;
  408         const char      *name;
  409         id_t            id;             /* DTrace probe ID. */
  410         int             n_args;         /* Number of arguments. */
  411         struct linker_file *sdtp_lf;    /* Module in which we're defined. */
  412 };
  413 
  414 struct sdt_provider {
  415         char *name;                     /* Provider name. */
  416         TAILQ_ENTRY(sdt_provider)
  417                         prov_entry;     /* SDT provider list entry. */
  418         uintptr_t       id;             /* DTrace provider ID. */
  419         int             sdt_refs;       /* Number of module references. */
  420 };
  421 
  422 void sdt_probe_stub(uint32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t,
  423     uintptr_t);
  424 
  425 SDT_PROVIDER_DECLARE(sdt);
  426 
  427 #endif /* _KERNEL */
  428 
  429 #endif /* _SYS_SDT_H */

Cache object: 8ed619e501470ff360f3ee2bf562cc6c


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.