Repository: hadoop Updated Branches: refs/heads/HDFS-6994 a607429b5 -> 650c3c6b7
HDFS-7577. Add additional headers needed by Windows (Thanh Do via Colin P. McCabe) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/650c3c6b Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/650c3c6b Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/650c3c6b Branch: refs/heads/HDFS-6994 Commit: 650c3c6b7b24a4ec6d268d3e7fe4e4d254bba65c Parents: a607429 Author: Colin Patrick Mccabe <[email protected]> Authored: Tue Jan 27 20:26:19 2015 -0800 Committer: Colin Patrick Mccabe <[email protected]> Committed: Tue Jan 27 20:26:19 2015 -0800 ---------------------------------------------------------------------- .../src/contrib/libhdfs3/os/posix/platform.h | 43 +++++++ .../src/contrib/libhdfs3/os/windows/arpa/inet.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/cpuid.h | 48 ++++++++ .../src/contrib/libhdfs3/os/windows/ifaddrs.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/inttypes.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/netdb.h | 19 ++++ .../contrib/libhdfs3/os/windows/netinet/in.h | 19 ++++ .../contrib/libhdfs3/os/windows/netinet/tcp.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/platform.h | 112 +++++++++++++++++++ .../src/contrib/libhdfs3/os/windows/poll.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/pthread.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/pwd.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/strings.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/sys/fcntl.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/sys/file.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/sys/mman.h | 19 ++++ .../contrib/libhdfs3/os/windows/sys/socket.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/sys/time.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/unistd.h | 19 ++++ .../src/contrib/libhdfs3/os/windows/uuid/uuid.h | 32 ++++++ .../src/contrib/libhdfs3/src/CMakeLists.txt | 8 +- .../src/contrib/libhdfs3/src/build.h.in | 31 +++++ .../src/contrib/libhdfs3/src/platform.h.in | 49 -------- 23 files changed, 577 insertions(+), 50 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/posix/platform.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/posix/platform.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/posix/platform.h new file mode 100644 index 0000000..c2068d4 --- /dev/null +++ b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/posix/platform.h @@ -0,0 +1,43 @@ +/** + * 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_POSIX_PLATFORM_H +#define LIBHDFS3_POSIX_PLATFORM_H + +#include "build.h" + +#define THREAD_LOCAL __thread +#define ATTRIBUTE_NORETURN __attribute__ ((noreturn)) +#define ATTRIBUTE_NOINLINE __attribute__ ((noinline)) + +#define GCC_VERSION (__GNUC__ * 10000 \ + + __GNUC_MINOR__ * 100 \ + + __GNUC_PATCHLEVEL__) + +// defined by gcc +#if defined(__ELF__) && defined(OS_LINUX) +# define HAVE_SYMBOLIZE +#elif defined(OS_MACOSX) && defined(HAVE_DLADDR) +// Use dladdr to symbolize. +# define HAVE_SYMBOLIZE +#endif + +#define STACK_LENGTH 64 +#define PATH_SEPRATOR '/' + +#endif // LIBHDFS3_POSIX_PLATFORM_H http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/arpa/inet.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/arpa/inet.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/arpa/inet.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/cpuid.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/cpuid.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/cpuid.h new file mode 100644 index 0000000..01f6a7d --- /dev/null +++ b/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 http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/ifaddrs.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/ifaddrs.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/ifaddrs.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/inttypes.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/inttypes.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/inttypes.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netdb.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netdb.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netdb.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netinet/in.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netinet/in.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netinet/in.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netinet/tcp.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netinet/tcp.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/netinet/tcp.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/platform.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/platform.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/platform.h new file mode 100644 index 0000000..2ae44e9 --- /dev/null +++ b/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 http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/poll.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/poll.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/poll.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/pthread.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/pthread.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/pthread.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/pwd.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/pwd.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/pwd.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/strings.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/strings.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/strings.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/fcntl.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/fcntl.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/fcntl.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/file.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/file.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/file.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/mman.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/mman.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/mman.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/socket.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/socket.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/socket.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/time.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/time.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/sys/time.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/unistd.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/unistd.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/unistd.h new file mode 100644 index 0000000..97c50e3 --- /dev/null +++ b/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 */ http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/uuid/uuid.h ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/uuid/uuid.h b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/os/windows/uuid/uuid.h new file mode 100644 index 0000000..21826c8 --- /dev/null +++ b/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 http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/CMakeLists.txt b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/CMakeLists.txt index b203379..f7d4a0e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/CMakeLists.txt +++ b/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}) http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/build.h.in ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/build.h.in b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/build.h.in new file mode 100644 index 0000000..6f9ff6b --- /dev/null +++ b/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 http://git-wip-us.apache.org/repos/asf/hadoop/blob/650c3c6b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/platform.h.in ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/platform.h.in b/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/platform.h.in deleted file mode 100644 index 683c8c9..0000000 --- a/hadoop-hdfs-project/hadoop-hdfs/src/contrib/libhdfs3/src/platform.h.in +++ /dev/null @@ -1,49 +0,0 @@ -/** - * 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_PLATFORM_H -#define LIBHDFS3_PLATFORM_H - -#define THREAD_LOCAL __thread -#define ATTRIBUTE_NORETURN __attribute__ ((noreturn)) -#define ATTRIBUTE_NOINLINE __attribute__ ((noinline)) - -#define GCC_VERSION (__GNUC__ * 10000 \ - + __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 -#elif defined(OS_MACOSX) && defined(HAVE_DLADDR) -// Use dladdr to symbolize. -# define HAVE_SYMBOLIZE -#endif - -#define STACK_LENGTH 64 - -#endif
