Sun Apr 19 03:12:26 2020 UTC ()
do {...} while (0) to make DTRACE_PROBE macros proper statements.


(riastradh)
diff -r1.12 -r1.13 src/sys/sys/sdt.h

cvs diff -r1.12 -r1.13 src/sys/sys/sdt.h (expand / switch to unified diff)

--- src/sys/sys/sdt.h 2019/10/16 18:29:49 1.12
+++ src/sys/sys/sdt.h 2020/04/19 03:12:26 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: sdt.h,v 1.12 2019/10/16 18:29:49 christos Exp $ */ 1/* $NetBSD: sdt.h,v 1.13 2020/04/19 03:12:26 riastradh Exp $ */
2 2
3/*- 3/*-
4 * Copyright 2006-2008 John Birrell <jb@FreeBSD.org> 4 * Copyright 2006-2008 John Birrell <jb@FreeBSD.org>
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 *  14 *
@@ -27,65 +27,65 @@ @@ -27,65 +27,65 @@
27 * $FreeBSD: head/sys/sys/sdt.h 270990 2014-09-02 23:43:06Z markj $ 27 * $FreeBSD: head/sys/sys/sdt.h 270990 2014-09-02 23:43:06Z markj $
28 * 28 *
29 * Statically Defined Tracing (SDT) definitions. 29 * Statically Defined Tracing (SDT) definitions.
30 * 30 *
31 */ 31 */
32 32
33#ifndef _SYS_SDT_H 33#ifndef _SYS_SDT_H
34#define _SYS_SDT_H 34#define _SYS_SDT_H
35 35
36#ifndef _KERNEL 36#ifndef _KERNEL
37 37
38#define _DTRACE_VERSION 1 38#define _DTRACE_VERSION 1
39 39
40#define DTRACE_PROBE(prov, name) { \ 40#define DTRACE_PROBE(prov, name) do { \
41 extern void __dtrace_##prov##___##name(void); \ 41 extern void __dtrace_##prov##___##name(void); \
42 __dtrace_##prov##___##name(); \ 42 __dtrace_##prov##___##name(); \
43} 43} while (0)
44 44
45#define DTRACE_PROBE1(prov, name, arg1) { \ 45#define DTRACE_PROBE1(prov, name, arg1) do { \
46 extern void __dtrace_##prov##___##name(unsigned long); \ 46 extern void __dtrace_##prov##___##name(unsigned long); \
47 __dtrace_##prov##___##name((unsigned long)arg1); \ 47 __dtrace_##prov##___##name((unsigned long)arg1); \
48} 48} while (0)
49 49
50#define DTRACE_PROBE2(prov, name, arg1, arg2) { \ 50#define DTRACE_PROBE2(prov, name, arg1, arg2) do { \
51 extern void __dtrace_##prov##___##name(unsigned long, \ 51 extern void __dtrace_##prov##___##name(unsigned long, \
52 unsigned long); \ 52 unsigned long); \
53 __dtrace_##prov##___##name((unsigned long)arg1, \ 53 __dtrace_##prov##___##name((unsigned long)arg1, \
54 (unsigned long)arg2); \ 54 (unsigned long)arg2); \
55} 55} while (0)
56 56
57#define DTRACE_PROBE3(prov, name, arg1, arg2, arg3) { \ 57#define DTRACE_PROBE3(prov, name, arg1, arg2, arg3) do { \
58 extern void __dtrace_##prov##___##name(unsigned long, \ 58 extern void __dtrace_##prov##___##name(unsigned long, \
59 unsigned long, unsigned long); \ 59 unsigned long, unsigned long); \
60 __dtrace_##prov##___##name((unsigned long)arg1, \ 60 __dtrace_##prov##___##name((unsigned long)arg1, \
61 (unsigned long)arg2, (unsigned long)arg3); \ 61 (unsigned long)arg2, (unsigned long)arg3); \
62} 62} while (0)
63 63
64#define DTRACE_PROBE4(prov, name, arg1, arg2, arg3, arg4) { \ 64#define DTRACE_PROBE4(prov, name, arg1, arg2, arg3, arg4) do { \
65 extern void __dtrace_##prov##___##name(unsigned long, \ 65 extern void __dtrace_##prov##___##name(unsigned long, \
66 unsigned long, unsigned long, unsigned long); \ 66 unsigned long, unsigned long, unsigned long); \
67 __dtrace_##prov##___##name((unsigned long)arg1, \ 67 __dtrace_##prov##___##name((unsigned long)arg1, \
68 (unsigned long)arg2, (unsigned long)arg3, \ 68 (unsigned long)arg2, (unsigned long)arg3, \
69 (unsigned long)arg4); \ 69 (unsigned long)arg4); \
70} 70} while (0)
71 71
72#define DTRACE_PROBE5(prov, name, arg1, arg2, arg3, arg4, arg5) { \ 72#define DTRACE_PROBE5(prov, name, arg1, arg2, arg3, arg4, arg5) do { \
73 extern void __dtrace_##prov##___##name(unsigned long, \ 73 extern void __dtrace_##prov##___##name(unsigned long, \
74 unsigned long, unsigned long, unsigned long, unsigned long);\ 74 unsigned long, unsigned long, unsigned long, unsigned long);\
75 __dtrace_##prov##___##name((unsigned long)arg1, \ 75 __dtrace_##prov##___##name((unsigned long)arg1, \
76 (unsigned long)arg2, (unsigned long)arg3, \ 76 (unsigned long)arg2, (unsigned long)arg3, \
77 (unsigned long)arg4, (unsigned long)arg5); \ 77 (unsigned long)arg4, (unsigned long)arg5); \
78} 78} while (0)
79 79
80#else /* _KERNEL */ 80#else /* _KERNEL */
81 81
82#include <sys/cdefs.h> 82#include <sys/cdefs.h>
83#include <sys/queue.h> 83#include <sys/queue.h>
84 84
85#ifdef _KERNEL_OPT 85#ifdef _KERNEL_OPT
86#include "opt_dtrace.h" 86#include "opt_dtrace.h"
87#endif 87#endif
88 88
89#ifndef KDTRACE_HOOKS 89#ifndef KDTRACE_HOOKS
90 90
91#define SDT_PROVIDER_DEFINE(prov) 91#define SDT_PROVIDER_DEFINE(prov)