## memory_object_synchronize

Server Interface - Forward a client's request to synchronize data with its image in backing store.

### SYNOPSIS

    kern_return_t   memory_object_synchronize
                    (memory_object_t                  memory_object,
                     memory_object_control_t         memory_control,
                     vm_offset_t                             offset,
                     vm_offset_t                             length,
                     memory_object                       sync_flags);

    kern_return_t   seqnos_memory_object_synchronize
                    (memory_object_t                  memory_object,
                     mach_port_seqno_t                        seqno,
                     memory_object_control_t         memory_control,
                     vm_offset_t                             offset,
                     vm_offset_t                             length,
                     memory_object                       sync_flags);

### PARAMETERS

memory_object
  [in abstract-memory-object (receive) right] The abstract memory object port that represents the memory object data.

seqno
  [in scalar] The sequence number of this message relative to the abstract memory object port.

memory_control
  [in memory-cache-control send right] The memory cache control port to be used for a response by the memory manager. If the memory object has been supplied to more than one kernel, this parameter identifies the kernel that is making the call.

offset
  [in scalar] The offset within the memory object.

length
  [in scalar] The number of bytes cleaned or flushed, starting at offset. The number converts to an integral number of virtual pages.

sync_flags
  [in scalar] The bit-wise OR of flags affecting the synchronization.

  VM_SYNC_INVALIDATE
    Flushes pages in the range. Only precious pages are returned to the memory manager.

  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

A memory_object_synchronize function is called as the result of a kernel message indicating that a client wishes to synchronize the contents of a range of a memory object with its backing storage image. This message would have been preceded by memory_object_data_return messages cleaning or flushing the specified range.

Depending on the client's supplied sync_flags, the manager waits for the pages to reach the desired state and then replies with memory_object_synchronize_completed at which time the client returns from its vm_msync call. Multiple synchronize requests may be outstanding at a time but they will not overlap.

### RETURN VALUES

Only generic errors apply.

### RELATED INFORMATION

Functions: vm_msync, memory_object_synchronize_completed, memory_object_data_return, memory_object_server, seqnos_memory_object_server.