Changeset 1643855 in mainline for uspace/app/trace/ipcp.c
- Timestamp:
- 2008-09-17T18:04:01Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e028660
- Parents:
- 8c125ad
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/trace/ipcp.c
r8c125ad r1643855 39 39 #include "ipc_desc.h" 40 40 #include "proto.h" 41 #include "trace.h" 41 42 #include "ipcp.h" 42 43 … … 178 179 proto_t *proto; 179 180 unsigned long key[1]; 181 oper_t *oper; 180 182 181 183 if (have_conn[phone]) proto = connections[phone].proto; 182 184 else proto = NULL; 183 185 184 // printf("ipcp_call_out()\n"); 185 printf("call id: 0x%x, phone: %d, proto: %s, method: ", hash, phone, 186 (proto ? proto->name : "n/a")); 187 ipc_m_print(proto, IPC_GET_METHOD(*call)); 188 printf(" args: (%u, %u, %u, %u, %u)\n", 189 IPC_GET_ARG1(*call), 190 IPC_GET_ARG2(*call), 191 IPC_GET_ARG3(*call), 192 IPC_GET_ARG4(*call), 193 IPC_GET_ARG5(*call) 194 ); 186 if ((display_mask & DM_IPC) != 0) { 187 printf("Call ID: 0x%x, phone: %d, proto: %s, method: ", hash, 188 phone, (proto ? proto->name : "n/a")); 189 ipc_m_print(proto, IPC_GET_METHOD(*call)); 190 printf(" args: (%u, %u, %u, %u, %u)\n", 191 IPC_GET_ARG1(*call), 192 IPC_GET_ARG2(*call), 193 IPC_GET_ARG3(*call), 194 IPC_GET_ARG4(*call), 195 IPC_GET_ARG5(*call) 196 ); 197 } 198 199 200 if ((display_mask & DM_USER) != 0) { 201 202 if (proto != NULL) { 203 oper = proto_get_oper(proto, IPC_GET_METHOD(*call)); 204 } else { 205 oper = NULL; 206 } 207 208 if (oper != NULL) { 209 210 printf("%s(%d).%s", (proto ? proto->name : "n/a"), 211 phone, (oper ? oper->name : "unknown")); 212 213 printf("(%u, %u, %u, %u, %u)\n", 214 IPC_GET_ARG1(*call), 215 IPC_GET_ARG2(*call), 216 IPC_GET_ARG3(*call), 217 IPC_GET_ARG4(*call), 218 IPC_GET_ARG5(*call) 219 ); 220 } 221 } 195 222 196 223 /* Store call in hash table for response matching */ … … 206 233 } 207 234 208 static void parse_answer(pending_call_t *pcall, ipc_call_t *answer) 235 static void parse_answer(ipc_callid_t hash, pending_call_t *pcall, 236 ipc_call_t *answer) 209 237 { 210 238 int phone; … … 220 248 method = IPC_GET_METHOD(pcall->question); 221 249 retval = IPC_GET_RETVAL(*answer); 222 printf("phone=%d, method=%d, retval=%d\n", 223 phone, method, retval); 250 251 if ((display_mask & DM_IPC) != 0) { 252 printf("Response to 0x%x: retval=%d, args = (%u, %u, %u, %u, %u)\n", 253 hash, retval, IPC_GET_ARG1(*answer), 254 IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer), 255 IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer)); 256 } 257 258 if ((display_mask & DM_USER) != 0) { 259 printf("-> %d\n", retval); 260 } 224 261 225 262 if (phone == 0 && method == IPC_M_CONNECT_ME_TO && retval == 0) { … … 230 267 231 268 cphone = IPC_GET_ARG5(*answer); 232 printf("registering connection (phone %d, protocol: %s)\n", cphone, 233 proto->name); 269 if ((display_mask & DM_SYSTEM) != 0) { 270 printf("Registering connection (phone %d, protocol: %s)\n", cphone, 271 proto->name); 272 } 234 273 ipcp_connection_set(cphone, 0, proto); 235 274 } … … 255 294 if ((hash & IPC_CALLID_ANSWERED) == 0 && hash != IPCP_CALLID_SYNC) { 256 295 /* Not a response */ 257 printf("Not a response (hash %d)\n", hash); 296 if ((display_mask & DM_IPC) != 0) { 297 printf("Not a response (hash %d)\n", hash); 298 } 258 299 return; 259 300 } … … 264 305 item = hash_table_find(&pending_calls, key); 265 306 if (item == NULL) return; // No matching question found 307 308 /* 309 * Response matched to question. 310 */ 266 311 267 312 pcall = hash_table_get_instance(item, pending_call_t, link); 268 269 printf("response matched to question\n");270 313 hash_table_remove(&pending_calls, key, 1); 271 314 272 parse_answer( pcall, call);315 parse_answer(hash, pcall, call); 273 316 free(pcall); 274 317 } … … 282 325 void ipcp_hangup(int phone, int rc) 283 326 { 284 printf("hangup phone %d -> %d\n", phone, rc); 285 ipcp_connection_clear(phone); 327 if ((display_mask & DM_SYSTEM) != 0) { 328 printf("Hang phone %d up -> %d\n", phone, rc); 329 ipcp_connection_clear(phone); 330 } 286 331 } 287 332
Note:
See TracChangeset
for help on using the changeset viewer.