Module Name:    src
Committed By:   jmcneill
Date:           Tue Aug 23 16:16:26 UTC 2011

Modified Files:
        src/sys/arch/usermode/include: thunk.h
        src/sys/arch/usermode/usermode: pmap.c thunk.c

Log Message:
unlink pmap backing file immediately after opening it, so we don't leave
a bunch of 128MB turds sitting around in /tmp


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/usermode/include/thunk.h
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/usermode/usermode/pmap.c
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/usermode/usermode/thunk.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/usermode/include/thunk.h
diff -u src/sys/arch/usermode/include/thunk.h:1.11 src/sys/arch/usermode/include/thunk.h:1.12
--- src/sys/arch/usermode/include/thunk.h:1.11	Tue Aug 23 16:09:27 2011
+++ src/sys/arch/usermode/include/thunk.h	Tue Aug 23 16:16:26 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.h,v 1.11 2011/08/23 16:09:27 jmcneill Exp $ */
+/* $NetBSD: thunk.h,v 1.12 2011/08/23 16:16:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcne...@invisible.ca>
@@ -68,6 +68,7 @@
 ssize_t	thunk_pwrite(int, const void *, size_t, off_t);
 int	thunk_fsync(int);
 int	thunk_mkstemp(char *);
+int	thunk_unlink(const char *);
 
 int	thunk_sigaction(int, const struct sigaction *, struct sigaction *);
 

Index: src/sys/arch/usermode/usermode/pmap.c
diff -u src/sys/arch/usermode/usermode/pmap.c:1.23 src/sys/arch/usermode/usermode/pmap.c:1.24
--- src/sys/arch/usermode/usermode/pmap.c:1.23	Tue Aug 23 15:35:53 2011
+++ src/sys/arch/usermode/usermode/pmap.c	Tue Aug 23 16:16:26 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.23 2011/08/23 15:35:53 reinoud Exp $ */
+/* $NetBSD: pmap.c,v 1.24 2011/08/23 16:16:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Reinoud Zandijk <rein...@netbsd.org>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.23 2011/08/23 15:35:53 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.24 2011/08/23 16:16:26 jmcneill Exp $");
 
 #include "opt_memsize.h"
 #include "opt_kmempages.h"
@@ -180,6 +180,9 @@
 	mem_fh = thunk_mkstemp(mem_name);
 	if (mem_fh < 0)
 		panic("pmap_bootstrap: can't create memory file\n");
+	/* unlink the file so space is freed when we quit */
+	if (thunk_unlink(mem_name) == -1)
+		panic("pmap_bootstrap: can't unlink %s", mem_name);
 
 	/* file_len is the backing store length, nothing to do with placement */
 	file_len = 1024 * MEMSIZE;

Index: src/sys/arch/usermode/usermode/thunk.c
diff -u src/sys/arch/usermode/usermode/thunk.c:1.12 src/sys/arch/usermode/usermode/thunk.c:1.13
--- src/sys/arch/usermode/usermode/thunk.c:1.12	Tue Aug 23 16:09:27 2011
+++ src/sys/arch/usermode/usermode/thunk.c	Tue Aug 23 16:16:26 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thunk.c,v 1.12 2011/08/23 16:09:27 jmcneill Exp $ */
+/* $NetBSD: thunk.c,v 1.13 2011/08/23 16:16:26 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: thunk.c,v 1.12 2011/08/23 16:09:27 jmcneill Exp $");
+__RCSID("$NetBSD: thunk.c,v 1.13 2011/08/23 16:16:26 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/ansi.h>
@@ -198,6 +198,12 @@
 }
 
 int
+thunk_unlink(const char *path)
+{
+	return unlink(path);
+}
+
+int
 thunk_sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
 {
 	return sigaction(sig, act, oact);

Reply via email to