- Timestamp:
- 2006-06-02T19:37:21Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 86029498
- Parents:
- 53daee3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
ns/ns.c
r53daee3 r2408969 102 102 ipcarg_t retval, arg1, arg2; 103 103 104 // printf("%s: Naming service started.\n", NAME);105 106 104 if (!hash_table_create(&ns_hash_table, NS_HASH_TABLE_CHAINS, 3, &ns_hash_table_ops)) { 107 // printf("%s: cannot create hash table\n", NAME);108 105 return ENOMEM; 109 106 } … … 111 108 while (1) { 112 109 callid = ipc_wait_for_call(&call); 113 // printf("NS: Call in_phone_hash=%lX...", call.in_phone_hash);114 110 switch (IPC_GET_METHOD(call)) { 115 case IPC_M_AS_AREA_SEND:116 as_area = (char *)IPC_GET_ARG1(call);117 // printf("Received as_area: %P, size:%d\n", as_area, IPC_GET_ARG2(call));118 retval = ipc_answer_fast(callid, 0,(sysarg_t)(1024*1024), 0);119 if (!retval) {120 // printf("Reading shared memory...");121 // printf("Text: %s", as_area);122 } else123 // printf("Failed answer: %d\n", retval);124 continue;125 111 case IPC_M_AS_AREA_RECV: 126 112 get_realtime_as(callid, &call); 127 113 continue; 128 case IPC_M_INTERRUPT:129 break;130 114 case IPC_M_PHONE_HUNGUP: 131 115 retval = 0; … … 136 120 */ 137 121 retval = register_service(IPC_GET_ARG1(call), IPC_GET_ARG3(call), &call); 138 ping_phone = IPC_GET_ARG3(call);139 122 break; 140 123 case IPC_M_CONNECT_ME_TO: … … 144 127 retval = connect_to_service(IPC_GET_ARG1(call), &call, callid); 145 128 break; 146 case NS_HANGUP:147 // printf("Closing connection.\n");148 retval = EHANGUP;149 break;150 case NS_PING:151 // printf("Ping...%P %P\n", IPC_GET_ARG1(call),152 // IPC_GET_ARG2(call));153 retval = 0;154 arg1 = 0xdead;155 arg2 = 0xbeef;156 break;157 case NS_PING_SVC:158 // printf("NS:Pinging service %d\n", ping_phone);159 ipc_call_sync(ping_phone, NS_PING, 0xbeef, 0);160 // printf("NS:Got pong\n");161 break;162 129 default: 163 // printf("Unknown method: %zd\n", IPC_GET_METHOD(call));164 130 retval = ENOENT; 165 131 break; 166 132 } 167 133 if (! (callid & IPC_CALLID_NOTIFICATION)) { 168 // printf("Answering.\n");169 134 ipc_answer_fast(callid, retval, arg1, arg2); 170 135 } … … 185 150 hashed_service_t *hs; 186 151 187 // printf("Registering service %d on phone %d...", service, phone);188 189 152 if (hash_table_find(&ns_hash_table, keys)) { 190 // printf("Service %d already registered.\n", service);191 153 return EEXISTS; 192 154 } … … 194 156 hs = (hashed_service_t *) malloc(sizeof(hashed_service_t)); 195 157 if (!hs) { 196 // printf("Failed to register service %d.\n", service);197 158 return ENOMEM; 198 159 } … … 223 184 hlp = hash_table_find(&ns_hash_table, keys); 224 185 if (!hlp) { 225 // printf("Service %d not registered.\n", service);226 186 return ENOENT; 227 187 } 228 188 hs = hash_table_get_instance(hlp, hashed_service_t, link); 229 // printf("Connecting in_phone_hash=%lX to service at phone %d...", call->in_phone_hash, hs->phone);230 189 return ipc_forward_fast(callid, hs->phone, 0, 0); 231 190 }
Note:
See TracChangeset
for help on using the changeset viewer.