CVS commit: src/external/cddl/osnet/dist/cmd/dtrace

2018-06-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Wed Jun  6 14:46:58 UTC 2018

Modified Files:
src/external/cddl/osnet/dist/cmd/dtrace: dtrace.c

Log Message:
Correct compilation of osnet/dist/cmd/dtrace/dtrace.c under Clang

Add missing const keywords.

This could be done with -W flags, but they are incompatible between
compilers.

This is a step forward functional MKLLVM=yes HAVE_LLVM=yes build.

Sponsored by 


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.11 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.12
--- src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.11	Mon May 28 21:05:04 2018
+++ src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c	Wed Jun  6 14:46:58 2018
@@ -555,7 +555,7 @@ static void
 print_probe_info(const dtrace_probeinfo_t *p)
 {
 	char buf[BUFSIZ];
-	char *user;
+	const char *user;
 	int i;
 
 	oprintf("\n\tProbe Description Attributes\n");
@@ -1164,8 +1164,8 @@ go(void)
 	int i;
 
 	struct {
-		char *name;
-		char *optname;
+		const char *name;
+		const char *optname;
 		dtrace_optval_t val;
 	} bufs[] = {
 		{ "buffer size", "bufsize" },
@@ -1221,7 +1221,7 @@ go(void)
 
 	for (i = 0; rates[i].name != NULL; i++) {
 		dtrace_optval_t nval;
-		char *dir;
+		const char *dir;
 
 		if (rates[i].val == DTRACEOPT_UNSET)
 			continue;



CVS commit: src/external/cddl/osnet/dist/cmd/dtrace

2017-06-05 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Mon Jun  5 21:19:33 UTC 2017

Modified Files:
src/external/cddl/osnet/dist/cmd/dtrace: dtrace.c

Log Message:
Undo the previous

While it fixed the problem of trailing spaces, but if the probe specifier
contained leading spaces, it would brake dtrace. The proper fix would be
to skip the leading spaces in the string as well.

However, it would result in a bigger diff for a very small benefit. While
a new import of dtrace is impending, it's better not to have this change.

Discussed with christos.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.9 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.10
--- src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.9	Mon Jun  5 17:11:10 2017
+++ src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c	Mon Jun  5 21:19:32 2017
@@ -762,7 +762,7 @@ compile_str(dtrace_cmd_t *dcp)
 	dcp->dc_spec, g_cflags | DTRACE_C_PSPEC, g_argc, g_argv)) == NULL)
 		dfatal("invalid probe specifier %s", dcp->dc_arg);
 
-	if ((p = strpbrk(dcp->dc_arg, "{/; ")) != NULL)
+	if ((p = strpbrk(dcp->dc_arg, "{/;")) != NULL)
 		*p = '\0'; /* crop name for reporting */
 
 	dcp->dc_desc = "description";



CVS commit: src/external/cddl/osnet/dist/cmd/dtrace

2017-06-05 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Mon Jun  5 17:11:10 UTC 2017

Modified Files:
src/external/cddl/osnet/dist/cmd/dtrace: dtrace.c

Log Message:
Fix the trailing space in the probe specifier's name in dtrace(1)'s output.

When using dtrace using one of the tracing options, such as -n, -P, -i, -f etc.,
the first line of output from dtrace one is something like this:

sudo dtrace -n 'syscall:::entry /pid == 100/ {@num[probefunc] = count();}'
dtrace: description 'syscall:::entry ' matched 482 probes

There is a trailing space at the end of the probe specifier name 
('syscall:::entry ').
This happens beucase dtrace tries to separate the probe name from the predicate 
and actions
using `{' and `/' as the separators but doesn't consider space also as a 
possible separator.

Output after this change:
sudo dtrace -n 'syscall:::entry /pid == 100/ {@num[probefunc] = count();}'
dtrace: description 'syscall:::entry' matched 482 probes

ok christos@


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.8 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.9
--- src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.8	Wed Feb  1 20:02:22 2017
+++ src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c	Mon Jun  5 17:11:10 2017
@@ -762,7 +762,7 @@ compile_str(dtrace_cmd_t *dcp)
 	dcp->dc_spec, g_cflags | DTRACE_C_PSPEC, g_argc, g_argv)) == NULL)
 		dfatal("invalid probe specifier %s", dcp->dc_arg);
 
-	if ((p = strpbrk(dcp->dc_arg, "{/;")) != NULL)
+	if ((p = strpbrk(dcp->dc_arg, "{/; ")) != NULL)
 		*p = '\0'; /* crop name for reporting */
 
 	dcp->dc_desc = "description";



CVS commit: src/external/cddl/osnet/dist/cmd/dtrace

2017-05-12 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Fri May 12 21:01:36 UTC 2017

Modified Files:
src/external/cddl/osnet/dist/cmd/dtrace: dtrace.1

Log Message:
Fix a typo: s/intepretation/interpretation


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1
diff -u src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1:1.2 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1:1.3
--- src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1:1.2	Fri May 12 20:58:35 2017
+++ src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1	Fri May 12 21:01:36 2017
@@ -88,7 +88,7 @@ You can use \fBdtrace\fR to create D scr
 .SH OPTIONS
 .sp
 .LP
-The arguments accepted by the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, and \fB-i\fR options can include an optional D language \fIpredicate\fR enclosed in slashes \fB//\fR and optional D language \fIaction\fR statement list enclosed in braces \fB{}\fR. D program code specified on the command line must be appropriately quoted to avoid intepretation of meta-characters by the shell. 
+The arguments accepted by the \fB-P\fR, \fB-m\fR, \fB-f\fR, \fB-n\fR, and \fB-i\fR options can include an optional D language \fIpredicate\fR enclosed in slashes \fB//\fR and optional D language \fIaction\fR statement list enclosed in braces \fB{}\fR. D program code specified on the command line must be appropriately quoted to avoid interpretation of meta-characters by the shell. 
 .sp
 .LP
 The following options are supported:



CVS commit: src/external/cddl/osnet/dist/cmd/dtrace

2017-05-12 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Fri May 12 20:58:35 UTC 2017

Modified Files:
src/external/cddl/osnet/dist/cmd/dtrace: dtrace.1

Log Message:
Change section number from 1M to 1
The man page gets installed in section 1 anyway.

Ok christos, mrg


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1
diff -u src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1:1.1.1.1 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1:1.2
--- src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1:1.1.1.1	Sat Feb 20 04:33:34 2010
+++ src/external/cddl/osnet/dist/cmd/dtrace/dtrace.1	Fri May 12 20:58:35 2017
@@ -18,7 +18,7 @@
 .\"
 .\" CDDL HEADER END
 .\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
-.TH dtrace 1M "5 Sep 2006" "SunOS 5.11" "System Administration Commands"
+.TH dtrace 1 "5 Sep 2006" "SunOS 5.11" "System Administration Commands"
 .SH NAME
 dtrace \- DTrace dynamic tracing compiler and tracing utility
 .SH SYNOPSIS



CVS commit: src/external/cddl/osnet/dist/cmd/dtrace

2017-02-01 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Feb  1 20:02:22 UTC 2017

Modified Files:
src/external/cddl/osnet/dist/cmd/dtrace: dtrace.c

Log Message:
add some missing bits from freebsd r211554:
remove the DOODAD from prochandler().
we are now DOODAD-compatible with current freebsd.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.7 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.8
--- src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.7	Fri Feb  5 10:14:49 2016
+++ src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c	Wed Feb  1 20:02:22 2017
@@ -770,22 +770,30 @@ compile_str(dtrace_cmd_t *dcp)
 }
 
 /*ARGSUSED*/
-static void __dead
+static void
 prochandler(struct ps_prochandle *P, const char *msg, void *arg)
 {
-fatal("DOODAD in function %s, file %s, line %d\n",__FUNCTION__,__FILE__,__LINE__);
-#ifdef DOODAD
+#ifdef illumos
 	const psinfo_t *prp = Ppsinfo(P);
 	int pid = Pstatus(P)->pr_pid;
 	char name[SIG2STR_MAX];
+#else
+	int wstatus = proc_getwstat(P);
+	int pid = proc_getpid(P);
+#endif
 
 	if (msg != NULL) {
 		notice("pid %d: %s\n", pid, msg);
 		return;
 	}
 
+#ifdef illumos
 	switch (Pstate(P)) {
+#else
+	switch (proc_state(P)) {
+#endif
 	case PS_UNDEAD:
+#ifdef illumos
 		/*
 		 * Ideally we would like to always report pr_wstat here, but it
 		 * isn't possible given current /proc semantics.  If we grabbed
@@ -798,9 +806,20 @@ fatal("DOODAD in function %s, file %s, l
 			notice("pid %d terminated by %s\n", pid,
 			proc_signame(WTERMSIG(prp->pr_wstat),
 			name, sizeof (name)));
+#else
+		if (WIFSIGNALED(wstatus)) {
+			notice("pid %d terminated by %d\n", pid,
+			WTERMSIG(wstatus));
+#endif
+#ifdef illumos
 		} else if (prp != NULL && WEXITSTATUS(prp->pr_wstat) != 0) {
 			notice("pid %d exited with status %d\n",
 			pid, WEXITSTATUS(prp->pr_wstat));
+#else
+		} else if (WEXITSTATUS(wstatus) != 0) {
+			notice("pid %d exited with status %d\n",
+			pid, WEXITSTATUS(wstatus));
+#endif
 		} else {
 			notice("pid %d has exited\n", pid);
 		}
@@ -812,7 +831,6 @@ fatal("DOODAD in function %s, file %s, l
 		g_pslive--;
 		break;
 	}
-#endif
 }
 
 /*ARGSUSED*/



CVS commit: src/external/cddl/osnet/dist/cmd/dtrace

2016-02-04 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Thu Feb  4 20:05:53 UTC 2016

Modified Files:
src/external/cddl/osnet/dist/cmd/dtrace: dtrace.c

Log Message:
Add some __printflike and __dead love. Init some structs fully.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c
diff -u src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.5 src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.6
--- src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c:1.5	Sat Feb  7 20:30:03 2015
+++ src/external/cddl/osnet/dist/cmd/dtrace/dtrace.c	Thu Feb  4 20:05:53 2016
@@ -173,7 +173,7 @@ usage(FILE *fp)
 	return (E_USAGE);
 }
 
-static void
+static void __printflike(1, 0)
 verror(const char *fmt, va_list ap)
 {
 	int error = errno;
@@ -186,7 +186,7 @@ verror(const char *fmt, va_list ap)
 }
 
 /*PRINTFLIKE1*/
-static void
+static void __printflike(1, 2) __dead
 fatal(const char *fmt, ...)
 {
 	va_list ap;
@@ -199,7 +199,7 @@ fatal(const char *fmt, ...)
 }
 
 /*PRINTFLIKE1*/
-static void
+static void __printflike(1, 2) __dead
 dfatal(const char *fmt, ...)
 {
 #if !defined(sun) && defined(NEED_ERRLOC)
@@ -239,7 +239,7 @@ dfatal(const char *fmt, ...)
 }
 
 /*PRINTFLIKE1*/
-static void
+static void __printflike(1, 2)
 error(const char *fmt, ...)
 {
 	va_list ap;
@@ -250,7 +250,7 @@ error(const char *fmt, ...)
 }
 
 /*PRINTFLIKE1*/
-static void
+static void __printflike(1, 2)
 notice(const char *fmt, ...)
 {
 	va_list ap;
@@ -264,7 +264,7 @@ notice(const char *fmt, ...)
 }
 
 /*PRINTFLIKE1*/
-static void
+static void __printflike(1, 2)
 oprintf(const char *fmt, ...)
 {
 	va_list ap;
@@ -770,7 +770,7 @@ compile_str(dtrace_cmd_t *dcp)
 }
 
 /*ARGSUSED*/
-static void
+static void __dead
 prochandler(struct ps_prochandle *P, const char *msg, void *arg)
 {
 fatal("DOODAD in function %s, file %s, line %d\n",__FUNCTION__,__FILE__,__LINE__);
@@ -896,7 +896,7 @@ bufhandler(const dtrace_bufdata_t *bufda
 	{ "AGGFORMAT",	DTRACE_BUFDATA_AGGFORMAT },
 	{ "AGGLAST",	DTRACE_BUFDATA_AGGLAST },
 	{ "???",		UINT32_MAX },
-	{ NULL }
+	{ NULL,		0 }
 	};
 
 	if (bufdata->dtbda_probe != NULL) {
@@ -1052,7 +1052,7 @@ chew(const dtrace_probedata_t *data, voi
 			(void) snprintf(name, sizeof (name), "%s:%s",
 			pd->dtpd_func, pd->dtpd_name);
 
-			oprintf("%3d %6d %32s ", cpu, pd->dtpd_id, name);
+			oprintf("%3d %6d %32s ", (int)cpu, pd->dtpd_id, name);
 		}
 	} else {
 		int indent = data->dtpda_indent;
@@ -1072,7 +1072,7 @@ chew(const dtrace_probedata_t *data, voi
 			data->dtpda_prefix, pd->dtpd_func);
 		}
 
-		oprintf("%3d %-41s ", cpu, name);
+		oprintf("%3d %-41s ", (int)cpu, name);
 	}
 
 	return (DTRACE_CONSUME_THIS);
@@ -1092,11 +1092,11 @@ go(void)
 		{ "aggregation size", "aggsize", 0 },
 		{ "speculation size", "specsize", 0 },
 		{ "dynamic variable size", "dynvarsize", 0 },
-		{ NULL }
+		{ NULL, NULL, 0 }
 	}, rates[] = {
 		{ "cleaning rate", "cleanrate", 0 },
 		{ "status rate", "statusrate", 0 },
-		{ NULL }
+		{ NULL, NULL ,0 }
 	};
 
 	for (i = 0; bufs[i].name != NULL; i++) {