WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH 19 of 22] xenpaging: add helper function for unlinkin

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 19 of 22] xenpaging: add helper function for unlinking pagefile
From: Olaf Hering <olaf@xxxxxxxxx>
Date: Fri, 10 Jun 2011 11:13:08 +0200
Delivery-date: Fri, 10 Jun 2011 02:31:47 -0700
Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1307697187; l=1175; s=domk; d=aepfle.de; h=To:From:Date:References:In-Reply-To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:X-RZG-CLASS-ID: X-RZG-AUTH; bh=DMSvZSlDRJZDhncrfcSA/Lp3864=; b=FkMWQQBlyPnL2BK2NbrvYEQciudxD0kNbwBScCwnXVpfYq4sOeAFGfv/gPuCHU1LJQT kGwzcp4QyCAE25LY/MR1uFMWeKK8L7np0tiYwUN4BwzPvUP/A9YUPMK/tArDRIrZ9HkBB 9j69XurjpRx0hOwY1yhnfQv2l/hcfjcsqDg=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1307697169@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <patchbomb.1307697169@xxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.7.5
# HG changeset patch
# User Olaf Hering <olaf@xxxxxxxxx>
# Date 1307695645 -7200
# Node ID c375ced18c763dd7dcebfdc923f1d5154656b578
# Parent  3d8e65d22c13aeebe3f1e25e2dd9724c3efcf8d6
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>

diff -r 3d8e65d22c13 -r c375ced18c76 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 @@ int main(int argc, char *argv[])
 
  out:
     close(fd);
+    unlink_pagefile();
     free(victims);
 
     /* Tear down domain paging */

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

<Prev in Thread] Current Thread [Next in Thread>