---
name: "vm_map_insert"
section: "9"
platform: "linux"
package: "freebsd-manpages"
version: "6.0-5"
release: "Debian 4.0 (Etch)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/vm_map_insert"
---

# vm\_map\_insert(9)

insert an object into a map

## NAME

**vm\_map\_insert** – insert an object into a map

## SYNOPSIS

**#include \<sys/param.h\>**

**#include \<vm/vm.h\>**

**#include \<vm/vm\_map.h\>**

*int*\

**vm\_map\_insert**(*vm\_map\_t map*, *vm\_object\_t object*, *vm\_ooffset\_t offset*, *vm\_offset\_t start*, *vm\_offset\_t end*, *vm\_prot\_t prot*, *vm\_prot\_t max*, *int cow*);

## DESCRIPTION

The **vm\_map\_insert**() function inserts a mapping for the entire vm\_object *object* into the target map *map*.

The *offset* argument specifies the offset into the *object* at which to begin mapping. The object's size should match that of the specified address range.

The *start* and *end* arguments specify the bounds of the mapped object's window in the address space of *map*.

The *cow* argument specifies the flags which should be propagated to the new entry, for example, to indicate that this is a copy-on-write mapping.

## IMPLEMENTATION NOTES

This function implicitly creates a new *vm\_map\_entry* by calling the internal function **vm\_map\_entry\_create**(). This function may use the *Giant* lock to ensure that only a single thread is present in the function.

## RETURN VALUES

The **vm\_map\_insert**() function returns KERN\_SUCCESS if the mapping could be made successfully.

Otherwise, KERN\_INVALID\_ADDRESS will be returned if the start of the range could not be found, or KERN\_NO\_SPACE if the range was found to be part of an existing entry or if it overlaps the end of the map.

## SEE ALSO

[vm\_map(9)](/vm_map/9.md)

## AUTHORS

This manual page was written by Bruce M Simpson ⟨bms@spc.org⟩.
