فهرست منبع

HDFS-7577. Add additional headers needed by Windows (Thanh Do via Colin P. McCabe)

Colin Patrick Mccabe 10 سال پیش
والد
کامیت
650c3c6b7b
22فایلهای تغییر یافته به همراه540 افزوده شده و 13 حذف شده
  1. 6 12
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/posix/platform.h
  2. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/arpa/inet.h
  3. 48 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/cpuid.h
  4. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/ifaddrs.h
  5. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/inttypes.h
  6. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netdb.h
  7. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netinet/in.h
  8. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netinet/tcp.h
  9. 112 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/platform.h
  10. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/poll.h
  11. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/pthread.h
  12. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/pwd.h
  13. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/strings.h
  14. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/fcntl.h
  15. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/file.h
  16. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/mman.h
  17. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/socket.h
  18. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/time.h
  19. 19 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/unistd.h
  20. 32 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/uuid/uuid.h
  21. 7 1
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/CMakeLists.txt
  22. 31 0
      hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/build.h.in

+ 6 - 12
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/platform.h.in → hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/posix/platform.h

@@ -16,8 +16,10 @@
  * limitations under the License.
  */
 
-#ifndef LIBHDFS3_PLATFORM_H
-#define LIBHDFS3_PLATFORM_H
+#ifndef LIBHDFS3_POSIX_PLATFORM_H
+#define LIBHDFS3_POSIX_PLATFORM_H
+
+#include "build.h"
 
 #define THREAD_LOCAL __thread
 #define ATTRIBUTE_NORETURN __attribute__ ((noreturn))
@@ -27,15 +29,6 @@
                      + __GNUC_MINOR__ * 100 \
                      + __GNUC_PATCHLEVEL__)
 
-#cmakedefine LIBUNWIND_FOUND
-#cmakedefine HAVE_DLADDR
-#cmakedefine OS_LINUX
-#cmakedefine OS_MACOSX
-#cmakedefine ENABLE_FRAME_POINTER
-#cmakedefine HAVE_SYMBOLIZE
-#cmakedefine NEED_BOOST
-#cmakedefine STRERROR_R_RETURN_INT
-
 // defined by gcc
 #if defined(__ELF__) && defined(OS_LINUX)
 # define HAVE_SYMBOLIZE
@@ -45,5 +38,6 @@
 #endif
 
 #define STACK_LENGTH 64
+#define PATH_SEPRATOR '/'
 
-#endif
+#endif // LIBHDFS3_POSIX_PLATFORM_H

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/arpa/inet.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 48 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/cpuid.h

@@ -0,0 +1,48 @@
+/**
+ * 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.
+ */
+
+/*
+ * Implement get_cpuid() in Windows.
+ */
+
+#ifndef _LIBHDFS3_CPUID_HEADER_
+#define _LIBHDFS3_CPUID_HEADER_
+
+#include <intrin.h>
+
+#if ((defined(__X86__) || defined(__i386__) || defined(i386) || defined(_M_IX86) || defined(__386__) || defined(__x86_64__) || defined(_M_X64)))
+int __get_cpuid(unsigned int __level, unsigned int *__eax,
+    unsigned int *__ebx, unsigned int *__ecx, unsigned int *__edx) {
+    int CPUInfo[4] = { *__eax, *__ebx, *__ecx, *__edx };
+    __cpuid(CPUInfo, 0);
+    // check if the CPU supports the cpuid instruction.
+    if (CPUInfo[0] != 0) {
+        __cpuid(CPUInfo, __level);
+        *__eax = CPUInfo[0];
+        *__ebx = CPUInfo[1];
+        *__ecx = CPUInfo[2];
+        *__edx = CPUInfo[3];
+        return 1;
+	}
+    return 0;
+}
+#else
+#error Unimplemented __get_cpuid() for non-x86 processor!
+#endif
+
+#endif

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/ifaddrs.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/inttypes.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netdb.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netinet/in.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netinet/tcp.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 112 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/platform.h

@@ -0,0 +1,112 @@
+/**
+ * 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.
+ */
+
+#ifndef LIBHDFS3_WINDOWS_PLATFORM_H
+#define LIBHDFS3_WINDOWS_PLATFORM_H
+
+#include "build.h"
+
+#define THREAD_LOCAL __declspec(thread)
+#define ATTRIBUTE_NORETURN __attribute__ ((noreturn))
+#define ATTRIBUTE_NOINLINE __attribute__ ((noinline))
+
+#define STACK_LENGTH 64
+
+/*
+ * Get rid of extra stuff.
+ */
+#define VC_EXTRALEAN
+#define WIN32_LEAN_AND_MEAN
+
+/*
+ * Windows does not understand __attribute__, which is gcc-specific.
+ * Hence make this key work invalid
+ */
+#define __attribute__(A) /* do nothing */
+
+/*
+ * Include Windows specific headers in one place.
+ */
+#include <WinSock2.h>
+#include <Windows.h>
+#include <io.h>
+#include <IPHlpApi.h>
+#pragma comment(lib, "IPHLPAPI.lib")
+#include <process.h>
+#include <Rpc.h>
+#include <RpcDce.h> /* for UidCreate */
+#include <stdio.h>
+#include <ws2ipdef.h>
+#include <Ws2tcpip.h>
+#pragma comment(lib, "ws2_32.lib")
+
+/*
+ * Account for the lack of inttypes.h in Visual Studio 2010
+ */
+#define PRId32 "ld"
+#define _PFX_64 "ll"
+#define PRId64 _PFX_64 "d"
+
+/*
+ * Define some macros for equivalent functions in Windows.
+ * Most of the time it is a rename. Sometimes, we have to redefine
+ * function signature as well.
+ */
+
+/*
+ * File access.
+ */
+#define R_OK 4 /* Read only */
+#define STDERR_FILENO 2
+#define access _access
+#define lseek _lseek
+
+/*
+ * String related.
+ */
+#define snprintf(str, size, format, ...) \
+	_snprintf_s((str), (size), _TRUNCATE, (format), __VA_ARGS__)
+#define strcasecmp _stricmp
+#define strerror_r(errnum, buf, buflen) strerror_s((buf), (buflen), (errnum))
+#define strtoll _strtoi64
+#define strtok_r strtok_s
+#define vsnprintf(str, size, format, ...) \
+	vsnprintf_s((str), (size), _TRUNCATE, (format), __VA_ARGS__)
+
+// Others.
+#define getpid _getpid
+#define pthread_self GetCurrentThreadId
+#define setenv(name, value, overwrite) _putenv_s((name), (value))
+
+/*
+ * ERROR macro conflicts with ERROR def in some protobuf header.
+ * Thus, undef it here.
+ */
+#undef ERROR
+
+/*
+ * Define path separator macro.
+ */
+#define PATH_SEPRATOR '\\'
+
+/*
+ * Support for signals in Windows is limited.
+ */
+typedef unsigned long sigset_t;
+
+#endif // LIBHDFS3_WINDOWS_PLATFORM_H

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/poll.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/pthread.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/pwd.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/strings.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/fcntl.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/file.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/mman.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/socket.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/time.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 19 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/unistd.h

@@ -0,0 +1,19 @@
+/**
+ * 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.
+ */
+
+/* Dummy file for Windows build */

+ 32 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/uuid/uuid.h

@@ -0,0 +1,32 @@
+/**
+ * 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.
+ */
+
+#ifndef _UUID_HEADER_FOR_WIN_
+#define _UUID_HEADER_FOR_WIN_
+
+/*
+ * This file an Windows equivalent of libuuid.
+ */
+
+#include <Rpc.h>
+#include <RpcDce.h>
+#pragma comment(lib, "rpcrt4.lib")
+
+#define uuid_generate(id) UuidCreate(&(id))
+
+#endif

+ 7 - 1
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/CMakeLists.txt

@@ -30,7 +30,12 @@ IF(ENABLE_DEBUG)
 	SET(libhdfs3_VERSION_STRING "${libhdfs3_VERSION_STRING}d")
 ENDIF(ENABLE_DEBUG)
 
-CONFIGURE_FILE(platform.h.in platform.h)
+IF(MSVC)
+    SET(libhdfs3_OS_PLATFORM_DIR ${libhdfs3_ROOT_SOURCES_DIR}/../os/windows)
+ELSE(MSVC)
+    SET(libhdfs3_OS_PLATFORM_DIR ${libhdfs3_ROOT_SOURCES_DIR}/../os/posix)
+ENDIF(MSVC)
+CONFIGURE_FILE(build.h.in build.h)
 CONFIGURE_FILE(doxyfile.in doxyfile)
 
 AUTO_SOURCES(files "*.cc" "RECURSE" "${CMAKE_CURRENT_SOURCE_DIR}")
@@ -109,6 +114,7 @@ IF(OS_LINUX)
 ENDIF(OS_LINUX)
 
 INCLUDE_DIRECTORIES(${libhdfs3_ROOT_SOURCES_DIR})
+INCLUDE_DIRECTORIES(${libhdfs3_OS_PLATFORM_DIR})
 INCLUDE_DIRECTORIES(${libhdfs3_COMMON_SOURCES_DIR})
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
 INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIRS})

+ 31 - 0
hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/build.h.in

@@ -0,0 +1,31 @@
+/**
+ * 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.
+ */
+
+#ifndef LIBHDFS3_BUILD_H
+#define LIBHDFS3_BUILD_H
+
+#cmakedefine LIBUNWIND_FOUND
+#cmakedefine HAVE_DLADDR
+#cmakedefine OS_LINUX
+#cmakedefine OS_MACOSX
+#cmakedefine ENABLE_FRAME_POINTER
+#cmakedefine HAVE_SYMBOLIZE
+#cmakedefine NEED_BOOST
+#cmakedefine STRERROR_R_RETURN_INT
+
+#endif // LIBHDFS3_BUILD_H