LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   RAM/Swap Memory Code Errors (https://www.linuxquestions.org/questions/programming-9/ram-swap-memory-code-errors-17287/)

ghe1 03-29-2002 12:21 PM

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***********************
**

ghe1 04-01-2002 07:38 AM

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.