Changes in kernel/generic/src/proc/task.c [82d515e9:b2e121a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/task.c
r82d515e9 rb2e121a 56 56 #include <print.h> 57 57 #include <errno.h> 58 #include < func.h>58 #include <halt.h> 59 59 #include <str.h> 60 60 #include <syscall/copy.h> … … 83 83 /* Forward declarations. */ 84 84 static void task_kill_internal(task_t *); 85 static int tsk_constructor(void *, unsigned int);85 static errno_t tsk_constructor(void *, unsigned int); 86 86 static size_t tsk_destructor(void *obj); 87 87 … … 158 158 } 159 159 160 int tsk_constructor(void *obj, unsigned int kmflags)160 errno_t tsk_constructor(void *obj, unsigned int kmflags) 161 161 { 162 162 task_t *task = (task_t *) obj; 163 163 164 int rc = caps_task_alloc(task);164 errno_t rc = caps_task_alloc(task); 165 165 if (rc != EOK) 166 166 return rc; … … 185 185 #endif 186 186 187 return 0;187 return EOK; 188 188 } 189 189 … … 207 207 { 208 208 task_t *task = (task_t *) slab_alloc(task_cache, 0); 209 if (task == NULL) { 210 return NULL; 211 } 212 209 213 task_create_arch(task); 210 214 … … 241 245 if ((ipc_phone_0) && 242 246 (container_check(ipc_phone_0->task->container, task->container))) { 243 cap_handle_t phone_handle = phone_alloc(task); 247 cap_handle_t phone_handle; 248 errno_t rc = phone_alloc(task, &phone_handle); 249 if (rc != EOK) { 250 task->as = NULL; 251 task_destroy_arch(task); 252 slab_free(task_cache, task); 253 return NULL; 254 } 255 244 256 kobject_t *phone_obj = kobject_get(task, phone_handle, 245 257 KOBJECT_TYPE_PHONE); … … 333 345 * 334 346 */ 335 sys arg_t sys_task_get_id(sysarg64_t *uspace_taskid)347 sys_errno_t sys_task_get_id(sysarg64_t *uspace_taskid) 336 348 { 337 349 /* … … 339 351 * the lifespan of the task. 340 352 */ 341 return (sys arg_t) copy_to_uspace(uspace_taskid, &TASK->taskid,353 return (sys_errno_t) copy_to_uspace(uspace_taskid, &TASK->taskid, 342 354 sizeof(TASK->taskid)); 343 355 } … … 373 385 * 374 386 */ 375 sys arg_t sys_task_set_name(const char *uspace_name, size_t name_len)387 sys_errno_t sys_task_set_name(const char *uspace_name, size_t name_len) 376 388 { 377 389 char namebuf[TASK_NAME_BUFLEN]; … … 381 393 name_len = TASK_NAME_BUFLEN - 1; 382 394 383 int rc = copy_from_uspace(namebuf, uspace_name, name_len);384 if (rc != 0)385 return (sys arg_t) rc;395 errno_t rc = copy_from_uspace(namebuf, uspace_name, name_len); 396 if (rc != EOK) 397 return (sys_errno_t) rc; 386 398 387 399 namebuf[name_len] = '\0'; … … 414 426 * 415 427 */ 416 sys arg_t sys_task_kill(task_id_t *uspace_taskid)428 sys_errno_t sys_task_kill(task_id_t *uspace_taskid) 417 429 { 418 430 task_id_t taskid; 419 int rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid));420 if (rc != 0)421 return (sys arg_t) rc;422 423 return (sys arg_t) task_kill(taskid);431 errno_t rc = copy_from_uspace(&taskid, uspace_taskid, sizeof(taskid)); 432 if (rc != EOK) 433 return (sys_errno_t) rc; 434 435 return (sys_errno_t) task_kill(taskid); 424 436 } 425 437 … … 527 539 * 528 540 */ 529 int task_kill(task_id_t id)541 errno_t task_kill(task_id_t id) 530 542 { 531 543 if (id == 1) … … 584 596 * 585 597 */ 586 sys arg_t sys_task_exit(sysarg_t notify)598 sys_errno_t sys_task_exit(sysarg_t notify) 587 599 { 588 600 task_kill_self(notify);
Note:
See TracChangeset
for help on using the changeset viewer.