diff options
Diffstat (limited to 'sys/vm/vm_map.c')
-rw-r--r-- | sys/vm/vm_map.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/vm/vm_map.c b/sys/vm/vm_map.c index 73cf6b0..9b91c1a 100644 --- a/sys/vm/vm_map.c +++ b/sys/vm/vm_map.c @@ -336,6 +336,7 @@ vmspace_swap_count(struct vmspace *vmspace) vm_map_entry_t cur; int count = 0; + vm_map_lock_read(map); for (cur = map->header.next; cur != &map->header; cur = cur->next) { vm_object_t object; @@ -351,6 +352,7 @@ vmspace_swap_count(struct vmspace *vmspace) } } } + vm_map_unlock_read(map); return (count); } @@ -397,6 +399,14 @@ vm_map_unlock_read(vm_map_t map) lockmgr(&(map)->lock, LK_RELEASE, NULL, curthread); } +int +vm_map_trylock(vm_map_t map) +{ + + return (lockmgr(&map->lock, LK_EXCLUSIVE | LK_NOWAIT, NULL, + curthread) == 0); +} + static __inline__ int _vm_map_lock_upgrade(vm_map_t map, struct thread *td) { int error; |