Changeset 617 for trunk

Show
Ignore:
Timestamp:
06/04/07 18:15:25 (1 year ago)
Author:
chtekk
Message:

Use proper int types for netstatus/limstatus values (uint64).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/vcc/vcc/limstatus.c

    r600 r617  
    2727{ 
    2828        xmlrpc_value *response, *result; 
    29         char *name, *type; 
    30         int min = 0, cur = 0, max = 0; 
     29        char *name, *type, *min, *cur, *max; 
    3130        int len, i; 
    3231 
     
    4948 
    5049                xmlrpc_decompose_value(env, result, 
    51                         "{s:s,s:i,s:i,s:i,*}", 
     50                        "{s:s,s:s,s:s,s:s,*}", 
    5251                        "type", &type, 
    5352                        "min",  &min, 
     
    5857                xmlrpc_DECREF(result); 
    5958 
    60                 printf("%-14s - cur: %d, min: %d, max: %d\n", type, cur, min, max); 
     59                printf("%-14s - cur: %s, min: %s, max: %s\n", type, cur, min, max); 
    6160        } 
    6261 
  • trunk/src/vcc/vcc/netstatus.c

    r597 r617  
    2727{ 
    2828        xmlrpc_value *response, *result; 
    29         char *name, *type; 
    30         int recvp = 0, recvb = 0, sendp = 0, sendb = 0, failp = 0, failb = 0; 
     29        char *name, *type, *recvp, *recvb, *sendp, *sendb, *failp, *failb; 
    3130        int len, i; 
    3231 
     
    4948 
    5049                xmlrpc_decompose_value(env, result, 
    51                         "{s:s,s:i,s:i,s:i,s:i,s:i,s:i,*}", 
     50                        "{s:s,s:s,s:s,s:s,s:s,s:s,s:s,*}", 
    5251                        "type",  &type, 
    5352                        "recvp", &recvp, 
     
    6160                xmlrpc_DECREF(result); 
    6261 
    63                 printf("%-10s - received: %d/%d, sent: %d/%d, failed: %d/%d\n", 
     62                printf("%-10s - received: %s/%s, sent: %s/%s, failed: %s/%s\n", 
    6463                                type, recvp, recvb, sendp, sendb, failp, failb); 
    6564        } 
  • trunk/src/vcd/methods/vx/vx_limstatus.c

    r601 r617  
    2020#include <vserver.h> 
    2121#include <sys/resource.h> 
     22#include <inttypes.h> 
    2223 
    2324#include "auth.h" 
     
    2627 
    2728#include <lucid/log.h> 
     29#include <lucid/printf.h> 
    2830 
    2931static 
    30 int pagestobytes(int pages) { 
    31         int bytes; 
    32         bytes = (pages * getpagesize()) / 1024; 
     32uint64_t pagestobytes(uint64_t pages) { 
     33        uint64_t bytes; 
     34        bytes = (pages * (uint64_t) getpagesize()) / 1024; 
    3335        return bytes; 
    3436} 
     
    107109                        } 
    108110 
    109                         int min = 0, cur = 0, max = 0; 
     111                        uint64_t min = 0, cur = 0, max = 0; 
    110112 
    111113                        if (LIMIT[i].pagestobytes == 1) { 
    112                                 min = pagestobytes((int) limstat.minimum); 
    113                                 cur = pagestobytes((int) limstat.value); 
    114                                 max = pagestobytes((int) limstat.maximum); 
     114                                min = pagestobytes(limstat.minimum); 
     115                                cur = pagestobytes(limstat.value); 
     116                                max = pagestobytes(limstat.maximum); 
    115117                        } 
    116118 
    117119                        else { 
    118                                 min = (int) limstat.minimum; 
    119                                 cur = (int) limstat.value; 
    120                                 max = (int) limstat.maximum; 
     120                                min = limstat.minimum; 
     121                                cur = limstat.value; 
     122                                max = limstat.maximum; 
    121123                        } 
    122124 
     125                        char *mins, *curs, *maxs; 
     126                        asprintf(&mins, "%" PRIu64, min); 
     127                        asprintf(&curs, "%" PRIu64, cur); 
     128                        asprintf(&maxs, "%" PRIu64, max); 
     129 
    123130                        xmlrpc_array_append_item(env, response, xmlrpc_build_value(env, 
    124                                 "{s:s,s:i,s:i,s:i}", 
     131                                "{s:s,s:s,s:s,s:s}", 
    125132                                "type", LIMIT[i].db, 
    126                                 "min",  min
    127                                 "cur",  cur
    128                                 "max",  max)); 
     133                                "min",  mins
     134                                "cur",  curs
     135                                "max",  maxs)); 
    129136                } 
    130137        } 
  • trunk/src/vcd/methods/vx/vx_netstatus.c

    r596 r617  
    1818 
    1919#include <vserver.h> 
     20#include <inttypes.h> 
    2021 
    2122#include "auth.h" 
     
    2425 
    2526#include <lucid/log.h> 
     27#include <lucid/printf.h> 
    2628 
    2729static 
     
    8284                        } 
    8385 
     86                        char *recvps, *recvbs, *sendps, *sendbs, *failps, *failbs; 
     87                        asprintf(&recvps, "%" PRIu32, netstat.count[0]); 
     88                        asprintf(&recvbs, "%" PRIu64, netstat.total[0]); 
     89                        asprintf(&sendps, "%" PRIu32, netstat.count[1]); 
     90                        asprintf(&sendbs, "%" PRIu64, netstat.total[1]); 
     91                        asprintf(&failps, "%" PRIu32, netstat.count[2]); 
     92                        asprintf(&failbs, "%" PRIu64, netstat.total[2]); 
     93 
    8494                        xmlrpc_array_append_item(env, response, xmlrpc_build_value(env, 
    85                                 "{s:s,s:i,s:i,s:i,s:i,s:i,s:i}", 
     95                                "{s:s,s:s,s:s,s:s,s:s,s:s,s:s}", 
    8696                                "type",  NET[i].db, 
    87                                 "recvp", (int) netstat.count[0]
    88                                 "recvb", (int) netstat.total[0]
    89                                 "sendp", (int) netstat.count[1]
    90                                 "sendb", (int) netstat.total[1]
    91                                 "failp", (int) netstat.count[2]
    92                                 "failb", (int) netstat.total[2])); 
     97                                "recvp", recvps
     98                                "recvb", recvbs
     99                                "sendp", sendps
     100                                "sendb", sendbs
     101                                "failp", failps
     102                                "failb", failbs)); 
    93103                } 
    94104        }