1.\" Copyright (c) 1991, 1993 2.\" The Regents of the University of California. All rights reserved. 3.\" 4.\" %sccs.include.redist.roff% 5.\" 6.\" @(#)msync.2 8.2 (Berkeley) 06/21/94 7.\" 8.Dd 9.Dt MSYNC 2 10.Os 11.Sh NAME 12.Nm msync 13.Nd synchronize a mapped region 14.Sh SYNOPSIS 15.Fn msync "caddr_t addr" "int len" 16.Sh DESCRIPTION 17The 18.Fn msync 19system call 20writes any modified pages back to the filesystem and updates 21the file modification time. 22If 23.Fa len 24is 0, all modified pages within the region containing 25.Fa addr 26will be flushed; 27if 28.Fa len 29is non-zero, only the pages containing 30.Fa addr 31and 32.Fa len 33succeeding locations will be examined. 34Any required synchronization of memory caches 35will also take place at this time. 36Filesystem operations on a file that is mapped for shared modifications 37are unpredictable except after an 38.Fn msync . 39.Sh ERRORS 40The following errors may be reported: 41.Bl -tag -width Er 42.It Bq Er EINVAL 43The 44.Fa addr 45parameter was not page aligned. 46.It Bq Er EINVAL 47The 48.Fa addr 49parameter did not specify an address part of a mapped region. 50.It Bq Er EINVAL 51The 52.Fa len 53parameter was negative. 54.It Bq Er EIO 55An I/O error occured while writing to the file system. 56.Sh SEE ALSO 57.Xr madvise 2 , 58.Xr munmap 2 , 59.Xr mprotect 2 , 60.Xr mincore 2 61.Sh HISTORY 62The 63.Fn msync 64function first appeared in 4.4BSD. 65