RAM/Swap Memory Code Errors
I use the following code to determine memory values on a 32bit machine and succeed with no errors and correct data. However, when I try to use this code for a 64bit machine it chokes. The error output is: In function 'sysinfo' undefined reference to '__ia64_syscall'. ANY SUGGESTIONS!!!!!!!!!!!
*********************CODE************************* ** #include <stdio.h> #include <linux/unistd.h> /* for _syscallX macros/related stuff */ #include <linux/kernel.h> /* for struct sysinfo */ #include <linux/sys.h> _syscall1(int, sysinfo, struct sysinfo *, info); int main(void) { struct sysinfo s_info; int error; error = sysinfo(&s_info); printf("code error = %d\n", error); printf("RAM: total %d KB/ free %d KB\n" "Swap: total %d KB/ free %d KB\n", (s_info.totalram/1024), (s_info.freeram/1024), (s_info.totalswap/1024), (s_info.freeswap/1024)); return(0); } ***********************CODE*********************** ** |
Problem has been solved. A line of code needed removed...now it works fine.
|
All times are GMT -5. The time now is 08:18 PM. |