unlink pmap backing file immediately after opening it, so we don't leave
a bunch of 128MB turds sitting around in /tmp
This commit is contained in:
parent
16a0338114
commit
0a7c520287
@ -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>
|
||||
@ -68,6 +68,7 @@ ssize_t thunk_pread(int, void *, size_t, off_t);
|
||||
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 *);
|
||||
|
||||
|
@ -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>
|
||||
@ -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 @@ pmap_bootstrap(void)
|
||||
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;
|
||||
|
@ -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>
|
||||
@ -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>
|
||||
@ -197,6 +197,12 @@ thunk_mkstemp(char *template)
|
||||
return mkstemp(template);
|
||||
}
|
||||
|
||||
int
|
||||
thunk_unlink(const char *path)
|
||||
{
|
||||
return unlink(path);
|
||||
}
|
||||
|
||||
int
|
||||
thunk_sigaction(int sig, const struct sigaction *act, struct sigaction *oact)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user