Skip to content

Instantly share code, notes, and snippets.

@doughgle
Created November 28, 2017 14:30
Show Gist options
  • Save doughgle/35f06326fe181b581d894514a9c2ab4f to your computer and use it in GitHub Desktop.
Save doughgle/35f06326fe181b581d894514a9c2ab4f to your computer and use it in GitHub Desktop.
hardcode line 1 of /proc/1/sched
diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
index 1ca0130..8d4e1fc 100644
--- a/kernel/sched/debug.c
+++ b/kernel/sched/debug.c
@@ -927,8 +927,11 @@ void proc_sched_show_task(struct task_struct *p, struct pid_namespace *ns,
{
unsigned long nr_switches;
- SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, task_pid_nr_ns(p, ns),
- get_nr_threads(p));
+ // always return systemd and PID 1
+ SEQ_printf(m, "systemd (1, #threads: %d)\n", get_nr_threads(p));
+ // SEQ_printf(m, "%s (%d, #threads: %d)\n", p->comm, task_pid_nr_ns(p, ns),
+ // get_nr_threads(p));
+
SEQ_printf(m,
"---------------------------------------------------------"
"----------\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment