}
if (target_memkb > memorykb) {
- XL_LOG_ERRNO(ctx, XL_LOG_ERROR,
+ XL_LOG(ctx, XL_LOG_ERROR,
"memory_dynamic_max must be less than or equal to memory_static_max\n");
return 1;
}
int fd;
char buf[512];
uint32_t uptime = 0;
- char *uptime_str = 0;
+ char *uptime_str = NULL;
+ char *now_str = NULL;
fd = open("/proc/uptime", O_RDONLY);
if (fd == -1)
if (short_mode)
{
+ now_str = current_time_to_string(now);
uptime_str = uptime_to_string(uptime, 1);
- printf(" %s up %s, %s (%d)\n", current_time_to_string(now),
- uptime_str, libxl_domid_to_name(&ctx, 0), 0);
+ printf(" %s up %s, %s (%d)\n", now_str, uptime_str,
+ libxl_domid_to_name(&ctx, 0), 0);
}
else
{
0, uptime_str);
}
+ if (now_str)
+ free(now_str);
if (uptime_str)
free(uptime_str);
return;
{
uint32_t s_time = 0;
uint32_t uptime = 0;
- char *uptime_str = 0;
+ char *uptime_str = NULL;
+ char *now_str = NULL;
s_time = libxl_vm_get_start_time(&ctx, domuid);
if (s_time == -1)
uptime = now - s_time;
if (short_mode)
{
+ now_str = current_time_to_string(now);
uptime_str = uptime_to_string(uptime, 1);
- printf(" %s up %s, %s (%d)\n", current_time_to_string(now),
- uptime_str, libxl_domid_to_name(&ctx, domuid), domuid);
+ printf(" %s up %s, %s (%d)\n", now_str, uptime_str,
+ libxl_domid_to_name(&ctx, domuid), domuid);
}
else
{
domuid, uptime_str);
}
+ if (now_str)
+ free(now_str);
if (uptime_str)
free(uptime_str);
return;
},
{ "mem-max",
&main_memmax,
- "Set the maximum amount reservation for a domain.\n"
- "Units default to kilobytes, but can be suffixed with\n"
- "'b' (bytes), 'k' (KB), 'm' (MB), 'g' (GB) or 't' (TB)",
- "<Domain> <MemKB>",
+ "Set the maximum amount reservation for a domain",
+ "<Domain> <MemKB['b'[bytes]|'k'[KB]|'m'[MB]|'g'[GB]|'t'[TB]]>",
},
{ "mem-set",
&main_memset,
- "Set the current memory usage for a domain.\n"
- "Units default to kilobytes, but can be suffixed with\n"
- "'b' (bytes), 'k' (KB), 'm' (MB), 'g' (GB) or 't' (TB)",
- "<Domain> <MemKB>",
+ "Set the current memory usage for a domain",
+ "<Domain> <MemKB['b'[bytes]|'k'[KB]|'m'[MB]|'g'[GB]|'t'[TB]]>",
},
{ "button-press",
&main_button_press,