Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/cddl/osnet/dist/cmd/dtrace add some missing bits fr...
details: https://anonhg.NetBSD.org/src/rev/8029ebdb2624
branches: trunk
changeset: 351089:8029ebdb2624
user: chs <chs%NetBSD.org@localhost>
date: Wed Feb 01 20:02:22 2017 +0000
description:
add some missing bits from freebsd r211554:
remove the DOODAD from prochandler().
we are now DOODAD-compatible with current freebsd.
diffstat:
external/cddl/osnet/dist/cmd/dtrace/dtrace.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diffs (66 lines):
diff -r 7e93b3ca8813 -r 8029ebdb2624 external/cddl/osnet/dist/cmd/dtrace/dtrace.c
--- a/external/cddl/osnet/dist/cmd/dtrace/dtrace.c Wed Feb 01 20:01:39 2017 +0000
+++ b/external/cddl/osnet/dist/cmd/dtrace/dtrace.c Wed Feb 01 20:02:22 2017 +0000
@@ -770,22 +770,30 @@
}
/*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 @@
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 @@
g_pslive--;
break;
}
-#endif
}
/*ARGSUSED*/
Home |
Main Index |
Thread Index |
Old Index