1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 *********************************************************************
11 *********************************************************************
16 PR_IMPLEMENT(PRFileMap
*)
17 PR_CreateFileMap(PRFileDesc
* fd
, PRInt64 size
, PRFileMapProtect prot
) {
20 PR_ASSERT(prot
== PR_PROT_READONLY
|| prot
== PR_PROT_READWRITE
||
21 prot
== PR_PROT_WRITECOPY
);
22 fmap
= PR_NEWZAP(PRFileMap
);
24 PR_SetError(PR_OUT_OF_MEMORY_ERROR
, 0);
29 if (_PR_MD_CREATE_FILE_MAP(fmap
, size
) == PR_SUCCESS
) {
36 PR_IMPLEMENT(PRInt32
) PR_GetMemMapAlignment(void) {
37 return _PR_MD_GET_MEM_MAP_ALIGNMENT();
41 PR_MemMap(PRFileMap
* fmap
, PROffset64 offset
, PRUint32 len
) {
42 return _PR_MD_MEM_MAP(fmap
, offset
, len
);
45 PR_IMPLEMENT(PRStatus
) PR_MemUnmap(void* addr
, PRUint32 len
) {
46 return _PR_MD_MEM_UNMAP(addr
, len
);
49 PR_IMPLEMENT(PRStatus
) PR_CloseFileMap(PRFileMap
* fmap
) {
50 return _PR_MD_CLOSE_FILE_MAP(fmap
);
53 PR_IMPLEMENT(PRStatus
) PR_SyncMemMap(PRFileDesc
* fd
, void* addr
, PRUint32 len
) {
54 return _PR_MD_SYNC_MEM_MAP(fd
, addr
, len
);