Skip to content

Commit ffd3402

Browse files
committed
clarify MIGClient
1 parent adcdd55 commit ffd3402

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

Sources/Mach/Core/Messaging/MIG/MIGClient.swift

+13-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import Darwin.Mach
22
import Foundation
33

44
extension Mach {
5-
/// A client for a MIG subsystem.
5+
/// A client for MIG requests.
66
open class MIGClient: Mach.Port {
77
/// The base routine ID for the remote MIG subsystem.
8-
public var baseRoutineId: mach_msg_id_t = 0
8+
/// - Warning: The vast majority of the time, this should not change after initialization. However, it is left as a
9+
/// variable for advanced cases (such as when multiple MIG subsystems are available through the same port), as well
10+
/// as to allow it to be set by convenience initializers (after the actual initializer has been called).
11+
public var baseRoutineId: mach_msg_id_t
912

1013
/// Represents an existing MIG server port.
1114
public required init(named name: mach_port_name_t, baseRoutineId: mach_msg_id_t) {
@@ -72,3 +75,11 @@ extension Mach {
7275
}
7376
}
7477
}
78+
79+
extension Mach.PortInitializableByServiceName where Self: Mach.MIGClient {
80+
/// Obtains a MIG client for the given service.
81+
public init(serviceName: String, baseRoutineId: mach_msg_id_t) throws {
82+
try self.init(serviceName: serviceName)
83+
self.baseRoutineId = baseRoutineId
84+
}
85+
}

0 commit comments

Comments
 (0)