cvs commit: apache-2.0/src/lib/apr configure.in aclocal.m4 acconfig.h
rbb 99/11/10 05:40:52 Modified:src/lib/apr configure.in aclocal.m4 acconfig.h Log: Fix a problem with the configure script. AC_CHECK_SIZEOF is only meant to be used for built-in types. ssize_t is not a built-in type on all systems, so SIZEOF_SSIZE_T was consistently getting defined to 0 on all of my systems. This fixes that problem by re-writing AC_TRY_RUN (the default AC_TRY_RUN has issues that don't allow for getting the return code from the program) and using it to get the size of SSIZE_T. Revision ChangesPath 1.24 +13 -1 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.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- configure.in 1999/11/09 09:01:10 1.23 +++ configure.in 1999/11/10 13:40:51 1.24 @@ -56,7 +56,19 @@ AC_CHECK_SIZEOF(short, 2) AC_CHECK_SIZEOF(long double, 12) AC_CHECK_SIZEOF(long long, 8) -AC_CHECK_SIZEOF(ssize_t, 4) + +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)) # Use /bin/sh if it exists, otherwise go looking for sh in the path if test .$SH = . -a -f /bin/sh; then 1.4 +42 -0 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.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- aclocal.m41999/10/21 16:41:07 1.3 +++ aclocal.m41999/11/10 13:40:52 1.4 @@ -95,4 +95,46 @@ fi ])dnl +dnl ### AC_TRY_RUN had some problems actually using a programs return code, +dnl ### so I am re-working it here to be used in APR's configure script. +dnl MY_TRY_RUN(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE +dnl[, ACTION-IF-CROSS-COMPILING]]]) +AC_DEFUN(MY_TRY_RUN, +[if test $cross_compiling = yes; then + ifelse([$4], , +[errprint(__file__:__line__: warning: [AC_TRY_RUN] called without default to allow cross compiling +)dnl + AC_MSG_ERROR(can not run test program while cross compiling)], + [$4]) +else + MY_TRY_RUN_NATIVE([$1], [$2], [$3]) +fi +]) + +dnl Like AC_TRY_RUN but assumes a native-environment (non-cross) compiler. +dnl MY_TRY_RUN_NATIVE(PROGRAM, [ACTION-IF-TRUE [, ACTION-IF-FALSE]]) +AC_DEFUN(MY_TRY_RUN_NATIVE, +[cat conftest.$ac_ext EOF +[#]line __oline__ configure +#include confdefs.h +ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus +extern C void exit(int); +#endif +])dnl +[$1] +EOF +if AC_TRY_EVAL(ac_link) test -s conftest${ac_exeext} (./conftest; exit) 2/dev/null +then +dnl Don't remove the temporary files here, so they can be examined. + ifelse([$2], , :, [$2]) +else +ifelse([$3], , , [ $3 + rm -fr conftest* +])dnl + echo configure: failed program was: AC_FD_CC + cat conftest.$ac_ext AC_FD_CC +fi +rm -fr conftest*]) + + 1.11 +1 -0 apache-2.0/src/lib/apr/acconfig.h Index: acconfig.h === RCS file: /home/cvs/apache-2.0/src/lib/apr/acconfig.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- acconfig.h1999/10/20 15:09:54 1.10 +++ acconfig.h1999/11/10 13:40:52 1.11 @@ -42,6 +42,7 @@ #undef NEED_RLIM_T #undef USEBCOPY +#undef SIZEOF_SSIZE_T #undef APR_HAS_THREADS @BOTTOM@
cvs commit: apache-2.0/src/lib/apr/mmap/unix common.c mmap.c mmap_h.h
rbb 99/11/10 07:25:05 Modified:src/lib/apr/mmap/unix common.c mmap.c mmap_h.h Log: Fix a logic error for mmap on unix. Basically, if you are going to check for the existance of an autoconf generated defintion, the check must be after you include all of your header files. Also, you must include apr_config.h. Lastly, include statements for system headers should ALWAYS be wrappered but #ifdef's checking for the availability of those header files. Revision ChangesPath 1.3 +16 -11apache-2.0/src/lib/apr/mmap/unix/common.c Index: common.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/mmap/unix/common.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- common.c 1999/11/04 12:33:41 1.2 +++ common.c 1999/11/10 15:25:04 1.3 @@ -61,26 +61,31 @@ * 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 apr_errno.h +#ifdef HAVE_STRING_H #include string.h +#endif +#ifdef HAVE_STDIO_H #include stdio.h +#endif +#ifdef BEOS +#include ../beos/mmap_h.h +#include kernel/OS.h +#else +#include mmap_h.h +#ifdef HAVE_SYS_MMAN_H +#include sys/mman.h +#endif +#endif + +#if HAVE_MMAP ap_int32_t ap_mmap_inode_compare(const void *m1, const void *m2) { 1.6 +10 -3 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- mmap.c1999/11/04 12:33:42 1.5 +++ mmap.c1999/11/10 15:25:04 1.6 @@ -53,18 +53,25 @@ * */ -#if HAVE_MMAP - #include mmap_h.h #include fileio.h #include apr_mmap.h #include apr_general.h #include apr_portable.h #include apr_lib.h +#include apr_errno.h +#include apr_config.h +#ifdef HAVE_SYS_MMAN_H #include sys/mman.h -#include errno.h +#endif +#ifdef HAVE_STRING_H #include string.h +#endif +#ifdef HAVE_STDIO_H #include stdio.h +#endif + +#if HAVE_MMAP ap_status_t mmap_cleanup(void *themmap) { 1.3 +3 -1 apache-2.0/src/lib/apr/mmap/unix/mmap_h.h Index: mmap_h.h === RCS file: /home/cvs/apache-2.0/src/lib/apr/mmap/unix/mmap_h.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- mmap_h.h 1999/11/04 12:33:42 1.2 +++ mmap_h.h 1999/11/10 15:25:04 1.3 @@ -56,10 +56,12 @@ #ifndef MMAP_H_H #define MMAP_H_H -#include sys/stat.h #include apr_general.h #include apr_mmap.h #include apr_errno.h +#ifdef HAVE_SYS_STAT_H +#include sys/stat.h +#endif struct mmap_t { ap_context_t *cntxt;
cvs commit: apache-2.0/src/lib/apr/network_io/unix sendrecv.c sockopt.c
rbb 99/11/10 07:49:57 Modified:src/lib/apr/file_io/unix fileio.h open.c pipe.c readwrite.c src/lib/apr/include apr_file_io.h src/lib/apr/network_io/unix sendrecv.c sockopt.c Log: Add timeouts to pipes. I also fixed a minor bug in timeout code for sending and receiving data over the network. Specifying a negative timeout will result in the send or recv blocking until the operation is done. Revision ChangesPath 1.4 +1 -0 apache-2.0/src/lib/apr/file_io/unix/fileio.h Index: fileio.h === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/fileio.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- fileio.h 1999/10/12 20:00:30 1.3 +++ fileio.h 1999/11/10 15:49:53 1.4 @@ -85,6 +85,7 @@ time_t atime; time_t mtime; time_t ctime; +int timeout; }; struct dir_t { 1.22 +7 -0 apache-2.0/src/lib/apr/file_io/unix/open.c Index: open.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -r1.21 -r1.22 --- open.c1999/11/04 22:04:16 1.21 +++ open.c1999/11/10 15:49:53 1.22 @@ -177,6 +177,7 @@ } (*new)-stated = 0; /* we haven't called stat for this file yet. */ +(*new)-timeout = -1; (*new)-eof_hit = 0; ap_register_cleanup((*new)-cntxt, (void *)(*new), file_cleanup, ap_null_cleanup); @@ -257,6 +258,12 @@ (*file) = ap_pcalloc(cont, sizeof(struct file_t)); (*file)-cntxt = cont; } +/* if we are putting in a new file descriptor, then we don't really + * have any of this information. + */ +(*file)-eof_hit = 0; +(*file)-timeout = -1; +(*file)-stated = 0; (*file)-filedes = *dafile; return APR_SUCCESS; } 1.5 +44 -0 apache-2.0/src/lib/apr/file_io/unix/pipe.c Index: pipe.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/pipe.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- pipe.c1999/11/01 03:07:07 1.4 +++ pipe.c1999/11/10 15:49:53 1.5 @@ -63,7 +63,46 @@ #include sys/types.h #include sys/stat.h +static ap_status_t pipenonblock(struct file_t *thefile) +{ +int fd_flags; + +fd_flags = fcntl(thefile-filedes, F_GETFL, 0); +#if defined(O_NONBLOCK) +fd_flags |= O_NONBLOCK; +#elif defined(O_NDELAY) +fd_flags |= O_NDELAY; +#elif defined(FNDELAY) +fd_flags |= O_FNDELAY; +#else +/* : this breaks things, but an alternative isn't obvious...*/ +return -1; +#endif +if (fcntl(thefile-filedes, F_SETFL, fd_flags) == -1) { +return errno; +} +return APR_SUCCESS; +} + /* ***APRDOC + * ap_status_t ap_set_pipe_timeout(ap_file_t *, ap_int32_t) + *Set the timeout value for a pipe. + * arg 1) The pipe we are setting a timeout on. + * arg 3) The timeout value in seconds. Values 0 mean wait forever, 0 + *means do not wait at all. + */ +ap_status_t ap_set_pipe_timeout(struct file_t *thepipe, ap_int32_t timeout) +{ +if (!strcmp(thepipe-fname, PIPE)) { +thepipe-timeout = timeout; +return APR_SUCCESS; +} +return APR_EINVAL; +} + + + +/* ***APRDOC * ap_status_t ap_create_pipe(ap_file_t **, ap_context_t *, ap_file_t **) *Create an anonymous pipe. * arg 1) The context to operate on. @@ -83,12 +122,17 @@ (*in)-filedes = filedes[0]; (*in)-buffered = 0; (*in)-fname = ap_pstrdup(cont, PIPE); +(*in)-timeout = -1; (*out) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); (*out)-cntxt = cont; (*out)-filedes = filedes[1]; (*out)-buffered = 0; (*out)-fname = ap_pstrdup(cont, PIPE); +(*out)-timeout = -1; + +pipenonblock(*in); +pipenonblock(*out); return APR_SUCCESS; } 1.16 +81 -4 apache-2.0/src/lib/apr/file_io/unix/readwrite.c Index: readwrite.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/readwrite.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- readwrite.c 1999/11/04 07:24:23 1.15 +++ readwrite.c 1999/11/10 15:49:53 1.16 @@ -70,6 +70,9 @@ #ifdef HAVE_SYS_UIO_H #include sys/uio.h #endif +#ifdef HAVE_SYS_TIME_H +#include sys/time.h +#endif /*
cvs commit: apache-2.0/src/lib/apr/file_io/unix fileacc.c pipe.c
rbb 99/11/10 08:47:10 Modified:src/lib/apr/file_io/unix fileacc.c pipe.c Log: Using the filename PIPE to determine if an apr_file_t refers to an anonymous pipe is a bad idea. We will now use the stated flag == -1 for this purpose. This makes sense because we shouldn't be stat'ing anonymous pipes anyway, if this is wrong, it is easy enough to add another flag to the file type if we have to, but I would rather not. Revision ChangesPath 1.11 +6 -6 apache-2.0/src/lib/apr/file_io/unix/fileacc.c Index: fileacc.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/fileacc.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- fileacc.c 1999/10/15 14:19:50 1.10 +++ fileacc.c 1999/11/10 16:47:03 1.11 @@ -118,7 +118,7 @@ ap_status_t ap_get_filesize(ap_ssize_t *size, struct file_t *file) { if (file != NULL) { -if (!file-stated) { +if (file-stated == 0) { ap_getfileinfo(file); } *size = file-size; @@ -139,7 +139,7 @@ ap_status_t ap_get_fileperms(ap_fileperms_t *perm, struct file_t *file) { if (file != NULL) { -if (!file-stated) { +if (file-stated == 0) { ap_getfileinfo(file); } *perm = file-protection; @@ -160,7 +160,7 @@ ap_status_t ap_get_fileatime(time_t *atime, struct file_t *file) { if (file != NULL) { -if (!file-stated) { +if (file-stated == 0) { ap_getfileinfo(file); } *atime = file-atime; @@ -181,7 +181,7 @@ ap_status_t ap_get_filectime(time_t *ptime, struct file_t *file) { if (file != NULL) { -if (!file-stated) { +if (file-stated == 0) { ap_getfileinfo(file); } *ptime = file-ctime; @@ -202,7 +202,7 @@ ap_status_t ap_get_filemtime(time_t *mtime, struct file_t *file) { if (file != NULL) { -if (!file-stated) { +if (file-stated == 0) { ap_getfileinfo(file); } *mtime = file-mtime; @@ -223,7 +223,7 @@ ap_status_t ap_get_filetype(ap_filetype_e *type, struct file_t *file) { if (file != NULL) { -if (!file-stated) { +if (file-stated == 0) { ap_getfileinfo(file); } if (S_ISREG(file-protection)) 1.6 +3 -1 apache-2.0/src/lib/apr/file_io/unix/pipe.c Index: pipe.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/pipe.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- pipe.c1999/11/10 15:49:53 1.5 +++ pipe.c1999/11/10 16:47:04 1.6 @@ -93,7 +93,7 @@ */ ap_status_t ap_set_pipe_timeout(struct file_t *thepipe, ap_int32_t timeout) { -if (!strcmp(thepipe-fname, PIPE)) { +if (thepipe-stated == -1) { thepipe-timeout = timeout; return APR_SUCCESS; } @@ -122,6 +122,7 @@ (*in)-filedes = filedes[0]; (*in)-buffered = 0; (*in)-fname = ap_pstrdup(cont, PIPE); +(*in)-stated = -1; (*in)-timeout = -1; (*out) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); @@ -129,6 +130,7 @@ (*out)-filedes = filedes[1]; (*out)-buffered = 0; (*out)-fname = ap_pstrdup(cont, PIPE); +(*out)-stated = -1; (*out)-timeout = -1; pipenonblock(*in);
cvs commit: apache-2.0/src/lib/apr aclocal.m4
rbb 99/11/10 10:27:14 Modified:src/lib/apr aclocal.m4 Log: Remove an error from my earlier commit to configure. Revision ChangesPath 1.5 +0 -2 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.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- aclocal.m41999/11/10 13:40:52 1.4 +++ aclocal.m41999/11/10 18:27:02 1.5 @@ -131,8 +131,6 @@ ifelse([$3], , , [ $3 rm -fr conftest* ])dnl - echo configure: failed program was: AC_FD_CC - cat conftest.$ac_ext AC_FD_CC fi rm -fr conftest*])