msync(2) - Linux man page
Name
msync - synchronize a file with a memory mapSynopsis
#include <sys/mman.h>int msync(void *start, size_t length, int flags);
Description
Return Value
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.Errors
- EINVAL
- start is not a multiple of PAGESIZE; or any bit other than MS_ASYNC | MS_INVALIDATE | MS_SYNC is set in flags; or both MS_SYNC and MS_ASYNC are set in flags.
- ENOMEM
- The indicated memory (or part of it) was not mapped.
Availability
On POSIX systems on which msync() is available, both _POSIX_MAPPED_FILES and _POSIX_SYNCHRONIZED_IO are defined in <unistd.h> to a value greater than 0. (See also sysconf(3).)Conforming to
POSIX.1-2001.This call was introduced in Linux 1.3.21, and then used EFAULT instead of ENOMEM. In Linux 2.4.19 this was changed to the POSIX value ENOMEM.
See Also
mmap(2)B.O. Gallmeister, POSIX.4, O'Reilly, pp. 128-129 and 389-391.
