Changeset e394c196 in mainline
- Timestamp:
- 2018-11-12T20:53:57Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 705ca2b
- Parents:
- 15639ec
- git-author:
- Jakub Jermar <jakub@…> (2018-08-28 19:55:29)
- git-committer:
- Jakub Jermar <jakub@…> (2018-11-12 20:53:57)
- Location:
- kernel/generic
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/cap/cap.h
r15639ec re394c196 137 137 extern void cap_free(struct task *, cap_handle_t); 138 138 139 extern kobject_t *kobject_alloc(unsigned int); 140 extern void kobject_free(kobject_t *); 139 141 extern void kobject_initialize(kobject_t *, kobject_type_t, void *, 140 142 kobject_ops_t *); -
kernel/generic/src/cap/cap.c
r15639ec re394c196 93 93 94 94 static slab_cache_t *cap_cache; 95 static slab_cache_t *kobject_cache; 95 96 96 97 static size_t caps_hash(const ht_link_t *item) … … 123 124 cap_cache = slab_cache_create("cap_t", sizeof(cap_t), 0, NULL, 124 125 NULL, 0); 126 kobject_cache = slab_cache_create("kobject_t", sizeof(kobject_t), 0, 127 NULL, NULL, 0); 125 128 } 126 129 … … 394 397 } 395 398 399 kobject_t *kobject_alloc(unsigned int flags) 400 { 401 return slab_alloc(kobject_cache, flags); 402 } 403 404 void kobject_free(kobject_t *kobj) 405 { 406 slab_free(kobject_cache, kobj); 407 } 408 396 409 /** Initialize kernel object 397 410 * … … 462 475 if (atomic_postdec(&kobj->refcnt) == 1) { 463 476 kobj->ops->destroy(kobj->raw); 464 free(kobj);477 kobject_free(kobj); 465 478 } 466 479 } -
kernel/generic/src/ipc/ipc.c
r15639ec re394c196 120 120 return NULL; 121 121 122 kobject_t *kobj = (kobject_t *) malloc(sizeof(kobject_t));122 kobject_t *kobj = kobject_alloc(0); 123 123 if (!kobj) { 124 124 slab_free(call_cache, call); -
kernel/generic/src/ipc/ipcrsc.c
r15639ec re394c196 76 76 return ENOMEM; 77 77 } 78 kobject_t *kobj = malloc(sizeof(kobject_t));78 kobject_t *kobj = kobject_alloc(FRAME_ATOMIC); 79 79 if (!kobj) { 80 80 cap_free(TASK, handle); -
kernel/generic/src/ipc/irq.c
r15639ec re394c196 356 356 } 357 357 358 kobject_t *kobject = malloc(sizeof(kobject_t));358 kobject_t *kobject = kobject_alloc(FRAME_ATOMIC); 359 359 if (!kobject) { 360 360 cap_free(TASK, handle); -
kernel/generic/src/synch/syswaitq.c
r15639ec re394c196 45 45 46 46 #include <stdint.h> 47 #include <stdlib.h>48 47 49 48 static slab_cache_t *waitq_cache; … … 96 95 waitq_initialize(wq); 97 96 98 kobject_t *kobj = (kobject_t *) malloc(sizeof(kobject_t));97 kobject_t *kobj = kobject_alloc(0); 99 98 if (!kobj) { 100 99 slab_free(waitq_cache, wq); … … 107 106 if (rc != EOK) { 108 107 slab_free(waitq_cache, wq); 109 free(kobj);108 kobject_free(kobj); 110 109 return (sys_errno_t) rc; 111 110 } … … 114 113 if (rc != EOK) { 115 114 cap_free(TASK, handle); 116 free(kobj);115 kobject_free(kobj); 117 116 slab_free(waitq_cache, wq); 118 117 return (sys_errno_t) rc;
Note:
See TracChangeset
for help on using the changeset viewer.