dreid 99/11/03 04:30:59
Modified: src/lib/apr/mmap/beos Makefile.in mmap.c
src/lib/apr/mmap/unix Makefile.in mmap.c
Added: src/lib/apr/mmap/beos common.c
src/lib/apr/mmap/unix common.c
Log:
Add more functions to the APR mmap.
Revision Changes Path
1.3 +16 -1 apache-2.0/src/lib/apr/mmap/beos/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/mmap/beos/Makefile.in,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- Makefile.in 1999/10/21 21:13:24 1.2
+++ Makefile.in 1999/11/03 12:30:55 1.3
@@ -15,7 +15,7 @@
LIB=libmmap.a
-OBJS=mmap.o
+OBJS=mmap.o common.o
.c.o:
$(CC) $(CFLAGS) -c $(INCLUDES) $<
@@ -50,3 +50,18 @@
&& rm Makefile.new
# DO NOT REMOVE
+common.o: common.c ../unix/common.c ../unix/../beos/mmap_h.h \
+ ../../include/apr_general.h ../../include/apr_config.h \
+ ../../include/apr_errno.h ../../include/apr_mmap.h \
+ ../../include/apr_network_io.h ../../include/apr_portable.h \
+ ../../include/apr_thread_proc.h ../../include/apr_file_io.h \
+ ../../include/apr_win.h ../../include/apr_lock.h \
+ ../../include/apr_time.h ../../file_io/unix/fileio.h \
+ ../../include/apr_lib.h
+mmap.o: mmap.c mmap_h.h ../../include/apr_general.h \
+ ../../include/apr_config.h ../../include/apr_errno.h \
+ ../../include/apr_mmap.h ../../include/apr_network_io.h \
+ ../../include/apr_portable.h ../../include/apr_thread_proc.h \
+ ../../include/apr_file_io.h ../../include/apr_win.h \
+ ../../include/apr_lock.h ../../include/apr_time.h \
+ ../../include/apr_lib.h ../../file_io/unix/fileio.h
1.3 +4 -4 apache-2.0/src/lib/apr/mmap/beos/mmap.c
Index: mmap.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/mmap/beos/mmap.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- mmap.c 1999/10/21 21:13:26 1.2
+++ mmap.c 1999/11/03 12:30:55 1.3
@@ -134,7 +134,7 @@
ap_status_t ap_mmap_open_create(struct mmap_t **new, ap_file_t *file,
ap_context_t *cont)
{
- void *mm;
+ char *mm;
area_id aid = -1;
char *areaname = "apr_mmap\0";
uint32 size;
@@ -164,8 +164,8 @@
size = ((file->size -1) / B_PAGE_SIZE) + 1;
- aid = create_area(areaname, &mm, B_ANY_ADDRESS, size * B_PAGE_SIZE,
- B_LAZY_LOCK, B_READ_AREA|B_WRITE_AREA);
+ aid = create_area(areaname, (void*)&mm, B_ANY_ADDRESS, size *
B_PAGE_SIZE,
+ B_FULL_LOCK, B_READ_AREA|B_WRITE_AREA);
free(areaname);
if (aid < B_OK) {
@@ -180,7 +180,7 @@
(*new)->size = file->size;
(*new)->area = aid;
(*new)->cntxt = cont;
-
+
/* register the cleanup... */
ap_register_cleanup((*new)->cntxt, (void*)(*new), mmap_cleanup,
ap_null_cleanup);
1.1 apache-2.0/src/lib/apr/mmap/beos/common.c
Index: common.c
===================================================================
#include "../unix/common.c"
1.4 +1 -1 apache-2.0/src/lib/apr/mmap/unix/Makefile.in
Index: Makefile.in
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/mmap/unix/Makefile.in,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Makefile.in 1999/10/30 05:59:24 1.3
+++ Makefile.in 1999/11/03 12:30:58 1.4
@@ -15,7 +15,7 @@
LIB=libmmap.a
-OBJS=mmap.o
+OBJS=mmap.o common.o
.c.o:
$(CC) $(CFLAGS) -c $(INCLUDES) $<
1.4 +1 -1 apache-2.0/src/lib/apr/mmap/unix/mmap.c
Index: mmap.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/mmap/unix/mmap.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- mmap.c 1999/10/24 04:30:19 1.3
+++ mmap.c 1999/11/03 12:30:59 1.4
@@ -111,7 +111,7 @@
(*new)->sinfo = st;
(*new)->size = st.st_size;
(*new)->cntxt = cont;
-
+
/* register the cleanup... */
ap_register_cleanup((*new)->cntxt, (void*)(*new), mmap_cleanup,
ap_null_cleanup);
1.1 apache-2.0/src/lib/apr/mmap/unix/common.c
Index: common.c
===================================================================
/* ====================================================================
* Copyright (c) 1999 The Apache Group. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. All advertising materials mentioning features or use of this
* software must display the following acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* 4. The names "Apache Server" and "Apache Group" must not be used to
* endorse or promote products derived from this software without
* prior written permission. For written permission, please contact
* [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* 6. Redistributions of any form whatsoever must retain the following
* acknowledgment:
* "This product includes software developed by the Apache Group
* for use in the Apache HTTP server project (http://www.apache.org/)."
*
* THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
* EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Group.
* For more information on the Apache Group and the Apache HTTP server
* project, please see <http://www.apache.org/>.
*
*/
/* common .c
* This file has any function that is truly common and platform
* neutral. Or at least that's the theory.
*
* The header files are a problem so there are a few #ifdef's to take
* care of those.
*
*/
#if HAVE_MMAP
#ifdef BEOS
#include "../beos/mmap_h.h"
#include <kernel/OS.h>
#else
#include "mmap_h.h"
#include <sys/mman.h>
#endif
#include "fileio.h"
#include "apr_mmap.h"
#include "apr_general.h"
#include "apr_portable.h"
#include "apr_lib.h"
#include <errno.h>
#include <string.h>
#include <stdio.h>
ap_int32_t ap_mmap_inode_compare(const void *m1, const void *m2)
{
const ap_mmap_t *a = *(ap_mmap_t **)m1;
const ap_mmap_t *b = *(ap_mmap_t **)m2;
ap_int32_t c;
c = a->sinfo.st_ino - b->sinfo.st_ino;
if (c == 0) {
return a->sinfo.st_dev - b->sinfo.st_dev;
}
return c;
}
ap_int32_t ap_mmap_filename_compare(const void *m1, const void *m2)
{
const ap_mmap_t *a = m1;
const ap_mmap_t *b = m2;
return strcmp(a->filename, b->filename);
}
ap_status_t ap_mmap_offset(void **addr, ap_mmap_t *mmap, ap_size_t offset)
{
if (offset < 0 || offset > mmap->size)
return APR_EINVAL;
(*addr) = mmap->mm + offset;
fprintf(stderr,"ap_mmap_offset (%p, %d) ==> %p\n",mmap->mm, offset,
(*addr));
return APR_SUCCESS;
}
#endif