.\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions .\" are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. All advertising materials mentioning features or use of this software .\" must display the following acknowledgement: .\" This product includes software developed by the University of .\" California, Berkeley and its contributors. .\" 4. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" .\" @(#)msync.2 8.2 (Berkeley) 6/21/94 .\" %FreeBSD: src/lib/libc/sys/msync.2,v 1.27 2004/06/30 20:09:10 ru Exp % .\" .\" $FreeBSD$ .Dd June 21, 1994 .Dt MSYNC 2 .Os .Sh 名称 .Nm msync .Nd マップされた領域を同期化する .Sh ライブラリ .Lb libc .Sh 書式 .In sys/mman.h .Ft int .Fn msync "void *addr" "size_t len" "int flags" .Sh 解説 .Fn msync システムコールは、修正されたページをファイルシステムに書き込んで ファイル修正時刻を更新します。 .Fa len が 0 の場合、 .Fa addr を含むリージョン内のすべての修正済みページがフラッシュされます。 .Fa len が 0 でない場合、 .Fa addr から .Fa len-1 の範囲を含むページだけが調べられます。 .Fa flags 引数は次のように指定できます: .Pp .Bl -tag -width ".Dv MS_INVALIDATE" -compact .It Dv MS_ASYNC ただちに戻ります .It Dv MS_SYNC 同期書込みを実行します .It Dv MS_INVALIDATE キャッシュされたデータをすべて無効にします .El .Sh 戻り値 .Rv -std msync .Sh エラー .Fn msync システムコールは次の場合に失敗します: .Bl -tag -width Er .It Bq Er EBUSY 指定された領域の一部またはすべてのページがロックされており、 .Dv MS_INVALIDATE が指定されました。 .It Bq Er EINVAL .Fa addr 引数はハードウェアページサイズの倍数ではありません。 .It Bq Er EINVAL .Fa len 引数が大きすぎるか、または負です。 .It Bq Er EINVAL .Fa flags 引数に MS_ASYNC と MS_INVALIDATE の両方が指定されました。 これらのフラグは同時に指定することはできません。 .El .Sh 関連項目 .Xr madvise 2 , .Xr mincore 2 , .Xr mlock 2 , .Xr mprotect 2 , .Xr munmap 2 .Sh 歴史 .Fn msync システムコールは .Bx 4.4 ではじめて登場しました。