File: spvw_singlemap.d

package info (click to toggle)
clisp 1%3A2.49-8.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 45,160 kB
  • sloc: lisp: 79,960; ansic: 48,257; xml: 26,814; sh: 12,846; fortran: 7,286; makefile: 1,456; perl: 164
file content (45 lines) | stat: -rw-r--r-- 1,448 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* Support for SINGLEMAP_MEMORY and TRIVIALMAP_MEMORY model.

 -------------------------- Specification -----------------------------

 The operating system permits to add memory to arbitrary addresses, which
 behaves like memory created through malloc().

 The granularity of memory mapping, i.e. the length of a memory page.
 This is a power of two, usually 4096. */
local /* uintL */ aint map_pagesize;
/* Initialize it.
 local void init_map_pagesize (void);

 Initialization:
 initmap()
 Returns 0 is successful, -1 on error.

 Covers the range [map_addr,map_addr+map_len-1] with empty pages.
 (map_addr and map_len must be multiples of map_pagesize.)
 zeromap(map_addr,map_len)
 Returns 0 is successful, -1/errno on error.

 Reserves an address range for use with mmap_zeromap().
 local int prepare_zeromap (uintP* map_addr, uintP* map_endaddr, bool shrinkp); */

#ifdef HAVE_MMAP
/* Fill a memory range [map_addr,map_addr+map_len-1] with pages mapped in from
 file fd starting at position offset.
 map_addr and map_len must be multiples of mmap_pagesize. */
local void* filemap (void* map_addr, uintM map_len, int fd, off_t offset)
;
#endif

/* -------------------------- Implementation ---------------------------- */

#define init_map_pagesize()   { map_pagesize = mmap_pagesize; }

#define initmap()  mmap_init()

#define zeromap  mmap_zeromap
#define prepare_zeromap  mmap_prepare

#ifdef HAVE_MMAP
  #define filemap  mmap_filemap
#endif