summaryrefslogtreecommitdiff
path: root/libports
diff options
context:
space:
mode:
Diffstat (limited to 'libports')
-rw-r--r--libports/Makefile1
-rw-r--r--libports/mig-decls.h40
-rw-r--r--libports/mig-mutate.h25
-rw-r--r--libports/notify-dead-name.c5
-rw-r--r--libports/notify-msg-accepted.c3
-rw-r--r--libports/notify-no-senders.c5
-rw-r--r--libports/notify-port-deleted.c3
-rw-r--r--libports/notify-port-destroyed.c3
-rw-r--r--libports/notify-send-once.c2
-rw-r--r--libports/ports.h20
10 files changed, 91 insertions, 16 deletions
diff --git a/libports/Makefile b/libports/Makefile
index 767ee73a..30da1c11 100644
--- a/libports/Makefile
+++ b/libports/Makefile
@@ -45,5 +45,6 @@ LDLIBS += -lpthread
OBJS = $(SRCS:.c=.o) notifyServer.o interruptServer.o
MIGCOMSFLAGS = -prefix ports_
+MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
include ../Makeconf
diff --git a/libports/mig-decls.h b/libports/mig-decls.h
new file mode 100644
index 00000000..f8c4f15c
--- /dev/null
+++ b/libports/mig-decls.h
@@ -0,0 +1,40 @@
+/*
+ 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 <http://www.gnu.org/licenses/>. */
+
+#ifndef __LIBPORTS_MIG_DECLS_H__
+#define __LIBPORTS_MIG_DECLS_H__
+
+#include "ports.h"
+
+/* Called by server stub functions. */
+
+static inline struct port_info * __attribute__ ((unused))
+begin_using_port_info_port (mach_port_t port)
+{
+ return ports_lookup_port (0, port, 0);
+}
+
+static inline void __attribute__ ((unused))
+end_using_port_info (struct port_info *p)
+{
+ if (p)
+ ports_port_deref (p);
+}
+
+#endif /* __LIBPORTS_MIG_DECLS_H__ */
diff --git a/libports/mig-mutate.h b/libports/mig-mutate.h
new file mode 100644
index 00000000..f692236e
--- /dev/null
+++ b/libports/mig-mutate.h
@@ -0,0 +1,25 @@
+/*
+ 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 <http://www.gnu.org/licenses/>. */
+
+#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/libports/notify-dead-name.c b/libports/notify-dead-name.c
index c67145d1..f974e331 100644
--- a/libports/notify-dead-name.c
+++ b/libports/notify-dead-name.c
@@ -22,13 +22,12 @@
#include "notify_S.h"
error_t
-ports_do_mach_notify_dead_name (mach_port_t notify, mach_port_t dead_name)
+ports_do_mach_notify_dead_name (struct port_info *pi,
+ mach_port_t dead_name)
{
- void *pi = ports_lookup_port (0, notify, 0);
if (!pi)
return EOPNOTSUPP;
ports_dead_name (pi, dead_name);
- ports_port_deref (pi);
/* Drop gratuitous extra reference that the notification creates. */
mach_port_deallocate (mach_task_self (), dead_name);
diff --git a/libports/notify-msg-accepted.c b/libports/notify-msg-accepted.c
index c9750836..0e49715d 100644
--- a/libports/notify-msg-accepted.c
+++ b/libports/notify-msg-accepted.c
@@ -22,7 +22,8 @@
#include "notify_S.h"
error_t
-ports_do_mach_notify_msg_accepted (mach_port_t notify, mach_port_t name)
+ports_do_mach_notify_msg_accepted (struct port_info *pi,
+ mach_port_t name)
{
return 0;
}
diff --git a/libports/notify-no-senders.c b/libports/notify-no-senders.c
index dc9b316e..55aa853f 100644
--- a/libports/notify-no-senders.c
+++ b/libports/notify-no-senders.c
@@ -22,12 +22,11 @@
#include "notify_S.h"
error_t
-ports_do_mach_notify_no_senders (mach_port_t port, mach_port_mscount_t count)
+ports_do_mach_notify_no_senders (struct port_info *pi,
+ mach_port_mscount_t count)
{
- void *pi = ports_lookup_port (0, port, 0);
if (!pi)
return EOPNOTSUPP;
ports_no_senders (pi, count);
- ports_port_deref (pi);
return 0;
}
diff --git a/libports/notify-port-deleted.c b/libports/notify-port-deleted.c
index 85012af5..cfd33793 100644
--- a/libports/notify-port-deleted.c
+++ b/libports/notify-port-deleted.c
@@ -22,7 +22,8 @@
#include "notify_S.h"
error_t
-ports_do_mach_notify_port_deleted (mach_port_t notify, mach_port_t name)
+ports_do_mach_notify_port_deleted (struct port_info *pi,
+ mach_port_t name)
{
return 0;
}
diff --git a/libports/notify-port-destroyed.c b/libports/notify-port-destroyed.c
index 78eaf211..b8ece2a3 100644
--- a/libports/notify-port-destroyed.c
+++ b/libports/notify-port-destroyed.c
@@ -22,7 +22,8 @@
#include "notify_S.h"
error_t
-ports_do_mach_notify_port_destroyed (mach_port_t notify, mach_port_t name)
+ports_do_mach_notify_port_destroyed (struct port_info *pi,
+ mach_port_t name)
{
return 0;
}
diff --git a/libports/notify-send-once.c b/libports/notify-send-once.c
index 09ffcf24..ad0ba334 100644
--- a/libports/notify-send-once.c
+++ b/libports/notify-send-once.c
@@ -22,7 +22,7 @@
#include "notify_S.h"
error_t
-ports_do_mach_notify_send_once (mach_port_t notify)
+ports_do_mach_notify_send_once (struct port_info *pi)
{
return 0;
}
diff --git a/libports/ports.h b/libports/ports.h
index 07918412..47d46078 100644
--- a/libports/ports.h
+++ b/libports/ports.h
@@ -50,6 +50,8 @@ struct port_info
hurd_ihash_locp_t hentry;
struct port_info *next, **prevp; /* links on port_class list */
};
+typedef struct port_info *port_info_t;
+
/* FLAGS above are the following: */
#define PORT_HAS_SENDRIGHTS 0x0001 /* send rights extant */
#define PORT_INHIBITED PORTS_INHIBITED
@@ -383,13 +385,19 @@ void ports_interrupt_notified_rpcs (void *object, mach_port_t port,
int ports_notify_server (mach_msg_header_t *, mach_msg_header_t *);
/* Notification server routines called by ports_notify_server. */
-extern kern_return_t ports_do_mach_notify_dead_name (mach_port_t notify, mach_port_t deadport);
-extern kern_return_t ports_do_mach_notify_msg_accepted (mach_port_t notify, mach_port_t name);
-extern kern_return_t ports_do_mach_notify_no_senders (mach_port_t port, mach_port_mscount_t count);
-extern kern_return_t ports_do_mach_notify_port_deleted (mach_port_t notify, mach_port_t name);
-extern kern_return_t ports_do_mach_notify_port_destroyed (mach_port_t notify, mach_port_t name);
extern kern_return_t
- ports_do_mach_notify_send_once (mach_port_t notify);
+ ports_do_mach_notify_dead_name (struct port_info *pi, mach_port_t deadport);
+extern kern_return_t
+ ports_do_mach_notify_msg_accepted (struct port_info *pi, mach_port_t name);
+extern kern_return_t
+ ports_do_mach_notify_no_senders (struct port_info *pi,
+ mach_port_mscount_t count);
+extern kern_return_t
+ ports_do_mach_notify_port_deleted (struct port_info *pi, mach_port_t name);
+extern kern_return_t
+ ports_do_mach_notify_port_destroyed (struct port_info *pi, mach_port_t name);
+extern kern_return_t
+ ports_do_mach_notify_send_once (struct port_info *pi);
/* A default interrupt server */
int ports_interrupt_server (mach_msg_header_t *, mach_msg_header_t *);