[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 18/21: boot: Add a verbose option.
From: |
Samuel Thibault |
Subject: |
[hurd] 18/21: boot: Add a verbose option. |
Date: |
Sat, 04 Mar 2017 21:10:59 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 5ac0c5c8e2e13217aabe7dd6e91ff218d0db6346
Author: Justus Winter <address@hidden>
Date: Tue Feb 28 17:57:37 2017 +0100
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.
---
boot/boot.c | 19 +++++++++++++++++++
boot/private.h | 25 +++++++++++++++++++++++++
boot/userland-boot.c | 15 +++++++++++++--
3 files changed, 57 insertions(+), 2 deletions(-)
diff --git a/boot/boot.c b/boot/boot.c
index 2fe1688..78bd183 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,
diff --git a/boot/private.h b/boot/private.h
new file mode 100644
index 0000000..4636252
--- /dev/null
+++ b/boot/private.h
@@ -0,0 +1,25 @@
+/* Boot boots Subhurds.
+
+ Copyright (C) 2017 Free Software Foundation, Inc.
+
+ This file is part of the GNU Hurd.
+
+ The GNU Hurd is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2, or (at
+ your option) any later version.
+
+ The GNU Hurd is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with the GNU Hurd. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef BOOT_PRIVATE_H
+#define BOOT_PRIVATE_H
+
+int verbose;
+
+#endif /* BOOT_PRIVATE_H */
diff --git a/boot/userland-boot.c b/boot/userland-boot.c
index 583078f..2f9bd8c 100644
--- a/boot/userland-boot.c
+++ b/boot/userland-boot.c
@@ -31,6 +31,7 @@
#include <error.h>
#include "boot_script.h"
+#include "private.h"
void *
boot_script_malloc (unsigned int size)
@@ -48,7 +49,12 @@ boot_script_free (void *ptr, unsigned int size)
int
boot_script_task_create (struct cmd *cmd)
{
- error_t err = task_create (mach_task_self (), 0, &cmd->task);
+ error_t err;
+
+ if (verbose)
+ fprintf (stderr, "Creating task '%s'.\r\n", cmd->path);
+
+ err = task_create (mach_task_self (), 0, &cmd->task);
if (err)
{
error (0, err, "%s: task_create", cmd->path);
@@ -66,7 +72,12 @@ boot_script_task_create (struct cmd *cmd)
int
boot_script_task_resume (struct cmd *cmd)
{
- error_t err = task_resume (cmd->task);
+ error_t err;
+
+ if (verbose)
+ fprintf (stderr, "Resuming task '%s'.\r\n", cmd->path);
+
+ err = task_resume (cmd->task);
if (err)
{
error (0, err, "%s: task_resume", cmd->path);
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 11/21: ext2fs: minor cleanup, (continued)
- [hurd] 11/21: ext2fs: minor cleanup, Samuel Thibault, 2017/03/04
- [hurd] 15/21: Fix mig URL, Samuel Thibault, 2017/03/04
- [hurd] 19/21: boot: Fix failing device lookups in unprivileged mode., Samuel Thibault, 2017/03/04
- [hurd] 09/21: ext2fs: Fix potential block leak., Samuel Thibault, 2017/03/04
- [hurd] 14/21: Merge remote-tracking branch 'remotes/darnassus/ext2fs-xattrs', Samuel Thibault, 2017/03/04
- [hurd] 05/21: ext2fs: Fix block leak in xattr code., Samuel Thibault, 2017/03/04
- [hurd] 21/21: Avoid ports_interrupt_rpcs cancel itself, Samuel Thibault, 2017/03/04
- [hurd] 07/21: ext2fs: Require users to opt-in for xattr-based translator records., Samuel Thibault, 2017/03/04
- [hurd] 20/21: boot: Make the halt message nicer., Samuel Thibault, 2017/03/04
- [hurd] 13/21: ext2fs: downgrade warnings about old translator records to debug messages, Samuel Thibault, 2017/03/04
- [hurd] 18/21: boot: Add a verbose option.,
Samuel Thibault <=
- [hurd] 04/21: ext2fs: Use correct type for sizes., Samuel Thibault, 2017/03/04
- [hurd] 02/21: ext2fs: Use xattr to store passive translator, Samuel Thibault, 2017/03/04
- [hurd] 17/21: boot: Cleanup Makefile., Samuel Thibault, 2017/03/04
- [hurd] 01/21: ext2fs: Add support for xattr, Samuel Thibault, 2017/03/04