You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by mi...@apache.org on 2011/07/19 02:59:13 UTC

svn commit: r1148116 [1/2] - in /zookeeper/trunk: ./ src/c/ src/c/include/ src/c/src/ src/c/src/hashtable/ src/java/main/org/apache/jute/compiler/

Author: michim
Date: Tue Jul 19 00:59:10 2011
New Revision: 1148116

URL: http://svn.apache.org/viewvc?rev=1148116&view=rev
Log:
ZOOKEEPER-992. MT Native Version of Windows C Client (Dheeraj Agrawal via michim)

Added:
    zookeeper/trunk/src/c/Cli.vcproj
    zookeeper/trunk/src/c/include/winconfig.h
    zookeeper/trunk/src/c/include/winstdint.h
    zookeeper/trunk/src/c/src/winport.c
    zookeeper/trunk/src/c/src/winport.h
    zookeeper/trunk/src/c/zookeeper.sln
    zookeeper/trunk/src/c/zookeeper.vcproj
Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/c/include/recordio.h
    zookeeper/trunk/src/c/include/zookeeper.h
    zookeeper/trunk/src/c/src/cli.c
    zookeeper/trunk/src/c/src/hashtable/hashtable.h
    zookeeper/trunk/src/c/src/hashtable/hashtable_itr.c
    zookeeper/trunk/src/c/src/load_gen.c
    zookeeper/trunk/src/c/src/mt_adaptor.c
    zookeeper/trunk/src/c/src/recordio.c
    zookeeper/trunk/src/c/src/zk_adaptor.h
    zookeeper/trunk/src/c/src/zk_hashtable.c
    zookeeper/trunk/src/c/src/zk_log.c
    zookeeper/trunk/src/c/src/zookeeper.c
    zookeeper/trunk/src/java/main/org/apache/jute/compiler/JRecord.java

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Tue Jul 19 00:59:10 2011
@@ -370,6 +370,8 @@ NEW FEATURES:
 
   ZOOKEEPER-784. Server-side functionality for read-only mode (Sergey Doroshenko via henryr)
 
+  ZOOKEEPER-992. MT Native Version of Windows C Client (Dheeraj Agrawal via michim)
+
 Release 3.3.0 - 2010-03-24
 
 Non-backward compatible changes:

Added: zookeeper/trunk/src/c/Cli.vcproj
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/Cli.vcproj?rev=1148116&view=auto
==============================================================================
--- zookeeper/trunk/src/c/Cli.vcproj (added)
+++ zookeeper/trunk/src/c/Cli.vcproj Tue Jul 19 00:59:10 2011
@@ -0,0 +1,408 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+    ProjectType="Visual C++"
+    Version="8.00"
+    Name="Cli"
+    ProjectGUID="{050228F9-070F-4806-A2B5-E6B95D8EC4AF}"
+    RootNamespace="Cli"
+    >
+    <Platforms>
+        <Platform
+            Name="Win32"
+        />
+    </Platforms>
+    <ToolFiles>
+    </ToolFiles>
+    <Configurations>
+        <Configuration
+            Name="Debug|Win32"
+            OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+            IntermediateDirectory="$(ConfigurationName)"
+            ConfigurationType="1"
+            CharacterSet="1"
+            >
+            <Tool
+                Name="VCPreBuildEventTool"
+            />
+            <Tool
+                Name="VCCustomBuildTool"
+            />
+            <Tool
+                Name="VCXMLDataGeneratorTool"
+            />
+            <Tool
+                Name="VCWebServiceProxyGeneratorTool"
+            />
+            <Tool
+                Name="VCMIDLTool"
+            />
+            <Tool
+                Name="VCCLCompilerTool"
+                Optimization="0"
+                AdditionalIncludeDirectories="$(ProjectDir);$(ProjectDir)include;$(ProjectDir)generated;$(ProjectDir)hashtable"
+                PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;THREADED"
+                MinimalRebuild="true"
+                BasicRuntimeChecks="3"
+                RuntimeLibrary="3"
+                ProgramDataBaseFileName="$(IntDir)\cli.pdb"
+                WarningLevel="3"
+                Detect64BitPortabilityProblems="true"
+                DebugInformationFormat="3"
+            />
+            <Tool
+                Name="VCManagedResourceCompilerTool"
+            />
+            <Tool
+                Name="VCResourceCompilerTool"
+            />
+            <Tool
+                Name="VCPreLinkEventTool"
+            />
+            <Tool
+                Name="VCLinkerTool"
+                GenerateDebugInformation="true"
+                TargetMachine="1"
+            />
+            <Tool
+                Name="VCALinkTool"
+            />
+            <Tool
+                Name="VCManifestTool"
+            />
+            <Tool
+                Name="VCXDCMakeTool"
+            />
+            <Tool
+                Name="VCBscMakeTool"
+            />
+            <Tool
+                Name="VCFxCopTool"
+            />
+            <Tool
+                Name="VCAppVerifierTool"
+            />
+            <Tool
+                Name="VCWebDeploymentTool"
+            />
+            <Tool
+                Name="VCPostBuildEventTool"
+            />
+        </Configuration>
+        <Configuration
+            Name="Release|Win32"
+            OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+            IntermediateDirectory="$(ConfigurationName)"
+            ConfigurationType="1"
+            CharacterSet="1"
+            WholeProgramOptimization="1"
+            >
+            <Tool
+                Name="VCPreBuildEventTool"
+            />
+            <Tool
+                Name="VCCustomBuildTool"
+            />
+            <Tool
+                Name="VCXMLDataGeneratorTool"
+            />
+            <Tool
+                Name="VCWebServiceProxyGeneratorTool"
+            />
+            <Tool
+                Name="VCMIDLTool"
+            />
+            <Tool
+                Name="VCCLCompilerTool"
+                AdditionalIncludeDirectories="$(ProjectDir);$(ProjectDir)include;$(ProjectDir)generated;$(ProjectDir)hashtable"
+                PreprocessorDefinitions="WIN32;NDEBUG;THREADED"
+                RuntimeLibrary="0"
+                ProgramDataBaseFileName="$(IntDir)\cli.pdb"
+                WarningLevel="3"
+                Detect64BitPortabilityProblems="true"
+                DebugInformationFormat="3"
+            />
+            <Tool
+                Name="VCManagedResourceCompilerTool"
+            />
+            <Tool
+                Name="VCResourceCompilerTool"
+            />
+            <Tool
+                Name="VCPreLinkEventTool"
+            />
+            <Tool
+                Name="VCLinkerTool"
+                GenerateDebugInformation="true"
+                OptimizeReferences="2"
+                EnableCOMDATFolding="2"
+                TargetMachine="1"
+            />
+            <Tool
+                Name="VCALinkTool"
+            />
+            <Tool
+                Name="VCManifestTool"
+            />
+            <Tool
+                Name="VCXDCMakeTool"
+            />
+            <Tool
+                Name="VCBscMakeTool"
+            />
+            <Tool
+                Name="VCFxCopTool"
+            />
+            <Tool
+                Name="VCAppVerifierTool"
+            />
+            <Tool
+                Name="VCWebDeploymentTool"
+            />
+            <Tool
+                Name="VCPostBuildEventTool"
+            />
+        </Configuration>
+    </Configurations>
+    <References>
+        <ProjectReference
+            ReferencedProjectIdentifier="{5754FB2B-5EA5-4988-851D-908CA533A626}"
+            RelativePathToProject=".\zookeeper.vcproj"
+        />
+    </References>
+    <Files>
+        <Filter
+            Name="Source Files"
+            Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+            UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+            >
+            <File
+                RelativePath=".\src\cli.c"
+                >
+            </File>
+        </Filter>
+        <Filter
+            Name="Header Files"
+            Filter="h;hpp;hxx;hm;inl;inc;xsd"
+            UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+            >
+        </Filter>
+        <Filter
+            Name="Resource Files"
+            Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+            UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+            >
+        </Filter>
+    </Files>
+    <Globals>
+    </Globals>
+</VisualStudioProject>
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+    ProjectType="Visual C++"
+    Version="9.00"
+    Name="Cli"
+    ProjectGUID="{050228F9-070F-4806-A2B5-E6B95D8EC4AF}"
+    RootNamespace="Cli"
+    Keyword="Win32Proj"
+    TargetFrameworkVersion="196613"
+    >
+    <Platforms>
+        <Platform
+            Name="Win32"
+        />
+    </Platforms>
+    <ToolFiles>
+    </ToolFiles>
+    <Configurations>
+        <Configuration
+            Name="Debug|Win32"
+            OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+            IntermediateDirectory="$(ConfigurationName)"
+            ConfigurationType="1"
+            CharacterSet="1"
+            >
+            <Tool
+                Name="VCPreBuildEventTool"
+            />
+            <Tool
+                Name="VCCustomBuildTool"
+            />
+            <Tool
+                Name="VCXMLDataGeneratorTool"
+            />
+            <Tool
+                Name="VCWebServiceProxyGeneratorTool"
+            />
+            <Tool
+                Name="VCMIDLTool"
+            />
+            <Tool
+                Name="VCCLCompilerTool"
+                Optimization="0"
+                AdditionalIncludeDirectories="$(ZOOKEEPER_HOME)\src\c\src;$(ZOOKEEPER_HOME)\src\c\include;$(ZOOKEEPER_HOME)\src\c;$(ZOOKEEPER_HOME)\src\c\generated"
+                PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;THREADED"
+                MinimalRebuild="true"
+                BasicRuntimeChecks="3"
+                RuntimeLibrary="3"
+                UsePrecompiledHeader="0"
+                WarningLevel="3"
+                DebugInformationFormat="4"
+                CompileAs="1"
+            />
+            <Tool
+                Name="VCManagedResourceCompilerTool"
+            />
+            <Tool
+                Name="VCResourceCompilerTool"
+            />
+            <Tool
+                Name="VCPreLinkEventTool"
+            />
+            <Tool
+                Name="VCLinkerTool"
+                AdditionalDependencies="Ws2_32.lib zookeeper_d.lib"
+                OutputFile="$(OutDir)\$(ProjectName).exe"
+                LinkIncremental="2"
+                AdditionalLibraryDirectories="$(ZOOKEEPER_HOME)\src\c\Debug"
+                GenerateDebugInformation="true"
+                SubSystem="1"
+                TargetMachine="1"
+            />
+            <Tool
+                Name="VCALinkTool"
+            />
+            <Tool
+                Name="VCManifestTool"
+            />
+            <Tool
+                Name="VCXDCMakeTool"
+            />
+            <Tool
+                Name="VCBscMakeTool"
+            />
+            <Tool
+                Name="VCFxCopTool"
+            />
+            <Tool
+                Name="VCAppVerifierTool"
+            />
+            <Tool
+                Name="VCPostBuildEventTool"
+            />
+        </Configuration>
+        <Configuration
+            Name="Release|Win32"
+            OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+            IntermediateDirectory="$(ConfigurationName)"
+            ConfigurationType="1"
+            CharacterSet="1"
+            WholeProgramOptimization="1"
+            >
+            <Tool
+                Name="VCPreBuildEventTool"
+            />
+            <Tool
+                Name="VCCustomBuildTool"
+            />
+            <Tool
+                Name="VCXMLDataGeneratorTool"
+            />
+            <Tool
+                Name="VCWebServiceProxyGeneratorTool"
+            />
+            <Tool
+                Name="VCMIDLTool"
+            />
+            <Tool
+                Name="VCCLCompilerTool"
+                Optimization="2"
+                EnableIntrinsicFunctions="true"
+                AdditionalIncludeDirectories="$(ZOOKEEPER_HOME)\src\c\src;$(ZOOKEEPER_HOME)\src\c\include;$(ZOOKEEPER_HOME)\src\c;$(ZOOKEEPER_HOME)\src\c\generated"
+                PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;THREADED"
+                RuntimeLibrary="2"
+                EnableFunctionLevelLinking="true"
+                UsePrecompiledHeader="0"
+                WarningLevel="3"
+                DebugInformationFormat="3"
+                CompileAs="1"
+            />
+            <Tool
+                Name="VCManagedResourceCompilerTool"
+            />
+            <Tool
+                Name="VCResourceCompilerTool"
+            />
+            <Tool
+                Name="VCPreLinkEventTool"
+            />
+            <Tool
+                Name="VCLinkerTool"
+                AdditionalDependencies="Ws2_32.lib zookeeper.lib"
+                LinkIncremental="1"
+                AdditionalLibraryDirectories="$(ZOOKEEPER_HOME)\src\c\Release"
+                GenerateDebugInformation="true"
+                SubSystem="1"
+                OptimizeReferences="2"
+                EnableCOMDATFolding="2"
+                TargetMachine="1"
+            />
+            <Tool
+                Name="VCALinkTool"
+            />
+            <Tool
+                Name="VCManifestTool"
+            />
+            <Tool
+                Name="VCXDCMakeTool"
+            />
+            <Tool
+                Name="VCBscMakeTool"
+            />
+            <Tool
+                Name="VCFxCopTool"
+            />
+            <Tool
+                Name="VCAppVerifierTool"
+            />
+            <Tool
+                Name="VCPostBuildEventTool"
+            />
+        </Configuration>
+    </Configurations>
+    <References>
+    </References>
+    <Files>
+        <Filter
+            Name="Source Files"
+            Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+            UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+            >
+            <File
+                RelativePath=".\src\cli.c"
+                >
+                <FileConfiguration
+                    Name="Debug|Win32"
+                    >
+                    <Tool
+                        Name="VCCLCompilerTool"
+                        AdditionalIncludeDirectories="$(ZOOKEEPER_HOME)\src\c\include;$(ZOOKEEPER_HOME)\src\c;$(ZOOKEEPER_HOME)\src\c\src"
+                    />
+                </FileConfiguration>
+            </File>
+        </Filter>
+        <Filter
+            Name="Header Files"
+            Filter="h;hpp;hxx;hm;inl;inc;xsd"
+            UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+            >
+        </Filter>
+        <Filter
+            Name="Resource Files"
+            Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+            UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+            >
+        </Filter>
+    </Files>
+    <Globals>
+    </Globals>
+</VisualStudioProject>

Modified: zookeeper/trunk/src/c/include/recordio.h
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/include/recordio.h?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/include/recordio.h (original)
+++ zookeeper/trunk/src/c/include/recordio.h Tue Jul 19 00:59:10 2011
@@ -19,6 +19,12 @@
 #define __RECORDIO_H__
 
 #include <sys/types.h>
+#ifndef WIN32
+#define STRUCT_INITIALIZER(l,r) .l = r
+#else
+#define STRUCT_INITIALIZER(l,r)  r
+#include "winconfig.h"
+#endif
 
 #ifdef __cplusplus
 extern "C" {

Added: zookeeper/trunk/src/c/include/winconfig.h
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/include/winconfig.h?rev=1148116&view=auto
==============================================================================
--- zookeeper/trunk/src/c/include/winconfig.h (added)
+++ zookeeper/trunk/src/c/include/winconfig.h Tue Jul 19 00:59:10 2011
@@ -0,0 +1,191 @@
+/* Define to 1 if you have the <arpa/inet.h> header file. */
+#undef HAVE_ARPA_INET_H
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the file `generated/zookeeper.jute.c'. */
+#define HAVE_GENERATED_ZOOKEEPER_JUTE_C 1
+
+/* Define to 1 if you have the file `generated/zookeeper.jute.h'. */
+#define HAVE_GENERATED_ZOOKEEPER_JUTE_H 1
+
+/* Define to 1 if you have the `getcwd' function. */
+#undef HAVE_GETCWD
+
+/* Define to 1 if you have the `gethostbyname' function. */
+#undef HAVE_GETHOSTBYNAME
+
+/* Define to 1 if you have the `gethostname' function. */
+#define HAVE_GETHOSTNAME 1
+
+/* Define to 1 if you have the `getlogin' function. */
+#undef HAVE_GETLOGIN
+
+/* Define to 1 if you have the `getpwuid_r' function. */
+#undef HAVE_GETPWUID_R
+
+/* Define to 1 if you have the `gettimeofday' function. */
+#undef HAVE_GETTIMEOFDAY
+
+/* Define to 1 if you have the `getuid' function. */
+#undef HAVE_GETUID
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `memmove' function. */
+#undef HAVE_MEMMOVE
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define to 1 if you have the <netinet/in.h> header file. */
+#undef HAVE_NETINET_IN_H
+
+/* Define to 1 if you have the `poll' function. */
+#undef HAVE_POLL
+
+/* Define to 1 if you have the `socket' function. */
+#undef HAVE_SOCKET
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
+
+/* Define to 1 if you have the `strdup' function. */
+#define HAVE_STRDUP 1
+
+/* Define to 1 if you have the `strerror' function. */
+#define HAVE_STRERROR 1
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtol' function. */
+#undef HAVE_STRTOL
+
+/* Define to 1 if you have the <sys/socket.h> header file. */
+#undef HAVE_SYS_SOCKET_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/time.h> header file. */
+#undef HAVE_SYS_TIME_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <sys/utsname.h> header file. */
+#undef HAVE_SYS_UTSNAME_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Name of package */
+#define PACKAGE "c-client-src"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "zookeeper-user@hadoop.apache.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "zookeeper C client"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "zookeeper C client 3.4.0 win32"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "c-client-src"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "3.4.0"
+
+/* poll() second argument type */
+#define POLL_NFDS_TYPE
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME
+
+/* Version number of package */
+#define VERSION "3.4.0"
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+   calls it, or to nothing if 'inline' is not supported under any name.  */
+#ifndef __cplusplus
+#define inline __inline
+#endif
+#ifdef WIN32
+#define __attribute__(x)
+#define __func__ __FUNCTION__
+
+#ifndef _WIN32_WINNT_NT4
+#define _WIN32_WINNT_NT4 0x0400
+#endif
+
+#define NTDDI_VERSION _WIN32_WINNT_NT4
+#define _WIN32_WINNT _WIN32_WINNT_NT4
+
+#define _CRT_SECURE_NO_WARNINGS
+#define WIN32_LEAN_AND_MEAN
+#include <Windows.h>
+#include <Winsock2.h>
+#include <winstdint.h>
+#include <process.h>
+#include <ws2tcpip.h>
+#undef AF_INET6
+#undef min
+#undef max
+
+#include <errno.h>
+
+#define strtok_r strtok_s
+#define localtime_r(a,b) localtime_s(b,a)
+#define get_errno() errno=GetLastError()
+#define random rand
+#define snprintf _snprintf
+
+#define ACL ZKACL  // Conflict with windows API
+
+#define EAI_ADDRFAMILY WSAEINVAL
+#define EHOSTDOWN EPIPE
+#define ESTALE ENODEV
+
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define EINPROGRESS WSAEINPROGRESS
+
+typedef int pid_t;
+#endif

Added: zookeeper/trunk/src/c/include/winstdint.h
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/include/winstdint.h?rev=1148116&view=auto
==============================================================================
--- zookeeper/trunk/src/c/include/winstdint.h (added)
+++ zookeeper/trunk/src/c/include/winstdint.h Tue Jul 19 00:59:10 2011
@@ -0,0 +1,247 @@
+// ISO C9x  compliant stdint.h for Microsoft Visual Studio
+// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 
+// 
+//  Copyright (c) 2006-2008 Alexander Chemeris
+// 
+// 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. The name of the author may be used to endorse or promote products
+//      derived from this software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 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 AUTHOR 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.
+// 
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _MSC_VER // [
+#error "Use this header only with Microsoft Visual C++ compilers!"
+#endif // _MSC_VER ]
+
+#ifndef _MSC_STDINT_H_ // [
+#define _MSC_STDINT_H_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif
+
+#include <limits.h>
+
+// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
+// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
+// or compiler give many errors like this:
+//   error C2733: second C linkage of overloaded function 'wmemchr' not allowed
+#ifdef __cplusplus
+extern "C" {
+#endif
+#  include <wchar.h>
+#ifdef __cplusplus
+}
+#endif
+
+// Define _W64 macros to mark types changing their size, like intptr_t.
+#ifndef _W64
+#  if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
+#     define _W64 __w64
+#  else
+#     define _W64
+#  endif
+#endif
+
+
+// 7.18.1 Integer types
+
+// 7.18.1.1 Exact-width integer types
+
+// Visual Studio 6 and Embedded Visual C++ 4 doesn't
+// realize that, e.g. char has the same size as __int8
+// so we give up on __intX for them.
+#if (_MSC_VER < 1300)
+   typedef signed char       int8_t;
+   typedef signed short      int16_t;
+   typedef signed int        int32_t;
+   typedef unsigned char     uint8_t;
+   typedef unsigned short    uint16_t;
+   typedef unsigned int      uint32_t;
+#else
+   typedef signed __int8     int8_t;
+   typedef signed __int16    int16_t;
+   typedef signed __int32    int32_t;
+   typedef unsigned __int8   uint8_t;
+   typedef unsigned __int16  uint16_t;
+   typedef unsigned __int32  uint32_t;
+#endif
+typedef signed __int64       int64_t;
+typedef unsigned __int64     uint64_t;
+
+
+// 7.18.1.2 Minimum-width integer types
+typedef int8_t    int_least8_t;
+typedef int16_t   int_least16_t;
+typedef int32_t   int_least32_t;
+typedef int64_t   int_least64_t;
+typedef uint8_t   uint_least8_t;
+typedef uint16_t  uint_least16_t;
+typedef uint32_t  uint_least32_t;
+typedef uint64_t  uint_least64_t;
+
+// 7.18.1.3 Fastest minimum-width integer types
+typedef int8_t    int_fast8_t;
+typedef int16_t   int_fast16_t;
+typedef int32_t   int_fast32_t;
+typedef int64_t   int_fast64_t;
+typedef uint8_t   uint_fast8_t;
+typedef uint16_t  uint_fast16_t;
+typedef uint32_t  uint_fast32_t;
+typedef uint64_t  uint_fast64_t;
+
+// 7.18.1.4 Integer types capable of holding object pointers
+#ifdef _WIN64 // [
+   typedef signed __int64    intptr_t;
+   typedef unsigned __int64  uintptr_t;
+#else // _WIN64 ][
+   typedef _W64 signed int   intptr_t;
+   typedef _W64 unsigned int uintptr_t;
+#endif // _WIN64 ]
+
+// 7.18.1.5 Greatest-width integer types
+typedef int64_t   intmax_t;
+typedef uint64_t  uintmax_t;
+
+
+// 7.18.2 Limits of specified-width integer types
+
+#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [   See footnote 220 at page 257 and footnote 221 at page 259
+
+// 7.18.2.1 Limits of exact-width integer types
+#define INT8_MIN     ((int8_t)_I8_MIN)
+#define INT8_MAX     _I8_MAX
+#define INT16_MIN    ((int16_t)_I16_MIN)
+#define INT16_MAX    _I16_MAX
+#define INT32_MIN    ((int32_t)_I32_MIN)
+#define INT32_MAX    _I32_MAX
+#define INT64_MIN    ((int64_t)_I64_MIN)
+#define INT64_MAX    _I64_MAX
+#define UINT8_MAX    _UI8_MAX
+#define UINT16_MAX   _UI16_MAX
+#define UINT32_MAX   _UI32_MAX
+#define UINT64_MAX   _UI64_MAX
+
+// 7.18.2.2 Limits of minimum-width integer types
+#define INT_LEAST8_MIN    INT8_MIN
+#define INT_LEAST8_MAX    INT8_MAX
+#define INT_LEAST16_MIN   INT16_MIN
+#define INT_LEAST16_MAX   INT16_MAX
+#define INT_LEAST32_MIN   INT32_MIN
+#define INT_LEAST32_MAX   INT32_MAX
+#define INT_LEAST64_MIN   INT64_MIN
+#define INT_LEAST64_MAX   INT64_MAX
+#define UINT_LEAST8_MAX   UINT8_MAX
+#define UINT_LEAST16_MAX  UINT16_MAX
+#define UINT_LEAST32_MAX  UINT32_MAX
+#define UINT_LEAST64_MAX  UINT64_MAX
+
+// 7.18.2.3 Limits of fastest minimum-width integer types
+#define INT_FAST8_MIN    INT8_MIN
+#define INT_FAST8_MAX    INT8_MAX
+#define INT_FAST16_MIN   INT16_MIN
+#define INT_FAST16_MAX   INT16_MAX
+#define INT_FAST32_MIN   INT32_MIN
+#define INT_FAST32_MAX   INT32_MAX
+#define INT_FAST64_MIN   INT64_MIN
+#define INT_FAST64_MAX   INT64_MAX
+#define UINT_FAST8_MAX   UINT8_MAX
+#define UINT_FAST16_MAX  UINT16_MAX
+#define UINT_FAST32_MAX  UINT32_MAX
+#define UINT_FAST64_MAX  UINT64_MAX
+
+// 7.18.2.4 Limits of integer types capable of holding object pointers
+#ifdef _WIN64 // [
+#  define INTPTR_MIN   INT64_MIN
+#  define INTPTR_MAX   INT64_MAX
+#  define UINTPTR_MAX  UINT64_MAX
+#else // _WIN64 ][
+#  define INTPTR_MIN   INT32_MIN
+#  define INTPTR_MAX   INT32_MAX
+#  define UINTPTR_MAX  UINT32_MAX
+#endif // _WIN64 ]
+
+// 7.18.2.5 Limits of greatest-width integer types
+#define INTMAX_MIN   INT64_MIN
+#define INTMAX_MAX   INT64_MAX
+#define UINTMAX_MAX  UINT64_MAX
+
+// 7.18.3 Limits of other integer types
+
+#ifdef _WIN64 // [
+#  define PTRDIFF_MIN  _I64_MIN
+#  define PTRDIFF_MAX  _I64_MAX
+#else  // _WIN64 ][
+#  define PTRDIFF_MIN  _I32_MIN
+#  define PTRDIFF_MAX  _I32_MAX
+#endif  // _WIN64 ]
+
+#define SIG_ATOMIC_MIN  INT_MIN
+#define SIG_ATOMIC_MAX  INT_MAX
+
+#ifndef SIZE_MAX // [
+#  ifdef _WIN64 // [
+#     define SIZE_MAX  _UI64_MAX
+#  else // _WIN64 ][
+#     define SIZE_MAX  _UI32_MAX
+#  endif // _WIN64 ]
+#endif // SIZE_MAX ]
+
+// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
+#ifndef WCHAR_MIN // [
+#  define WCHAR_MIN  0
+#endif  // WCHAR_MIN ]
+#ifndef WCHAR_MAX // [
+#  define WCHAR_MAX  _UI16_MAX
+#endif  // WCHAR_MAX ]
+
+#define WINT_MIN  0
+#define WINT_MAX  _UI16_MAX
+
+#endif // __STDC_LIMIT_MACROS ]
+
+
+// 7.18.4 Limits of other integer types
+
+#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [   See footnote 224 at page 260
+
+// 7.18.4.1 Macros for minimum-width integer constants
+
+#define INT8_C(val)  val##i8
+#define INT16_C(val) val##i16
+#define INT32_C(val) val##i32
+#define INT64_C(val) val##i64
+
+#define UINT8_C(val)  val##ui8
+#define UINT16_C(val) val##ui16
+#define UINT32_C(val) val##ui32
+#define UINT64_C(val) val##ui64
+
+// 7.18.4.2 Macros for greatest-width integer constants
+#define INTMAX_C   INT64_C
+#define UINTMAX_C  UINT64_C
+
+#endif // __STDC_CONSTANT_MACROS ]
+
+
+#endif // _MSC_STDINT_H_ ]

Modified: zookeeper/trunk/src/c/include/zookeeper.h
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/include/zookeeper.h?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/include/zookeeper.h (original)
+++ zookeeper/trunk/src/c/include/zookeeper.h Tue Jul 19 00:59:10 2011
@@ -20,8 +20,12 @@
 #define ZOOKEEPER_H_
 
 #include <stdlib.h>
+#ifndef WIN32
 #include <sys/socket.h>
 #include <sys/time.h>
+#else
+#include "winconfig.h"
+#endif
 #include <stdio.h>
 #include <ctype.h>
 
@@ -64,7 +68,7 @@
 #ifdef DLL_EXPORT
 #    define ZOOAPI __declspec(dllexport)
 #else
-#  if defined(__CYGWIN__) && !defined(USE_STATIC_LIB)
+#  if (defined(__CYGWIN__) || defined(WIN32)) && !defined(USE_STATIC_LIB)
 #    define ZOOAPI __declspec(dllimport)
 #  else
 #    define ZOOAPI
@@ -526,8 +530,13 @@ ZOOAPI struct sockaddr* zookeeper_get_co
  * timeout value specified in zookeeper_init()
  * ZSYSTEMERROR -- a system (OS) error occured; it's worth checking errno to get details
  */
+#ifdef WIN32
+ZOOAPI int zookeeper_interest(zhandle_t *zh, SOCKET *fd, int *interest, 
+	struct timeval *tv);
+#else
 ZOOAPI int zookeeper_interest(zhandle_t *zh, int *fd, int *interest, 
 	struct timeval *tv);
+#endif
 
 /**
  * \brief Notifies zookeeper that an event of interest has happened.

Modified: zookeeper/trunk/src/c/src/cli.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/cli.c?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/cli.c (original)
+++ zookeeper/trunk/src/c/src/cli.c Tue Jul 19 00:59:10 2011
@@ -21,9 +21,19 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
+
+#ifndef WIN32
+#include <sys/time.h>
 #include <unistd.h>
 #include <sys/select.h>
-#include <sys/time.h>
+#else
+#include "winport.h"
+//#include <io.h> <-- can't include, conflicting definitions of close()
+int read(int _FileHandle, void * _DstBuf, unsigned int _MaxCharCount);
+int write(int _Filehandle, const void * _Buf, unsigned int _MaxCharCount);
+#define ctime_r(tctime, buffer) ctime_s (buffer, 40, tctime)
+#endif
+
 #include <time.h>
 #include <errno.h>
 #include <assert.h>
@@ -132,11 +142,15 @@ void dumpStat(const struct Stat *stat) {
     }
     tctime = stat->ctime/1000;
     tmtime = stat->mtime/1000;
+       
+    ctime_r(&tmtime, tmtimes);
+    ctime_r(&tctime, tctimes);
+       
     fprintf(stderr, "\tctime = %s\tczxid=%llx\n"
     "\tmtime=%s\tmzxid=%llx\n"
     "\tversion=%x\taversion=%x\n"
     "\tephemeralOwner = %llx\n",
-    ctime_r(&tctime, tctimes), _LL_CAST_ stat->czxid, ctime_r(&tmtime, tmtimes),
+     tctimes, _LL_CAST_ stat->czxid, tmtimes,
     _LL_CAST_ stat->mzxid,
     (unsigned int)stat->version, (unsigned int)stat->aversion,
     _LL_CAST_ stat->ephemeralOwner);
@@ -308,7 +322,7 @@ void processline(char *line) {
             fprintf(stderr, "Path must start with /, found: %s\n", line);
             return;
         }
-        gettimeofday(&startTime, 0);
+               
         rc = zoo_aget(zh, line, 1, my_data_completion, strdup(line));
         if (rc) {
             fprintf(stderr, "Error %d for %s\n", rc, line);

Modified: zookeeper/trunk/src/c/src/hashtable/hashtable.h
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/hashtable/hashtable.h?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/hashtable/hashtable.h (original)
+++ zookeeper/trunk/src/c/src/hashtable/hashtable.h Tue Jul 19 00:59:10 2011
@@ -2,7 +2,9 @@
 
 #ifndef __HASHTABLE_CWC22_H__
 #define __HASHTABLE_CWC22_H__
-
+#ifdef WIN32
+#include "winconfig.h"
+#endif
 #ifdef __cplusplus
 extern "C" {
 #endif

Modified: zookeeper/trunk/src/c/src/hashtable/hashtable_itr.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/hashtable/hashtable_itr.c?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/hashtable/hashtable_itr.c (original)
+++ zookeeper/trunk/src/c/src/hashtable/hashtable_itr.c Tue Jul 19 00:59:10 2011
@@ -35,18 +35,6 @@ hashtable_iterator(struct hashtable *h)
 }
 
 /*****************************************************************************/
-/* key      - return the key of the (key,value) pair at the current position */
-/* value    - return the value of the (key,value) pair at the current position */
-
-void *
-hashtable_iterator_key(struct hashtable_itr *i)
-{ return i->e->k; }
-
-void *
-hashtable_iterator_value(struct hashtable_itr *i)
-{ return i->e->v; }
-
-/*****************************************************************************/
 /* advance - advance the iterator to the next element
  *           returns zero if advanced to end of table */
 

Modified: zookeeper/trunk/src/c/src/load_gen.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/load_gen.c?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/load_gen.c (original)
+++ zookeeper/trunk/src/c/src/load_gen.c Tue Jul 19 00:59:10 2011
@@ -19,7 +19,13 @@
 #include <zookeeper.h>
 #include "zookeeper_log.h"
 #include <errno.h>
+#ifndef WIN32
+#ifdef THREADED 
 #include <pthread.h>
+#endif
+#else
+#include "win32port.h"
+#endif
 #include <string.h>
 #include <stdlib.h>
 

Modified: zookeeper/trunk/src/c/src/mt_adaptor.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/mt_adaptor.c?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/mt_adaptor.c (original)
+++ zookeeper/trunk/src/c/src/mt_adaptor.c Tue Jul 19 00:59:10 2011
@@ -33,13 +33,16 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <time.h>
-#include <sys/time.h>
-#include <signal.h>
-#include <poll.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <assert.h>
+#include <errno.h>
+
+#ifndef WIN32
+#include <signal.h>
+#include <poll.h>
 #include <unistd.h>
+#include <sys/time.h>
+#endif
 
 void zoo_lock_auth(zhandle_t *zh)
 {
@@ -107,15 +110,81 @@ int process_async(int outstanding_sync)
     return 0;
 }
 
+#ifdef WIN32
+unsigned __stdcall do_io( void * );
+unsigned __stdcall do_completion( void * );
+
+int handle_error(SOCKET sock, char* message)
+{
+       LOG_ERROR(("%s. %d",message, WSAGetLastError()));
+       closesocket (sock);
+       return -1;
+}
+
+//--create socket pair for interupting selects.
+int create_socket_pair(SOCKET fds[2]) 
+{ 
+    struct sockaddr_in inaddr; 
+    struct sockaddr addr; 
+    int yes=1; 
+    int len=0;
+       
+    SOCKET lst=socket(AF_INET, SOCK_STREAM,IPPROTO_TCP); 
+    if (lst ==  INVALID_SOCKET ){
+       LOG_ERROR(("Error creating socket. %d",WSAGetLastError()));
+       return -1;
+    }
+    memset(&inaddr, 0, sizeof(inaddr)); 
+    memset(&addr, 0, sizeof(addr)); 
+    inaddr.sin_family = AF_INET; 
+    inaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); 
+    inaddr.sin_port = 0; //--system assigns the port
+
+    if ( setsockopt(lst,SOL_SOCKET,SO_REUSEADDR,(char*)&yes,sizeof(yes)) == SOCKET_ERROR  ) {
+       return handle_error(lst,"Error trying to set socket option.");          
+    }  
+    if (bind(lst,(struct sockaddr *)&inaddr,sizeof(inaddr)) == SOCKET_ERROR){
+       return handle_error(lst,"Error trying to bind socket.");                
+    }
+    if (listen(lst,1) == SOCKET_ERROR){
+       return handle_error(lst,"Error trying to listen on socket.");
+    }
+    len=sizeof(inaddr); 
+    getsockname(lst, &addr,&len); 
+    fds[0]=socket(AF_INET, SOCK_STREAM,0); 
+    if (connect(fds[0],&addr,len) == SOCKET_ERROR){
+       return handle_error(lst, "Error while connecting to socket.");
+    }
+    if ((fds[1]=accept(lst,0,0)) == INVALID_SOCKET){
+       closesocket(fds[0]);
+       return handle_error(lst, "Error while accepting socket connection.");
+    }
+    closesocket(lst);  
+    return 0;
+} 
+#else
 void *do_io(void *);
 void *do_completion(void *);
+#endif
+
+
 int wakeup_io_thread(zhandle_t *zh);
 
+#ifdef WIN32
+static int set_nonblock(SOCKET fd){
+    ULONG nonblocking_flag = 1;
+    if (ioctlsocket(fd, FIONBIO, &nonblocking_flag) == 0)
+        return 1;
+    else 
+        return -1;
+}
+#else
 static int set_nonblock(int fd){
     long l = fcntl(fd, F_GETFL);
     if(l & O_NONBLOCK) return 0;
     return fcntl(fd, F_SETFL, l | O_NONBLOCK);
 }
+#endif
 
 void wait_for_others(zhandle_t* zh)
 {
@@ -167,9 +236,14 @@ int adaptor_init(zhandle_t *zh)
         return -1;
     }
 
-    /* We use a pipe for interrupting select() */
+    /* We use a pipe for interrupting select() in unix/sol and socketpair in windows. */
+#ifdef WIN32   
+    if (create_socket_pair(adaptor_threads->self_pipe) == -1){
+       LOG_ERROR(("Can't make a socket."));
+#else
     if(pipe(adaptor_threads->self_pipe)==-1) {
         LOG_ERROR(("Can't make a pipe %d",errno));
+#endif
         free(adaptor_threads);
         return -1;
     }
@@ -250,7 +324,11 @@ int wakeup_io_thread(zhandle_t *zh)
 {
     struct adaptor_threads *adaptor_threads = zh->adaptor_priv;
     char c=0;
+#ifndef WIN32
     return write(adaptor_threads->self_pipe[1],&c,1)==1? ZOK: ZSYSTEMERROR;    
+#else
+    return send(adaptor_threads->self_pipe[1], &c, 1, 0)==1? ZOK: ZSYSTEMERROR;    
+#endif         
 }
 
 int adaptor_send_queue(zhandle_t *zh, int timeout)
@@ -264,13 +342,23 @@ int adaptor_send_queue(zhandle_t *zh, in
 
 /* These two are declared here because we will run the event loop
  * and not the client */
+#ifdef WIN32
+int zookeeper_interest(zhandle_t *zh, SOCKET *fd, int *interest,
+        struct timeval *tv);
+#else
 int zookeeper_interest(zhandle_t *zh, int *fd, int *interest,
         struct timeval *tv);
+#endif
 int zookeeper_process(zhandle_t *zh, int events);
 
+#ifdef WIN32
+unsigned __stdcall do_io( void * v)
+#else
 void *do_io(void *v)
+#endif
 {
     zhandle_t *zh = (zhandle_t*)v;
+#ifndef WIN32
     struct pollfd fds[2];
     struct adaptor_threads *adaptor_threads = zh->adaptor_priv;
 
@@ -305,7 +393,48 @@ void *do_io(void *v)
             // flush the pipe
             char b[128];
             while(read(adaptor_threads->self_pipe[0],b,sizeof(b))==sizeof(b)){}
+        }        
+#else
+    fd_set rfds, wfds, efds;
+    struct adaptor_threads *adaptor_threads = zh->adaptor_priv;
+    api_prolog(zh);
+    notify_thread_ready(zh);
+    LOG_DEBUG(("started IO thread"));
+    FD_ZERO(&rfds);   FD_ZERO(&wfds);    FD_ZERO(&efds);
+    while(!zh->close_requested) {      
+        struct timeval tv;
+        SOCKET fd;
+        SOCKET maxfd=adaptor_threads->self_pipe[0];
+        int interest;        
+        int rc;
+               
+       zookeeper_interest(zh, &fd, &interest, &tv);
+       if (fd != -1) {
+           if (interest&ZOOKEEPER_READ) {
+                FD_SET(fd, &rfds);
+            } else {
+                FD_CLR(fd, &rfds);
+            }
+           if (interest&ZOOKEEPER_WRITE) {
+                FD_SET(fd, &wfds);
+            } else {
+                FD_CLR(fd, &wfds);
+            }                  
+        }
+       FD_SET( adaptor_threads->self_pipe[0] ,&rfds );        
+       rc = select((int)maxfd, &rfds, &wfds, &efds, &tv);
+       if (fd != -1) 
+       {
+           interest = (FD_ISSET(fd, &rfds))? ZOOKEEPER_READ:0;
+           interest|= (FD_ISSET(fd, &wfds))? ZOOKEEPER_WRITE:0;
         }
+               
+       if (FD_ISSET(adaptor_threads->self_pipe[0], &rfds)){
+            // flush the pipe/socket
+            char b[128];
+           while(recv(adaptor_threads->self_pipe[0],b,sizeof(b), 0)==sizeof(b)){}
+       }
+#endif
         // dispatch zookeeper events
         rc = zookeeper_process(zh, interest);
         // check the current state of the zhandle and terminate 
@@ -318,7 +447,11 @@ void *do_io(void *v)
     return 0;
 }
 
+#ifdef WIN32
+unsigned __stdcall do_completion( void * v)
+#else
 void *do_completion(void *v)
+#endif
 {
     zhandle_t *zh = v;
     api_prolog(zh);
@@ -349,6 +482,7 @@ int32_t inc_ref_counter(zhandle_t* zh,in
 
 int32_t fetch_and_add(volatile int32_t* operand, int incr)
 {
+#ifndef WIN32
     int32_t result;
     asm __volatile__(
          "lock xaddl %0,%1\n"
@@ -356,6 +490,19 @@ int32_t fetch_and_add(volatile int32_t* 
          : "0"(incr)
          : "memory");
    return result;
+#else
+    volatile int32_t result;
+    _asm
+    {
+        mov eax, operand; //eax = v;
+       mov ebx, incr; // ebx = i;
+        mov ecx, 0x0; // ecx = 0;
+        lock xadd dword ptr [eax], ecx; 
+       lock xadd dword ptr [eax], ebx; 
+        mov result, ecx; // result = ebx;        
+     }
+     return result;    
+#endif
 }
 
 // make sure the static xid is initialized before any threads started

Modified: zookeeper/trunk/src/c/src/recordio.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/recordio.c?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/recordio.c (original)
+++ zookeeper/trunk/src/c/src/recordio.c Tue Jul 19 00:59:10 2011
@@ -21,7 +21,9 @@
 #include <stdio.h>
 #include <errno.h>
 #include <stdlib.h>
+#ifndef WIN32
 #include <netinet/in.h>
+#endif
 
 void deallocate_String(char **s)
 {
@@ -276,21 +278,21 @@ int ia_deserialize_string(struct iarchiv
     return 0;
 }
 
-static struct iarchive ia_default = { .start_record = ia_start_record,
-        .end_record = ia_end_record, .start_vector = ia_start_vector,
-        .end_vector = ia_end_vector, .deserialize_Bool = ia_deserialize_bool,
-        .deserialize_Int = ia_deserialize_int,
-        .deserialize_Buffer = ia_deserialize_buffer,
-        .deserialize_String = ia_deserialize_string,
-        .deserialize_Long = ia_deserialize_long };
-
-static struct oarchive oa_default = { .start_record = oa_start_record,
-        .end_record = oa_end_record, .start_vector = oa_start_vector,
-        .end_vector = oa_end_vector, .serialize_Bool = oa_serialize_bool,
-        .serialize_Int = oa_serialize_int,
-        .serialize_Buffer = oa_serialize_buffer,
-        .serialize_String = oa_serialize_string,
-        .serialize_Long = oa_serialize_long };
+static struct iarchive ia_default = { STRUCT_INITIALIZER (start_record ,ia_start_record),
+        STRUCT_INITIALIZER (end_record ,ia_end_record), STRUCT_INITIALIZER (start_vector , ia_start_vector),
+        STRUCT_INITIALIZER (end_vector ,ia_end_vector), STRUCT_INITIALIZER (deserialize_Bool , ia_deserialize_bool),
+        STRUCT_INITIALIZER (deserialize_Int ,ia_deserialize_int),
+        STRUCT_INITIALIZER (deserialize_Long , ia_deserialize_long) ,
+        STRUCT_INITIALIZER (deserialize_Buffer, ia_deserialize_buffer),
+        STRUCT_INITIALIZER (deserialize_String, ia_deserialize_string)   };
+
+static struct oarchive oa_default = { STRUCT_INITIALIZER (start_record , oa_start_record),
+        STRUCT_INITIALIZER (end_record , oa_end_record), STRUCT_INITIALIZER (start_vector , oa_start_vector),
+        STRUCT_INITIALIZER (end_vector , oa_end_vector), STRUCT_INITIALIZER (serialize_Bool , oa_serialize_bool),
+        STRUCT_INITIALIZER (serialize_Int , oa_serialize_int),
+        STRUCT_INITIALIZER (serialize_Long , oa_serialize_long) ,
+        STRUCT_INITIALIZER (serialize_Buffer , oa_serialize_buffer),
+        STRUCT_INITIALIZER (serialize_String , oa_serialize_string) };
 
 struct iarchive *create_buffer_iarchive(char *buffer, int len)
 {

Added: zookeeper/trunk/src/c/src/winport.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/winport.c?rev=1148116&view=auto
==============================================================================
--- zookeeper/trunk/src/c/src/winport.c (added)
+++ zookeeper/trunk/src/c/src/winport.c Tue Jul 19 00:59:10 2011
@@ -0,0 +1,291 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifdef WIN32
+#include "winport.h"
+#include <winsock2.h>
+#include <ws2tcpip.h>
+
+int pthread_mutex_lock(pthread_mutex_t* _mutex ){      
+       int rc = WaitForSingleObject( *_mutex,    // handle to mutex
+            INFINITE);  // no time-out interval
+       return ((rc == WAIT_OBJECT_0) ? 0: rc); 
+}
+
+int pthread_mutex_unlock( pthread_mutex_t* _mutex ){   
+       int rc = ReleaseMutex(*_mutex);
+       return ((rc != 0)? 0: GetLastError());  
+}
+
+int pthread_mutex_init(pthread_mutex_t* _mutex, void* ignoredAttr){
+       //use CreateMutex as we are using the HANDLES in pthread_cond
+       *_mutex = CreateMutex( 
+        NULL,              // default security attributes
+        FALSE,             // initially not owned
+        NULL);             // unnamed mutex    
+       return ((*_mutex == NULL) ? GetLastError() : 0);
+}
+
+int pthread_mutex_destroy(pthread_mutex_t* _mutex)
+{
+       int rc = CloseHandle(*_mutex);
+       return ((rc != 0)? 0: GetLastError());  
+}
+
+int pthread_create(pthread_t *thread, const pthread_attr_t *attr, unsigned  (__stdcall* start_routine)(void* a), void *arg)
+{
+   int _intThreadId; 
+   (*thread).thread_handle = (HANDLE)_beginthreadex( NULL, 0, start_routine , arg, 0, (unsigned int*)&_intThreadId );
+   (*thread).thread_id = _intThreadId;
+   return (((*thread).thread_handle == 0 ) ? errno : 0 );         
+}
+
+
+int pthread_equal(pthread_t t1, pthread_t t2){
+//Is there a better way to do this? GetThreadId(handle) is only supported Windows 2003 n above.
+       return ((t1.thread_id == t2.thread_id) ? 1:0);              
+}
+
+pthread_t pthread_self(){
+    pthread_t thread_self;
+    thread_self.thread_handle = GetCurrentThread();
+    thread_self.thread_id     = GetCurrentThreadId();
+    return thread_self;
+}
+
+int pthread_join(pthread_t _thread, void** ignore)
+{
+       int rc = WaitForSingleObject( _thread.thread_handle, INFINITE );
+       return ((rc == WAIT_OBJECT_0) ? 0: rc); 
+}
+
+int pthread_detach(pthread_t _thread)
+{
+       int rc = CloseHandle(_thread.thread_handle) ;
+       return  (rc != 0) ? 0: GetLastError();
+}
+
+void pthread_mutexattr_init(pthread_mutexattr_t* ignore){}
+void pthread_mutexattr_settype(pthread_mutexattr_t* ingore_attr, int ignore){}
+void pthread_mutexattr_destroy(pthread_mutexattr_t* ignore_attr){}
+       
+int 
+pthread_cond_init (pthread_cond_t *cv,
+                   const pthread_condattr_t * ignore)
+{
+  cv->waiters_count_ = 0;
+  cv->was_broadcast_ = 0;
+  cv->sema_ = CreateSemaphore (NULL,       // no security
+                                0,          // initially 0
+                                0x7fffffff, // max count
+                                NULL);      // unnamed 
+  if (cv->sema_ == NULL ) 
+               return GetLastError();
+  InitializeCriticalSection (&cv->waiters_count_lock_);
+  cv->waiters_done_ = CreateEvent (NULL,  // no security
+                                   FALSE, // auto-reset
+                                   FALSE, // non-signaled initially
+                                   NULL); // unnamed
+  return (cv->waiters_done_ == NULL) ? GetLastError() : 0;
+       
+}
+
+
+int pthread_cond_destroy(pthread_cond_t *cond)
+{
+       CloseHandle( cond->sema_);
+       return (CloseHandle( cond->waiters_done_ ) == 0)? GetLastError(): 0 ;
+}
+
+
+int
+pthread_cond_signal (pthread_cond_t *cv)
+{
+  int have_waiters;
+  EnterCriticalSection (& (cv->waiters_count_lock_));
+  have_waiters = cv->waiters_count_ > 0;
+  LeaveCriticalSection (&cv->waiters_count_lock_);
+
+  // If there aren't any waiters, then this is a no-op.  
+  if (have_waiters){
+         return (ReleaseSemaphore (cv->sema_, 1, 0) == 0 )  ? GetLastError() : 0 ;
+  }else
+         return 0;
+}
+
+
+int
+pthread_cond_broadcast (pthread_cond_t *cv)
+{
+  // This is needed to ensure that <waiters_count_> and <was_broadcast_> are
+  // consistent relative to each other.
+  int have_waiters = 0;
+  EnterCriticalSection (&cv->waiters_count_lock_);
+  
+  if (cv->waiters_count_ > 0) {
+    // We are broadcasting, even if there is just one waiter...
+    // Record that we are broadcasting, which helps optimize
+    // <pthread_cond_wait> for the non-broadcast case.
+    cv->was_broadcast_ = 1;
+    have_waiters = 1;
+  }
+
+  if (have_waiters) {
+    // Wake up all the waiters atomically.
+    ReleaseSemaphore (cv->sema_, cv->waiters_count_, 0);
+
+    LeaveCriticalSection (&cv->waiters_count_lock_);
+
+    // Wait for all the awakened threads to acquire the counting
+    // semaphore. 
+    WaitForSingleObject (cv->waiters_done_, INFINITE);
+    // This assignment is okay, even without the <waiters_count_lock_> held 
+    // because no other waiter threads can wake up to access it.
+    cv->was_broadcast_ = 0;
+  }
+  else
+    LeaveCriticalSection (&cv->waiters_count_lock_);
+}
+
+
+int
+pthread_cond_wait (pthread_cond_t *cv, 
+                   pthread_mutex_t *external_mutex)
+{
+  int last_waiter;
+  // Avoid race conditions.
+  EnterCriticalSection (&cv->waiters_count_lock_);
+  cv->waiters_count_++;
+  LeaveCriticalSection (&cv->waiters_count_lock_);
+
+  // This call atomically releases the mutex and waits on the
+  // semaphore until <pthread_cond_signal> or <pthread_cond_broadcast>
+  // are called by another thread.
+  SignalObjectAndWait (*external_mutex, cv->sema_, INFINITE, FALSE);
+
+  // Reacquire lock to avoid race conditions.
+  EnterCriticalSection (&cv->waiters_count_lock_);
+
+  // We're no longer waiting...
+  cv->waiters_count_--;
+
+  // Check to see if we're the last waiter after <pthread_cond_broadcast>.
+  last_waiter = cv->was_broadcast_ && cv->waiters_count_ == 0;
+
+  LeaveCriticalSection (&cv->waiters_count_lock_);
+
+  // If we're the last waiter thread during this particular broadcast
+  // then let all the other threads proceed.
+  if (last_waiter)
+    // This call atomically signals the <waiters_done_> event and waits until
+    // it can acquire the <external_mutex>.  This is required to ensure fairness. 
+    SignalObjectAndWait (cv->waiters_done_, *external_mutex, INFINITE, FALSE);
+  else
+    // Always regain the external mutex since that's the guarantee we
+    // give to our callers. 
+    WaitForSingleObject (*external_mutex, INFINITE);
+}
+
+int pthread_key_create(pthread_key_t *key, void (*destructor)(void *) )
+{
+  int result = 0;
+  pthread_key_t* newkey;
+
+  if ((newkey = (pthread_key_t*) calloc (1, sizeof (pthread_key_t))) == NULL)
+    {
+      result = ENOMEM;
+    }
+  else if ((newkey->key = TlsAlloc ()) == TLS_OUT_OF_INDEXES)
+    {
+      result = EAGAIN;
+      free (newkey);
+      newkey = NULL;
+    }
+  else if (destructor != NULL)
+    {
+      //--we have to store the function pointer for destructor, so that we can call it 
+         //--to free up the user allocated storage--       
+      newkey->destructor = destructor;
+    }
+  key = newkey;  
+  return (result);     
+}
+
+int pthread_key_delete(pthread_key_t key)
+{
+  int rc = 0;
+  LPVOID lpvData =  TlsGetValue(key.key);
+  rc = TlsFree (key.key);
+  rc = (rc != 0 ) ? 0 : GetLastError();
+  if (key.destructor != NULL && lpvData != 0){
+       key.destructor(lpvData);         //we take control of calling destructor, instead of calling it on thread exit.
+  }
+  free (&key);
+  return (rc);
+}
+
+void *pthread_getspecific(pthread_key_t key)
+{
+       LPVOID lpvData =  TlsGetValue(key.key);
+       if ((lpvData == 0) && (GetLastError() != ERROR_SUCCESS)) 
+               return NULL;
+       else 
+               return lpvData;
+}
+
+int pthread_setspecific(pthread_key_t key, const void *value)
+{
+       int rc = TlsSetValue (key.key, value);
+       return ((rc != 0 ) ? 0 : GetLastError());
+}
+
+
+int close(SOCKET fd) {
+        return closesocket(fd);
+}
+
+int Win32WSAStartup()
+{
+       WORD    wVersionRq;
+       WSADATA wsaData;
+       int             err;
+
+       wVersionRq = MAKEWORD(2,0);
+       err = WSAStartup(wVersionRq, &wsaData);
+       if (err != 0)
+               return 1;
+       
+       // confirm the version information
+       if ((LOBYTE(wsaData.wVersion) != 2) ||
+           (HIBYTE(wsaData.wVersion) != 0))
+       {
+               Win32WSACleanup();              
+               return 1;
+       }
+       return 0;
+}
+
+void Win32WSACleanup()
+{
+       WSACleanup();
+}
+
+#endif //WIN32
+
+
+

Added: zookeeper/trunk/src/c/src/winport.h
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/winport.h?rev=1148116&view=auto
==============================================================================
--- zookeeper/trunk/src/c/src/winport.h (added)
+++ zookeeper/trunk/src/c/src/winport.h Tue Jul 19 00:59:10 2011
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This header file is to port pthread lib , sockets and other utility methods on windows.
+ * Specifically the threads function, mutexes, keys, and socket initialization.
+ */
+
+#ifndef WINPORT_H_
+#define WINPORT_H_
+
+#ifdef WIN32
+#include <winconfig.h>
+#include <errno.h>
+#include <process.h>
+#include <stdlib.h>
+#include <malloc.h>
+
+
+typedef int ssize_t;
+typedef HANDLE pthread_mutex_t;
+
+struct pthread_t_
+{
+  HANDLE thread_handle;
+  DWORD  thread_id;
+};
+
+typedef struct pthread_t_ pthread_t;
+typedef int pthread_mutexattr_t;       
+typedef int pthread_condattr_t;        
+typedef int pthread_attr_t; 
+#define PTHREAD_MUTEX_RECURSIVE 0
+
+int pthread_mutex_lock(pthread_mutex_t* _mutex );
+int pthread_mutex_unlock( pthread_mutex_t* _mutex );
+int pthread_mutex_init(pthread_mutex_t* _mutex, void* ignoredAttr);
+int pthread_mutex_destroy(pthread_mutex_t* _mutex);
+int pthread_create(pthread_t *thread, const pthread_attr_t *attr, unsigned  (__stdcall* start_routine)(void* a), void *arg);
+int pthread_equal(pthread_t t1, pthread_t t2);
+pthread_t pthread_self();
+int pthread_join(pthread_t _thread, void** ignore);
+int pthread_detach(pthread_t _thread);
+
+void pthread_mutexattr_init(pthread_mutexattr_t* ignore);
+void pthread_mutexattr_settype(pthread_mutexattr_t* ingore_attr, int ignore);
+void pthread_mutexattr_destroy(pthread_mutexattr_t* ignore_attr);
+
+
+// http://www.cs.wustl.edu/~schmidt/win32-cv-1.html
+ 
+typedef struct 
+{
+       int waiters_count_;
+    // Number of waiting threads.
+
+    CRITICAL_SECTION waiters_count_lock_;
+    // Serialize access to <waiters_count_>.
+
+    HANDLE sema_;
+       // Semaphore used to queue up threads waiting for the condition to
+    // become signaled. 
+
+    HANDLE waiters_done_;
+    // An auto-reset event used by the broadcast/signal thread to wait
+    // for all the waiting thread(s) to wake up and be released from the
+    // semaphore. 
+
+    size_t was_broadcast_;
+    // Keeps track of whether we were broadcasting or signaling.  This
+    // allows us to optimize the code if we're just signaling.
+}pthread_cond_t;
+       
+int pthread_cond_init (pthread_cond_t *cv,const pthread_condattr_t * ignore);
+int pthread_cond_destroy(pthread_cond_t *cond);
+int pthread_cond_signal (pthread_cond_t *cv);
+int pthread_cond_broadcast (pthread_cond_t *cv);
+int pthread_cond_wait (pthread_cond_t *cv, pthread_mutex_t *external_mutex);
+
+
+struct pthread_key_t_
+{
+  DWORD key;
+  void (*destructor) (void *);  
+};
+
+typedef struct pthread_key_t_ pthread_key_t;
+int pthread_key_create(pthread_key_t *key, void (*destructor)(void *) );
+int pthread_key_delete(pthread_key_t key);
+void *pthread_getspecific(pthread_key_t key);
+int pthread_setspecific(pthread_key_t key, const void *value);
+
+inline int gettimeofday(struct timeval *tp, void *tzp) {
+        int64_t now = 0;
+        if (tzp != 0) { errno = EINVAL; return -1; }
+        GetSystemTimeAsFileTime( (LPFILETIME)&now );
+        tp->tv_sec = (long)(now / 10000000 - 11644473600LL);
+        tp->tv_usec = (now / 10) % 1000000;
+        return 0;
+}
+int close(SOCKET fd);
+int Win32WSAStartup();
+void Win32WSACleanup();
+#endif //WIN32
+
+
+
+#endif //WINPORT_H_

Modified: zookeeper/trunk/src/c/src/zk_adaptor.h
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/zk_adaptor.h?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/zk_adaptor.h (original)
+++ zookeeper/trunk/src/c/src/zk_adaptor.h Tue Jul 19 00:59:10 2011
@@ -20,7 +20,11 @@
 #define ZK_ADAPTOR_H_
 #include <zookeeper.jute.h>
 #ifdef THREADED
+#ifndef WIN32
 #include <pthread.h>
+#else
+#include "winport.h"
+#endif
 #endif
 #include "zookeeper.h"
 #include "zk_hashtable.h"
@@ -155,7 +159,11 @@ struct adaptor_threads {
      pthread_cond_t cond;       // barrier's conditional
      pthread_mutex_t lock;      // ... and a lock
      pthread_mutex_t zh_lock;   // critical section lock
+#ifdef WIN32
+     SOCKET self_pipe[2];
+#else
      int self_pipe[2];
+#endif
 };
 #endif
 
@@ -172,7 +180,11 @@ typedef struct _auth_list_head {
  */
 
 struct _zhandle {
+#ifdef WIN32
+    SOCKET fd; /* the descriptor used to talk to zookeeper */
+#else
     int fd; /* the descriptor used to talk to zookeeper */
+#endif
     char *hostname; /* the hostname of zookeeper */
     struct sockaddr_storage *addrs; /* the addresses that correspond to the hostname */
     int addrs_count; /* The number of addresses in the addrs array */

Modified: zookeeper/trunk/src/c/src/zk_hashtable.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/zk_hashtable.c?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/zk_hashtable.c (original)
+++ zookeeper/trunk/src/c/src/zk_hashtable.c Tue Jul 19 00:59:10 2011
@@ -68,8 +68,8 @@ static unsigned int string_hash_djb2(voi
 {
     unsigned int hash = 5381;
     int c;
-
-    while ((c = *(const char*)str++))
+    const char* cstr = (const char*)str;
+    while ((c = *cstr++))
         hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
 
     return hash;

Modified: zookeeper/trunk/src/c/src/zk_log.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/zk_log.c?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/zk_log.c (original)
+++ zookeeper/trunk/src/c/src/zk_log.c Tue Jul 19 00:59:10 2011
@@ -21,7 +21,10 @@
 #endif
 
 #include "zookeeper_log.h"
+#ifndef WIN32
 #include <unistd.h>
+#endif
+
 #include <stdarg.h>
 #include <time.h>
 
@@ -29,7 +32,11 @@
 #define FORMAT_LOG_BUF_SIZE 4096
 
 #ifdef THREADED
+#ifndef WIN32
 #include <pthread.h>
+#else 
+#include "winport.h"
+#endif
 
 static pthread_key_t time_now_buffer;
 static pthread_key_t format_log_msg_buffer;
@@ -89,15 +96,11 @@ void zoo_set_log_stream(FILE* stream){
     logStream=stream;
 }
 
-static const char* time_now(){
+static const char* time_now(char* now_str){
     struct timeval tv;
     struct tm lt;
     time_t now = 0;
     size_t len = 0;
-    char* now_str=get_time_buffer();
-    
-    if(!now_str)
-        return "time_now(): Failed to allocate memory buffer";
     
     gettimeofday(&tv,0);
 
@@ -108,7 +111,7 @@ static const char* time_now(){
     // specifically: "yyyy-MM-dd HH:mm:ss,SSS"
 
     len = strftime(now_str, TIME_NOW_BUF_SIZE,
-                          "%F %H:%M:%S",
+                          "%Y-%m-%d %H:%M:%S",
                           &lt);
 
     len += snprintf(now_str + len,
@@ -125,14 +128,23 @@ void log_message(ZooLogLevel curLevel,in
     static const char* dbgLevelStr[]={"ZOO_INVALID","ZOO_ERROR","ZOO_WARN",
             "ZOO_INFO","ZOO_DEBUG"};
     static pid_t pid=0;
+#ifdef WIN32
+    char timebuf [TIME_NOW_BUF_SIZE];
+#endif
     if(pid==0)pid=getpid();
 #ifndef THREADED
-    fprintf(LOGSTREAM, "%s:%d:%s@%s@%d: %s\n", time_now(),pid,
+    fprintf(LOGSTREAM, "%s:%d:%s@%s@%d: %s\n", time_now(get_time_buffer()),pid,
             dbgLevelStr[curLevel],funcName,line,message);
 #else
-    fprintf(LOGSTREAM, "%s:%d(0x%lx):%s@%s@%d: %s\n", time_now(),pid,
+#ifdef WIN32
+    fprintf(LOGSTREAM, "%s:%d(0x%lx):%s@%s@%d: %s\n", time_now(timebuf),pid,
+            (unsigned long int)(pthread_self().thread_id),
+            dbgLevelStr[curLevel],funcName,line,message);      
+#else
+    fprintf(LOGSTREAM, "%s:%d(0x%lx):%s@%s@%d: %s\n", time_now(get_time_buffer()),pid,
             (unsigned long int)pthread_self(),
-            dbgLevelStr[curLevel],funcName,line,message);
+            dbgLevelStr[curLevel],funcName,line,message);      
+#endif
 #endif
     fflush(LOGSTREAM);
 }

Modified: zookeeper/trunk/src/c/src/zookeeper.c
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/src/zookeeper.c?rev=1148116&r1=1148115&r2=1148116&view=diff
==============================================================================
--- zookeeper/trunk/src/c/src/zookeeper.c (original)
+++ zookeeper/trunk/src/c/src/zookeeper.c Tue Jul 19 00:59:10 2011
@@ -35,6 +35,13 @@
 #include <stdio.h>
 #include <string.h>
 #include <time.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <assert.h>
+#include <stdarg.h>
+#include <limits.h>
+
+#ifndef WIN32
 #include <sys/time.h>
 #include <sys/socket.h>
 #include <poll.h>
@@ -42,14 +49,9 @@
 #include <netinet/tcp.h>
 #include <arpa/inet.h>
 #include <netdb.h>
-#include <errno.h>
 #include <unistd.h>
-#include <fcntl.h>
-#include <assert.h>
-#include <stdarg.h>
-#include <limits.h>
-
 #include "config.h"
+#endif
 
 #ifdef HAVE_SYS_UTSNAME_H
 #include <sys/utsname.h>
@@ -403,6 +405,7 @@ static void destroy(zhandle_t *zh)
 
 static void setup_random()
 {
+#ifndef WIN32          // TODO: better seed
     int seed;
     int fd = open("/dev/urandom", O_RDONLY);
     if (fd == -1) {
@@ -413,6 +416,7 @@ static void setup_random()
         close(fd);
     }
     srandom(seed);
+#endif
 }
 
 #ifndef __CYGWIN__
@@ -425,7 +429,9 @@ static void setup_random()
 static int getaddrinfo_errno(int rc) { 
     switch(rc) {
     case EAI_NONAME:
+#if EAI_NODATA != EAI_NONAME
     case EAI_NODATA:
+#endif
         return ENOENT;
     case EAI_MEMORY:
         return ENOMEM;
@@ -568,7 +574,11 @@ int getaddrs(zhandle_t *zh)
 #endif
             if (rc != 0) {
                 errno = getaddrinfo_errno(rc);
+#ifdef WIN32
+                LOG_ERROR(("Win32 message: %s\n", gai_strerror(rc)));
+#else
                 LOG_ERROR(("getaddrinfo: %s\n", strerror(errno)));
+#endif
                 rc=ZSYSTEMERROR;
                 goto fail;
             }
@@ -739,7 +749,12 @@ zhandle_t *zookeeper_init(const char *ho
     char *index_chroot = NULL;
 
     log_env();
-
+#ifdef WIN32
+       if (Win32WSAStartup()){
+               LOG_ERROR(("Error initializing ws2_32.dll"));
+               return 0;
+       }
+#endif
     LOG_INFO(("Initiating client connection, host=%s sessionTimeout=%d watcher=%p"
           " sessionId=%#llx sessionPasswd=%s context=%p flags=%d",
               host,
@@ -983,7 +998,11 @@ static __attribute__ ((unused)) int get_
  * 0 if send would block while sending the buffer (or a send was incomplete),
  * 1 if success
  */
+#ifdef WIN32
+static int send_buffer(SOCKET fd, buffer_list_t *buff)
+#else
 static int send_buffer(int fd, buffer_list_t *buff)
+#endif
 {
     int len = buff->len;
     int off = buff->curr_offset;
@@ -995,7 +1014,11 @@ static int send_buffer(int fd, buffer_li
         char *b = (char*)&nlen;
         rc = send(fd, b + off, sizeof(nlen) - off, 0);
         if (rc == -1) {
+#ifndef _WINDOWS
             if (errno != EAGAIN) {
+#else            
+            if (WSAGetLastError() != WSAEWOULDBLOCK) {
+#endif            
                 return -1;
             } else {
                 return 0;
@@ -1010,7 +1033,11 @@ static int send_buffer(int fd, buffer_li
         off -= sizeof(buff->len);
         rc = send(fd, buff->buffer + off, len - off, 0);
         if (rc == -1) {
+#ifndef _WINDOWS
             if (errno != EAGAIN) {
+#else            
+            if (WSAGetLastError() != WSAEWOULDBLOCK) {
+#endif            
                 return -1;
             }
         } else {
@@ -1025,7 +1052,11 @@ static int send_buffer(int fd, buffer_li
  * 0 if recv would block,
  * 1 if success
  */
+#ifdef WIN32
+static int recv_buffer(SOCKET fd, buffer_list_t *buff)
+#else
 static int recv_buffer(int fd, buffer_list_t *buff)
+#endif
 {
     int off = buff->curr_offset;
     int rc = 0;
@@ -1040,7 +1071,11 @@ static int recv_buffer(int fd, buffer_li
         case 0:
             errno = EHOSTDOWN;
         case -1:
+#ifndef _WINDOWS
             if (errno == EAGAIN) {
+#else
+            if (WSAGetLastError() == WSAEWOULDBLOCK) {
+#endif
                 return 0;
             }
             return -1;
@@ -1062,7 +1097,11 @@ static int recv_buffer(int fd, buffer_li
         case 0:
             errno = EHOSTDOWN;
         case -1:
+#ifndef _WINDOWS
             if (errno == EAGAIN) {
+#else
+            if (WSAGetLastError() == WSAEWOULDBLOCK) {
+#endif
                 break;
             }
             return -1;
@@ -1236,7 +1275,7 @@ static void auth_completion_func(int rc,
 
 static int send_info_packet(zhandle_t *zh, auth_info* auth) {
     struct oarchive *oa;
-    struct RequestHeader h = { .xid = AUTH_XID, .type = ZOO_SETAUTH_OP};
+    struct RequestHeader h = { STRUCT_INITIALIZER(xid , AUTH_XID), STRUCT_INITIALIZER(type , ZOO_SETAUTH_OP)};
     struct AuthPacket req;
     int rc;
     oa = create_buffer_oarchive();
@@ -1304,7 +1343,7 @@ static void free_key_list(char **list, i
 static int send_set_watches(zhandle_t *zh)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { .xid = SET_WATCHES_XID, .type = ZOO_SETWATCHES_OP};
+    struct RequestHeader h = { STRUCT_INITIALIZER(xid , SET_WATCHES_XID), STRUCT_INITIALIZER(type , ZOO_SETWATCHES_OP)};
     struct SetWatches req;
     int rc;
 
@@ -1458,7 +1497,7 @@ static struct timeval get_timeval(int in
  {
     int rc;
     struct oarchive *oa = create_buffer_oarchive();
-    struct RequestHeader h = { .xid = PING_XID, .type = ZOO_PING_OP };
+    struct RequestHeader h = { STRUCT_INITIALIZER(xid ,PING_XID), STRUCT_INITIALIZER (type , ZOO_PING_OP) };
 
     rc = serialize_RequestHeader(oa, "header", &h);
     enter_critical(zh);
@@ -1471,9 +1510,17 @@ static struct timeval get_timeval(int in
     return rc<0 ? rc : adaptor_send_queue(zh, 0);
 }
 
- int zookeeper_interest(zhandle_t *zh, int *fd, int *interest,
+#ifdef WIN32
+int zookeeper_interest(zhandle_t *zh, SOCKET *fd, int *interest,
+     struct timeval *tv)
+{
+
+    ULONG nonblocking_flag = 1;
+#else
+int zookeeper_interest(zhandle_t *zh, int *fd, int *interest,
      struct timeval *tv)
 {
+#endif
     struct timeval now;
     if(zh==0 || fd==0 ||interest==0 || tv==0)
         return ZBADARGUMENTS;
@@ -1496,23 +1543,31 @@ static struct timeval get_timeval(int in
             zh->connect_index = 0;
         }else {
             int rc;
-            int on = 1;
+            char on = 1;
 
             zh->fd = socket(zh->addrs[zh->connect_index].ss_family, SOCK_STREAM, 0);
             if (zh->fd < 0) {
                 return api_epilog(zh,handle_socket_error_msg(zh,__LINE__,
                                                              ZSYSTEMERROR, "socket() call failed"));
             }
-            setsockopt(zh->fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(int));
+            setsockopt(zh->fd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(char));
+#ifdef WIN32
+            ioctlsocket(zh->fd, FIONBIO, &nonblocking_flag);                    
+#else
             fcntl(zh->fd, F_SETFL, O_NONBLOCK|fcntl(zh->fd, F_GETFL, 0));
+#endif
 #if defined(AF_INET6)
             if (zh->addrs[zh->connect_index].ss_family == AF_INET6) {
                 rc = connect(zh->fd, (struct sockaddr*) &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in6));
             } else {
 #else
+               LOG_DEBUG(("[zk] connect()\n"));
             {
 #endif
                 rc = connect(zh->fd, (struct sockaddr*) &zh->addrs[zh->connect_index], sizeof(struct sockaddr_in));
+#ifdef WIN32
+                get_errno();
+#endif
             }
             if (rc == -1) {
                 /* we are handling the non-blocking connect according to
@@ -1545,7 +1600,11 @@ static struct timeval get_timeval(int in
         // have we exceeded the receive timeout threshold?
         if (recv_to <= 0) {
             // We gotta cut our losses and connect to someone else
+#ifdef WIN32
+            errno = WSAETIMEDOUT;
+#else
             errno = ETIMEDOUT;
+#endif
             *fd=-1;
             *interest=0;
             *tv = get_timeval(0);
@@ -1864,8 +1923,8 @@ static int deserialize_multi(int xid, co
 {
     int rc = 0;
     completion_head_t *clist = &cptr->c.clist;
+    struct MultiHeader mhdr = { STRUCT_INITIALIZER(type , 0), STRUCT_INITIALIZER(done , 0), STRUCT_INITIALIZER(err , 0) };
     assert(clist);
-    struct MultiHeader mhdr = { 0 };
     deserialize_MultiHeader(ia, "multiheader", &mhdr);
     while (!mhdr.done) {
         completion_list_t *entry = dequeue_completion(clist);
@@ -2020,13 +2079,25 @@ void process_completions(zhandle_t *zh)
 
 static void isSocketReadable(zhandle_t* zh)
 {
+#ifndef WIN32
     struct pollfd fds;
     fds.fd = zh->fd;
     fds.events = POLLIN;
     if (poll(&fds,1,0)<=0) {
         // socket not readable -- no more responses to process
         zh->socket_readable.tv_sec=zh->socket_readable.tv_usec=0;
-    }else{
+    }
+#else
+    fd_set rfds;
+    struct timeval waittime = {0, 0};
+    FD_ZERO(&rfds);
+    FD_SET( zh->fd , &rfds);
+    if (select(0, &rfds, NULL, NULL, &waittime) <= 0){
+        // socket not readable -- no more responses to process
+        zh->socket_readable.tv_sec=zh->socket_readable.tv_usec=0;
+    }
+#endif
+    else{
         gettimeofday(&zh->socket_readable,0);
     }
 }
@@ -2385,7 +2456,7 @@ int zookeeper_close(zhandle_t *zh)
     }
     if(zh->state==ZOO_CONNECTED_STATE){
         struct oarchive *oa;
-        struct RequestHeader h = { .xid = get_xid(), .type = ZOO_CLOSE_OP};
+        struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type , ZOO_CLOSE_OP)};
         LOG_INFO(("Closing zookeeper sessionId=%#llx to [%s]\n",
                 zh->client_id.client_id,format_current_endpoint_info(zh)));
         oa = create_buffer_oarchive();
@@ -2412,6 +2483,9 @@ finish:
     destroy(zh);
     adaptor_destroy(zh);
     free(zh);
+#ifdef WIN32
+    Win32WSACleanup();
+#endif
     return rc;
 }
 
@@ -2508,7 +2582,7 @@ int zoo_awget(zhandle_t *zh, const char 
 {
     struct oarchive *oa;
     char *server_path = prepend_string(zh, path);
-    struct RequestHeader h = { .xid = get_xid(), .type = ZOO_GETDATA_OP};
+    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type ,ZOO_GETDATA_OP)};
     struct GetDataRequest req =  { (char*)server_path, watcher!=0 };
     int rc;
 
@@ -2543,8 +2617,9 @@ int zoo_awget(zhandle_t *zh, const char 
 static int SetDataRequest_init(zhandle_t *zh, struct SetDataRequest *req,
         const char *path, const char *buffer, int buflen, int version)
 {
+    int rc;
     assert(req);
-    int rc = Request_path_init(zh, 0, &req->path, path);
+    rc = Request_path_init(zh, 0, &req->path, path);
     if (rc != ZOK) {
         return rc;
     }
@@ -2559,7 +2634,7 @@ int zoo_aset(zhandle_t *zh, const char *
         int version, stat_completion_t dc, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { .xid = get_xid(), .type = ZOO_SETDATA_OP};
+    struct RequestHeader h = { STRUCT_INITIALIZER(xid , get_xid()), STRUCT_INITIALIZER (type , ZOO_SETDATA_OP)};
     struct SetDataRequest req;
     int rc = SetDataRequest_init(zh, &req, path, buffer, buflen, version);
     if (rc != ZOK) {
@@ -2588,8 +2663,10 @@ static int CreateRequest_init(zhandle_t 
         const char *path, const char *value,
         int valuelen, const struct ACL_vector *acl_entries, int flags)
 {
+    int rc;
+    assert(req);
+    rc = Request_path_init(zh, flags, &req->path, path);
     assert(req);
-    int rc = Request_path_init(zh, flags, &req->path, path);
     if (rc != ZOK) {
         return rc;
     }
@@ -2611,7 +2688,7 @@ int zoo_acreate(zhandle_t *zh, const cha
         string_completion_t completion, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { .xid = get_xid(), .type = ZOO_CREATE_OP };
+    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type ,ZOO_CREATE_OP) };
     struct CreateRequest req;
 
     int rc = CreateRequest_init(zh, &req, 
@@ -2653,7 +2730,7 @@ int zoo_adelete(zhandle_t *zh, const cha
         void_completion_t completion, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { .xid = get_xid(), .type = ZOO_DELETE_OP};
+    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type , ZOO_DELETE_OP)};
     struct DeleteRequest req;
     int rc = DeleteRequest_init(zh, &req, path, version);
     if (rc != ZOK) {
@@ -2689,7 +2766,7 @@ int zoo_awexists(zhandle_t *zh, const ch
         stat_completion_t completion, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { .xid = get_xid(), .type = ZOO_EXISTS_OP };
+    struct RequestHeader h = { STRUCT_INITIALIZER (xid ,get_xid()), STRUCT_INITIALIZER (type , ZOO_EXISTS_OP) };
     struct ExistsRequest req;
     int rc = Request_path_watch_init(zh, 0, &req.path, path, 
             &req.watch, watcher != NULL);
@@ -2723,7 +2800,7 @@ static int zoo_awget_children_(zhandle_t
          const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { .xid = get_xid(), .type = ZOO_GETCHILDREN_OP};
+    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type , ZOO_GETCHILDREN_OP)};
     struct GetChildrenRequest req ;
     int rc = Request_path_watch_init(zh, 0, &req.path, path, 
             &req.watch, watcher != NULL);
@@ -2771,7 +2848,7 @@ static int zoo_awget_children2_(zhandle_
 {
     /* invariant: (sc == NULL) != (sc == NULL) */
     struct oarchive *oa;
-    struct RequestHeader h = { .xid = get_xid(), .type = ZOO_GETCHILDREN2_OP};
+    struct RequestHeader h = { STRUCT_INITIALIZER( xid, get_xid()), STRUCT_INITIALIZER (type ,ZOO_GETCHILDREN2_OP)};
     struct GetChildren2Request req ;
     int rc = Request_path_watch_init(zh, 0, &req.path, path, 
             &req.watch, watcher != NULL);
@@ -2816,7 +2893,7 @@ int zoo_async(zhandle_t *zh, const char 
         string_completion_t completion, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { .xid = get_xid(), .type = ZOO_SYNC_OP};
+    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER (type , ZOO_SYNC_OP)};
     struct SyncRequest req;
     int rc = Request_path_init(zh, 0, &req.path, path);
     if (rc != ZOK) {
@@ -2846,7 +2923,7 @@ int zoo_aget_acl(zhandle_t *zh, const ch
         const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { .xid = get_xid(), .type = ZOO_GETACL_OP};
+    struct RequestHeader h = { STRUCT_INITIALIZER (xid , get_xid()), STRUCT_INITIALIZER(type ,ZOO_GETACL_OP)};
     struct GetACLRequest req;
     int rc = Request_path_init(zh, 0, &req.path, path) ;
     if (rc != ZOK) {
@@ -2875,7 +2952,7 @@ int zoo_aset_acl(zhandle_t *zh, const ch
         struct ACL_vector *acl, void_completion_t completion, const void *data)
 {
     struct oarchive *oa;
-    struct RequestHeader h = { .xid = get_xid(), .type = ZOO_SETACL_OP};
+    struct RequestHeader h = { STRUCT_INITIALIZER(xid ,get_xid()), STRUCT_INITIALIZER (type , ZOO_SETACL_OP)};
     struct SetACLRequest req;
     int rc = Request_path_init(zh, 0, &req.path, path);
     if (rc != ZOK) {
@@ -2946,8 +3023,9 @@ static void op_result_stat_completion(in
 static int CheckVersionRequest_init(zhandle_t *zh, struct CheckVersionRequest *req,
         const char *path, int version)
 {
+    int rc ;
     assert(req);
-    int rc = Request_path_init(zh, 0, &req->path, path);
+    rc = Request_path_init(zh, 0, &req->path, path);
     if (rc != ZOK) {
         return rc;
     }
@@ -2959,7 +3037,8 @@ static int CheckVersionRequest_init(zhan
 int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t *ops,
         zoo_op_result_t *results, void_completion_t completion, const void *data)
 {
-    struct RequestHeader h = { .xid = get_xid(), .type = ZOO_MULTI_OP };
+    struct RequestHeader h = { STRUCT_INITIALIZER(xid, get_xid()), STRUCT_INITIALIZER(type, ZOO_MULTI_OP) };
+    struct MultiHeader mh = { STRUCT_INITIALIZER(type, -1), STRUCT_INITIALIZER(done, 1), STRUCT_INITIALIZER(err, -1) };
     struct oarchive *oa = create_buffer_oarchive();
     completion_head_t clist = { 0 };
 
@@ -2971,7 +3050,7 @@ int zoo_amulti(zhandle_t *zh, int count,
         zoo_op_result_t *result = results+index;
         completion_list_t *entry = NULL;
 
-        struct MultiHeader mh = { .type=op->type, .done=0, .err=-1 };
+        struct MultiHeader mh = { STRUCT_INITIALIZER(type, op->type), STRUCT_INITIALIZER(done, 0), STRUCT_INITIALIZER(err, -1) };
         rc = rc < 0 ? rc : serialize_MultiHeader(oa, "multiheader", &mh);
      
         switch(op->type) {
@@ -3041,7 +3120,6 @@ int zoo_amulti(zhandle_t *zh, int count,
         queue_completion(&clist, entry, 0);
     }
 
-    struct MultiHeader mh = { .type=-1, .done=1, .err=-1 };
     rc = rc < 0 ? rc : serialize_MultiHeader(oa, "multiheader", &mh);
   
     /* BEGIN: CRTICIAL SECTION */
@@ -3130,6 +3208,10 @@ int flush_send_queue(zhandle_t*zh, int t
 {
     int rc= ZOK;
     struct timeval started;
+#ifdef WIN32
+    fd_set pollSet; 
+    struct timeval wait;
+#endif
     gettimeofday(&started,0);
     // we can't use dequeue_buffer() here because if (non-blocking) send_buffer()
     // returns EWOULDBLOCK we'd have to put the buffer back on the queue.
@@ -3139,7 +3221,6 @@ int flush_send_queue(zhandle_t*zh, int t
     while (zh->to_send.head != 0&& zh->state == ZOO_CONNECTED_STATE) {
         if(timeout!=0){
             int elapsed;
-            struct pollfd fds;
             struct timeval now;
             gettimeofday(&now,0);
             elapsed=calculate_interval(&started,&now);
@@ -3147,10 +3228,20 @@ int flush_send_queue(zhandle_t*zh, int t
                 rc = ZOPERATIONTIMEOUT;
                 break;
             }
+
+#ifdef WIN32
+            wait = get_timeval(timeout-elapsed);
+            FD_ZERO(&pollSet);
+            FD_SET(zh->fd, &pollSet);
+            // Poll the socket
+            rc = select((int)(zh->fd)+1, NULL,  &pollSet, NULL, &wait);      
+#else
+            struct pollfd fds;
             fds.fd = zh->fd;
             fds.events = POLLOUT;
             fds.revents = 0;
             rc = poll(&fds, 1, timeout-elapsed);
+#endif
             if (rc<=0) {
                 /* timed out or an error or POLLERR */
                 rc = rc==0 ? ZOPERATIONTIMEOUT : ZSYSTEMERROR;
@@ -3286,6 +3377,9 @@ static const char* format_endpoint_info(
     static char buf[128];
     char addrstr[128];
     void *inaddr;
+#ifdef WIN32
+    char * addrstring;
+#endif
     int port;
     if(ep==0)
         return "null";
@@ -3301,8 +3395,13 @@ static const char* format_endpoint_info(
 #if defined(AF_INET6)
     }
 #endif
+#ifdef WIN32
+    addrstring = inet_ntoa (*(struct in_addr*)inaddr); 
+    sprintf(buf,"%s:%d",addrstring,ntohs(port));
+#else
     inet_ntop(ep->ss_family,inaddr,addrstr,sizeof(addrstr)-1);
     sprintf(buf,"%s:%d",addrstr,ntohs(port));
+#endif    
     return buf;
 }
 

Added: zookeeper/trunk/src/c/zookeeper.sln
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/c/zookeeper.sln?rev=1148116&view=auto
==============================================================================
--- zookeeper/trunk/src/c/zookeeper.sln (added)
+++ zookeeper/trunk/src/c/zookeeper.sln Tue Jul 19 00:59:10 2011
@@ -0,0 +1,57 @@
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zookeeper", "zookeeper.vcproj", "{5754FB2B-5EA5-4988-851D-908CA533A626}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cli", "Cli.vcproj", "{050228F9-070F-4806-A2B5-E6B95D8EC4AF}"
+    ProjectSection(ProjectDependencies) = postProject
+        {5754FB2B-5EA5-4988-851D-908CA533A626} = {5754FB2B-5EA5-4988-851D-908CA533A626}
+    EndProjectSection
+EndProject
+Global
+    GlobalSection(SolutionConfigurationPlatforms) = preSolution
+        Debug|Win32 = Debug|Win32
+        Release|Win32 = Release|Win32
+    EndGlobalSection
+    GlobalSection(ProjectConfigurationPlatforms) = postSolution
+        {5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|Win32.ActiveCfg = Debug|Win32
+        {5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|Win32.Build.0 = Debug|Win32
+        {5754FB2B-5EA5-4988-851D-908CA533A626}.Release|Win32.ActiveCfg = Release|Win32
+        {5754FB2B-5EA5-4988-851D-908CA533A626}.Release|Win32.Build.0 = Release|Win32
+        {050228F9-070F-4806-A2B5-E6B95D8EC4AF}.Debug|Win32.ActiveCfg = Debug|Win32
+        {050228F9-070F-4806-A2B5-E6B95D8EC4AF}.Debug|Win32.Build.0 = Debug|Win32
+        {050228F9-070F-4806-A2B5-E6B95D8EC4AF}.Release|Win32.ActiveCfg = Release|Win32
+        {050228F9-070F-4806-A2B5-E6B95D8EC4AF}.Release|Win32.Build.0 = Release|Win32
+    EndGlobalSection
+    GlobalSection(SolutionProperties) = preSolution
+        HideSolutionNode = FALSE
+    EndGlobalSection
+EndGlobal
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual Studio 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zookeeper", "zookeeper.vcproj", "{5754FB2B-5EA5-4988-851D-908CA533A626}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cli", "Cli.vcproj", "{050228F9-070F-4806-A2B5-E6B95D8EC4AF}"
+    ProjectSection(ProjectDependencies) = postProject
+        {5754FB2B-5EA5-4988-851D-908CA533A626} = {5754FB2B-5EA5-4988-851D-908CA533A626}
+    EndProjectSection
+EndProject
+Global
+    GlobalSection(SolutionConfigurationPlatforms) = preSolution
+        Debug|Win32 = Debug|Win32
+        Release|Win32 = Release|Win32
+    EndGlobalSection
+    GlobalSection(ProjectConfigurationPlatforms) = postSolution
+        {5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|Win32.ActiveCfg = Debug|Win32
+        {5754FB2B-5EA5-4988-851D-908CA533A626}.Debug|Win32.Build.0 = Debug|Win32
+        {5754FB2B-5EA5-4988-851D-908CA533A626}.Release|Win32.ActiveCfg = Release|Win32
+        {5754FB2B-5EA5-4988-851D-908CA533A626}.Release|Win32.Build.0 = Release|Win32
+        {050228F9-070F-4806-A2B5-E6B95D8EC4AF}.Debug|Win32.ActiveCfg = Debug|Win32
+        {050228F9-070F-4806-A2B5-E6B95D8EC4AF}.Debug|Win32.Build.0 = Debug|Win32
+        {050228F9-070F-4806-A2B5-E6B95D8EC4AF}.Release|Win32.ActiveCfg = Release|Win32
+        {050228F9-070F-4806-A2B5-E6B95D8EC4AF}.Release|Win32.Build.0 = Release|Win32
+    EndGlobalSection
+    GlobalSection(SolutionProperties) = preSolution
+        HideSolutionNode = FALSE
+    EndGlobalSection
+EndGlobal