Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

util.c: introduce is_vswap_mode()

Will be used by a few tools to run-time check for VSwap-enabled kernel

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
  • Loading branch information...
commit bc113fa6b99b68333048833749be7a9af87171f8 1 parent 1aebad8
@kolyshkin kolyshkin authored
Showing with 6 additions and 1 deletion.
  1. +1 −0  include/util.h
  2. +5 −1 src/lib/util.c
View
1  include/util.h
@@ -65,6 +65,7 @@ int get_running_ve_list(envid_t **ves);
int ve_in_list(envid_t *list, int size, envid_t ve);
const char* ubcstr(unsigned long bar, unsigned long lim);
+int is_vswap_mode(void);
#define logger_enomem(log_level, err, size, file, line) \
logger(log_level, err, "%s:%i: Can't allocate %lu bytes", \
View
6 src/lib/util.c
@@ -725,7 +725,6 @@ int ve_in_list(envid_t *list, int size, envid_t ve)
envid_sort_fn) != NULL;
}
-
const char* ubcstr(unsigned long bar, unsigned long lim)
{
static char str[64];
@@ -748,3 +747,8 @@ const char* ubcstr(unsigned long bar, unsigned long lim)
return str;
}
+
+int is_vswap_mode(void)
+{
+ return (access("/proc/vz/vswap", F_OK) == 0);
+}

0 comments on commit bc113fa

Please sign in to comment.
Something went wrong with that request. Please try again.