@@ -25,12 +25,13 @@ extension Mach {
2525 public func doRoutine(
2626 _ routineIndex: mach_msg_id_t ,
2727 request: MIGRequest < some Mach . MIGPayload > ,
28- on replyPort: Mach . Port ? = nil
28+ replyPort: Mach . Port ? = nil
2929 ) throws -> MIGReply < Never > {
3030 try self . doRoutine (
3131 routineIndex,
3232 request: request,
33- replyPayloadType: Never . self
33+ replyPayloadType: Never . self,
34+ replyPort: replyPort
3435 )
3536 }
3637
@@ -40,15 +41,15 @@ extension Mach {
4041 _ routineIndex: mach_msg_id_t ,
4142 request: MIGRequest < some Mach . MIGPayload > ,
4243 replyPayloadType: ReplyPayload . Type ,
43- on replyPort: Mach . Port = Mach . MIGReplyPort ( )
44+ replyPort: Mach . Port ?
4445 ) throws -> Mach . MIGReply < ReplyPayload > {
4546 let routineId = self . baseRoutineId + routineIndex
4647 request. header. msgh_id = routineId
4748 request. header. bits. remotePortDisposition = . copySend // make a copy of the send right so we can reuse the port
4849 request. header. bits. localPortDisposition = . makeSendOnce // make a send-once right so we can receive the reply
4950 let reply = try Mach . Message. send (
5051 request, to: self ,
51- receiving: Mach . MIGReply< ReplyPayload> . self , from: replyPort
52+ receiving: Mach . MIGReply< ReplyPayload> . self , from: replyPort ?? Mach . MIGReplyPort ( )
5253 )
5354 guard reply. header. msgh_id != MACH_NOTIFY_SEND_ONCE else {
5455 throw Mach . MIGError ( . serverDied)
0 commit comments