[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 02/37: proc: register for new task notifications
From: |
Samuel Thibault |
Subject: |
[hurd] 02/37: proc: register for new task notifications |
Date: |
Mon, 09 Feb 2015 09:59:08 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to annotated tag upstream/hurd/0.5.git20150208
in repository hurd.
commit 46b2c2b071f31893c9ce9548537e34747b2941d6
Author: Justus Winter <address@hidden>
Date: Mon Sep 16 16:09:05 2013 +0200
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.
---
proc/Makefile | 4 +++-
proc/main.c | 11 ++++++++++-
proc/mgt.c | 35 ++++++++++++++++++++++++++++++++++-
3 files changed, 47 insertions(+), 3 deletions(-)
diff --git a/proc/Makefile b/proc/Makefile
index aa31ffb..2275a66 100644
--- a/proc/Makefile
+++ b/proc/Makefile
@@ -27,9 +27,11 @@ SRCS = wait.c hash.c host.c info.c main.c mgt.c
notify.c pgrp.c msg.c \
MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
MIGSTUBS = processServer.o notifyServer.o \
- ourmsgUser.o proc_excUser.o proc_excServer.o
+ ourmsgUser.o proc_excUser.o proc_excServer.o \
+ task_notifyServer.o
OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
HURDLIBS = ihash ports shouldbeinlibc
+
OTHERLIBS = -lpthread
include ../Makeconf
diff --git a/proc/main.c b/proc/main.c
index 3419d44..b4288fb 100644
--- a/proc/main.c
+++ b/proc/main.c
@@ -31,6 +31,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA
02139, USA. */
#include <pids.h>
#include "proc.h"
+#include "gnumach_U.h"
const char *argp_program_version = STANDARD_HURD_VERSION (proc);
@@ -38,6 +39,7 @@ const char *argp_program_version = STANDARD_HURD_VERSION
(proc);
#include "notify_S.h"
#include "../libports/interrupt_S.h"
#include "proc_exc_S.h"
+#include "task_notify_S.h"
int
message_demuxer (mach_msg_header_t *inp,
@@ -47,7 +49,8 @@ message_demuxer (mach_msg_header_t *inp,
if ((routine = process_server_routine (inp)) ||
(routine = notify_server_routine (inp)) ||
(routine = ports_interrupt_server_routine (inp)) ||
- (routine = proc_exc_server_routine (inp)))
+ (routine = proc_exc_server_routine (inp)) ||
+ (routine = task_notify_server_routine (inp)))
{
pthread_mutex_lock (&global_lock);
(*routine) (inp, outp);
@@ -152,6 +155,12 @@ main (int argc, char **argv, char **envp)
if (err)
error (0, err, "Increasing priority failed");
+ err = register_new_task_notification (_hurd_host_priv,
+ generic_port,
+ MACH_MSG_TYPE_MAKE_SEND);
+ if (err)
+ error (0, err, "Registering task notifications failed");
+
{
/* Get our stderr set up to print on the console, in case we have
to panic or something. */
diff --git a/proc/mgt.c b/proc/mgt.c
index 02d69db..32408ae 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -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;
+}
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 19/37: misc: Fix typos in comments (found by codespell), (continued)
- [hurd] 19/37: misc: Fix typos in comments (found by codespell), Samuel Thibault, 2015/02/09
- [hurd] 36/37: startup: add more error handling, Samuel Thibault, 2015/02/09
- [hurd] 32/37: utils/rpctrace: fix notification port handling, Samuel Thibault, 2015/02/09
- [hurd] 16/37: aclocal.m4, configure.ac: Fix typos and grammar in comment (found by codespell), Samuel Thibault, 2015/02/09
- [hurd] 37/37: Merge remote-tracking branch 'upstream/master' into upstream, Samuel Thibault, 2015/02/09
- [hurd] 24/37: libfshelp: improve error handling, Samuel Thibault, 2015/02/09
- [hurd] 18/37: console: Fix typos in comments, Samuel Thibault, 2015/02/09
- [hurd] 30/37: proc: call `startup_essential_task' earlier, Samuel Thibault, 2015/02/09
- [hurd] 34/37: Allow dhcp trafic and configuration, Samuel Thibault, 2015/02/09
- [hurd] 01/37: Makeconf: handle the task_notify protocol, Samuel Thibault, 2015/02/09
- [hurd] 02/37: proc: register for new task notifications,
Samuel Thibault <=
- [hurd] 07/37: ext2fs: tune the size of the inode cache, Samuel Thibault, 2015/02/09
- [hurd] 26/37: libports: silence pointless error message, Samuel Thibault, 2015/02/09
- [hurd] 12/37: Avoid ./ components in mtab output, Samuel Thibault, 2015/02/09
- [hurd] 10/37: Fix inclusion loop between hurd_types.defs and hurd/signal.h>, Samuel Thibault, 2015/02/09
- [hurd] 35/37: Explicit the keymap compatibility flags, Samuel Thibault, 2015/02/09
- [hurd] 03/37: proc: implement `proc_make_task_namespace', Samuel Thibault, 2015/02/09
- [hurd] 28/37: auth: simplify expression, Samuel Thibault, 2015/02/09
- [hurd] 29/37: auth: remove implicit assumption about the bootstrap process, Samuel Thibault, 2015/02/09
- [hurd] 22/37: Backport Linux changes for proper TCP EOF handling, Samuel Thibault, 2015/02/09
- [hurd] 05/37: libpager: remove the `seqno' parameters, Samuel Thibault, 2015/02/09