[DTrace-devel] [PATCH 01/12] proc: use a rawtp for the proc:::exit probe

Kris Van Hees kris.van.hees at oracle.com
Fri Jan 5 05:24:38 UTC 2024


Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 libdtrace/dt_prov_proc.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/libdtrace/dt_prov_proc.c b/libdtrace/dt_prov_proc.c
index 42698e3a..d4487e4a 100644
--- a/libdtrace/dt_prov_proc.c
+++ b/libdtrace/dt_prov_proc.c
@@ -1,6 +1,6 @@
 /*
  * Oracle Linux DTrace.
- * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
  * Licensed under the Universal Permissive License v 1.0 as shown at
  * http://oss.oracle.com/licenses/upl.
  *
@@ -204,10 +204,10 @@ static void enable(dtrace_hdl_t *dtp, dt_probe_t *prp)
 	} else if (strcmp(prp->desc->prb, "exit") == 0 ||
 		   strcmp(prp->desc->prb, "lwp-exit") == 0) {
 		pd.id = DTRACE_IDNONE;
-		pd.prv = "fbt";
+		pd.prv = "rawtp";
 		pd.mod = "";
-		pd.fun = "taskstats_exit";
-		pd.prb = "entry";
+		pd.fun = "";
+		pd.prb = "sched_process_exit";
 
 		uprp = dt_probe_lookup(dtp, &pd);
 		assert(uprp != NULL);
@@ -323,7 +323,7 @@ static int trampoline(dt_pcb_t *pcb, uint_t exitlbl)
 		int		rc = 0;
 		uint_t		lbl_out = dt_irlist_label(dlp);
 
-		emit(dlp,  BPF_LOAD(BPF_DW, BPF_REG_0, BPF_REG_7, DMST_ARG(1)));
+		emit(dlp,  BPF_LOAD(BPF_DW, BPF_REG_0, BPF_REG_7, DMST_ARG(0)));
 		emit(dlp,  BPF_BRANCH_IMM(BPF_JEQ, BPF_REG_0, 0, exitlbl));
 
 		if (!cfp)
@@ -342,9 +342,9 @@ static int trampoline(dt_pcb_t *pcb, uint_t exitlbl)
 		/*
 		 * This implements:
 		 *	%r1 = tsk->exit_code
-		 *	if ((%r1 & 0x7f) == 0) args[0] = 1;
-		 *	else if (%r1 & 0x80) args[0] = 3;
-		 *	else args[0] = 2;
+		 *	if ((%r1 & 0x7f) == 0) args[0] = 1;	// CLD_EXITED
+		 *	else if (%r1 & 0x80) args[0] = 3;	// CLD_DUMPED
+		 *	else args[0] = 2;			// CLD_KILLED
 		 */
 		emit(dlp,  BPF_MOV_REG(BPF_REG_1, BPF_REG_FP));
 		emit(dlp,  BPF_ALU64_IMM(BPF_ADD, BPF_REG_1, DT_STK_SPILL(0)));
-- 
2.42.0




More information about the DTrace-devel mailing list