unguard(with:)
Unguards the port using the specified context.
func unguard(with context: mach_port_context_t) throws
Unguards the port using the specified context.
func unguard(with context: mach_port_context_t) throws
import MachCore
The core module for interacting with the Mach kernel.
class Port
A port name
in the owningTask
’s name space.
struct Mach
The Mach kernel.
func `guard`(with context: mach_port_context_t, flags: Mach.PortGuardFlags = []) throws
Guards the port using the specified context and flags.
struct PortGuardFlags
Flags to guard a port with.
var guarded: Bool { get }
Experimental. Whether the port is guarded.
required init(named name: mach_port_name_t, inNameSpaceOf task: Task = .current)
References an existing port.
static func allocate(right: Mach.PortRight, named name: mach_port_name_t? = nil, inNameSpaceOf task: Mach.Task = .current) throws -> Self
Allocates a new port with a given right in the specified task with an optional name.
static func construct(flags: Mach.PortConstructFlags = [], limits: mach_port_limits = mach_port_limits(), inNameSpaceOf task: Mach.Task = .current) throws -> Self
static func construct(options: consuming mach_port_options_t, context: mach_port_context_t? = nil, inNameSpaceOf task: Mach.Task = .current) throws -> Self
Constructs a new port with the given options.
class var Nil: Port { get }
A nil-named port.
var attributes: Mach.PortAttributeManager { get }
The attributes of the port.
var context: mach_port_context_t { get throws }
The context of the port.
var debugDescription: String { get }
A debug description of the port.
var description: String { get }
A description of the port.
var kernelObject: Mach.KernelObject { get throws }
The kernel object underlying the port.
let name: mach_port_name_t
The name of the port in the owningTask
’s name space.
var owningTask: Mach.Task { get }
The task that the port name
is in the name space of.
var rights: Set<Mach.PortRight> { get throws }
The port rights named by name
.
var sendRightCount: Int { get throws }
The number of send rights the receive right has.
static func != (lhs: Mach.Port, rhs: Mach.Port) -> Bool
Compares two ports.
static func == (lhs: Mach.Port, rhs: Mach.Port) -> Bool
Compares two ports.
static func == (lhs: Mach.Port, rhs: mach_port_name_t) -> Bool
Compares a port to a port name.
static func == (lhs: mach_port_name_t, rhs: Mach.Port) -> Bool
Compares a port name to a port.
func deallocate() throws
Deallocates the port.
func destroy() throws
Destroys the port.
func destruct(guard: mach_port_context_t = mach_port_context_t(), sendRightDelta: mach_port_delta_t) throws
Destructs the port.
func extractRight(using disposition: Mach.PortDisposition) throws -> Mach.Port
Extracts a right from the port and brings it into the current task’s name space.
func getContext() throws -> mach_port_context_t
Gets the context of the port.
func hash(into hasher: inout Hasher)
Hashes the port.
func insert(into set: Mach.PortSet) throws
Inserts the port into a port set.
func insertRight(intoNameSpaceOf task: Mach.Task, using disposition: Mach.PortDisposition) throws
Inserts a right from the port into the specified task’s name space.
func move(to set: Mach.PortSet) throws
Moves the port into a port set.
func setContext(to context: mach_port_context_t) throws
Sets the context of the port.
func setMakeSendCount(to count: Int32) throws
Set the make-send count of the port.
func setUserRefs(for right: Mach.PortRight, to count: mach_port_urefs_t) throws
Sets the user reference count for the port right.
func userRefs(for right: Mach.PortRight) -> UserRefs
Gets the user reference count for the port right.
struct UserRefs
A user reference count for a port right.