2015-09-28 11:08:50 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
2021-06-03 08:37:05 +02:00
|
|
|
*
|
2015-09-28 11:08:50 +02:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
2018-02-23 09:53:12 +01:00
|
|
|
*
|
2015-09-28 11:08:50 +02:00
|
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
|
|
* information regarding copyright ownership.
|
|
|
|
*/
|
|
|
|
|
2018-03-28 14:19:37 +02:00
|
|
|
#include <inttypes.h>
|
2024-09-20 08:45:46 +02:00
|
|
|
|
|
|
|
#include <isc/meminfo.h>
|
2024-09-20 09:10:20 +02:00
|
|
|
#include <isc/uv.h>
|
2015-09-28 11:08:50 +02:00
|
|
|
|
2018-03-28 14:19:37 +02:00
|
|
|
uint64_t
|
2015-09-28 11:08:50 +02:00
|
|
|
isc_meminfo_totalphys(void) {
|
2024-09-20 09:10:20 +02:00
|
|
|
uint64_t tmem = uv_get_total_memory();
|
|
|
|
#if UV_VERSION_HEX >= UV_VERSION(1, 29, 0)
|
|
|
|
uint64_t cmem = uv_get_constrained_memory();
|
|
|
|
if (cmem > 0 && cmem < tmem) {
|
|
|
|
return (cmem);
|
2020-09-17 14:37:24 +02:00
|
|
|
}
|
2024-09-20 09:10:20 +02:00
|
|
|
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 29, 0) */
|
|
|
|
return (tmem);
|
2015-09-28 11:08:50 +02:00
|
|
|
}
|