diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2013-09-16 16:09:05 +0200 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-12-10 13:35:17 +0100 |
commit | 46b2c2b071f31893c9ce9548537e34747b2941d6 (patch) | |
tree | 30bf0c4086923410b994da0ec09691f690203a38 /proc/mgt.c | |
parent | 09ff61acc11cd495af5f4cba1f9a1f850c6745c9 (diff) | |
download | hurd-46b2c2b071f31893c9ce9548537e34747b2941d6.tar.gz hurd-46b2c2b071f31893c9ce9548537e34747b2941d6.tar.bz2 hurd-46b2c2b071f31893c9ce9548537e34747b2941d6.zip |
proc: register for new task notifications
* proc/Makefile (MIGSTUBS): Add `gnumachServer.o'.
* proc/main.c (message_demuxer): Handle the `task_notify' protocol.
(main): Register for new task notificatinos.
* proc/mgt.c (S_mach_notify_new_task): Add server function.
Diffstat (limited to 'proc/mgt.c')
-rw-r--r-- | proc/mgt.c | 35 |
1 files changed, 34 insertions, 1 deletions
@@ -1,5 +1,5 @@ /* Process management - Copyright (C) 1992,93,94,95,96,99,2000,01,02,13 + Copyright (C) 1992,93,94,95,96,99,2000,01,02,13,14 Free Software Foundation, Inc. This file is part of the GNU Hurd. @@ -981,3 +981,36 @@ S_proc_get_code (struct proc *callerp, return 0; } + +/* Handle new task notifications from the kernel. */ +error_t +S_mach_notify_new_task (mach_port_t notify, + mach_port_t task, + mach_port_t parent) +{ + struct proc *parentp, *childp; + + if (notify != generic_port) + return EOPNOTSUPP; + + parentp = task_find_nocreate (parent); + if (! parentp) + { + mach_port_deallocate (mach_task_self (), task); + mach_port_deallocate (mach_task_self (), parent); + return ESRCH; + } + + childp = task_find_nocreate (task); + if (! childp) + { + mach_port_mod_refs (mach_task_self (), task, MACH_PORT_RIGHT_SEND, +1); + childp = new_proc (task); + } + + /* XXX do something interesting */ + + mach_port_deallocate (mach_task_self (), task); + mach_port_deallocate (mach_task_self (), parent); + return 0; +} |