mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 05:10:11 +01:00
meson/util: properly detect sysconf
There's two functions that use sysconf(), and they don't seem to agree on what combination of platforms supports the function. Let's perform proper function detection instead. Acked-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Reviewed-by: Eric Engestrom <eric@igalia.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36621>
This commit is contained in:
parent
e636991c78
commit
fe42a3d0eb
2 changed files with 3 additions and 2 deletions
|
|
@ -1414,6 +1414,7 @@ functions_to_detect = {
|
||||||
'qsort_s': '',
|
'qsort_s': '',
|
||||||
'posix_fallocate': '',
|
'posix_fallocate': '',
|
||||||
'secure_getenv': '',
|
'secure_getenv': '',
|
||||||
|
'sysconf': '#include <unistd.h>',
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach f, prefix: functions_to_detect
|
foreach f, prefix: functions_to_detect
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,7 @@ exit_mutex:
|
||||||
bool
|
bool
|
||||||
os_get_total_physical_memory(uint64_t *size)
|
os_get_total_physical_memory(uint64_t *size)
|
||||||
{
|
{
|
||||||
#if DETECT_OS_LINUX || DETECT_OS_CYGWIN || DETECT_OS_SOLARIS || DETECT_OS_HURD || DETECT_OS_MANAGARM
|
#if HAVE_SYSCONF
|
||||||
const long phys_pages = sysconf(_SC_PHYS_PAGES);
|
const long phys_pages = sysconf(_SC_PHYS_PAGES);
|
||||||
const long page_size = sysconf(_SC_PAGESIZE);
|
const long page_size = sysconf(_SC_PAGESIZE);
|
||||||
|
|
||||||
|
|
@ -412,7 +412,7 @@ os_get_available_system_memory(uint64_t *size)
|
||||||
bool
|
bool
|
||||||
os_get_page_size(uint64_t *size)
|
os_get_page_size(uint64_t *size)
|
||||||
{
|
{
|
||||||
#if DETECT_OS_POSIX_LITE && !DETECT_OS_APPLE && !DETECT_OS_HAIKU
|
#if HAVE_SYSCONF
|
||||||
const long page_size = sysconf(_SC_PAGESIZE);
|
const long page_size = sysconf(_SC_PAGESIZE);
|
||||||
|
|
||||||
if (page_size <= 0)
|
if (page_size <= 0)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue