+/*
+ * Only valid for receive rights.
+ * Gets the context pointer for the port.
+ */
+
+routine mach_port_get_context(
+ task : ipc_space_t;
+ name : mach_port_name_t;
+#ifdef LIBSYSCALL_INTERFACE
+ out context : mach_port_context_t
+#else
+ out context : mach_vm_address_t
+#endif
+ );
+
+/*
+ * Only valid for receive rights.
+ * Sets the context pointer for the port.
+ */
+
+routine mach_port_set_context(
+ task : ipc_space_t;
+ name : mach_port_name_t;
+#ifdef LIBSYSCALL_INTERFACE
+ context : mach_port_context_t
+#else
+ context : mach_vm_address_t
+#endif
+ );
+
+/*
+ * Return the type and address of the kernel object
+ * that the given send/receive right represents.
+ * This call is only valid on MACH_IPC_DEBUG kernels.
+ * Otherwise, KERN_FAILURE is returned.
+ */
+routine mach_port_kobject(
+ task : ipc_space_t;
+ name : mach_port_name_t;
+ out object_type : natural_t;
+ out object_addr : mach_vm_address_t);
+
+
+/*
+ * Constructs a right based on the options passed
+ * in. Also allows guarding the port as one of the
+ * options if the requested right is a receive
+ * right.
+ */
+routine mach_port_construct(
+ task : ipc_space_t;
+ options : mach_port_options_ptr_t;
+#ifdef LIBSYSCALL_INTERFACE
+ context : mach_port_context_t;
+#else
+ context : uint64_t;
+#endif
+ out name : mach_port_name_t);
+
+/*
+ * Destroys a mach port using the guard provided
+ * for guarded ports. Also reduces the user ref
+ * count for send rights as specified by srdelta.
+ */
+routine mach_port_destruct(
+ task : ipc_space_t;
+ name : mach_port_name_t;
+ srdelta : mach_port_delta_t;
+#ifdef LIBSYSCALL_INTERFACE
+ guard : mach_port_context_t
+#else
+ guard : uint64_t
+#endif
+ );
+
+/*
+ * Guard an already existing port. Allows guarding
+ * receive rights only. Uses the context field in the
+ * port structure to store the guard.
+ */
+routine mach_port_guard(
+ task : ipc_space_t;
+ name : mach_port_name_t;
+#ifdef LIBSYSCALL_INTERFACE
+ guard : mach_port_context_t;
+#else
+ guard : uint64_t;
+#endif
+ strict : boolean_t);
+
+/*
+ * Unguard a port guarded previously. For unguarded ports
+ * or incorrect guards passed in it raises an exception
+ * indicating guarding misbehavior.
+ */
+routine mach_port_unguard(
+ task : ipc_space_t;
+ name : mach_port_name_t;
+#ifdef LIBSYSCALL_INTERFACE
+ guard : mach_port_context_t
+#else
+ guard : uint64_t
+#endif
+ );
+
+/* vim: set ft=c : */