Changes in kernel/generic/src/cap/cap.c [c1f68b0:f571ca49] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/cap/cap.c
rc1f68b0 rf571ca49 73 73 74 74 #include <cap/cap.h> 75 #include <abi/cap.h> 75 76 #include <proc/task.h> 76 77 #include <synch/mutex.h> … … 81 82 #include <stdint.h> 82 83 83 #define MAX_CAPS INT_MAX 84 #define CAPS_START (CAP_NIL + 1) 85 #define CAPS_SIZE (INT_MAX - CAPS_START) 86 #define CAPS_LAST (CAPS_SIZE - 1) 84 87 85 88 static slab_cache_t *cap_slab; … … 129 132 if (!task->cap_info->handles) 130 133 goto error_handles; 131 if (!ra_span_add(task->cap_info->handles, 0, MAX_CAPS))134 if (!ra_span_add(task->cap_info->handles, CAPS_START, CAPS_SIZE)) 132 135 goto error_span; 133 136 if (!hash_table_create(&task->cap_info->caps, 0, 0, &caps_ops)) … … 220 223 assert(mutex_locked(&task->cap_info->lock)); 221 224 222 if ((handle < 0) || (handle >= MAX_CAPS))225 if ((handle < CAPS_START) || (handle > CAPS_LAST)) 223 226 return NULL; 224 227 ht_link_t *link = hash_table_find(&task->cap_info->caps, &handle); … … 357 360 void cap_free(task_t *task, cap_handle_t handle) 358 361 { 359 assert(handle >= 0);360 assert(handle < MAX_CAPS);362 assert(handle >= CAPS_START); 363 assert(handle <= CAPS_LAST); 361 364 362 365 mutex_lock(&task->cap_info->lock);
Note:
See TracChangeset
for help on using the changeset viewer.