mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-05 09:05:40 +00:00
This change uses uv_get_total_memory() to get the memory available to BIND 9 with possible modification by uv_get_constrained_memory() if the libuv version is recent enough to honour constraints created by f.e. cgroups.
30 lines
788 B
C
30 lines
788 B
C
/*
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
*
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*
|
|
* 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/.
|
|
*
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
* information regarding copyright ownership.
|
|
*/
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <isc/meminfo.h>
|
|
#include <isc/uv.h>
|
|
|
|
uint64_t
|
|
isc_meminfo_totalphys(void) {
|
|
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);
|
|
}
|
|
#endif /* UV_VERSION_HEX >= UV_VERSION(1, 29, 0) */
|
|
return (tmem);
|
|
}
|