]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
common/util: enable cgroup only on linux
authorKefu Chai <kchai@redhat.com>
Tue, 27 Apr 2021 02:11:53 +0000 (10:11 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 2 May 2021 00:16:12 +0000 (08:16 +0800)
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 <kchai@redhat.com>
src/common/util.cc

index 6cb1f02733cfce00efd21aca57624b26a91fa927..dc676c2647e3fa89d206cf5dfa0fb0529839c8f8 100644 (file)
@@ -167,7 +167,7 @@ static void distro_detect(map<string, string> *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