/
index
/
free.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
explicitly close kvm device
[free.git]
/
free.c
diff --git
a/free.c
b/free.c
index 971711b5e5f1d00aa695c0aa8fcdeebfed2fcac0..c1dfa476ec623b12fd14a5f845966bc40a3b1494 100644
(file)
--- a/
free.c
+++ b/
free.c
@@
-25,14
+25,14
@@
static kvm_t *kd;
static long pgsz;
static char sbuff[32];
static long pgsz;
static char sbuff[32];
-void
+
static
void
usage(void)
{
fprintf(stderr, "usage: %s [-bghkmpt]\n", getprogname());
exit(2);
}
usage(void)
{
fprintf(stderr, "usage: %s [-bghkmpt]\n", getprogname());
exit(2);
}
-long long
+
static
long long
getphysmem(int unused)
{
(void)unused;
getphysmem(int unused)
{
(void)unused;
@@
-46,7
+46,7
@@
getphysmem(int unused)
return physcnt;
}
return physcnt;
}
-long long
+
static
long long
getavailmem(int flag)
{
size_t len;
getavailmem(int flag)
{
size_t len;
@@
-66,7
+66,7
@@
getavailmem(int flag)
return (long long)((freecnt + inactcnt) * pgsz);
}
return (long long)((freecnt + inactcnt) * pgsz);
}
-long long
+
static
long long
getwiredmem(int unused)
{
(void)unused;
getwiredmem(int unused)
{
(void)unused;
@@
-82,7
+82,7
@@
getwiredmem(int unused)
}
}
-long long
+
static
long long
getbufcachestats(int unused)
{
(void)unused;
getbufcachestats(int unused)
{
(void)unused;
@@
-104,7
+104,7
@@
getbufcachestats(int unused)
return (long long)(cachecnt * pgsz + bufspace + arcspace);
}
return (long long)(cachecnt * pgsz + bufspace + arcspace);
}
-long long
+
static
long long
getswapstats(int flag)
{
int nswap;
getswapstats(int flag)
{
int nswap;
@@
-121,7
+121,7
@@
getswapstats(int flag)
return (long long)((swap.ksw_total - swap.ksw_used) * pgsz);
}
return (long long)((swap.ksw_total - swap.ksw_used) * pgsz);
}
-int
+
static
int
tohumansize(long long bytes, char **buff, ConvFlags flag)
{
int i = 0;
tohumansize(long long bytes, char **buff, ConvFlags flag)
{
int i = 0;
@@
-147,7
+147,7
@@
tohumansize(long long bytes, char **buff, ConvFlags flag)
return asprintf(buff, "%.0f%c", size, units[i]);
}
return asprintf(buff, "%.0f%c", size, units[i]);
}
-void
+
static
void
sprintfaligned(char *buff, size_t len)
{
size_t blen;
sprintfaligned(char *buff, size_t len)
{
size_t blen;
@@
-160,7
+160,7
@@
sprintfaligned(char *buff, size_t len)
ind = sbuff;
*ind = '%';
ind++; buff += t;
ind = sbuff;
*ind = '%';
ind++; buff += t;
- blen =
30
;
+ blen =
11
;
}
strlcpy(ind, buff, blen + 1);
}
strlcpy(ind, buff, blen + 1);
@@
-229,5
+229,7
@@
main(int argc, char *argv[])
}
putc('\n', stdout);
}
putc('\n', stdout);
+ kvm_close(kd);
+
return 0;
}
return 0;
}