162913Sbostic.\" Copyright (c) 1991, 1993 262913Sbostic.\" The Regents of the University of California. All rights reserved. 349901Smckusick.\" 450801Scael.\" %sccs.include.redist.roff% 549901Smckusick.\" 6*67441Smckusick.\" @(#)msync.2 8.2 (Berkeley) 06/21/94 749901Smckusick.\" 850801Scael.Dd 950801Scael.Dt MSYNC 2 1050801Scael.Os 1150801Scael.Sh NAME 1250801Scael.Nm msync 1350801Scael.Nd synchronize a mapped region 1450801Scael.Sh SYNOPSIS 1550801Scael.Fn msync "caddr_t addr" "int len" 1650801Scael.Sh DESCRIPTION 1750801ScaelThe 1850801Scael.Fn msync 1950801Scaelsystem call 2049901Smckusickwrites any modified pages back to the filesystem and updates 2149901Smckusickthe file modification time. 2250801ScaelIf 2350801Scael.Fa len 2450801Scaelis 0, all modified pages within the region containing 2550801Scael.Fa addr 2649901Smckusickwill be flushed; 2750801Scaelif 2850801Scael.Fa len 2950801Scaelis non-zero, only the pages containing 3050801Scael.Fa addr 3150801Scaeland 3250801Scael.Fa len 3349901Smckusicksucceeding locations will be examined. 3449901SmckusickAny required synchronization of memory caches 3549901Smckusickwill also take place at this time. 3649901SmckusickFilesystem operations on a file that is mapped for shared modifications 3750801Scaelare unpredictable except after an 3850801Scael.Fn msync . 39*67441Smckusick.Sh ERRORS 40*67441SmckusickThe following errors may be reported: 41*67441Smckusick.Bl -tag -width Er 42*67441Smckusick.It Bq Er EINVAL 43*67441SmckusickThe 44*67441Smckusick.Fa addr 45*67441Smckusickparameter was not page aligned. 46*67441Smckusick.It Bq Er EINVAL 47*67441SmckusickThe 48*67441Smckusick.Fa addr 49*67441Smckusickparameter did not specify an address part of a mapped region. 50*67441Smckusick.It Bq Er EINVAL 51*67441SmckusickThe 52*67441Smckusick.Fa len 53*67441Smckusickparameter was negative. 54*67441Smckusick.It Bq Er EIO 55*67441SmckusickAn I/O error occured while writing to the file system. 5650801Scael.Sh SEE ALSO 5750801Scael.Xr madvise 2 , 5850801Scael.Xr munmap 2 , 5950801Scael.Xr mprotect 2 , 6050801Scael.Xr mincore 2 6150801Scael.Sh HISTORY 6250801ScaelThe 6350801Scael.Fn msync 6462912Sbosticfunction first appeared in 4.4BSD. 65