Revision: 14573
Author: adrian.chadd
Date: Sat Apr 10 18:41:22 2010
Log: Issue #94 - fix the win32 async IO support to mostly compile.

There's issues with the 64-bit stat struct being redefined -
the fix is to include sys/stat.h earlier than include/config.h.


http://code.google.com/p/lusca-cache/source/detail?r=14573

Modified:
 /branches/LUSCA_HEAD/libasyncio/aiops.h
 /branches/LUSCA_HEAD/libasyncio/aiops_win32.c
 /branches/LUSCA_HEAD/libasyncio/async_io.c

=======================================
--- /branches/LUSCA_HEAD/libasyncio/aiops.h     Sun Aug  9 21:22:14 2009
+++ /branches/LUSCA_HEAD/libasyncio/aiops.h     Sat Apr 10 18:41:22 2010
@@ -50,6 +50,7 @@
     squidaio_result_t *resultp;
 } squidaio_request_t;

+#ifndef _SQUID_MSWIN_
 typedef struct squidaio_request_queue_t {
     pthread_mutex_t mutex;
     pthread_cond_t cond;
@@ -67,6 +68,27 @@
     struct squidaio_request_t *current_req;
     unsigned long requests;
 };
+#else
+typedef struct squidaio_request_queue_t {
+    HANDLE mutex;
+    HANDLE cond;
+    squidaio_request_t *volatile head;
+    squidaio_request_t *volatile *volatile tailp;
+    unsigned long requests;
+    unsigned long blocked;      /* main failed to lock the queue */
+} squidaio_request_queue_t;
+
+typedef struct squidaio_thread_t squidaio_thread_t;
+struct squidaio_thread_t {
+    squidaio_thread_t *next;
+    HANDLE thread;
+    DWORD dwThreadId;
+    squidaio_thread_status status;
+    struct squidaio_request_t *current_req;
+    unsigned long requests;
+    int volatile exit;
+};
+#endif

 extern int aiops_default_ndirs;

=======================================
--- /branches/LUSCA_HEAD/libasyncio/aiops_win32.c       Sat Apr 10 18:20:59 2010
+++ /branches/LUSCA_HEAD/libasyncio/aiops_win32.c       Sat Apr 10 18:41:22 2010
@@ -34,9 +34,20 @@
  *
  */

+
 #include "../include/config.h"

-#include <windows.h>
+#include       <stdio.h>
+#include       <sys/types.h>
+#if HAVE_FCNTL_H
+#include       <fcntl.h>
+#endif
+#if HAVE_ERRNO_H
+#include       <errno.h>
+#endif
+#include       <sys/stat.h>
+#include       <dirent.h>
+#include       <signal.h>

 #include "../include/util.h"
 #include "../include/Array.h"
@@ -57,19 +68,11 @@
 #include "../libiapp/fd_types.h"
 #include "../libiapp/comm_types.h"
 #include "../libiapp/comm.h"
+#include "../libiapp/win32_pipe.h"

 #include "aiops.h"
 #include "async_io.h"

-#include       <stdio.h>
-#include       <sys/types.h>
-#include       <sys/stat.h>
-#include       <fcntl.h>
-#if HAVE_ERRNO_H
-#include       <errno.h>
-#endif
-#include       <dirent.h>
-#include       <signal.h>

 #define RIDICULOUS_LENGTH      4096

@@ -929,21 +932,8 @@
     }
 }

-void
-squidaio_stats(StoreEntry * sentry)
-{
-    squidaio_thread_t *threadp;
-    int i;
-
-    if (!squidaio_initialised)
-       return;
-
-    storeAppendPrintf(sentry, "\n\nThreads Status:\n");
-    storeAppendPrintf(sentry, "#\tID\t# Requests\n");
-
-    threadp = threads;
-    for (i = 0; i < squidaio_nthreads; i++) {
- storeAppendPrintf(sentry, "%i\t0x%lx\t%ld\n", i + 1, threadp->dwThreadId, threadp->requests);
-       threadp = threadp->next;
-    }
-}
+squidaio_thread_t *
+squidaio_get_thread_head(void)
+{
+       return NULL;    /* XXX for now */
+}
=======================================
--- /branches/LUSCA_HEAD/libasyncio/async_io.c  Sun Aug  9 21:22:14 2009
+++ /branches/LUSCA_HEAD/libasyncio/async_io.c  Sat Apr 10 18:41:22 2010
@@ -40,11 +40,15 @@

 #include "../include/config.h"

+#ifndef _SQUID_WIN32_
 #include        <pthread.h>
+#endif
 #include        <stdio.h>
 #include        <sys/types.h>
 #include        <sys/stat.h>
+#ifndef _SQUID_WIN32_
 #include        <sys/uio.h>
+#endif
 #include        <unistd.h>
 #include        <fcntl.h>
 #include        <errno.h>

--
You received this message because you are subscribed to the Google Groups 
"lusca-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/lusca-commit?hl=en.

Reply via email to