18 #if defined(_WIN32) || defined(__CYGWIN__)
20 # define _WIN32_WINNT 0x0500
24 #elif defined(__OS2__)
28 #elif defined(__DJGPP__)
32 # include <lib$routines.h>
36 #elif defined(AMIGA) || defined(__AROS__)
37 # define __USE_INLINE__
38 # include <proto/exec.h>
40 #elif defined(__QNX__)
41 # include <sys/syspage.h>
44 #elif defined(TUKLIB_PHYSMEM_AIX)
45 # include <sys/systemcfg.h>
47 #elif defined(TUKLIB_PHYSMEM_SYSCONF)
50 #elif defined(TUKLIB_PHYSMEM_SYSCTL)
51 # ifdef HAVE_SYS_PARAM_H
52 # include <sys/param.h>
54 # include <sys/sysctl.h>
57 #elif defined(TUKLIB_PHYSMEM_GETSYSINFO)
58 # include <sys/sysinfo.h>
59 # include <machine/hal_sysinfo.h>
62 #elif defined(TUKLIB_PHYSMEM_PSTAT_GETSTATIC)
63 # include <sys/param.h>
64 # include <sys/pstat.h>
67 #elif defined(TUKLIB_PHYSMEM_GETINVENT_R)
71 #elif defined(TUKLIB_PHYSMEM_SYSINFO)
72 # include <sys/sysinfo.h>
81 #if defined(_WIN32) || defined(__CYGWIN__)
82 if ((GetVersion() & 0xFF) >= 5) {
87 HMODULE kernel32 = GetModuleHandle(
"kernel32.dll");
88 if (kernel32 !=
NULL) {
89 typedef BOOL (WINAPI *gmse_type)(LPMEMORYSTATUSEX);
90 gmse_type gmse = (gmse_type)GetProcAddress(
91 kernel32,
"GlobalMemoryStatusEx");
93 MEMORYSTATUSEX meminfo;
94 meminfo.dwLength =
sizeof(meminfo);
96 ret = meminfo.ullTotalPhys;
105 MEMORYSTATUS meminfo;
106 meminfo.dwLength =
sizeof(meminfo);
107 GlobalMemoryStatus(&meminfo);
108 ret = meminfo.dwTotalPhys;
111 #elif defined(__OS2__)
113 if (DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM,
117 #elif defined(__DJGPP__)
118 __dpmi_free_mem_info meminfo;
119 if (__dpmi_get_free_memory_information(&meminfo) == 0
120 && meminfo.total_number_of_physical_pages
121 != (
unsigned long)-1)
122 ret = (
uint64_t)meminfo.total_number_of_physical_pages * 4096;
126 int val = SYI$_MEMSIZE;
127 if (LIB$GETSYI(&
val, &vms_mem, 0, 0, 0, 0) == SS$_NORMAL)
130 #elif defined(AMIGA) || defined(__AROS__)
131 ret = AvailMem(MEMF_TOTAL);
133 #elif defined(__QNX__)
134 const struct asinfo_entry *
entries = SYSPAGE_ENTRY(asinfo);
135 size_t count = SYSPAGE_ENTRY_SIZE(asinfo) /
sizeof(
struct asinfo_entry);
142 #elif defined(TUKLIB_PHYSMEM_AIX)
143 ret = _system_configuration.physmem;
145 #elif defined(TUKLIB_PHYSMEM_SYSCONF)
146 const long pagesize = sysconf(_SC_PAGESIZE);
147 const long pages = sysconf(_SC_PHYS_PAGES);
148 if (pagesize != -1 && pages != -1)
156 #elif defined(TUKLIB_PHYSMEM_SYSCTL)
169 size_t mem_ptr_size =
sizeof(
mem.u64);
170 if (sysctl(
name, 2, &
mem.u64, &mem_ptr_size,
NULL, 0) != -1) {
174 if (mem_ptr_size ==
sizeof(
mem.u64))
176 else if (mem_ptr_size ==
sizeof(
mem.u32))
180 #elif defined(TUKLIB_PHYSMEM_GETSYSINFO)
185 if (getsysinfo(GSI_PHYSMEM, (
caddr_t)&memkb,
sizeof(memkb), &
start)
189 #elif defined(TUKLIB_PHYSMEM_PSTAT_GETSTATIC)
190 struct pst_static pst;
191 if (pstat_getstatic(&pst,
sizeof(pst), 1, 0) != -1)
194 #elif defined(TUKLIB_PHYSMEM_GETINVENT_R)
195 inv_state_t *st =
NULL;
196 if (setinvent_r(&st) != -1) {
198 while ((
i = getinvent_r(st)) !=
NULL) {
199 if (
i->inv_class == INV_MEMORY
200 &&
i->inv_type == INV_MAIN_MB) {
209 #elif defined(TUKLIB_PHYSMEM_SYSINFO)
RzList * entries(RzBinFile *bf)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
checking print the parsed form of the magic use in n conjunction with m to debug a new magic file n before installing it n output MIME type strings(--mime-type and\n"
" --mime-encoding)\n") OPT('s'
static const char struct stat static buf struct stat static buf static vhangup int struct rusage static rusage sysinfo
uint64_t tuklib_physmem(void)
Get the amount of physical memory.
if(dbg->bits==RZ_SYS_BITS_64)