Add unit(in variable) & fix bugs
[platform/core/system/resourced.git] / src / resource-limiter / memory / lowmem-system.c
index 94a643b..53bffa4 100644 (file)
@@ -104,7 +104,7 @@ static int search_systemd_cgroup(const char *dir)
        FOREACH_DIRENT(de, d, return -errno) {
                _cleanup_free_ char *path = NULL;
 
-               unsigned int limit;
+               unsigned long long limit_bytes;
 
                if (de->d_type != DT_DIR)
                        continue;
@@ -113,8 +113,8 @@ static int search_systemd_cgroup(const char *dir)
                if (ret < 0)
                        return -ENOMEM;
 
-               ret = cgroup_read_node_uint32(path, MEMCG_LIMIT_BYTE, &limit);
-               if (ret != RESOURCED_ERROR_NONE ||limit <= 0)
+               ret = cgroup_read_node_ulonglong(path, MEMCG_LIMIT_BYTE, &limit_bytes);
+               if (ret != RESOURCED_ERROR_NONE ||limit_bytes <= 0)
                        continue;
 
                if (changeswappiness >= 0) {
@@ -125,7 +125,7 @@ static int search_systemd_cgroup(const char *dir)
                                        MEMCG_SWAPPINESS, changeswappiness, path);
                }
 
-               lowmem_reassign_limit(path, limit, PROC_ACTION_KILL);
+               lowmem_reassign_limit(path, limit_bytes, PROC_ACTION_KILL);
        }
        return RESOURCED_ERROR_NONE;
 }