File: mmap.c

package info (click to toggle)
mlton 20100608-5
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 36,624 kB
  • sloc: ansic: 18,441; lisp: 2,879; makefile: 1,572; sh: 1,326; pascal: 256; asm: 97
file content (16 lines) | stat: -rw-r--r-- 597 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
static inline void *mmapAnon (void *start, size_t length) {
        return mmap (start, length, PROT_READ | PROT_WRITE, 
                        MAP_PRIVATE | MAP_ANON, -1, 0);
}

static void munmap_safe (void *base, size_t length) {
        if (DEBUG_MEM)
                fprintf (stderr, "munmap_safe ("FMTPTR", %s)\n",
                                (uintptr_t)base,
                                uintmaxToCommaString (length));
        assert (base != NULL);
        if (0 == length)
                return;
        if (0 != munmap (base, length))
                diee ("munmap failed");
}