Changeset 23483
- Timestamp:
- 01/14/08 16:51:21 (11 months ago)
- Files:
-
- 1 modified
-
trunk/launchd/src/launchd_runtime.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/launchd/src/launchd_runtime.c
r23482 r23483 1022 1022 tmp_options = options; 1023 1023 1024 if (unlikely(mr == MACH_SEND_INVALID_DEST || mr == MACH_SEND_TIMED_OUT)) { 1024 /* It looks like the compiler doesn't optimize switch(unlikely(...)) */ 1025 if (unlikely(mr)) switch (mr) { 1026 case MACH_SEND_INVALID_DEST: 1027 case MACH_SEND_TIMED_OUT: 1025 1028 /* We need to clean up and start over. */ 1026 1029 if (bufReply->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) { … … 1028 1031 } 1029 1032 continue; 1030 } else if (unlikely(mr == MACH_RCV_TIMED_OUT)) {1033 case MACH_RCV_TIMED_OUT: 1031 1034 if (to != MACH_MSG_TIMEOUT_NONE) { 1032 1035 if (runtime_busy_cnt == 0) { … … 1037 1040 } 1038 1041 continue; 1039 } else if (!launchd_assumes(mr == MACH_MSG_SUCCESS)) { 1042 default: 1043 launchd_assumes(mr == MACH_MSG_SUCCESS); 1040 1044 continue; 1041 1045 } … … 1077 1081 if (the_demux(&bufRequest->Head, &bufReply->Head) == FALSE) { 1078 1082 /* XXX - also gross */ 1079 if ( bufRequest->Head.msgh_id == MACH_NOTIFY_NO_SENDERS) {1083 if (likely(bufRequest->Head.msgh_id == MACH_NOTIFY_NO_SENDERS)) { 1080 1084 notify_server(&bufRequest->Head, &bufReply->Head); 1081 1085 } 1082 1086 } 1083 1087 1088 /* bufReply is a union. If MACH_MSGH_BITS_COMPLEX is set, then bufReply->RetCode is assumed to be zero. */ 1084 1089 if (!(bufReply->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { 1085 if (bufReply->RetCode == MIG_NO_REPLY) { 1086 bufReply->Head.msgh_remote_port = MACH_PORT_NULL; 1087 } else if ((bufReply->RetCode != KERN_SUCCESS) && (bufRequest->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX)) { 1088 /* destroy the request - but not the reply port */ 1089 bufRequest->Head.msgh_remote_port = MACH_PORT_NULL; 1090 mach_msg_destroy(&bufRequest->Head); 1091 } 1092 } 1093 1094 if (bufReply->Head.msgh_remote_port != MACH_PORT_NULL) { 1090 if (unlikely(bufReply->RetCode != KERN_SUCCESS)) { 1091 if (likely(bufReply->RetCode == MIG_NO_REPLY)) { 1092 bufReply->Head.msgh_remote_port = MACH_PORT_NULL; 1093 } else if (bufRequest->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) { 1094 /* destroy the request - but not the reply port */ 1095 bufRequest->Head.msgh_remote_port = MACH_PORT_NULL; 1096 mach_msg_destroy(&bufRequest->Head); 1097 } 1098 } 1099 } 1100 1101 if (likely(bufReply->Head.msgh_remote_port != MACH_PORT_NULL)) { 1095 1102 tmp_options |= MACH_SEND_MSG; 1096 1103 1097 if ( MACH_MSGH_BITS_REMOTE(bufReply->Head.msgh_bits) != MACH_MSG_TYPE_MOVE_SEND_ONCE) {1104 if (unlikely(MACH_MSGH_BITS_REMOTE(bufReply->Head.msgh_bits) != MACH_MSG_TYPE_MOVE_SEND_ONCE)) { 1098 1105 tmp_options |= MACH_SEND_TIMEOUT; 1099 1106 }

