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*/