]> 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>
Thu, 9 Nov 2017 00:03:59 +0000 (01:03 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/utils.c
src/lxc/utils.h

index 102bcdcfd763c96bea7c354f5179f61ac0e27cbd..0c188341a4630c30f5cdc43efe0b3f7ecebe466f 100644 (file)
@@ -2417,3 +2417,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 967744ff3e5ad59b0e23dd13cc16dc1c1fd916a2..1fe61ec3986b1be058460b198f1809572c8ecae4 100644 (file)
@@ -457,5 +457,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 */