summaryrefslogtreecommitdiff
path: root/boot/boot.c
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2017-02-28 17:57:37 +0100
committerJustus Winter <justus@gnupg.org>2017-02-28 18:02:40 +0100
commit5ac0c5c8e2e13217aabe7dd6e91ff218d0db6346 (patch)
tree7f6da331d141f618c13c6862843d394776dff3cd /boot/boot.c
parent9beba9b6d168f59eeb74859ab5d88d9cabfe6f37 (diff)
boot: Add a verbose option.
* boot/boot.c (verbose): New variable. (options): New option. (parse_opt): Handle new option. (ds_device_open): Be verbose if so desired. (task_died): Likewise. (S_mach_notify_new_task): Likewise. * boot/userland-boot.c (boot_script_task_create): Likewise. (boot_script_task_resume): Likewise. * boot/private.h: New file.
Diffstat (limited to 'boot/boot.c')
-rw-r--r--boot/boot.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/boot/boot.c b/boot/boot.c
index 2fe1688e..78bd1838 100644
--- a/boot/boot.c
+++ b/boot/boot.c
@@ -68,6 +68,8 @@
#include <hurd.h>
#include <assert.h>
+#include "private.h"
+
/* We support two modes of operation. Traditionally, Subhurds were
privileged, i.e. they had the privileged kernel ports. This has a
few drawbacks. Privileged subhurds can manipulate all tasks on the
@@ -113,6 +115,8 @@ host_exit (int status)
exit (status);
}
+int verbose;
+
mach_port_t privileged_host_port, master_device_port;
mach_port_t pseudo_privileged_host_port;
mach_port_t pseudo_master_device_port;
@@ -230,6 +234,8 @@ static struct argp_option options[] =
"Boot in single user mode" },
{ "kernel-command-line", 'c', "COMMAND LINE", 0,
"Simulated multiboot command line to supply" },
+ { "verbose", 'v', 0, 0,
+ "Be verbose" },
{ "pause" , 'd', 0, 0,
"Pause for user confirmation at various times during booting" },
{ "isig", 'I', 0, 0,
@@ -305,6 +311,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
case 'I': isig = 1; break;
+ case 'v':
+ verbose += 1;
+ break;
+
case 's': case 'd':
len = strlen (bootstrap_args);
if (len >= sizeof bootstrap_args - 1)
@@ -883,6 +893,9 @@ ds_device_open (mach_port_t master_port,
if (master_port != pseudo_master_device_port)
return D_INVALID_OPERATION;
+ if (verbose > 1)
+ fprintf (stderr, "Device '%s' being opened.\r\n", name);
+
if (!strcmp (name, "console"))
{
#if 0
@@ -1940,6 +1953,9 @@ static struct hurd_ihash task_ihash =
static void
task_died (mach_port_t name)
{
+ if (verbose > 1)
+ fprintf (stderr, "Task '%u' died.\r\n", name);
+
hurd_ihash_remove (&task_ihash, (hurd_ihash_key_t) name);
}
@@ -1955,6 +1971,9 @@ S_mach_notify_new_task (mach_port_t notify,
if (notify != task_notification_port)
return EOPNOTSUPP;
+ if (verbose > 1)
+ fprintf (stderr, "Task '%u' created by task '%u'.\r\n", task, parent);
+
err = mach_port_request_notification (mach_task_self (), task,
MACH_NOTIFY_DEAD_NAME, 0,
dead_task_notification_port,