Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/usermode unlink pmap backing file immediately after...



details:   https://anonhg.NetBSD.org/src/rev/eaa8d5c5d981
branches:  trunk
changeset: 768645:eaa8d5c5d981
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Tue Aug 23 16:16:26 2011 +0000

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

diffstat:

 sys/arch/usermode/include/thunk.h  |   3 ++-
 sys/arch/usermode/usermode/pmap.c  |   7 +++++--
 sys/arch/usermode/usermode/thunk.c |  10 ++++++++--
 3 files changed, 15 insertions(+), 5 deletions(-)

diffs (76 lines):

diff -r 6e2fea73dcb0 -r eaa8d5c5d981 sys/arch/usermode/include/thunk.h
--- a/sys/arch/usermode/include/thunk.h Tue Aug 23 16:09:27 2011 +0000
+++ b/sys/arch/usermode/include/thunk.h Tue Aug 23 16:16:26 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 *);
 
diff -r 6e2fea73dcb0 -r eaa8d5c5d981 sys/arch/usermode/usermode/pmap.c
--- a/sys/arch/usermode/usermode/pmap.c Tue Aug 23 16:09:27 2011 +0000
+++ b/sys/arch/usermode/usermode/pmap.c Tue Aug 23 16:16:26 2011 +0000
@@ -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 <reinoud%NetBSD.org@localhost>
@@ -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;
diff -r 6e2fea73dcb0 -r eaa8d5c5d981 sys/arch/usermode/usermode/thunk.c
--- a/sys/arch/usermode/usermode/thunk.c        Tue Aug 23 16:09:27 2011 +0000
+++ b/sys/arch/usermode/usermode/thunk.c        Tue Aug 23 16:16:26 2011 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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);



Home | Main Index | Thread Index | Old Index