summaryrefslogtreecommitdiff
path: root/hurd/hurd/port.h
diff options
context:
space:
mode:
Diffstat (limited to 'hurd/hurd/port.h')
-rw-r--r--hurd/hurd/port.h46
1 files changed, 44 insertions, 2 deletions
diff --git a/hurd/hurd/port.h b/hurd/hurd/port.h
index 4fea1aa4d2..0779578d03 100644
--- a/hurd/hurd/port.h
+++ b/hurd/hurd/port.h
@@ -1,5 +1,5 @@
/* Lightweight user references for ports.
- Copyright (C) 1993-2016 Free Software Foundation, Inc.
+ Copyright (C) 1993-2018 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -24,7 +24,6 @@
#include <mach.h>
#include <hurd/userlink.h>
#include <spin-lock.h>
-#include <hurd/signal.h>
/* Structure describing a cell containing a port. With the lock held, a
@@ -60,6 +59,10 @@ struct hurd_port
/* Initialize *PORT to INIT. */
+extern void _hurd_port_init (struct hurd_port *port, mach_port_t init);
+
+#if defined __USE_EXTERN_INLINES && defined _LIBC
+# if IS_IN (libc)
_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_init (struct hurd_port *port, mach_port_t init)
{
@@ -67,6 +70,8 @@ _hurd_port_init (struct hurd_port *port, mach_port_t init)
port->users = NULL;
port->port = init;
}
+# endif
+#endif
/* Cleanup function for non-local exits. */
@@ -75,6 +80,12 @@ extern void _hurd_port_cleanup (void *, jmp_buf, int);
/* Get a reference to *PORT, which is locked.
Pass return value and LINK to _hurd_port_free when done. */
+extern mach_port_t
+_hurd_port_locked_get (struct hurd_port *port,
+ struct hurd_userlink *link);
+
+#if defined __USE_EXTERN_INLINES && defined _LIBC
+# if IS_IN (libc)
_HURD_PORT_H_EXTERN_INLINE mach_port_t
_hurd_port_locked_get (struct hurd_port *port,
struct hurd_userlink *link)
@@ -90,9 +101,17 @@ _hurd_port_locked_get (struct hurd_port *port,
__spin_unlock (&port->lock);
return result;
}
+# endif
+#endif
/* Same, but locks PORT first. */
+extern mach_port_t
+_hurd_port_get (struct hurd_port *port,
+ struct hurd_userlink *link);
+
+#if defined __USE_EXTERN_INLINES && defined _LIBC
+# if IS_IN (libc)
_HURD_PORT_H_EXTERN_INLINE mach_port_t
_hurd_port_get (struct hurd_port *port,
struct hurd_userlink *link)
@@ -104,10 +123,19 @@ _hurd_port_get (struct hurd_port *port,
HURD_CRITICAL_END;
return result;
}
+# endif
+#endif
/* Free a reference gotten with `USED_PORT = _hurd_port_get (PORT, LINK);' */
+extern void
+_hurd_port_free (struct hurd_port *port,
+ struct hurd_userlink *link,
+ mach_port_t used_port);
+
+#if defined __USE_EXTERN_INLINES && defined _LIBC
+# if IS_IN (libc)
_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_free (struct hurd_port *port,
struct hurd_userlink *link,
@@ -127,11 +155,17 @@ _hurd_port_free (struct hurd_port *port,
if (dealloc)
__mach_port_deallocate (__mach_task_self (), used_port);
}
+# endif
+#endif
/* Set *PORT's port to NEWPORT. NEWPORT's reference is consumed by PORT->port.
PORT->lock is locked. */
+extern void _hurd_port_locked_set (struct hurd_port *port, mach_port_t newport);
+
+#if defined __USE_EXTERN_INLINES && defined _LIBC
+# if IS_IN (libc)
_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_locked_set (struct hurd_port *port, mach_port_t newport)
{
@@ -142,9 +176,15 @@ _hurd_port_locked_set (struct hurd_port *port, mach_port_t newport)
if (old != MACH_PORT_NULL)
__mach_port_deallocate (__mach_task_self (), old);
}
+# endif
+#endif
/* Same, but locks PORT first. */
+extern void _hurd_port_set (struct hurd_port *port, mach_port_t newport);
+
+#if defined __USE_EXTERN_INLINES && defined _LIBC
+# if IS_IN (libc)
_HURD_PORT_H_EXTERN_INLINE void
_hurd_port_set (struct hurd_port *port, mach_port_t newport)
{
@@ -153,6 +193,8 @@ _hurd_port_set (struct hurd_port *port, mach_port_t newport)
_hurd_port_locked_set (port, newport);
HURD_CRITICAL_END;
}
+# endif
+#endif
#endif /* hurd/port.h */