Debian Codegraph @

tapset/linux/pstrace.stp

raw
1 /*
2 * kernel pstrace tapset
3 * Copyright (C) 2012 Red Hat Corporation.
4 *
5 * This file is part of systemtap, and is free software. You can
6 * redistribute it and/or modify it under the terms of the GNU General
7 * Public License (GPL); either version 2, or (at your option) any
8 * later version.
9 */
10
11 /**
12 * sfunction pstrace - Chain of processes and pids back to init(1)
13 * @task: Pointer to task struct of process
14 *
15 * This function returns a string listing execname and pid for each
16 * process starting from @task back to the process ancestor
17 * that init(1) spawned.
18 */
19 function pstrace:string(task:long)
20 {
21 while (task_pid(task) > 1) {
22 trace = sprintf("%s %s(%d)", trace, task_execname(task), task_pid(task));
23 task = task_parent(task);
24 }
25 return trace;
26 }