commit-hurd
[Top][All Lists]
Advanced

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

[hurd] 02/05: proc: Receive new-task notifications on kernel's process p


From: Samuel Thibault
Subject: [hurd] 02/05: proc: Receive new-task notifications on kernel's process port.
Date: Fri, 10 Mar 2017 03:33:19 +0000

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

sthibault pushed a commit to branch upstream
in repository hurd.

commit 40c752c4e5e3c8c20cee345790954511e9f3825b
Author: Justus Winter <address@hidden>
Date:   Mon Mar 6 00:18:21 2017 +0100

    proc: Receive new-task notifications on kernel's process port.
    
    * proc/main.c (main): Initialize 'kernel_proc' and use it to register
    for new-task notifications.
    * proc/mgt.c (S_mach_notify_new_task): Adapt receiver check.
    * proc/proc.h (kernel_proc): New variable.
---
 proc/main.c | 11 ++++++++++-
 proc/mgt.c  |  4 +++-
 proc/proc.h |  1 +
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/proc/main.c b/proc/main.c
index 5a088b7..d97650f 100644
--- a/proc/main.c
+++ b/proc/main.c
@@ -191,8 +191,17 @@ main (int argc, char **argv, char **envp)
   if (err && err != EPERM)
     error (0, err, "Increasing priority failed");
 
+  /* Get a list of all tasks to find the kernel.  */
+  /* XXX: I't be nice if GNU Mach would hand us the task port.  */
+  add_tasks (MACH_PORT_NULL);
+  kernel_proc = pid_find (HURD_PID_KERNEL);
+
+  /* Register for new task notifications using the kernel's process as
+     the port.  */
   err = register_new_task_notification (_hurd_host_priv,
-                                       generic_port,
+                                       kernel_proc
+                                        ? ports_get_right (kernel_proc)
+                                        : generic_port,
                                        MACH_MSG_TYPE_MAKE_SEND);
   if (err)
     error (0, err, "Registering task notifications failed");
diff --git a/proc/mgt.c b/proc/mgt.c
index 8dc82f1..dc3a19e 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -1055,7 +1055,9 @@ S_mach_notify_new_task (struct port_info *notify,
 {
   struct proc *parentp, *childp;
 
-  if (! notify || notify->class != generic_port_class)
+  if (! notify
+      || (kernel_proc == NULL && notify->class != generic_port_class)
+      || (kernel_proc != NULL && notify != (struct port_info *) kernel_proc))
     return EOPNOTSUPP;
 
   parentp = task_find_nocreate (parent);
diff --git a/proc/proc.h b/proc/proc.h
index 2c08fd1..ffb54bf 100644
--- a/proc/proc.h
+++ b/proc/proc.h
@@ -148,6 +148,7 @@ struct port_class *generic_port_class;
 struct port_class *exc_class;
 
 mach_port_t generic_port;      /* messages not related to a specific proc */
+struct proc *kernel_proc;
 
 pthread_mutex_t global_lock;
 

-- 
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]