the function in qnx6.2.1 can't be used in 6.3

I have get one function that detect memory size, it can work in 6.2.1,but when i use it in 6.3,the size i get is a negative value.

int CProcInfo::GetFreeMem()
if (s_hSysProc==-1)
s_hSysProc=open("/proc", O_RDONLY);
struct stat st;
if (fstat(s_hSysProc, &st) == -1)
printf( “couldn’t get stat info for %s: %s\n”, “/proc”, strerror(errno));
return st.st_size;

Does you machine has more then 2 gig of ram?. You should use fstat64 instead.

thank you

I found the error is caused by the total number of memory,which is got by _SYSPAGE_ENTRY(sysinfo, system_private)->ramsize,Is it right in 6.3?

the value from _SYSPAGE_ENTRY(sysinfo, system_private)->ramsize is 0 in 6.3

off64_t get_total_mem(void)
char *str = SYSPAGE_ENTRY(strings)->data;
struct asinfo_entry *as = SYSPAGE_ENTRY(asinfo);
off64_t total = 0;
unsigned num;

for(num = _syspage_ptr->asinfo.entry_size / sizeof(*as); num > 0; --num) 
 	if(strcmp(&str[as->name], "ram") == 0) 
		total += as->end - as->start + 1;

return total;

it is from “showmem” util srcs