]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
utils: add lxc_getpagesize()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sat, 21 Oct 2017 14:22:58 +0000 (16:22 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sat, 21 Oct 2017 16:38:13 +0000 (18:38 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/utils.c
src/lxc/utils.h

index e4015bdc89a83b113b7c5d3739e560f51d413735..95aad8b09ed2fdeb317f55cdfe81d8e1dfa7620c 100644 (file)
@@ -2359,3 +2359,14 @@ int lxc_make_tmpfile(char *template, bool rm)
 
        return fd;
 }
+
+uint64_t lxc_getpagesize(void)
+{
+       int64_t pgsz;
+
+       pgsz = sysconf(_SC_PAGESIZE);
+       if (pgsz <= 0)
+               pgsz = 1 << 12;
+
+       return pgsz;
+}
index 32a181acca2e14869653d19ef17e377f93946abe..8d32e4aaa2f834b27034540bb68f5926ef9180be 100644 (file)
@@ -467,5 +467,6 @@ extern bool has_fs_type(const char *path, fs_type_magic magic_val);
 extern bool is_fs_type(const struct statfs *fs, fs_type_magic magic_val);
 extern bool lxc_nic_exists(char *nic);
 extern int lxc_make_tmpfile(char *template, bool rm);
+extern uint64_t lxc_getpagesize(void);
 
 #endif /* __LXC_UTILS_H */