From e9687ec4ff525ae4a88314ba4ae97da770bd012f Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Sat, 5 Apr 2014 17:40:24 +0200 Subject: libports: fix notify_port_t receiver lookups * libports/Makefile (MIGSFLAGS): Include mig-mutate.h. * libports/mig-decls.h: New file. * libports/mig-mutate.h: Likewise. * libports/notify-dead-name.c: Fix receiver lookups. * libports/notify-no-senders.c: Likewise. * libports/notify-msg-accepted.c: Adjust function declaration. * libports/notify-port-deleted.c: Likewise. * libports/notify-port-destroyed.c: Likewise. * libports/notify-send-once.c: Likewise. * libports/ports.h: Likewise. * proc/Makefile (MIGSFLAGS): Include mig-mutate.h, move PROCESS mutators... * proc/mig-mutate.h: ... into a new file, add NOTIFY mutators. * proc/notify.c: Fix receiver lookups, adjust function declarations. * term/devio.c (ports_do_mach_notify_send_once): Adjust accordingly. --- proc/Makefile | 4 +--- proc/mig-mutate.h | 33 +++++++++++++++++++++++++++++++++ proc/notify.c | 24 ++++++++++++------------ 3 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 proc/mig-mutate.h (limited to 'proc') diff --git a/proc/Makefile b/proc/Makefile index 2eed13c1..aa31ffbf 100644 --- a/proc/Makefile +++ b/proc/Makefile @@ -24,9 +24,7 @@ target = proc SRCS = wait.c hash.c host.c info.c main.c mgt.c notify.c pgrp.c msg.c \ cpu-types.c stubs.c -MIGSFLAGS="-DPROCESS_INTRAN=pstruct_t reqport_find (process_t)" \ - "-DPROCESS_DESTRUCTOR=process_drop (pstruct_t)" \ - "-DPROCESS_IMPORTS=import \"proc.h\";" +MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h MIGSTUBS = processServer.o notifyServer.o \ ourmsgUser.o proc_excUser.o proc_excServer.o diff --git a/proc/mig-mutate.h b/proc/mig-mutate.h new file mode 100644 index 00000000..ad6eb321 --- /dev/null +++ b/proc/mig-mutate.h @@ -0,0 +1,33 @@ +/* + Copyright (C) 2014 Free Software Foundation, Inc. + Written by Justus Winter. + + 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 . */ + + +#define PROCESS_INTRAN \ + pstruct_t reqport_find (process_t) +#define PROCESS_DESTRUCTOR \ + process_drop (pstruct_t) +#define PROCESS_IMPORTS \ + import "proc.h"; + +#define NOTIFY_INTRAN \ + port_info_t begin_using_port_info_port (mach_port_t) +#define NOTIFY_DESTRUCTOR \ + end_using_port_info (port_info_t) +#define NOTIFY_IMPORTS \ + import "libports/mig-decls.h"; diff --git a/proc/notify.c b/proc/notify.c index 5a112b07..b6731ae5 100644 --- a/proc/notify.c +++ b/proc/notify.c @@ -36,33 +36,33 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ message ports die. Both notifications get sent to the process port. */ kern_return_t -do_mach_notify_dead_name (mach_port_t notify, +do_mach_notify_dead_name (struct port_info *pi, mach_port_t deadport) { struct proc *p; - if (notify == generic_port) + if (pi->port_right == generic_port) { check_dead_execdata_notify (deadport); mach_port_deallocate (mach_task_self (), deadport); return 0; } - p = ports_lookup_port (proc_bucket, notify, proc_class); + p = (struct proc *) pi; - if (!p) + if (!p + || p->p_pi.bucket != proc_bucket + || p->p_pi.class != proc_class) return EOPNOTSUPP; if (p->p_task == deadport) { process_has_exited (p); - ports_port_deref (p); mach_port_deallocate (mach_task_self (), deadport); return 0; } else { - ports_port_deref (p); return EINVAL; } } @@ -70,35 +70,35 @@ do_mach_notify_dead_name (mach_port_t notify, /* We get no-senders notifications on exception ports that we handle through proc_handle_exceptions. */ kern_return_t -do_mach_notify_no_senders (mach_port_t notify, +do_mach_notify_no_senders (struct port_info *pi, mach_port_mscount_t mscount) { - return ports_do_mach_notify_no_senders (notify, mscount); + return ports_do_mach_notify_no_senders (pi, mscount); } kern_return_t -do_mach_notify_port_deleted (mach_port_t notify, +do_mach_notify_port_deleted (struct port_info *pi, mach_port_t name) { return 0; } kern_return_t -do_mach_notify_msg_accepted (mach_port_t notify, +do_mach_notify_msg_accepted (struct port_info *pi, mach_port_t name) { return 0; } kern_return_t -do_mach_notify_port_destroyed (mach_port_t notify, +do_mach_notify_port_destroyed (struct port_info *pi, mach_port_t name) { return 0; } kern_return_t -do_mach_notify_send_once (mach_port_t notify) +do_mach_notify_send_once (struct port_info *pi) { return 0; } -- cgit v1.2.3