diff options
author | Justus Winter <justus@gnupg.org> | 2016-11-01 14:38:27 +0100 |
---|---|---|
committer | Justus Winter <justus@gnupg.org> | 2016-11-01 15:18:19 +0100 |
commit | 34b5aa167da439900c4c1d1bb45b642b47d9a572 (patch) | |
tree | 3706805b15b1497d5f987459f280c31687f6e159 | |
parent | ccfdec8708430e4255b4d24424aafbd0d5f4c32d (diff) |
startup: Dump processes if we cannot find the kernel.
* startup/startup.c (dump_processes): New function.
(frob_kerne_process): Use the new function.
-rw-r--r-- | startup/startup.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/startup/startup.c b/startup/startup.c index f54de5ec..2eba5636 100644 --- a/startup/startup.c +++ b/startup/startup.c @@ -880,6 +880,23 @@ init_stdarrays () so the kernel command line can be read as for a normal Hurd process. */ void +dump_processes (void) +{ + pid_t pid; + for (pid = 1; pid < 100; pid++) + { + char args[256], *buffer = args; + size_t len = sizeof args; + if (proc_getprocargs (procserver, pid, &buffer, &len) == 0) + { + fprintf (stderr, "pid%d\t%s\n", (int) pid, buffer); + if (buffer != args) + vm_deallocate (mach_task_self (), (vm_offset_t) buffer, len); + } + } +} + +void frob_kernel_process (void) { error_t err; @@ -904,7 +921,10 @@ frob_kernel_process (void) /* Make the kernel our child. */ err = proc_child (procserver, task); if (err) - error (0, err, "cannot make the kernel our child"); + { + error (0, err, "cannot make the kernel our child"); + dump_processes (); + } err = proc_task2proc (procserver, task, &proc); if (err) |