Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/cap/cap.c

    rf571ca49 rc1f68b0  
    7373
    7474#include <cap/cap.h>
    75 #include <abi/cap.h>
    7675#include <proc/task.h>
    7776#include <synch/mutex.h>
     
    8281#include <stdint.h>
    8382
    84 #define CAPS_START      (CAP_NIL + 1)
    85 #define CAPS_SIZE       (INT_MAX - CAPS_START)
    86 #define CAPS_LAST       (CAPS_SIZE - 1)
     83#define MAX_CAPS        INT_MAX
    8784
    8885static slab_cache_t *cap_slab;
     
    132129        if (!task->cap_info->handles)
    133130                goto error_handles;
    134         if (!ra_span_add(task->cap_info->handles, CAPS_START, CAPS_SIZE))
     131        if (!ra_span_add(task->cap_info->handles, 0, MAX_CAPS))
    135132                goto error_span;
    136133        if (!hash_table_create(&task->cap_info->caps, 0, 0, &caps_ops))
     
    223220        assert(mutex_locked(&task->cap_info->lock));
    224221
    225         if ((handle < CAPS_START) || (handle > CAPS_LAST))
     222        if ((handle < 0) || (handle >= MAX_CAPS))
    226223                return NULL;
    227224        ht_link_t *link = hash_table_find(&task->cap_info->caps, &handle);
     
    360357void cap_free(task_t *task, cap_handle_t handle)
    361358{
    362         assert(handle >= CAPS_START);
    363         assert(handle <= CAPS_LAST);
     359        assert(handle >= 0);
     360        assert(handle < MAX_CAPS);
    364361
    365362        mutex_lock(&task->cap_info->lock);
Note: See TracChangeset for help on using the changeset viewer.