You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@locus.apache.org on 2000/04/15 04:56:51 UTC
cvs commit: apache-2.0/src/lib/apr/test testpipe.c
trawick 00/04/14 19:56:51
Modified: src/main iol_file.c
src/lib/apr/file_io/os2 pipe.c
src/lib/apr/file_io/unix fileio.h pipe.c readwrite.c
src/lib/apr/file_io/win32 fileio.h
src/lib/apr/include apr_file_io.h apr_time.h
src/lib/apr/test testpipe.c
Log:
ap_set_pipe_timeout() now takes microseconds instead of seconds;
ap_interval_time_t was created to represent intervals;
Unfortunately, some compile fixes for the recently added buffering
code are mixed in with these changes.
Revision Changes Path
1.15 +2 -1 apache-2.0/src/main/iol_file.c
Index: iol_file.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/main/iol_file.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- iol_file.c 2000/04/14 00:11:08 1.14
+++ iol_file.c 2000/04/15 02:56:47 1.15
@@ -111,7 +111,8 @@
switch (opt) {
case AP_IOL_TIMEOUT:
- return ap_set_pipe_timeout(iol->file, *(const int*)value);
+ return ap_set_pipe_timeout(iol->file,
+ *(const int*)value * AP_USEC_PER_SEC);
default:
return APR_EINVAL;
}
1.15 +1 -1 apache-2.0/src/lib/apr/file_io/os2/pipe.c
Index: pipe.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/pipe.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- pipe.c 2000/04/14 15:58:22 1.14
+++ pipe.c 2000/04/15 02:56:47 1.15
@@ -100,7 +100,7 @@
-ap_status_t ap_set_pipe_timeout(ap_file_t *thepipe, ap_int32_t timeout)
+ap_status_t ap_set_pipe_timeout(ap_file_t *thepipe, ap_interval_time_t timeout)
{
return APR_ENOTIMPL;
}
1.18 +2 -2 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.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- fileio.h 2000/04/14 23:36:12 1.17
+++ fileio.h 2000/04/15 02:56:48 1.18
@@ -109,7 +109,7 @@
int oflags;
int eof_hit;
int pipe;
- int timeout;
+ ap_interval_time_t timeout;
int buffered;
int ungetchar; /* Last char provided by an unget op. (-1 = no char)*/
@@ -120,7 +120,7 @@
int direction; /* buffer being used for 0 = read, 1 = write */
unsigned long filePtr; /* position in file of handle */
#if APR_HAS_THREADS
- ap_lock_t *thlock;
+ struct ap_lock_t *thlock;
#endif
};
1.27 +1 -2 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.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- pipe.c 2000/04/14 23:36:12 1.26
+++ pipe.c 2000/04/15 02:56:48 1.27
@@ -76,8 +76,7 @@
return APR_SUCCESS;
}
-
-ap_status_t ap_set_pipe_timeout(ap_file_t *thepipe, ap_int32_t timeout)
+ap_status_t ap_set_pipe_timeout(ap_file_t *thepipe, ap_interval_time_t timeout)
{
if(thepipe == NULL)
return APR_EBADARG;
1.42 +12 -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.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- readwrite.c 2000/04/14 23:36:13 1.41
+++ readwrite.c 2000/04/15 02:56:48 1.42
@@ -56,20 +56,28 @@
static ap_status_t wait_for_io_or_timeout(ap_file_t *file, int for_read)
{
- struct timeval tv;
+ struct timeval tv, *tvptr;
fd_set fdset;
int srv;
+ /* TODO - timeout should be less each time through this loop */
+
do {
FD_ZERO(&fdset);
FD_SET(file->filedes, &fdset);
- tv.tv_sec = file->timeout;
- tv.tv_usec = 0;
+ if (file->timeout >= 0) {
+ tv.tv_sec = file->timeout / AP_USEC_PER_SEC;
+ tv.tv_usec = file->timeout % AP_USEC_PER_SEC;
+ tvptr = &tv;
+ }
+ else {
+ tvptr = NULL;
+ }
srv = select(FD_SETSIZE,
for_read ? &fdset : NULL,
for_read ? NULL : &fdset,
NULL,
- file->timeout < 0 ? NULL : &tv);
+ tvptr);
} while (srv == -1 && errno == EINTR);
if (srv == 0) {
1.17 +1 -1 apache-2.0/src/lib/apr/file_io/win32/fileio.h
Index: fileio.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/fileio.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- fileio.h 2000/04/14 15:58:23 1.16
+++ fileio.h 2000/04/15 02:56:49 1.17
@@ -110,7 +110,7 @@
ap_time_t mtime;
ap_time_t ctime;
int pipe;
- int timeout;
+ ap_interval_time_t timeout;
};
struct ap_dir_t {
1.43 +2 -1 apache-2.0/src/lib/apr/include/apr_file_io.h
Index: apr_file_io.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_file_io.h,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- apr_file_io.h 2000/04/14 15:58:24 1.42
+++ apr_file_io.h 2000/04/15 02:56:49 1.43
@@ -79,6 +79,7 @@
#define APR_EXCL 64 /* Open should fail if APR_CREATE and file
exists. */
#define APR_DELONCLOSE 256 /* Delete the file after close */
+#define APR_BUFFERED 512 /* Buffered I/O */
/* flags for ap_seek */
#define APR_SET SEEK_SET
@@ -422,7 +423,7 @@
* 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(ap_file_t *thepipe, ap_int32_t timeout);
+ap_status_t ap_set_pipe_timeout(ap_file_t *thepipe, ap_interval_time_t timeout);
/* ***APRDOC********************************************************
* ap_status_t ap_block_pipe(ap_file_t *thepipe)
1.17 +3 -0 apache-2.0/src/lib/apr/include/apr_time.h
Index: apr_time.h
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_time.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- apr_time.h 2000/04/14 01:38:41 1.16
+++ apr_time.h 2000/04/15 02:56:49 1.17
@@ -68,6 +68,9 @@
/* number of microseconds since 00:00:00 january 1, 1970 UTC */
typedef ap_int64_t ap_time_t;
+/* intervals for I/O timeouts, in microseconds */
+typedef ap_int32_t ap_interval_time_t;
+
#ifdef WIN32
#define AP_USEC_PER_SEC ((LONGLONG) 1000000)
#else
1.7 +1 -1 apache-2.0/src/lib/apr/test/testpipe.c
Index: testpipe.c
===================================================================
RCS file: /home/cvs/apache-2.0/src/lib/apr/test/testpipe.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- testpipe.c 2000/04/14 15:58:44 1.6
+++ testpipe.c 2000/04/15 02:56:50 1.7
@@ -95,7 +95,7 @@
}
fprintf(stdout, "\tSetting pipe timeout.......");
- if (ap_set_pipe_timeout(readp, 1) != APR_SUCCESS) {
+ if (ap_set_pipe_timeout(readp, 1 * AP_USEC_PER_SEC) != APR_SUCCESS) {
perror("Couldn't set a timeout");
exit(-1);
} else {