From b378f6a008890a2f5497d63c1173a66151ef0915 Mon Sep 17 00:00:00 2001 From: Maksym Planeta Date: Sun, 20 Nov 2011 09:32:22 +0100 Subject: Work with memory object only after vm_map has been performed * tmpfs/node.c (diskfs_get_filemap): Work with memory object only after vm_map has been performed. --- tmpfs/node.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'tmpfs') diff --git a/tmpfs/node.c b/tmpfs/node.c index 17fe8ce7..b2503a05 100644 --- a/tmpfs/node.c +++ b/tmpfs/node.c @@ -498,17 +498,18 @@ diskfs_get_filemap (struct node *np, vm_prot_t prot) return MACH_PORT_NULL; } assert (np->dn->u.reg.memobj != MACH_PORT_NULL); - /* A new-fangled default pager lets us prevent user accesses - past the specified size of the file. */ - err = default_pager_object_set_size (np->dn->u.reg.memobj, - np->allocsize); - assert_perror (err); /* XXX we need to keep a reference to the object, or GNU Mach will terminate it when we release the map. */ vm_map (mach_task_self (), &np->dn->u.reg.memref, 4096, 0, 1, np->dn->u.reg.memobj, 0, 0, VM_PROT_NONE, VM_PROT_NONE, VM_INHERIT_NONE); + + /* A new-fangled default pager lets us prevent user accesses + past the specified size of the file. */ + err = default_pager_object_set_size (np->dn->u.reg.memobj, + np->allocsize); + assert_perror (err); } /* XXX always writable */ -- cgit v1.2.3