Coverage Report

Created: 2026-06-07 07:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/nspr/pr/src/io/prmmap.c
Line
Count
Source
1
/* This Source Code Form is subject to the terms of the Mozilla Public
2
 * License, v. 2.0. If a copy of the MPL was not distributed with this
3
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5
/*
6
 *********************************************************************
7
 *
8
 * Memory-mapped files
9
 *
10
 *********************************************************************
11
 */
12
13
#include "primpl.h"
14
15
PR_IMPLEMENT(PRFileMap*)
16
0
PR_CreateFileMap(PRFileDesc* fd, PRInt64 size, PRFileMapProtect prot) {
17
0
  PRFileMap* fmap;
18
19
0
  PR_ASSERT(prot == PR_PROT_READONLY || prot == PR_PROT_READWRITE ||
20
0
            prot == PR_PROT_WRITECOPY);
21
0
  fmap = PR_NEWZAP(PRFileMap);
22
0
  if (NULL == fmap) {
23
0
    PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
24
0
    return NULL;
25
0
  }
26
0
  fmap->fd = fd;
27
0
  fmap->prot = prot;
28
0
  if (_PR_MD_CREATE_FILE_MAP(fmap, size) == PR_SUCCESS) {
29
0
    return fmap;
30
0
  }
31
0
  PR_DELETE(fmap);
32
0
  return NULL;
33
0
}
34
35
0
PR_IMPLEMENT(PRInt32) PR_GetMemMapAlignment(void) {
36
0
  return _PR_MD_GET_MEM_MAP_ALIGNMENT();
37
0
}
38
39
PR_IMPLEMENT(void*)
40
0
PR_MemMap(PRFileMap* fmap, PROffset64 offset, PRUint32 len) {
41
0
  return _PR_MD_MEM_MAP(fmap, offset, len);
42
0
}
43
44
0
PR_IMPLEMENT(PRStatus) PR_MemUnmap(void* addr, PRUint32 len) {
45
0
  return _PR_MD_MEM_UNMAP(addr, len);
46
0
}
47
48
0
PR_IMPLEMENT(PRStatus) PR_CloseFileMap(PRFileMap* fmap) {
49
0
  return _PR_MD_CLOSE_FILE_MAP(fmap);
50
0
}
51
52
0
PR_IMPLEMENT(PRStatus) PR_SyncMemMap(PRFileDesc* fd, void* addr, PRUint32 len) {
53
0
  return _PR_MD_SYNC_MEM_MAP(fd, addr, len);
54
0
}