Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

msync(2) [hpux man page]

msync(2)							System Calls Manual							  msync(2)

NAME
msync() - synchronize the memory of a mapped file with physical storage SYNOPSIS
Parameters addr With len, specifies the region to be synchronized. len With addr, specifies the region to be synchronized. flags Specifies one of the following values: Performs asynchronous writes. The function synchronizes the file contents to match the current contents of the memory region. If flags is the function may return immediately once all write operations have been scheduled. o All write references to the memory region made prior to the call are visible by subsequent read operations on the file. o It is unspecified whether writes to the same portion of the file prior to the call are visible by read references to the memory region. o It is unspecified whether unmodified pages in the specified range are also written to the underlying hardware. Performs synchronous writes. The function synchronizes the file contents to match the current contents of the memory region. If flags is the function does not return until all write operations are completed. o All write references to the memory region made prior to the call are visible by subsequent read operations on the file. o It is unspecified whether writes to the same portion of the file prior to the call are visible by read references to the memory region. o It is unspecified whether unmodified pages in the specified range are also written to the underlying hardware. Invalidates mappings. The function synchronizes the contents of the memory region to match the current file contents. o All writes to the mapped portion of the file made prior to the call are visible by subsequent read references to the mapped memory region. o It is unspecified whether write references prior to the call, by any process, to memory regions mapped to the same portion of the file using are visible by read references to the region. DESCRIPTION
The function writes all modified copies of pages over the range [addr, addr+len] to the underlying hardware, or invalidates any copies so that further references to the pages will be obtained by the system from their permanent storage locations. addr and len specify the region to be synchronized. If these are not the address and length of a region created by a previous successful call to returns an error. The behavior of upon a region created with the or flags is undefined. If causes any write to the file, then the file's st_ctime and st_mtime fields are marked for update. Performance Considerations The following performance considerations only apply when using the option with These performance constraints do not apply when either or are exclusively used with Direct read/write references to portions of a mapped memory region currently undergoing an operation (with specified), may be blocked until all scheduled write operations are completed. This is especially true when performing an operation across a relatively large address range that requires many individual write operations to be scheduled out to the underlying hardware. HP-UX will schedule a separate write opera- tion for each contiguous group of modified pages on disk. As more write operations are queued out to the device, the overall suspension time of direct read/write references to the same portions of the memory region will generally increase. The suspension times of direct read/write references can be reduced by issuing requests over smaller portions of the memory region, but issuing them more frequently than a corresponding larger synchronization request. This will serve to more evenly distribute I/O activity across the mapped file, while reducing the number of write operations per RETURN VALUE
returns the following values: Successful completion. Failure. is set to indicate the error. ERRORS
The function will fail if: A transient error occurred while reading from or writing to the file system. Some or all of the addresses in the range starting at addr and continuing for len bytes are locked, and is specified. The addr argument is not a multiple of the page size as returned by The address range specified by addr and len was not created by a successful call to The value of flags is invalid. An I/O error occurred while reading from or writing to the file system. Some or all the addresses in the range [addr, addr+len] are invalid for the address space of the process. Or, pages that are not mapped are specified. APPLICATION USAGE
The function should be used by programs that require a memory object to be in a known state. For example, in building transaction facili- ties. Normal system activity can cause pages to be written to disk. Therefore, there are no guarantees that is the only control over when pages are or are not written to disk. AUTHOR
was developed by HP, AT&T, and OSF. SEE ALSO
mmap(2), sysconf(2), <sys/mman.h>. STANDARDS CONFORMANCE
CHANGE HISTORY
First released in Issue 4, Version 2. msync(2)
Man Page