Projects
Browse Source     Search     Timeline     Wiki

Changeset 23483

Show
Ignore:
Timestamp:
01/14/08 16:51:21 (11 months ago)
Author:
zarzycki@…
Message:

More misc changes.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/launchd/src/launchd_runtime.c

    r23482 r23483  
    10221022                tmp_options = options; 
    10231023 
    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: 
    10251028                        /* We need to clean up and start over. */ 
    10261029                        if (bufReply->Head.msgh_bits & MACH_MSGH_BITS_COMPLEX) { 
     
    10281031                        } 
    10291032                        continue; 
    1030                 } else if (unlikely(mr == MACH_RCV_TIMED_OUT)) { 
     1033                case MACH_RCV_TIMED_OUT: 
    10311034                        if (to != MACH_MSG_TIMEOUT_NONE) { 
    10321035                                if (runtime_busy_cnt == 0) { 
     
    10371040                        } 
    10381041                        continue; 
    1039                 } else if (!launchd_assumes(mr == MACH_MSG_SUCCESS)) { 
     1042                default: 
     1043                        launchd_assumes(mr == MACH_MSG_SUCCESS); 
    10401044                        continue; 
    10411045                } 
     
    10771081                if (the_demux(&bufRequest->Head, &bufReply->Head) == FALSE) { 
    10781082                        /* XXX - also gross */ 
    1079                         if (bufRequest->Head.msgh_id == MACH_NOTIFY_NO_SENDERS) { 
     1083                        if (likely(bufRequest->Head.msgh_id == MACH_NOTIFY_NO_SENDERS)) { 
    10801084                                notify_server(&bufRequest->Head, &bufReply->Head); 
    10811085                        } 
    10821086                } 
    10831087 
     1088                /* bufReply is a union. If MACH_MSGH_BITS_COMPLEX is set, then bufReply->RetCode is assumed to be zero. */ 
    10841089                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)) { 
    10951102                        tmp_options |= MACH_SEND_MSG; 
    10961103 
    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)) { 
    10981105                                tmp_options |= MACH_SEND_TIMEOUT; 
    10991106                        }