Changeset eadaeae8 in mainline for uspace/app/trace
- Timestamp:
- 2018-03-21T20:58:49Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3be9d10
- Parents:
- 874381a
- Location:
- uspace/app/trace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/trace/ipcp.c
r874381a readaeae8 46 46 47 47 typedef struct { 48 sysarg_t phone_hash;48 cap_phone_handle_t phone_handle; 49 49 ipc_call_t question; 50 50 oper_t *oper; 51 51 52 ipc_callid_t call_hash;52 cap_call_handle_t call_handle; 53 53 54 54 ht_link_t link; … … 75 75 static size_t pending_call_key_hash(void *key) 76 76 { 77 ipc_callid_t *call_id = (ipc_callid_t *)key;78 return *call_id;77 cap_call_handle_t *chandle = (cap_call_handle_t *) key; 78 return CAP_HANDLE_RAW(*chandle); 79 79 } 80 80 … … 82 82 { 83 83 pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link); 84 return hs->call_hash;84 return CAP_HANDLE_RAW(hs->call_handle); 85 85 } 86 86 87 87 static bool pending_call_key_equal(void *key, const ht_link_t *item) 88 88 { 89 ipc_callid_t *call_id = (ipc_callid_t *)key;89 cap_call_handle_t *chandle = (cap_call_handle_t *) key; 90 90 pending_call_t *hs = hash_table_get_inst(item, pending_call_t, link); 91 91 92 return *c all_id == hs->call_hash;92 return *chandle == hs->call_handle; 93 93 } 94 94 … … 102 102 103 103 104 void ipcp_connection_set(int phone, int server, proto_t *proto) 105 { 106 if (phone <0 || phone >= MAX_PHONE) return; 107 connections[phone].server = server; 108 connections[phone].proto = proto; 109 have_conn[phone] = 1; 110 } 111 112 void ipcp_connection_clear(int phone) 113 { 114 have_conn[phone] = 0; 115 connections[phone].server = 0; 116 connections[phone].proto = NULL; 104 void ipcp_connection_set(cap_phone_handle_t phone, int server, proto_t *proto) 105 { 106 // XXX: there is no longer a limit on the number of phones as phones are 107 // now handled using capabilities 108 if (CAP_HANDLE_RAW(phone) < 0 || CAP_HANDLE_RAW(phone) >= MAX_PHONE) 109 return; 110 connections[CAP_HANDLE_RAW(phone)].server = server; 111 connections[CAP_HANDLE_RAW(phone)].proto = proto; 112 have_conn[CAP_HANDLE_RAW(phone)] = 1; 113 } 114 115 void ipcp_connection_clear(cap_phone_handle_t phone) 116 { 117 have_conn[CAP_HANDLE_RAW(phone)] = 0; 118 connections[CAP_HANDLE_RAW(phone)].server = 0; 119 connections[CAP_HANDLE_RAW(phone)].proto = NULL; 117 120 } 118 121 … … 174 177 } 175 178 176 void ipcp_call_out(int phone, ipc_call_t *call, ipc_callid_t hash) 179 void ipcp_call_out(cap_phone_handle_t phandle, ipc_call_t *call, 180 cap_call_handle_t chandle) 177 181 { 178 182 pending_call_t *pcall; … … 182 186 int i; 183 187 184 if (have_conn[phone]) proto = connections[phone].proto; 185 else proto = NULL; 188 if (have_conn[CAP_HANDLE_RAW(phandle)]) 189 proto = connections[CAP_HANDLE_RAW(phandle)].proto; 190 else 191 proto = NULL; 186 192 187 193 args = call->args; 188 194 189 195 if ((display_mask & DM_IPC) != 0) { 190 printf("Call ID: %d, phone: %d, proto: %s, method: ", 191 hash, phone, 192 (proto ? proto->name : "n/a")); 196 printf("Call ID: %p, phone: %p, proto: %s, method: ", 197 chandle, phandle, (proto ? proto->name : "n/a")); 193 198 ipc_m_print(proto, IPC_GET_IMETHOD(*call)); 194 199 printf(" args: (%" PRIun ", %" PRIun ", %" PRIun ", " … … 208 213 if (oper != NULL) { 209 214 210 printf("%s(% d).%s", (proto ? proto->name : "n/a"),211 ph one, (oper ? oper->name : "unknown"));215 printf("%s(%p).%s", (proto ? proto->name : "n/a"), 216 phandle, (oper ? oper->name : "unknown")); 212 217 213 218 putchar('('); … … 236 241 237 242 pcall = malloc(sizeof(pending_call_t)); 238 pcall->phone_ha sh = phone;243 pcall->phone_handle = phandle; 239 244 pcall->question = *call; 240 pcall->call_ha sh = hash;245 pcall->call_handle = chandle; 241 246 pcall->oper = oper; 242 247 … … 244 249 } 245 250 246 static void parse_answer( ipc_callid_t hash, pending_call_t *pcall,251 static void parse_answer(cap_call_handle_t call_handle, pending_call_t *pcall, 247 252 ipc_call_t *answer) 248 253 { 249 sysarg_t phone;254 cap_phone_handle_t phone; 250 255 sysarg_t method; 251 256 sysarg_t service; 252 257 errno_t retval; 253 258 proto_t *proto; 254 int cphone;259 cap_phone_handle_t cphone; 255 260 256 261 sysarg_t *resp; … … 258 263 int i; 259 264 260 phone = pcall->phone_ha sh;265 phone = pcall->phone_handle; 261 266 method = IPC_GET_IMETHOD(pcall->question); 262 267 retval = IPC_GET_RETVAL(*answer); … … 265 270 266 271 if ((display_mask & DM_IPC) != 0) { 267 printf("Response to % d: retval=%s, args = (%" PRIun ", "272 printf("Response to %p: retval=%s, args = (%" PRIun ", " 268 273 "%" PRIun ", %" PRIun ", %" PRIun ", %" PRIun ")\n", 269 hash, str_error_name(retval), IPC_GET_ARG1(*answer),274 call_handle, str_error_name(retval), IPC_GET_ARG1(*answer), 270 275 IPC_GET_ARG2(*answer), IPC_GET_ARG3(*answer), 271 276 IPC_GET_ARG4(*answer), IPC_GET_ARG5(*answer)); … … 307 312 proto = proto_unknown; 308 313 309 cphone = IPC_GET_ARG5(*answer);314 cphone = (cap_phone_handle_t) IPC_GET_ARG5(*answer); 310 315 if ((display_mask & DM_SYSTEM) != 0) { 311 printf("Registering connection (phone % d, protocol: %s)\n", cphone,316 printf("Registering connection (phone %p, protocol: %s)\n", cphone, 312 317 proto->name); 313 318 } … … 317 322 } 318 323 319 void ipcp_call_in(ipc_call_t *call, ipc_callid_t hash)324 void ipcp_call_in(ipc_call_t *call, cap_call_handle_t chandle) 320 325 { 321 326 ht_link_t *item; … … 325 330 /* Not a response */ 326 331 if ((display_mask & DM_IPC) != 0) { 327 printf("Not a response (ha sh %d)\n", hash);332 printf("Not a response (handle %p)\n", chandle); 328 333 } 329 334 return; 330 335 } 331 336 332 item = hash_table_find(&pending_calls, & hash);337 item = hash_table_find(&pending_calls, &chandle); 333 338 if (item == NULL) 334 339 return; /* No matching question found */ … … 339 344 340 345 pcall = hash_table_get_inst(item, pending_call_t, link); 341 hash_table_remove(&pending_calls, & hash);342 343 parse_answer( hash, pcall, call);346 hash_table_remove(&pending_calls, &chandle); 347 348 parse_answer(chandle, pcall, call); 344 349 free(pcall); 345 350 } 346 351 347 void ipcp_hangup( int phone, errno_t rc)352 void ipcp_hangup(cap_phone_handle_t phone, errno_t rc) 348 353 { 349 354 if ((display_mask & DM_SYSTEM) != 0) { 350 printf("Hang phone %d up -> %s\n", phone, str_error_name(rc));355 printf("Hang up phone %p -> %s\n", phone, str_error_name(rc)); 351 356 ipcp_connection_clear(phone); 352 357 } -
uspace/app/trace/ipcp.h
r874381a readaeae8 41 41 void ipcp_cleanup(void); 42 42 43 void ipcp_call_out( int phone, ipc_call_t *call, ipc_callid_t hash);44 void ipcp_call_sync( int phone, ipc_call_t *call, ipc_call_t *answer);45 void ipcp_call_in(ipc_call_t *call, ipc_callid_t hash);46 void ipcp_hangup( int phone, errno_t rc);43 void ipcp_call_out(cap_phone_handle_t, ipc_call_t *, cap_call_handle_t); 44 void ipcp_call_sync(cap_phone_handle_t, ipc_call_t *call, ipc_call_t *answer); 45 void ipcp_call_in(ipc_call_t *call, cap_call_handle_t); 46 void ipcp_hangup(cap_phone_handle_t, errno_t); 47 47 48 void ipcp_connection_set( int phone, int server, proto_t *proto);49 void ipcp_connection_clear( int phone);48 void ipcp_connection_set(cap_phone_handle_t, int server, proto_t *proto); 49 void ipcp_connection_clear(cap_phone_handle_t); 50 50 51 51 #endif -
uspace/app/trace/trace.c
r874381a readaeae8 282 282 { 283 283 ipc_call_t call; 284 sysarg_t phoneid;284 cap_phone_handle_t phandle; 285 285 286 286 if (sc_rc != EOK) 287 287 return; 288 288 289 ph oneid =sc_args[0];289 phandle = (cap_phone_handle_t) sc_args[0]; 290 290 291 291 IPC_SET_IMETHOD(call, sc_args[1]); … … 296 296 IPC_SET_ARG5(call, 0); 297 297 298 ipcp_call_out(ph oneid, &call, 0);298 ipcp_call_out(phandle, &call, 0); 299 299 } 300 300 … … 311 311 312 312 if (rc == EOK) { 313 ipcp_call_out( sc_args[0], &call, 0);314 } 315 } 316 317 static void sc_ipc_wait(sysarg_t *sc_args, int sc_rc)313 ipcp_call_out((cap_phone_handle_t) sc_args[0], &call, 0); 314 } 315 } 316 317 static void sc_ipc_wait(sysarg_t *sc_args, cap_call_handle_t sc_rc) 318 318 { 319 319 ipc_call_t call; … … 390 390 break; 391 391 case SYS_IPC_WAIT: 392 sc_ipc_wait(sc_args, sc_rc);392 sc_ipc_wait(sc_args, (cap_call_handle_t) sc_rc); 393 393 break; 394 394 default:
Note:
See TracChangeset
for help on using the changeset viewer.