dreid 99/11/12 16:07:26
Modified:src/lib/apr aclocal.m4 configure.in
src/lib/apr/include apr_mmap.h
src/lib/apr/mmap/beos mmap.c mmap_h.h
src/lib/apr/mmap/unix common.c mmap.c mmap_h.h
Log:
hange the way that we test for the size of ssize_t, using code suggested by
Ralf after I found that the test failed on FreeBSD.
Update the mmap code to use a much simpler API than previously. I'll
add documentation as well as support for this in http_core.c over the
weekend.
Revision ChangesPath
1.6 +27 -1 apache-2.0/src/lib/apr/aclocal.m4
Index: aclocal.m4
===
RCS file: /home/cvs/apache-2.0/src/lib/apr/aclocal.m4,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- aclocal.m41999/11/10 18:27:02 1.5
+++ aclocal.m41999/11/13 00:07:04 1.6
@@ -133,6 +133,32 @@
])dnl
fi
rm -fr conftest*])
-
+dnl A variant of AC_CHECK_SIZEOF which allows the checking of
+dnl sizes of non-builtin types
+dnl AC_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE])
+AC_DEFUN(AC_CHECK_SIZEOF_EXTENDED,
+[changequote(,)dnl
+dnl The name to #define
+define(AC_TYPE_NAME, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl
+dnl The cache variable
+define(AC_CV_NAME, translit(ac_cv_sizeof_$2, [ *],[p]))dnl
+changequote([, ])dnl
+AC_MSG_CHECKING(size of $2)
+AC_CACHE_VAL(AC_CV_NAME,
+[AC_TRY_RUN([#include stdio.h
+$1
+main()
+{
+ FILE *f=fopen(conftestval,w);
+ if (!f) exit(1);
+ fprintf(f, %d\n, sizeof($2));
+ exit(0);
+}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,,
+AC_CV_NAME=$3))])dnl
+AC_MSG_RESULT($AC_CV_NAME)
+AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME)
+undefine([AC_TYPE_NAME])dnl
+undefine([AC_CV_NAME])dnl
+])
1.25 +1 -12 apache-2.0/src/lib/apr/configure.in
Index: configure.in
===
RCS file: /home/cvs/apache-2.0/src/lib/apr/configure.in,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- configure.in 1999/11/10 13:40:51 1.24
+++ configure.in 1999/11/13 00:07:05 1.25
@@ -57,18 +57,7 @@
AC_CHECK_SIZEOF(long double, 12)
AC_CHECK_SIZEOF(long long, 8)
-MY_TRY_RUN([
-#include sys/types.h
-#include stdlib.h
-#include stdio.h
-
-int main() {
-return(sizeof(ssize_t));
-}
-],
-AC_DEFINE(SIZEOF_SSIZE_T, 4),
-AC_DEFINE_UNQUOTED(SIZEOF_SSIZE_T, $?),
-AC_DEFINE(SIZEOF_SSIZE_T, 4))
+AC_CHECK_SIZEOF_EXTENDED([#include sys/types.h], ssize_t, 8)
# Use /bin/sh if it exists, otherwise go looking for sh in the path
if test .$SH = . -a -f /bin/sh; then
1.4 +3 -9 apache-2.0/src/lib/apr/include/apr_mmap.h
Index: apr_mmap.h
===
RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_mmap.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- apr_mmap.h1999/11/04 12:33:39 1.3
+++ apr_mmap.h1999/11/13 00:07:12 1.4
@@ -71,19 +71,13 @@
/* Function definitions */
/* creation */
-ap_status_t ap_mmap_create(ap_mmap_t ** newmmap, const char *fname,
ap_context_t *cntxt);
-ap_status_t ap_mmap_open_create(ap_mmap_t **newmmap, ap_file_t *file,
ap_context_t *cntxt);
-ap_status_t ap_mmap_size_create(ap_mmap_t **newmmap, ap_file_t *file,
ap_size_t size,
-ap_context_t *cntxt);
+ap_status_t ap_mmap_create(ap_mmap_t ** newmmap, ap_file_t *file, ap_off_t
offset,
+ ap_size_t size, ap_context_t *cntxt);
/* destruction */
ap_status_t ap_mmap_delete(ap_mmap_t *mmap);
-/* These are designed to be used in qsort, bsearch etc */
-ap_int32_t ap_mmap_inode_compare(const void *m1, const void *m2);
-ap_int32_t ap_mmap_filename_compare(const void *m1, const void *m2);
-
-ap_status_t ap_mmap_offset(void **addr, ap_mmap_t *mmap, ap_size_t offset);
+ap_status_t ap_mmap_offset(void **addr, ap_mmap_t *mmap, ap_off_t offset);
#ifdef __cplusplus
}
1.5 +13 -126 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- mmap.c1999/11/04 12:33:40 1.4
+++ mmap.c1999/11/13 00:07:16 1.5
@@ -79,151 +79,38 @@
return errno;
}
-ap_status_t ap_mmap_create(struct mmap_t **new, const char *fname,
- ap_context_t *cont)
+ap_status_t ap_mmap_create(struct mmap_t **new, ap_file_t *file, ap_off_t
offset, ap_size_t size,
+ap_context_t *cont)
{
-struct stat st;