Chapter Contents |
Previous |
Next |
msync |
Portability: | UNIX compatible |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
USAGE NOTES | |
EXAMPLE | |
RELATED FUNCTIONS |
SYNOPSIS |
#include <mman.h> int msync(void *addr, unsigned int len, int flags);
DESCRIPTION |
The
msync
function is used to synchronize an HFS file with one or more pages
of memory mapped to the file. The call may either cause the file to be updated
with data in memory or cause the data in memory to be updated from the file.
The
addr
argument
is the address of the first page of mapped memory to be synchronized. The
address must be on a page boundary, but need not be the first byte of the
entire area mapped to a file.
The
len
argument
specifies the number of bytes of memory to be synchronized. If the length
does not specify an integral number of pages, it is rounded up to do so. The
length need not specify the entire area of mapped memory.
The
flags
argument
specifies options describing how synchronization should be performed. One
or more of the following symbolic constants should be specified, combined
using the or operator (|).
MS_ASYNC
-
All modified data in the memory specified is written to the file. The writes
are performed asynchronously, which means that they need not be performed
in any particular order. Control is returned as soon as all writes have been
scheduled.
MS_SYNC
-
All modified data in the memory specified is written to the file. The writes
are performed synchronously, that is, control is not returned from
msync
until all data has been written.
MS_INVALIDATE
-
The contents of the memory pages specified are discarded. References to data
in the affected pages will cause data to be read from the appropriate portion
of the mapped file.
One of the three flags must be specified, and only one of
MS_ASYNC
and
MS_SYNC
may be specified. If
MS_INVALIDATE
is specified together with another flag, the memory
contents
specified are discarded only after all write operations have completed.
See the IBM UNIX System Services Assembler Callable Services
manual for additional information about the behavior of
msync
and the conditions under which it can be
used.
RETURN VALUE |
msync
returns
0
if successful,
or
-1
if unsuccessful.
USAGE NOTES |
The
msync
function can only be used with MVS 5.2.2 or a later release.
EXAMPLE |
Refer to mmap for an example.
RELATED FUNCTIONS |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.