Lines Matching +full:long +full:- +full:ram +full:- +full:code
1 // SPDX-License-Identifier: 0BSD
14 // We want to use Windows-specific code on Cygwin, which also has memory
60 // HP-UX
69 // This sysinfo() is Linux-specific.
92 // code working also on older Windows versions, use in tuklib_physmem()
120 unsigned long mem; in tuklib_physmem()
129 != (unsigned long)-1) in tuklib_physmem()
144 const char *strings = SYSPAGE_ENTRY(strings)->data; in tuklib_physmem()
147 if (strcmp(strings + entries[i].name, "ram") == 0) in tuklib_physmem()
148 ret += entries[i].end - entries[i].start + 1; in tuklib_physmem()
154 const long pagesize = sysconf(_SC_PAGESIZE); in tuklib_physmem()
155 const long pages = sysconf(_SC_PHYS_PAGES); in tuklib_physmem()
156 if (pagesize != -1 && pages != -1) in tuklib_physmem()
158 // Simple case is 32-bit box with 4 GiB or more RAM, in tuklib_physmem()
159 // which may report exactly 4 GiB of RAM, and "long" in tuklib_physmem()
160 // being 32-bit will overflow. Casting to uint64_t in tuklib_physmem()
178 if (sysctl(name, 2, &mem.u64, &mem_ptr_size, NULL, 0) != -1) { in tuklib_physmem()
179 // IIRC, 64-bit "return value" is possible on some 64-bit in tuklib_physmem()
194 != -1) in tuklib_physmem()
199 if (pstat_getstatic(&pst, sizeof(pst), 1, 0) != -1) in tuklib_physmem()
204 if (setinvent_r(&st) != -1) { in tuklib_physmem()
207 if (i->inv_class == INV_MEMORY in tuklib_physmem()
208 && i->inv_type == INV_MAIN_MB) { in tuklib_physmem()
209 ret = (uint64_t)i->inv_state << 20; in tuklib_physmem()