cputnik: use %lld instead of %Ld when getting meminfo
This commit is contained in:
parent
ea844727f7
commit
1b475f8666
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
CFLAGS = -Wall -Os
|
CFLAGS = -Wall -Os
|
||||||
INCS = -I/usr/X11R6/include/X11
|
INCS = -I/usr/X11R7/include/
|
||||||
LIBS = -L/usr/X11R6/lib -lXpm -lXext -lX11
|
LIBS = -L/usr/X11R7/lib -lXpm -lXext -lX11 -R/usr/X11R7/lib
|
||||||
INSTALL_PREFIX = /usr/local
|
INSTALL_PREFIX = /usr/local
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,15 +41,17 @@ char temp[BUFFER_SIZE];
|
||||||
while(fscanf(fp_memory, "%s", temp)!=EOF) {
|
while(fscanf(fp_memory, "%s", temp)!=EOF) {
|
||||||
|
|
||||||
if(!strncmp(temp,"MemTotal:", 9))
|
if(!strncmp(temp,"MemTotal:", 9))
|
||||||
fscanf(fp_memory, "%Ld", &m_total);
|
fscanf(fp_memory, "%lld", &m_total);
|
||||||
|
|
||||||
if(!strncmp(temp,"MemFree:", 8))
|
if(!strncmp(temp,"MemFree:", 8))
|
||||||
fscanf(fp_memory, "%Ld", &m_free);
|
fscanf(fp_memory, "%lld", &m_free);
|
||||||
|
|
||||||
if(!strncmp(temp,"Cached:", 7))
|
if(!strncmp(temp,"Cached:", 7))
|
||||||
fscanf(fp_memory, "%Ld", &m_cached);
|
fscanf(fp_memory, "%lld", &m_cached);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("m_total: %ld, m_free: %ld, m_cached: %ld\n", m_total, m_free, m_cached);
|
||||||
|
|
||||||
*free = (int)(((float)(m_total - m_free - m_cached) / m_total) * 100.0);
|
*free = (int)(((float)(m_total - m_free - m_cached) / m_total) * 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue