Changeset 8c125ad in mainline
- Timestamp:
- 2008-09-17T15:36:34Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1643855
- Parents:
- c9a29d6
- Location:
- uspace/app/trace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/trace/ipcp.c
rc9a29d6 r8c125ad 64 64 hash_table_t pending_calls; 65 65 66 /* 67 * Pseudo-protocols 68 */ 69 proto_t *proto_system; /**< Protocol describing system IPC methods. */ 70 proto_t *proto_unknown; /**< Protocol with no known methods. */ 71 66 72 static hash_index_t pending_call_hash(unsigned long key[]); 67 73 static int pending_call_compare(unsigned long key[], hash_count_t keys, … … 116 122 static void ipc_m_print(proto_t *proto, ipcarg_t method) 117 123 { 124 oper_t *oper; 125 126 /* Try system methods first */ 127 oper = proto_get_oper(proto_system, method); 128 129 if (oper == NULL && proto != NULL) { 130 /* Not a system method, try the user protocol. */ 131 oper = proto_get_oper(proto, method); 132 } 133 134 if (oper != NULL) { 135 printf("%s (%d)", oper->name, method); 136 return; 137 } 138 139 printf("%d", method); 140 } 141 142 void ipcp_init(void) 143 { 118 144 ipc_m_desc_t *desc; 119 145 oper_t *oper; 120 146 121 /* FIXME: too slow */ 147 /* 148 * Create a pseudo-protocol 'unknown' that has no known methods. 149 */ 150 proto_unknown = proto_new("unknown"); 151 152 /* 153 * Create a pseudo-protocol 'system' defining names of system IPC 154 * methods. 155 */ 156 proto_system = proto_new("system"); 157 122 158 desc = ipc_methods; 123 159 while (desc->number != 0) { 124 if (desc->number == method) { 125 printf("%s (%d)", desc->name, method); 126 return; 127 } 160 oper = oper_new(desc->name); 161 proto_add_oper(proto_system, desc->number, oper); 128 162 129 163 ++desc; 130 164 } 131 165 132 if (proto != NULL) {133 oper = proto_get_oper(proto, method);134 if (oper != NULL) {135 printf("%s (%d)", oper->name, method);136 return;137 }138 }139 140 printf("%d", method);141 }142 143 void ipcp_init(void)144 {145 166 hash_table_create(&pending_calls, PCALL_TABLE_CHAINS, 1, &pending_call_ops); 146 167 } … … 148 169 void ipcp_cleanup(void) 149 170 { 171 proto_delete(proto_system); 150 172 hash_table_destroy(&pending_calls); 151 173 } … … 190 212 ipcarg_t service; 191 213 int retval; 192 static proto_t proto_unknown = { .name = "unknown" };193 214 proto_t *proto; 194 215 int cphone; … … 206 227 service = IPC_GET_ARG1(pcall->question); 207 228 proto = proto_get_by_srv(service); 208 if (proto == NULL) proto = &proto_unknown;229 if (proto == NULL) proto = proto_unknown; 209 230 210 231 cphone = IPC_GET_ARG5(*answer); -
uspace/app/trace/proto.c
rc9a29d6 r8c125ad 173 173 } 174 174 175 void proto_delete(proto_t *proto) 176 { 177 free(proto); 178 } 179 175 180 void proto_add_oper(proto_t *proto, int method, oper_t *oper) 176 181 { -
uspace/app/trace/proto.h
rc9a29d6 r8c125ad 59 59 proto_t *proto_get_by_srv(int srv); 60 60 proto_t *proto_new(char *name); 61 void proto_delete(proto_t *proto); 61 62 void proto_add_oper(proto_t *proto, int method, oper_t *oper); 62 63 oper_t *proto_get_oper(proto_t *proto, int method);
Note:
See TracChangeset
for help on using the changeset viewer.