From: Kefu Chai Date: Tue, 27 Apr 2021 02:11:53 +0000 (+0800) Subject: common/util: enable cgroup only on linux X-Git-Tag: v17.1.0~2082^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=7c0ed157d75df24994a2cad4f601a9e57daf7236;p=ceph.git common/util: enable cgroup only on linux cgroups, i.e. control groups, are a linux kernel feature. this is not available on FreeBSD, Win32 or MacOS. furthermore, we are reading the information of it by accessing files exposed using a tmpfs filesystem mounted at /sys/fs/cgroup, which is not available on other systems. in this change, instead of guarding it using `#ifndef _WIN32`, it is now guraded using `defined(__linux__)`. Signed-off-by: Kefu Chai --- diff --git a/src/common/util.cc b/src/common/util.cc index 6cb1f02733cfc..dc676c2647e3f 100644 --- a/src/common/util.cc +++ b/src/common/util.cc @@ -167,7 +167,7 @@ static void distro_detect(map *m, CephContext *cct) int get_cgroup_memory_limit(uint64_t *limit) { -#ifndef _WIN32 +#if defined(__linux__) // /sys/fs/cgroup/memory/memory.limit_in_bytes // the magic value 9223372036854771712 or 0x7ffffffffffff000