View | Details | Raw Unified | Return to bug 65158
Collapse All | Expand All

(-)include/apr_mmap.h (-3 / +4 lines)
Lines 62-72 typedef struct apr_mmap_t apr_mmap_t; Link Here
62
struct apr_mmap_t {
62
struct apr_mmap_t {
63
    /** The pool the mmap structure was allocated out of. */
63
    /** The pool the mmap structure was allocated out of. */
64
    apr_pool_t *cntxt;
64
    apr_pool_t *cntxt;
65
#ifdef BEOS
65
#if defined(BEOS)
66
    /** An area ID.  Only valid on BeOS */
66
    /** An area ID.  Only valid on BeOS */
67
    area_id area;
67
    area_id area;
68
#endif
68
#elif defined(WIN32)
69
#ifdef WIN32
70
    /** The handle of the file mapping */
69
    /** The handle of the file mapping */
71
    HANDLE mhandle;
70
    HANDLE mhandle;
72
    /** The start of the real memory page area (mapped view) */
71
    /** The start of the real memory page area (mapped view) */
Lines 75-80 struct apr_mmap_t { Link Here
75
    apr_off_t  pstart;
74
    apr_off_t  pstart;
76
    apr_size_t psize;
75
    apr_size_t psize;
77
    apr_off_t  poffset;
76
    apr_off_t  poffset;
77
#else
78
    apr_off_t  poffset;
78
#endif
79
#endif
79
    /** The start of the memory mapped area */
80
    /** The start of the memory mapped area */
80
    void *mm;
81
    void *mm;
(-)mmap/unix/mmap.c (-3 / +14 lines)
Lines 61-67 static apr_status_t mmap_cleanup(void *themmap) Link Here
61
#ifdef BEOS
61
#ifdef BEOS
62
    rv = delete_area(mm->area);
62
    rv = delete_area(mm->area);
63
#else
63
#else
64
    rv = munmap(mm->mm, mm->size);
64
    rv = munmap((char *)mm->mm - mm->poffset, mm->size + mm->poffset);
65
#endif
65
#endif
66
    mm->mm = (void *)-1;
66
    mm->mm = (void *)-1;
67
67
Lines 81-86 APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap Link Here
81
    area_id aid = -1;
81
    area_id aid = -1;
82
    uint32 pages = 0;
82
    uint32 pages = 0;
83
#else
83
#else
84
    apr_off_t poffset = 0;
84
    apr_int32_t native_flags = 0;
85
    apr_int32_t native_flags = 0;
85
#endif
86
#endif
86
87
Lines 130-137 APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap Link Here
130
        native_flags |= PROT_READ;
131
        native_flags |= PROT_READ;
131
    }
132
    }
132
133
133
    mm = mmap(NULL, size, native_flags, MAP_SHARED, file->filedes, offset);
134
#if defined(_SC_PAGESIZE)
135
    {
136
        apr_off_t psize = sysconf(_SC_PAGESIZE);
137
        poffset = offset & (psize - 1);
138
    }
139
#endif
134
140
141
    mm = mmap(NULL, size + poffset,
142
              native_flags, MAP_SHARED,
143
              file->filedes, offset - poffset);
144
135
    if (mm == (void *)-1) {
145
    if (mm == (void *)-1) {
136
        /* we failed to get an mmap'd file... */
146
        /* we failed to get an mmap'd file... */
137
        *new = NULL;
147
        *new = NULL;
Lines 139-145 APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap Link Here
139
    }
149
    }
140
#endif
150
#endif
141
151
142
    (*new)->mm = mm;
152
    (*new)->mm = (char *)mm + poffset;
153
    (*new)->poffset = poffset;
143
    (*new)->size = size;
154
    (*new)->size = size;
144
    (*new)->cntxt = cont;
155
    (*new)->cntxt = cont;
145
    APR_RING_ELEM_INIT(*new, link);
156
    APR_RING_ELEM_INIT(*new, link);

Return to bug 65158