Deleted Added
full compact
tuklib_physmem.c (278433) tuklib_physmem.c (291125)
1///////////////////////////////////////////////////////////////////////////////
2//
3/// \file tuklib_physmem.c
4/// \brief Get the amount of physical memory
5//
6// Author: Lasse Collin
7//
8// This file has been put into the public domain.

--- 23 unchanged lines hidden (view full) ---

32# include <lib$routines.h>
33# include <syidef.h>
34# include <ssdef.h>
35
36#elif defined(AMIGA) || defined(__AROS__)
37# define __USE_INLINE__
38# include <proto/exec.h>
39
1///////////////////////////////////////////////////////////////////////////////
2//
3/// \file tuklib_physmem.c
4/// \brief Get the amount of physical memory
5//
6// Author: Lasse Collin
7//
8// This file has been put into the public domain.

--- 23 unchanged lines hidden (view full) ---

32# include <lib$routines.h>
33# include <syidef.h>
34# include <ssdef.h>
35
36#elif defined(AMIGA) || defined(__AROS__)
37# define __USE_INLINE__
38# include <proto/exec.h>
39
40// AIX
40#elif defined(__QNX__)
41# include <sys/syspage.h>
42# include <string.h>
43
41#elif defined(TUKLIB_PHYSMEM_AIX)
42# include <sys/systemcfg.h>
43
44#elif defined(TUKLIB_PHYSMEM_SYSCONF)
45# include <unistd.h>
46
47#elif defined(TUKLIB_PHYSMEM_SYSCTL)
48# ifdef HAVE_SYS_PARAM_H

--- 72 unchanged lines hidden (view full) ---

121 int vms_mem;
122 int val = SYI$_MEMSIZE;
123 if (LIB$GETSYI(&val, &vms_mem, 0, 0, 0, 0) == SS$_NORMAL)
124 ret = (uint64_t)vms_mem * 8192;
125
126#elif defined(AMIGA) || defined(__AROS__)
127 ret = AvailMem(MEMF_TOTAL);
128
44#elif defined(TUKLIB_PHYSMEM_AIX)
45# include <sys/systemcfg.h>
46
47#elif defined(TUKLIB_PHYSMEM_SYSCONF)
48# include <unistd.h>
49
50#elif defined(TUKLIB_PHYSMEM_SYSCTL)
51# ifdef HAVE_SYS_PARAM_H

--- 72 unchanged lines hidden (view full) ---

124 int vms_mem;
125 int val = SYI$_MEMSIZE;
126 if (LIB$GETSYI(&val, &vms_mem, 0, 0, 0, 0) == SS$_NORMAL)
127 ret = (uint64_t)vms_mem * 8192;
128
129#elif defined(AMIGA) || defined(__AROS__)
130 ret = AvailMem(MEMF_TOTAL);
131
132#elif defined(__QNX__)
133 const struct asinfo_entry *entries = SYSPAGE_ENTRY(asinfo);
134 size_t count = SYSPAGE_ENTRY_SIZE(asinfo) / sizeof(struct asinfo_entry);
135 const char *strings = SYSPAGE_ENTRY(strings)->data;
136
137 for (size_t i = 0; i < count; ++i)
138 if (strcmp(strings + entries[i].name, "ram") == 0)
139 ret += entries[i].end - entries[i].start + 1;
140
129#elif defined(TUKLIB_PHYSMEM_AIX)
130 ret = _system_configuration.physmem;
131
132#elif defined(TUKLIB_PHYSMEM_SYSCONF)
133 const long pagesize = sysconf(_SC_PAGESIZE);
134 const long pages = sysconf(_SC_PHYS_PAGES);
135 if (pagesize != -1 && pages != -1)
136 // According to docs, pagesize * pages can overflow.

--- 67 unchanged lines hidden ---
141#elif defined(TUKLIB_PHYSMEM_AIX)
142 ret = _system_configuration.physmem;
143
144#elif defined(TUKLIB_PHYSMEM_SYSCONF)
145 const long pagesize = sysconf(_SC_PAGESIZE);
146 const long pages = sysconf(_SC_PHYS_PAGES);
147 if (pagesize != -1 && pages != -1)
148 // According to docs, pagesize * pages can overflow.

--- 67 unchanged lines hidden ---