Chapter Contents

Previous

Next
msync

msync



Synchronize a Memory Mapped HFS File

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 (|).

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

mmap , mprotect , munmap


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.