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

[Xen-changelog] [xen-unstable] xenpaging: add helper function for unlinking pagefile



# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1307695645 -7200
# Node ID 2fe46305a00d81585604ab56a772fc3bd5ce1ee0
# Parent  7d72475641fa392c8d457bc978db3c9015a7ffff
xenpaging: add helper function for unlinking pagefile

Unlink pagefile in the signal handler and also in the exit path.
This does not leave a stale pagefile if an error occoured.

Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
---


diff -r 7d72475641fa -r 2fe46305a00d tools/xenpaging/xenpaging.c
--- a/tools/xenpaging/xenpaging.c       Fri Jun 10 10:47:24 2011 +0200
+++ b/tools/xenpaging/xenpaging.c       Fri Jun 10 10:47:25 2011 +0200
@@ -41,11 +41,20 @@
 
 static char filename[80];
 static int interrupted;
+
+static void unlink_pagefile(void)
+{
+    if ( filename[0] )
+    {
+        unlink(filename);
+        filename[0] = '\0';
+    }
+}
+
 static void close_handler(int sig)
 {
     interrupted = sig;
-    if ( filename[0] )
-        unlink(filename);
+    unlink_pagefile();
 }
 
 static int xenpaging_mem_paging_flush_ioemu_cache(xenpaging_t *paging)
@@ -716,6 +725,7 @@
 
  out:
     close(fd);
+    unlink_pagefile();
     free(victims);
 
     /* Tear down domain paging */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.