/branches/tracing/uspace/app/sctrace/proto.c |
---|
56,12 → 56,34 |
link_t link; |
} method_oper_t; |
hash_index_t srv_proto_hash(unsigned long key[]) |
static hash_index_t srv_proto_hash(unsigned long key[]); |
static int srv_proto_compare(unsigned long key[], hash_count_t keys, |
link_t *item); |
static void srv_proto_remove_callback(link_t *item); |
hash_table_operations_t srv_proto_ops = { |
.hash = srv_proto_hash, |
.compare = srv_proto_compare, |
.remove_callback = srv_proto_remove_callback |
}; |
static hash_index_t method_oper_hash(unsigned long key[]); |
static int method_oper_compare(unsigned long key[], hash_count_t keys, |
link_t *item); |
static void method_oper_remove_callback(link_t *item); |
hash_table_operations_t method_oper_ops = { |
.hash = method_oper_hash, |
.compare = method_oper_compare, |
.remove_callback = method_oper_remove_callback |
}; |
static hash_index_t srv_proto_hash(unsigned long key[]) |
{ |
return key[0] % SRV_PROTO_TABLE_CHAINS; |
} |
int srv_proto_compare(unsigned long key[], hash_count_t keys, |
static int srv_proto_compare(unsigned long key[], hash_count_t keys, |
link_t *item) |
{ |
srv_proto_t *sp; |
71,22 → 93,16 |
return key[0] == sp->srv; |
} |
void srv_proto_remove_callback(link_t *item) |
static void srv_proto_remove_callback(link_t *item) |
{ |
} |
hash_table_operations_t srv_proto_ops = { |
.hash = srv_proto_hash, |
.compare = srv_proto_compare, |
.remove_callback = srv_proto_remove_callback |
}; |
hash_index_t method_oper_hash(unsigned long key[]) |
static hash_index_t method_oper_hash(unsigned long key[]) |
{ |
return key[0] % METHOD_OPER_TABLE_CHAINS; |
} |
int method_oper_compare(unsigned long key[], hash_count_t keys, |
static int method_oper_compare(unsigned long key[], hash_count_t keys, |
link_t *item) |
{ |
method_oper_t *mo; |
96,17 → 112,11 |
return key[0] == mo->method; |
} |
void method_oper_remove_callback(link_t *item) |
static void method_oper_remove_callback(link_t *item) |
{ |
} |
hash_table_operations_t method_oper_ops = { |
.hash = method_oper_hash, |
.compare = method_oper_compare, |
.remove_callback = method_oper_remove_callback |
}; |
void proto_init(void) |
{ |
hash_table_create(&srv_proto, SRV_PROTO_TABLE_CHAINS, 1, |
/branches/tracing/uspace/app/sctrace/sctrace.c |
---|
68,7 → 68,7 |
static proto_t *proto_console; |
int task_connect(int taskid) |
static int task_connect(int taskid) |
{ |
int rc; |
91,16 → 91,15 |
return 0; |
} |
int get_thread_list(void) |
static int get_thread_list(void) |
{ |
int rc; |
int tb_copied; |
int tb_needed; |
size_t tb_copied; |
size_t tb_needed; |
int i; |
printf("send IPC_M_DEBUG_THREAD_READ message\n"); |
rc = udebug_thread_read(phoneid, (unsigned)thread_hash_buf, |
rc = udebug_thread_read(phoneid, thread_hash_buf, |
THBUF_SIZE*sizeof(unsigned), &tb_copied, &tb_needed); |
printf("-> %d\n", rc); |
if (rc < 0) return rc; |
116,7 → 115,7 |
return 0; |
} |
void print_sc_retval(int retval, rv_type_t rv_type) |
static void print_sc_retval(int retval, rv_type_t rv_type) |
{ |
printf (" -> "); |
if (rv_type == RV_INTEGER) { |
143,7 → 142,7 |
putchar('\n'); |
} |
void print_sc_args(unsigned *sc_args, int n) |
static void print_sc_args(unsigned *sc_args, int n) |
{ |
int i; |
155,7 → 154,7 |
putchar(')'); |
} |
void sc_ipc_call_async_fast(unsigned *sc_args, int sc_rc) |
static void sc_ipc_call_async_fast(unsigned *sc_args, int sc_rc) |
{ |
ipc_call_t call; |
int phoneid; |
175,7 → 174,7 |
ipcp_call_out(phoneid, &call, sc_rc); |
} |
void sc_ipc_call_async_slow(unsigned *sc_args, int sc_rc) |
static void sc_ipc_call_async_slow(unsigned *sc_args, int sc_rc) |
{ |
ipc_call_t call; |
int rc; |
191,7 → 190,7 |
} |
} |
void sc_ipc_call_sync_fast(unsigned *sc_args) |
static void sc_ipc_call_sync_fast(unsigned *sc_args) |
{ |
ipc_call_t question, reply; |
int rc; |
219,7 → 218,7 |
ipcp_call_sync(phoneidx, &question, &reply); |
} |
void sc_ipc_call_sync_slow(unsigned *sc_args) |
static void sc_ipc_call_sync_slow(unsigned *sc_args) |
{ |
ipc_call_t question, reply; |
int rc; |
237,12 → 236,12 |
ipcp_call_sync(sc_args[0], &question, &reply); |
} |
void sc_ipc_wait(unsigned *sc_args, int sc_rc) |
static void sc_ipc_wait(unsigned *sc_args, int sc_rc) |
{ |
ipc_call_t call; |
int rc; |
if (sc_rc == 0) return 0; |
if (sc_rc == 0) return; |
memset(&call, 0, sizeof(call)); |
rc = udebug_mem_read(phoneid, &call, sc_args[0], sizeof(call)); |
254,10 → 253,9 |
} |
} |
void event_syscall_b(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
static void event_syscall_b(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
{ |
unsigned sc_args[6]; |
int rv_type; |
int rc; |
/* Read syscall arguments */ |
280,7 → 278,7 |
async_serialize_end(); |
} |
void event_syscall_e(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
static void event_syscall_e(unsigned thread_id, unsigned thread_hash, unsigned sc_id, int sc_rc) |
{ |
unsigned sc_args[6]; |
int rv_type; |
325,7 → 323,7 |
async_serialize_end(); |
} |
void event_thread_b(unsigned hash) |
static void event_thread_b(unsigned hash) |
{ |
async_serialize_start(); |
printf("new thread, hash 0x%x\n", hash); |
334,7 → 332,7 |
thread_trace_start(hash); |
} |
void trace_loop(void *thread_hash_arg) |
static int trace_loop(void *thread_hash_arg) |
{ |
int rc; |
unsigned ev_type; |
393,6 → 391,7 |
} |
printf("trace_loop(%d) exiting\n", thread_id); |
return 0; |
} |
void thread_trace_start(unsigned thread_hash) |
408,7 → 407,7 |
fibril_add_ready(fid); |
} |
void trace_active_task(void) |
static void trace_active_task(void) |
{ |
int taskid; |
int i; |
/branches/tracing/uspace/app/sctrace/ipcp.c |
---|
63,13 → 63,25 |
#define PCALL_TABLE_CHAINS 32 |
hash_table_t pending_calls; |
hash_index_t pending_call_hash(unsigned long key[]) |
static hash_index_t pending_call_hash(unsigned long key[]); |
static int pending_call_compare(unsigned long key[], hash_count_t keys, |
link_t *item); |
static void pending_call_remove_callback(link_t *item); |
hash_table_operations_t pending_call_ops = { |
.hash = pending_call_hash, |
.compare = pending_call_compare, |
.remove_callback = pending_call_remove_callback |
}; |
static hash_index_t pending_call_hash(unsigned long key[]) |
{ |
// printf("pending_call_hash\n"); |
return key[0] % PCALL_TABLE_CHAINS; |
} |
int pending_call_compare(unsigned long key[], hash_count_t keys, |
static int pending_call_compare(unsigned long key[], hash_count_t keys, |
link_t *item) |
{ |
pending_call_t *hs; |
80,16 → 92,11 |
return key[0] == hs->call_hash; |
} |
void pending_call_remove_callback(link_t *item) |
static void pending_call_remove_callback(link_t *item) |
{ |
// printf("pending_call_remove_callback\n"); |
} |
hash_table_operations_t pending_call_ops = { |
.hash = pending_call_hash, |
.compare = pending_call_compare, |
.remove_callback = pending_call_remove_callback |
}; |
void ipcp_connection_set(int phone, int server, proto_t *proto) |
{ |
147,6 → 154,7 |
{ |
pending_call_t *pcall; |
proto_t *proto; |
unsigned long key[1]; |
if (have_conn[phone]) proto = connections[phone].proto; |
else proto = NULL; |
170,7 → 178,9 |
pcall->question = *call; |
pcall->call_hash = hash; |
hash_table_insert(&pending_calls, &pcall->call_hash, &pcall->link); |
key[0] = hash; |
hash_table_insert(&pending_calls, key, &pcall->link); |
} |
static void parse_answer(pending_call_t *pcall, ipc_call_t *answer) |
208,6 → 218,7 |
{ |
link_t *item; |
pending_call_t *pcall; |
unsigned long key[1]; |
// printf("ipcp_call_in()\n"); |
/* printf("phone: %d, method: ", call->in_phone_hash); |
227,14 → 238,15 |
} |
hash = hash & ~IPC_CALLID_ANSWERED; |
key[0] = hash; |
item = hash_table_find(&pending_calls, &hash); |
item = hash_table_find(&pending_calls, key); |
if (item == NULL) return; // No matching question found |
pcall = hash_table_get_instance(item, pending_call_t, link); |
printf("response matched to question\n"); |
hash_table_remove(&pending_calls, &hash, 1); |
hash_table_remove(&pending_calls, key, 1); |
parse_answer(pcall, call); |
free(pcall); |
/branches/tracing/uspace/app/sctrace/Makefile |
---|
57,7 → 57,7 |
-include Makefile.depend |
clean: |
-rm -f $(OUTPUT) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend |
-rm -f $(OUTPUT) $(OBJECTS) $(OUTPUT).map $(OUTPUT).disasm Makefile.depend |
depend: |
$(CC) $(DEFS) $(CFLAGS) -M $(SOURCES) > Makefile.depend |