![]() |
![]() |
![]() |
![]() |
![]() |
This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Synchronize memory with physical storage
#include <sys/mman.h> int msync( void * addr, size_t len, int flags );
![]() |
This flag was added in the QNX Neutrino Core OS 6.3.2. |
![]() |
You can specify at most one of MS_ASYNC and MS_SYNC, not both. |
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The msync() function writes all modified data to permanent storage locations, if any, in those whole pages containing any part of the address space of the process starting at address addr and continuing for len bytes. The msync() function is used with memory mapped files. If no such storage exists, msync() need not have any effect. If requested, the msync() function then invalidates cached copies of data.
For mappings to files, this function ensures that all write operations are completed as defined for synchronized I/O data integrity completion.
![]() |
Mappings to files aren't implemented on all filesystems. |
When the msync() function is called on MAP_PRIVATE mappings, any modified data won't be written to the underlying object and won't cause such data to be made visible to other processes.
The behavior of msync() is unspecified if the mapping wasn't established by a call to mmap().
If msync() causes any write to a file, the file's st_ctime and st_mtime fields are marked for update.
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | Yes |
Thread | Yes |
MS_INVALIDATE_ICACHE and MS_CACHE_ONLY are QNX Neutrino extensions. The behavior of this function changed in the QNX Neutrino Core OS 6.3.2; to get the previous behavior of just data-cache operations, add the MS_CACHE_ONLY flag to the call in addition to MS_ASYNC, MS_SYNC, or MS_INVALIDATE.
![]() |
![]() |
![]() |
![]() |