[DTrace-devel] [PATCH 6/7] dtrace: clarity: pass NULL to dtrace_setopt() before dtrace is initialized
Nick Alcock
nick.alcock at oracle.com
Tue May 2 17:12:21 UTC 2023
This was not done in an earlier commit because it's purely a stylistic
change and doesn't affect behaviour, and it keeps earlier commits
cleaner to split it out.
Signed-off-by: Nick Alcock <nick.alcock at oracle.com>
---
cmd/dtrace.c | 37 +++++++++++++++++++------------------
1 file changed, 19 insertions(+), 18 deletions(-)
diff --git a/cmd/dtrace.c b/cmd/dtrace.c
index 0755a39e3b8b1..982a8f36decf9 100644
--- a/cmd/dtrace.c
+++ b/cmd/dtrace.c
@@ -1152,26 +1152,27 @@ main(int argc, char *argv[])
dtrace_handle_setopt_err(setopt_err_handler, NULL);
/*
- * Set default options. Because g_dtp is NULL these go into a cache of
- * default options to be validated and applied at dtrace_open time.
+ * Set default options. Because the first argument NULL these go into a
+ * cache of default options to be validated and applied at dtrace_open
+ * time.
*/
- dtrace_setopt(g_dtp, "bufsize", "4m");
- dtrace_setopt(g_dtp, "aggsize", "4m");
+ dtrace_setopt(NULL, "bufsize", "4m");
+ dtrace_setopt(NULL, "aggsize", "4m");
/*
* The very first thing we do after buffer-size sanitization is run
* through the environment and set DTrace options based on environment
* variables.
*/
- dtrace_setoptenv(g_dtp, "DTRACE_OPT_");
+ dtrace_setoptenv(NULL, "DTRACE_OPT_");
/*
* If -G is specified, enable -xlink=dynamic and -xunodefs to permit
* references to undefined symbols to remain as unresolved relocations.
*/
if (g_mode == DMODE_LINK) {
- dtrace_setopt(g_dtp, "linkmode", "dynamic");
- dtrace_setopt(g_dtp, "unodefs", NULL);
+ dtrace_setopt(NULL, "linkmode", "dynamic");
+ dtrace_setopt(NULL, "unodefs", NULL);
/*
* Use the remaining arguments as the list of object files
@@ -1196,7 +1197,7 @@ main(int argc, char *argv[])
while ((c = getopt(argc, argv, DTRACE_OPTSTR)) != EOF) {
switch (c) {
case 'b':
- dtrace_setopt(g_dtp, "bufsize", optarg);
+ dtrace_setopt(NULL, "bufsize", optarg);
break;
case 'B':
@@ -1208,7 +1209,7 @@ main(int argc, char *argv[])
break;
case 'D':
- dtrace_setopt(g_dtp, "define", optarg);
+ dtrace_setopt(NULL, "define", optarg);
break;
case 'f':
@@ -1219,11 +1220,11 @@ main(int argc, char *argv[])
break;
case 'F':
- dtrace_setopt(g_dtp, "flowindent", 0);
+ dtrace_setopt(NULL, "flowindent", 0);
break;
case 'H':
- dtrace_setopt(g_dtp, "cpphdrs", 0);
+ dtrace_setopt(NULL, "cpphdrs", 0);
break;
case 'i':
@@ -1234,11 +1235,11 @@ main(int argc, char *argv[])
break;
case 'I':
- dtrace_setopt(g_dtp, "incdir", optarg);
+ dtrace_setopt(NULL, "incdir", optarg);
break;
case 'L':
- dtrace_setopt(g_dtp, "libdir", optarg);
+ dtrace_setopt(NULL, "libdir", optarg);
break;
case 'm':
@@ -1263,7 +1264,7 @@ main(int argc, char *argv[])
break;
case 'q':
- dtrace_setopt(g_dtp, "quiet", 0);
+ dtrace_setopt(NULL, "quiet", 0);
break;
case 'o':
@@ -1282,22 +1283,22 @@ main(int argc, char *argv[])
break;
case 'U':
- dtrace_setopt(g_dtp, "undef", optarg);
+ dtrace_setopt(NULL, "undef", optarg);
break;
case 'w':
- dtrace_setopt(g_dtp, "destructive", 0);
+ dtrace_setopt(NULL, "destructive", 0);
break;
case 'x':
if ((p = strchr(optarg, '=')) != NULL)
*p++ = '\0';
- dtrace_setopt(g_dtp, optarg, p);
+ dtrace_setopt(NULL, optarg, p);
break;
case 'X':
- dtrace_setopt(g_dtp, "stdc", optarg);
+ dtrace_setopt(NULL, "stdc", optarg);
break;
case 'Z':
--
2.39.1.268.g9de2f9a303
More information about the DTrace-devel
mailing list