Re: [PATCH]lxc: don't do duplicate work when getting pagesize

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18/11/13 16:03, Chen Hanxiao wrote:
From: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>

Don't do duplicate work when getting pagesize.
With some debug logs added.

Signed-off-by: Chen Hanxiao <chenhanxiao@xxxxxxxxxxxxxx>
---
  src/lxc/lxc_container.c | 16 +++++++++++-----
  1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/lxc/lxc_container.c b/src/lxc/lxc_container.c
index 255c711..e85d01c 100644
--- a/src/lxc/lxc_container.c
+++ b/src/lxc/lxc_container.c
@@ -144,6 +144,7 @@ int lxcContainerHasReboot(void)
      int cmd, v;
      int status;
      char *tmp;
+    int stacksize = getpagesize() * 4;
if (virFileReadAll("/proc/sys/kernel/ctrl-alt-del", 10, &buf) < 0)
          return -1;
@@ -160,10 +161,12 @@ int lxcContainerHasReboot(void)
      VIR_FREE(buf);
      cmd = v ? LINUX_REBOOT_CMD_CAD_ON : LINUX_REBOOT_CMD_CAD_OFF;
- if (VIR_ALLOC_N(stack, getpagesize() * 4) < 0)
+    if (VIR_ALLOC_N(stack, stacksize) < 0) {
+        VIR_DEBUG("Unable to allocate stack");

virAllocN already reports the out-of-memory error, why do we
need a debug log?

Osier

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]