From e2c478a929e3190f070da766a199b26249aa29df Mon Sep 17 00:00:00 2001 From: mubarak Date: Thu, 6 Aug 2015 13:32:38 -0500 Subject: [PATCH] Fixing a couple of query functions for resource LP --- src/util/resource.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/util/resource.c b/src/util/resource.c index 3410777..02327f7 100644 --- a/src/util/resource.c +++ b/src/util/resource.c @@ -7,6 +7,7 @@ #include "codes/resource.h" #include #include +#include static uint64_t min_u64(uint64_t a, uint64_t b){ return a < b ? a : b; @@ -63,7 +64,8 @@ int resource_get_avail(resource_token_t tok, uint64_t *avail, resource *r){ return 2; } else{ - return r->avail[tok]; + *avail = r->avail[tok]; + return 0; } } @@ -75,7 +77,8 @@ int resource_get_used(resource_token_t tok, uint64_t *used, resource *r){ return 2; } else{ - return r->max[tok] - r->avail[tok]; + *used = r->max[tok] - r->avail[tok]; + return 0; } } -- 2.26.2