commit-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[hurd] 01/07: exec: connect std{in,out,err} to the mach console


From: Samuel Thibault
Subject: [hurd] 01/07: exec: connect std{in,out,err} to the mach console
Date: Thu, 06 Feb 2014 02:05:11 +0000

This is an automated email from the git hooks/post-receive script.

sthibault pushed a commit to branch upstream
in repository hurd.

commit a5b95344a4f9fd3202e627ce08a3a492e35a0fff
Author: Justus Winter <address@hidden>
Date:   Sun Feb 2 15:36:57 2014 +0100

    exec: connect std{in,out,err} to the mach console
    
    * exec/main.c (S_exec_init): Get the device master port and connect
    std{in,out,err} to the mach console.
---
 exec/main.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/exec/main.c b/exec/main.c
index c1f347c..27f33b1 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -200,7 +200,7 @@ kern_return_t
 S_exec_init (struct trivfs_protid *protid,
             auth_t auth, process_t proc)
 {
-  mach_port_t host_priv, startup;
+  mach_port_t host_priv, device_master, startup;
   error_t err;
 
   if (! protid || ! protid->isroot)
@@ -232,9 +232,22 @@ S_exec_init (struct trivfs_protid *protid,
     mach_port_deallocate (mach_task_self (), right);
   }
 
-  err = get_privileged_ports (&host_priv, NULL);
+  err = get_privileged_ports (&host_priv, &device_master);
   assert_perror (err);
 
+  {
+    /* Get our stderr set up to print on the console, in case we have
+       to panic or something.  */
+    mach_port_t cons;
+    error_t err;
+    err = device_open (device_master, D_READ|D_WRITE, "console", &cons);
+    assert_perror (err);
+    mach_port_deallocate (mach_task_self (), device_master);
+    stdin = mach_open_devstream (cons, "r");
+    stdout = stderr = mach_open_devstream (cons, "w");
+    mach_port_deallocate (mach_task_self (), cons);
+  }
+
   proc_register_version (procserver, host_priv, "exec", "", HURD_VERSION);
 
   err = proc_getmsgport (procserver, HURD_PID_STARTUP, &startup);

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-hurd/hurd.git



reply via email to

[Prev in Thread] Current Thread [Next in Thread]