vm_msync


Function - Synchronize the specified region of virtual memory.

SYNOPSIS

kern_return_t   vm_msync
                (vm_task_t                          target_task,
                 vm_address_t                           address,
                 vm_size_t                                 size,
                 target_task                         sync_flags);

PARAMETERS

target_task
[in task send right] The port for the task whose address space contains the region.

address
[in scalar] The starting address for the region.

size
[in scalar] The number of bytes in the region.

sync_flags
[in scalar] The bit-wise OR of flags affecting the synchronization. Specifying both VM_SYNC_SYNCHRONOUS and VM_SYNC_ASYNCHRONOUS is invalid.

VM_SYNC_INVALIDATE
Flushes pages in the range. Only precious pages are returned to the memory manager unless either VM_SYNC_SYNCHRONOUS or VM_SYNC_ASYNCHRONOUS is also set.

VM_SYNC_SYNCHRONOUS
Writes dirty and precious pages back to the memory manager, waits for pages to reach backing storage.

VM_SYNC_ASYNCHRONOUS
Writes dirty and precious pages back to the memory manager, returns without waiting for pages to reach backing storage.

DESCRIPTION

The vm_msync function synchronizes the contents of a memory range with its backing store image by flushing or cleaning the contents of the specified range to the range's memory manager, engaging in a synchronization protocol with the manager (memory_object_synchronize). The client does not return from this call until the memory manager responds (to the kernel) with memory_object_synchronize_completed.

NOTES

This interface is machine word length specific because of the virtual address parameter.

RETURN VALUES

KERN_INVALID_ADDRESS
The address is illegal or specifies a non-allocated region.

RELATED INFORMATION

Functions: memory_object_synchronize, memory_object_synchronize_completed.