Changeset b2f05e2 in mainline
- Timestamp:
- 2020-01-09T06:27:27Z (5 years ago)
- Children:
- 8a74512
- Parents:
- 33c5626
- git-author:
- Matthieu Riolo <matthieu.riolo@…> (2020-01-09 02:56:12)
- git-committer:
- Matthieu Riolo <matthieu.riolo@…> (2020-01-09 06:27:27)
- Location:
- uspace
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/taskman.c
r33c5626 rb2f05e2 132 132 { 133 133 async_exch_t *exch = taskman_exchange_begin(); 134 errno_t rc = async_connect_to_me(exch, INTERFACE_ANY, TASKMAN_LOADER_CALLBACK, 0); 134 aid_t req = async_send_0(exch, TASKMAN_I_AM_LOADER, NULL); 135 136 errno_t rc = async_connect_to_me(exch, INTERFACE_ANY, 0, 0); 135 137 taskman_exchange_end(exch); 136 138 137 return rc; 139 if (rc != EOK) { 140 async_forget(req); 141 return rc; 142 } 143 144 errno_t retval; 145 async_wait_for(req, &retval); 146 return retval; 138 147 } 139 148 -
uspace/lib/c/include/ipc/taskman.h
r33c5626 rb2f05e2 43 43 TASKMAN_EVENT_CALLBACK, 44 44 TASKMAN_NEW_TASK, 45 45 46 TASKMAN_I_AM_NS, 47 TASKMAN_I_AM_LOADER, 46 48 47 49 TASKMAN_CONNECT_TO_NS, 48 TASKMAN_CONNECT_TO_LOADER, 49 TASKMAN_LOADER_CALLBACK 50 TASKMAN_CONNECT_TO_LOADER 50 51 } taskman_request_t; 51 52 -
uspace/srv/taskman/main.c
r33c5626 rb2f05e2 222 222 } 223 223 224 static void loader_callback(ipc_call_t *icall)224 static void taskman_i_am_loader(ipc_call_t *icall) 225 225 { 226 226 DPRINTF("%s:%d from %" PRIu64 "\n", __func__, __LINE__, icall->task_id); … … 236 236 237 237 /* Create callback connection */ 238 sess_ref->sess = async_callback_receive_start(EXCHANGE_ATOMIC, icall); 239 if (sess_ref->sess == NULL) { 240 async_answer_0(icall, EINVAL); 241 return; 242 } 243 244 async_answer_0(icall, EOK); 238 sess_ref->sess = async_callback_receive(EXCHANGE_ATOMIC); 245 239 246 240 /* Notify spawners */ … … 251 245 static void taskman_connection(ipc_call_t *icall, void *arg) 252 246 { 253 /* handle new incoming calls */ 254 if (ipc_get_imethod(icall) == IPC_M_CONNECT_ME_TO) { 255 switch (ipc_get_arg2(icall)) { 256 case TASKMAN_NEW_TASK: 257 taskman_new_task(icall); 258 break; 259 case TASKMAN_CONNECT_TO_NS: 260 connect_to_ns(icall); 261 return; 262 case TASKMAN_CONNECT_TO_LOADER: 263 connect_to_loader(icall); 264 return; 265 default: 266 DPRINTF("%s:%d from %" PRIu64 "/%" SCNuPTR "/%" SCNuPTR "/%" SCNuPTR "\n", 267 __func__, __LINE__, 268 icall->task_id, ipc_get_imethod(icall), 269 ipc_get_arg1(icall), ipc_get_arg2(icall)); 270 async_answer_0(icall, ENOTSUP); 271 return; 272 } 247 /* handle new incoming IPC_M_CONNECT_ME_TO calls */ 248 switch (ipc_get_arg2(icall)) { 249 case TASKMAN_NEW_TASK: 250 taskman_new_task(icall); 251 break; 252 case TASKMAN_CONNECT_TO_NS: 253 connect_to_ns(icall); 254 break; 255 case TASKMAN_CONNECT_TO_LOADER: 256 connect_to_loader(icall); 257 break; 258 default: 259 DPRINTF("%s:%d from %" PRIu64 "/%" SCNuPTR "/%" SCNuPTR "/%" SCNuPTR "\n", 260 __func__, __LINE__, 261 icall->task_id, ipc_get_imethod(icall), 262 ipc_get_arg1(icall), ipc_get_arg2(icall)); 263 async_answer_0(icall, ENOTSUP); 264 return; 273 265 } 274 266 … … 277 269 ipc_call_t call; 278 270 279 if (!async_get_call(&call) ) {271 if (!async_get_call(&call) || !ipc_get_imethod(&call)) { 280 272 /* Client disconnected */ 281 273 DPRINTF("%s:%d client disconnected\n", __func__, __LINE__); 282 return;274 break; 283 275 } 284 276 … … 287 279 taskman_i_am_ns(&call); 288 280 break; 281 case TASKMAN_I_AM_LOADER: 282 taskman_i_am_loader(&call); 283 break; 289 284 case TASKMAN_WAIT: 290 285 taskman_ctl_wait(&call); … … 296 291 taskman_ctl_ev_callback(&call); 297 292 break; 298 case IPC_M_CONNECT_TO_ME:299 if (ipc_get_arg2(&call) == TASKMAN_LOADER_CALLBACK) {300 loader_callback(&call);301 break;302 }303 goto FALLTHROUGH_DEFAULT;304 break;305 FALLTHROUGH_DEFAULT:306 293 default: 307 294 DPRINTF("%s:%d from %" PRIu64 "/%" SCNuPTR "/%" SCNuPTR "/%" SCNuPTR "\n",
Note:
See TracChangeset
for help on using the changeset viewer.