| true | 42 | | trc_recv_messages( ID, max_count, status ) |
| | 43 | | TRC_ID ID; |
| | 44 | | int max_count; |
| | 45 | | int *status; |
| | 46 | | { |
| | 47 | | static int *tids = (int *) NULL;
|
| | 48 | | static int ntids = 0; |
| | 49 | | |
| | 50 | | TRC_HOST H; |
| | 51 | | |
| | 52 | | TRC_ID DEAD_ID_last; |
| | | | ... |
| | 61 | | int mid; |
| | 62 | | int num; |
| | 63 | | int tid; |
| | 64 | | int src; |
| | 65 | | int tmp; |
| | 66 | | int cc; |
| | 67 | | int i; |
| | 68 | | |
| | 69 | | |
| | 70 | | |
| | 71 | | if ( TRC_HOST_ADD_NOTIFY_CODE == -1 |
| | 72 | | || TRC_HOST_DEL_NOTIFY_CODE == -1 |
| | 73 | | #ifndef USE_PVM_33 |
| | 74 | | || ID->event_ctx == -1 || ID->output_ctx == -1 |
| | 75 | | #endif |
| | 76 | | || ID->event_tag == -1 || ID->output_tag == -1 ) |
| | 77 | | { |
| | 78 | | printf( "Error: Message Codes Not Set - %d %d %d %d %d %d\n", |
| | 79 | | TRC_HOST_ADD_NOTIFY_CODE, TRC_HOST_DEL_NOTIFY_CODE, |
| | 80 | | ID->event_ctx, ID->output_ctx, |
| | 81 | | ID->event_tag, ID->output_tag ); |
| | 82 | | |
| | 83 | | return( -1 ); |
| | 84 | | } |
| | 85 | | |
| | 86 | | |
| | 87 | | |
| | 88 | | if ( status != NULL )
|
| | 89 | | *status = TRC_MSG_STATUS_NONE;
|
| | 90 | | |
| | 91 | | |
| | 92 | | |
| | 93 | | ecnt = 0; |
| | 94 | | |
| | 95 | | |
| | 96 | | |
| | 97 | | ecnt += trc_check_host_sync( ID ); |
| | 98 | | |
| | 99 | | |
| | 100 | | |
| | 101 | | cnt = 0; |
| | 102 | | |
| | 103 | | while ( cnt < max_count |
| | 104 | | && (mid = trc_get_msg( ID, &len, &msgtag, &src, &others )) > 0 ) |
| | 105 | | { |
| | 106 | | |
| | 107 | | |
| | 108 | | if ( status != NULL )
|
| | 109 | | *status |= TRC_MSG_STATUS_ACTIVE;
|
| | 110 | | |
| | 111 | | |
| | 112 | | |
| | 113 | | if ( msgtag == TRC_HOST_ADD_NOTIFY_CODE && src == 0x80000000 ) |
| | | | ... |
| | 200 | | "Tracer: msg from 0x%x code %d len %d ?\n", |
| | 201 | | src, msgtag, len ); |
| | 202 | | } |
| | 203 | | |
| | 204 | | if ( pvm_freebuf( mid ) < 0 ) |
| | 205 | | pvm_perror( "Error Freeing Message Buffer" ); |
| | 206 | | |
| | 207 | | cnt++; |
| | 208 | | } |
| | 209 | | |
| | 210 | | if ( mid < 0 ) |
| | 211 | | { |
| | 212 | | pvm_perror( "PVM System Failure" ); |
| | 213 | | |
| | 214 | | printf( "Tracer exiting...\n" ); |
| | 215 | | |
| | 216 | | return( -1 ); |
| | 217 | | } |
| | 218 | | |
| | 219 | | if ( status != NULL )
|
| | 220 | | { |
| | 221 | | if ( cnt == max_count ) |
| | 222 | | *status |= TRC_MSG_STATUS_MORE;
|
| | 223 | | } |
| | 224 | | |
| | 225 | | |
| | 226 | | |
| others is uninitialized | 227 | | if ( others ) |