function show_pidtree:long(pn:long) %{ struct task_struct *task; int pid_nr = STAP_ARG_pn; struct pid_namespace *pid_ns; int indent_level = 0, i; struct pid *pid = find_get_pid(pid_nr); if (!pid) { STAP_PRINTF("Could not find pid %d\n", pid_nr); STAP_RETURN(-1); } task = pid_task(pid, PIDTYPE_PID); if (!task) { STAP_PRINTF("Cannot find task by pid %d\n", pid_nr); STAP_RETURN(-1); } pid_ns = task->nsproxy->pid_ns_for_children; do { pid_nr = __task_pid_nr_ns(task, PIDTYPE_PID, pid_ns); for (i = 0; i < indent_level; i++) STAP_PRINTF(" "); STAP_PRINTF("pid %d\n", pid_nr); pid_ns = pid_ns->parent; indent_level++; } while (pid_ns); STAP_RETURN(0); %} c 言語による処理の記述 STAP_XXX は systemtap 固有の書き方