PortConstructFlags
Flags to use when constructing a port.
struct PortConstructFlags
Flags to use when constructing a port.
struct PortConstructFlags
import MachCore
The core module for interacting with the Mach kernel.
struct Mach
The Mach kernel.
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(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.
static func construct(flags: Mach.PortConstructFlags = [], limits: mach_port_limits = mach_port_limits(), inNameSpaceOf task: Mach.Task = .current) throws -> Self
static func call(_ call: @autoclosure () -> kern_return_t) throws
Calls the kernel and throws an error if the call fails.
static func callWithCountIn<ArrayElement>(array: [ArrayElement], _ call: CountInCallBlock<ArrayElement>) throws where ArrayElement : BitwiseCopyable
Executes a kernel call with an array of a specified type.
static func callWithCountIn<ArrayElement, DataType>(value: DataType, _ call: CountInCallBlock<ArrayElement>) throws where ArrayElement : BitwiseCopyable, DataType : BitwiseCopyable
Executes a kernel call with a value expressed as an array of a specified type.
static func callWithCountInOut<ArrayElement>(count: inout mach_msg_type_number_t, _ call: CountInOutCallBlock<ArrayElement>) throws -> [ArrayElement] where ArrayElement : BitwiseCopyable
Executes a kernel call that expects an array pointer and a desired count and returns the result.
static func callWithCountInOut<ArrayElement, DataType>(type: DataType.Type, _ call: CountInOutCallBlock<ArrayElement>) throws -> DataType where ArrayElement : BitwiseCopyable, DataType : BitwiseCopyable
Executes a kernel call that expects an array pointer and a desired count and returns the result.
static func callWithCountOut<ArrayElement>(element: ArrayElement.Type, _ call: CountOutCallBlock<ArrayElement>) throws -> [ArrayElement] where ArrayElement : BitwiseCopyable
Executes a kernel call that returns an array of a specified type.
static func callWithCountOut<ArrayElement, DataType>(type: DataType.Type, _ call: CountOutCallBlock<ArrayElement>) throws -> DataType where ArrayElement : BitwiseCopyable, DataType : BitwiseCopyable
Executes a kernel call that returns an array of a specified type.
protocol FlavoredDataGetter : Mach.PortDataOperator
A data operator that can get flavored data for a port.
protocol FlavoredDataManager : Mach.FlavoredDataGetter, Mach.FlavoredDataSetter
A data operator that can get and set flavored data for a port.
protocol FlavoredDataSetter : Mach.PortDataOperator
A data operator that can set flavored data for a port.
protocol MIGPayload : Mach.MessagePayload
A payload for a MIG message.
protocol MIGPayloadWithNDR : Mach.MIGPayload, Mach.TrivialMessagePayload
A payload for a MIG message containing an NDR record.
protocol MessageDescriptor
A descriptor for a message body.
protocol MessagePayload
A message payload.
protocol MessageWithTypedPayload : Mach.Message
A message with a typed payload.
protocol PortDataOperator
A data operator that operates on flavored data for a port.
protocol PortInitializableByServiceName : Mach.Port
A port that can be initialized by looking up a service name.
protocol PortWithExceptionPorts : Mach.Port
A port representing a kernel object that can have exception ports.
protocol TaskFlavored : Mach.Task
A task (port) with a flavor.
protocol ThreadFlavored : Mach.Thread
A thread (port) with a flavor.
protocol TrivialMessagePayload : BitwiseCopyable, Mach.MessagePayload
A payload with a fixed length and trivial representation.
protocol VoucherAttributeCommand : NamedOptionEnum where Self.RawValue == UInt32
A voucher attribute command.
protocol VoucherAttributeRecipeCommand : NamedOptionEnum where Self.RawValue == UInt32
A voucher attribute recipe command.
class Alarm
An alarm on a clock.
class BootstrapPort
A port for communicating with the bootstrap server.
class Clock
A clock.
struct ClockAttribute
A type of clock attribute.
struct ClockAttributeManager
A clock attribute manager.
class ClockControl
A clock control port.
struct ClockType
A type of clock.
class ConnectionPort
A connection port.
class DefaultExceptionMessage
A message sent when an exception occurs using the default
exception behavior.
struct ExceptionBehavior
A behavior for an exception.
struct ExceptionMask
A mask for getting or setting exception ports.
class ExceptionPort
An exception port.
struct ExceptionType
A type of exception.
class Host
A host.
struct HostDebugInfoInternal
Debug information about the host.
struct HostInfoFlavor
A flavor of host info.
struct HostInfoManager
A host info manager.
struct HostRebootOption
A reboot option.
struct HostSpecialPort
A special port for a host.
struct HostStatisticsFlavor
A flavor of host statistics.
struct HostStatisticsManager
A host statistics manager.
struct KernelObject
A kernel object underlying a port.
class MIGClient
A client for MIG requests.
class MIGError
An error from a MIG server routine.
struct MIGErrorCode
An error code from a MIG server routine.
final class MIGErrorReply
An error reply to a MIG request.
struct MIGPayloadWithOnlyNDR
A payload for a MIG message containing only an NDR record.
class MIGReply<MIGPayloadType> where MIGPayloadType : Mach.MIGPayload
A MIG reply message.
class MIGReplyPort
A reply port for a MIG request.
class MIGRequest<MIGPayloadType> where MIGPayloadType : Mach.MIGPayload
A MIG request message.
struct MemoryInfoCounterType
A type of memory counter.
struct MemoryInfoFlags
Flags for memory info.
struct MemoryInfoTag
A tag for memory info.
struct MemoryInfoType
A type of memory info.
class MemoryManager
A memory manager.
class Message
A message.
struct MessageBody
A body of message descriptors.
class MessageClient
A message client for enqueuing messages.
struct MessageDescriptorType
A descriptor type.
struct MessageHeaderBits
Configuration bits in a message header.
struct MessageOptions
Options for sending and receiving messages.
struct MessagePortGuardFlags
Flags for guarding a port in a message.
class MessageQueue
A message queue.
class MessageServer
A message server for dequeuing messages.
struct OOLDescriptorCopyOption
A copy option for out-of-line descriptors.
struct PeekedMessage
A peeked preview of a message.
class Port
A port name
in the owningTask
’s name space.
struct PortAttributeFlavor
A flavor of port attribute.
struct PortAttributeManager
A port attribute manager.
struct PortDisposition
Processing to perform on a port.
struct PortGuardFlags
Flags to guard a port with.
struct PortRight
A right to a port.
class PortSet
A port set.
class Processor
A processor in a host.
struct ProcessorBasicInfo
Basic information about a processor.
struct ProcessorInfoFlavor
A flavor of processor info.
struct ProcessorInfoManager
A processor info manager.
class ProcessorSet
A set of processors in a host.
class ProcessorSetControl
A control port for a processor set.
struct ProcessorSetInfoFlavor
struct ProcessorSetInfoManager
A processor set info manager.
struct ProcessorSetStatisticsFlavor
A flavor of processor set statistics.
struct ProcessorSetStatisticsManager
A processor set statistics manager.
class Semaphore
A semaphore.
struct SemaphorePolicy
A synchronization policy for a semaphore.
class ServicePort
A service port.
class Task
A task (port).
class TaskControl
A task’s control port.
class TaskCorpse
A corpse for a task.
struct TaskFlavor
A flavor of task (port).
class TaskIdentityToken
A task’s identity token.
struct TaskInfoFlavor
A flavor of task info.
struct TaskInfoManager
A task info manager.
class TaskInspect
A task’s inspect port.
struct TaskInspectInfoManager
A task inspect info manager.
class TaskName
A task’s name port.
struct TaskPolicyFlavor
A flavor of task policy.
struct TaskPolicyManager
A task policy manager.
class TaskRead
A task’s read port.
struct TaskSpecialPort
A special port for a task.
class TaskSuspensionToken
A task suspension token.
class Thread
A thread in a task.
class ThreadControl
A thread’s control port.
struct ThreadFlavor
A flavor of thread (port).
struct ThreadInfoFlavor
A flavor of thread info.
struct ThreadInfoManager
A thread info manager.
class ThreadInspect
A thread’s inspect port.
struct ThreadPolicyFlavor
A flavor of thread policy.
struct ThreadPolicyManager
A thread policy manager.
struct ThreadPolicyState
A thread’s policy state.
struct ThreadQoSPolicy
A thread’s QoS policy.
class ThreadRead
A thread’s read port.
struct ThreadRequestedQoSPolicy
A thread’s requested QoS policy.
struct ThreadSpecialPort
A special port for a thread.
struct ThreadStateConvertDirection
A direction for converting thread states.
struct ThreadStateFlavor
A flavor of thread state.
struct ThreadStateManager
A thread state manager.
struct ThreadSwitchOption
A thread switching option.
struct ThreadTimeConstraintWithPriorityPolicy
A thread’s time constraint policy (with a priority field).
struct TimeType
A type of time value.
class Timer
A timer.
struct TimerArmFlags
Flags for arming a timer.
struct VMAllocationFlags
Flags for allocating memory.
struct VMProtectionOptions
A protection option for virtual memory.
class Voucher
A voucher.
struct VoucherATMAction
A voucher attribute command for the atm
key.
struct VoucherATMAttributeRecipeCommand
An ATM voucher attribute recipe command.
struct VoucherAttributeKey
A voucher attribute key.
struct VoucherAttributeRecipe
A voucher attribute recipe.
struct VoucherBankAction
A voucher attribute command for the bank
key.
struct VoucherBankAttributeRecipeCommand
A bank voucher attribute recipe command.
struct VoucherBaseAttributeRecipeCommand
A base voucher attribute recipe command.
struct VoucherImportanceAction
A voucher attribute command for the importance
key.
struct VoucherImportanceAttributeRecipeCommand
An importance voucher attribute recipe command.
struct VoucherOtherAttributeRecipeCommand
A voucher attribute recipe command that cannot be represented by a known command.
struct VoucherPthreadPriorityAttributeRecipeCommand
A POSIX thread priority voucher attribute recipe command.
struct VoucherUserDataAttributeRecipeCommand
A user data voucher attribute recipe command.
struct Zone
A zone.
typealias CountInCallBlock<ArrayElement> = (UnsafeMutablePointer<ArrayElement>, mach_msg_type_number_t) -> kern_return_t where ArrayElement : BitwiseCopyable
A function that executes a kernel call expecting an array of a specified type, passing an array pointer and count.
typealias CountInOutCallBlock<ArrayElement> = (UnsafeMutablePointer<ArrayElement>, inout mach_msg_type_number_t) -> kern_return_t where ArrayElement : BitwiseCopyable
A function that executes a kernel call that expects an array pointer and a desired count, passing an array pointer and count.
typealias CountOutCallBlock<ArrayElement> = (UnsafeMutablePointer<ArrayElement>?, inout mach_msg_type_number_t) -> kern_return_t where ArrayElement : BitwiseCopyable
A function that executes a kernel call that returns an array of a specified type, passing an array pointer and count.
protocol Equatable
A type that can be compared for value equality.
protocol ExpressibleByArrayLiteral
A type that can be initialized using an array literal.
protocol OptionSet : RawRepresentable, SetAlgebra
A type that presents a mathematical set interface to a bit set.
protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
protocol Sendable
protocol SetAlgebra<Element> : Equatable, ExpressibleByArrayLiteral
A type that provides mathematical set operations.
init(rawValue: Int32)
static let connectionPort: Mach.PortConstructFlags
Construct a connection port.
static let contextAsGuard: Mach.PortConstructFlags
Use the passed context as a guard.
static let denapReceiver: Mach.PortConstructFlags
Mark the port as a De-Nap receiver.
static let enforceReplyPortSemantics: Mach.PortConstructFlags
Enforce reply port semantics.
static let filterMsg: Mach.PortConstructFlags
Enable message filtering.
static let immovableReceive: Mach.PortConstructFlags
Mark the receive right as immovable, protected by the guard.
static let importanceReceiver: Mach.PortConstructFlags
Mark the port as an importance receiver.
static let insertSendRight: Mach.PortConstructFlags
Insert a send right in addition to the allocated receive right.
static let provisionalIdProtectionOptOut: Mach.PortConstructFlags
Opt out of identity protection for the port.
static let provisionalReplyPort: Mach.PortConstructFlags
Mark the port as a provisional reply port.
static let queueLimit: Mach.PortConstructFlags
Use the passed queue limit.
static let replyPort: Mach.PortConstructFlags
Mark the port as a reply port.
static let servicePort: Mach.PortConstructFlags
Construct a service port.
static let strict: Mach.PortConstructFlags
Use strict guarding.
static let tempOwner: Mach.PortConstructFlags
Set the tempower bit on the port.
static let trackThreadGroupBlocking: Mach.PortConstructFlags
Enable tracking of thread group blocking.
let rawValue: Int32
init()
Creates an empty option set.
init<S>(_ sequence: S) where S : Sequence, Self.Element == S.Element
Creates a new set from a finite sequence of items.
init(arrayLiteral: Self.Element...)
Creates a set containing the elements of the given array literal.
var isEmpty: Bool { get }
A Boolean value that indicates whether the set has no elements.
static func != (lhs: Self, rhs: Self) -> Bool
Returns a Boolean value indicating whether two values are not equal.
func contains(_ member: Self) -> Bool
Returns a Boolean value that indicates whether a given element is a member of the option set.
mutating func formIntersection(_ other: Self)
Removes all elements of this option set that are not also present in the given set.
mutating func formSymmetricDifference(_ other: Self)
Replaces this set with a new set containing all elements contained in either this set or the given set, but not in both.
mutating func formUnion(_ other: Self)
Inserts the elements of another set into this option set.
@discardableResult mutating func insert(_ newMember: Self.Element) -> (inserted: Bool, memberAfterInsert: Self.Element)
Adds the given element to the option set if it is not already a member.
func intersection(_ other: Self) -> Self
Returns a new option set with only the elements contained in both this set and the given set.
func isDisjoint(with other: Self) -> Bool
Returns a Boolean value that indicates whether the set has no members in common with the given set.
func isStrictSubset(of other: Self) -> Bool
Returns a Boolean value that indicates whether this set is a strict subset of the given set.
func isStrictSuperset(of other: Self) -> Bool
Returns a Boolean value that indicates whether this set is a strict superset of the given set.
func isSubset(of other: Self) -> Bool
Returns a Boolean value that indicates whether the set is a subset of another set.
func isSuperset(of other: Self) -> Bool
Returns a Boolean value that indicates whether the set is a superset of the given set.
@discardableResult mutating func remove(_ member: Self.Element) -> Self.Element?
Removes the given element and all elements subsumed by it.
mutating func subtract(_ other: Self)
Removes the elements of the given set from this set.
func subtracting(_ other: Self) -> Self
Returns a new set containing the elements of this set that do not occur in the given set.
func symmetricDifference(_ other: Self) -> Self
Returns a new option set with the elements contained in this set or in the given set, but not in both.
func union(_ other: Self) -> Self
Returns a new option set of the elements contained in this set, in the given set, or in both.
@discardableResult mutating func update(with newMember: Self.Element) -> Self.Element?
Inserts the given element into the set.