diff --git a/Makefile.in b/Makefile.in index cc2e9a6f4aedf..b3d9dcb71afe1 100755 --- a/Makefile.in +++ b/Makefile.in @@ -26,7 +26,6 @@ DIRECTORY_ARCHIVES=$(DVDPLAYER_ARCHIVES) \ lib/libXDAAP/libxdaap.a \ lib/libhts/libhts.a \ lib/libsquish/libsquish.a \ - lib/libTcpSocket/libTcpSocket.a \ lib/tinyXML/tinyxml.a \ lib/xbmc-dll-symbols/dll-symbols.a \ xbmc/addons/addons.a \ diff --git a/XBMC-ATV2.xcodeproj/project.pbxproj b/XBMC-ATV2.xcodeproj/project.pbxproj index 779607fd4eb58..f1737df00ee09 100644 --- a/XBMC-ATV2.xcodeproj/project.pbxproj +++ b/XBMC-ATV2.xcodeproj/project.pbxproj @@ -101,7 +101,6 @@ DF7E680013ED4E25003ED690 /* DVDInputStreamPVRManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7E67FC13ED4E25003ED690 /* DVDInputStreamPVRManager.cpp */; }; DF7E680113ED4E25003ED690 /* DVDInputStreamStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7E67FE13ED4E25003ED690 /* DVDInputStreamStack.cpp */; }; DF7E680413ED4E42003ED690 /* DVDDemuxPVRClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7E680213ED4E42003ED690 /* DVDDemuxPVRClient.cpp */; }; - DF7E680813ED4F15003ED690 /* libTcpSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF7E680713ED4F15003ED690 /* libTcpSocket.a */; }; DF7E681613ED5152003ED690 /* TimeSmoother.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF88787913E8912900B4ECE2 /* TimeSmoother.cpp */; }; DF7E683B13ED52B7003ED690 /* PVRDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7E683713ED52B7003ED690 /* PVRDirectory.cpp */; }; DF7E683C13ED52B7003ED690 /* PVRFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF7E683913ED52B7003ED690 /* PVRFile.cpp */; }; @@ -1192,7 +1191,6 @@ DF7E67FF13ED4E25003ED690 /* DVDInputStreamStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVDInputStreamStack.h; sourceTree = ""; }; DF7E680213ED4E42003ED690 /* DVDDemuxPVRClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDDemuxPVRClient.cpp; sourceTree = ""; }; DF7E680313ED4E42003ED690 /* DVDDemuxPVRClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVDDemuxPVRClient.h; sourceTree = ""; }; - DF7E680713ED4F15003ED690 /* libTcpSocket.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTcpSocket.a; path = lib/libTcpSocket/libTcpSocket.a; sourceTree = ""; }; DF7E683713ED52B7003ED690 /* PVRDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PVRDirectory.cpp; sourceTree = ""; }; DF7E683813ED52B7003ED690 /* PVRDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PVRDirectory.h; sourceTree = ""; }; DF7E683913ED52B7003ED690 /* PVRFile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PVRFile.cpp; sourceTree = ""; }; @@ -3140,7 +3138,6 @@ F56B161B12CD69DB009B4C96 /* ImageIO.framework in Frameworks */, 4D5D2E131301753F006ABC13 /* CFNetwork.framework in Frameworks */, 18404DFD1396C44F00863BBA /* SlingboxLib.a in Frameworks */, - DF7E680813ED4F15003ED690 /* libTcpSocket.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6199,7 +6196,6 @@ F589AE7012890B9E00D8079E /* libapetag.a */, F589AE7D12890BEF00D8079E /* libsquish.a */, F589AE7E12890BEF00D8079E /* librtv.a */, - DF7E680713ED4F15003ED690 /* libTcpSocket.a */, F589AE8012890BEF00D8079E /* libxdaap.a */, 18404DFC1396C44F00863BBA /* SlingboxLib.a */, ); @@ -7400,7 +7396,6 @@ "\"$(SRCROOT)/xbmc/interfaces/json-rpc\"", "\"$(SRCROOT)/xbmc/interfaces/http-api\"", "\"$(SRCROOT)/xbmc/pvrclients/mythtv/libmythxml\"", - "\"$(SRCROOT)/lib/libTcpSocket\"", ); OTHER_LDFLAGS = ( "-Wl,-headerpad_max_install_names", @@ -7499,7 +7494,6 @@ "\"$(SRCROOT)/xbmc/interfaces/json-rpc\"", "\"$(SRCROOT)/xbmc/interfaces/http-api\"", "\"$(SRCROOT)/xbmc/pvrclients/mythtv/libmythxml\"", - "\"$(SRCROOT)/lib/libTcpSocket\"", ); OTHER_LDFLAGS = ( "-Wl,-headerpad_max_install_names", diff --git a/XBMC-IOS.xcodeproj/project.pbxproj b/XBMC-IOS.xcodeproj/project.pbxproj index e6407d20c700f..cc04f37077060 100644 --- a/XBMC-IOS.xcodeproj/project.pbxproj +++ b/XBMC-IOS.xcodeproj/project.pbxproj @@ -105,7 +105,6 @@ DF79146B13D4A0A20018E92E /* GUIEPGGridContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF79146313D4A0A20018E92E /* GUIEPGGridContainer.cpp */; }; DF79147113D4A0E20018E92E /* Observer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF79146F13D4A0E20018E92E /* Observer.cpp */; }; DF79147413D4A0F60018E92E /* TextSearch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF79147213D4A0F60018E92E /* TextSearch.cpp */; }; - DF79147C13D4A30A0018E92E /* libTcpSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF79147B13D4A30A0018E92E /* libTcpSocket.a */; }; DFAC338A13EC693E0020DDC0 /* TimeSmoother.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF88796713E8997E00B4ECE2 /* TimeSmoother.cpp */; }; DFAC338B13EC69690020DDC0 /* DVDOverlayCodecTX3G.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF8879A413E89AE000B4ECE2 /* DVDOverlayCodecTX3G.cpp */; }; DFAC338E13EC698D0020DDC0 /* Implementation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF88795E13E8997000B4ECE2 /* Implementation.cpp */; }; @@ -1211,7 +1210,6 @@ DF79147013D4A0E20018E92E /* Observer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Observer.h; sourceTree = ""; }; DF79147213D4A0F60018E92E /* TextSearch.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextSearch.cpp; sourceTree = ""; }; DF79147313D4A0F60018E92E /* TextSearch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextSearch.h; sourceTree = ""; }; - DF79147B13D4A30A0018E92E /* libTcpSocket.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTcpSocket.a; path = lib/libTcpSocket/libTcpSocket.a; sourceTree = ""; }; DF88795A13E8997000B4ECE2 /* ThreadLocal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadLocal.h; path = platform/ThreadLocal.h; sourceTree = ""; }; DF88795C13E8997000B4ECE2 /* Condition.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Condition.h; sourceTree = ""; }; DF88795D13E8997000B4ECE2 /* CriticalSection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CriticalSection.h; sourceTree = ""; }; @@ -3186,7 +3184,6 @@ F56C8C12131F4811000AD0F6 /* librtv.a in Frameworks */, F56C8C14131F4811000AD0F6 /* libxdaap.a in Frameworks */, 18404DD31396C3D200863BBA /* SlingboxLib.a in Frameworks */, - DF79147C13D4A30A0018E92E /* libTcpSocket.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6226,7 +6223,6 @@ F589AE6D12890B6700D8079E /* Internal Libs */ = { isa = PBXGroup; children = ( - DF79147B13D4A30A0018E92E /* libTcpSocket.a */, F56C8C03131F47EA000AD0F6 /* libapetag.a */, F56C8C0D131F4811000AD0F6 /* libsquish.a */, F56C8C0E131F4811000AD0F6 /* librtv.a */, @@ -7437,7 +7433,6 @@ "\"$(SRCROOT)/lib/SlingboxLib\"", "\"$(SRCROOT)/xbmc/interfaces/http-api\"", "\"$(SRCROOT)/xbmc/interfaces/json-rpc\"", - "\"$(SRCROOT)/lib/libTcpSocket\"", ); OTHER_LDFLAGS = ( "-Wl,-headerpad_max_install_names", @@ -7531,7 +7526,6 @@ "\"$(SRCROOT)/lib/cmyth/librefmem\"", "\"$(SRCROOT)/lib/libapetag/.libs\"", "\"$(SRCROOT)/lib/libsquish\"", - "\"$(SRCROOT)/lib/libTcpSocket\"", "\"$(SRCROOT)/lib/SlingboxLib\"", "\"$(SRCROOT)/xbmc/interfaces/http-api\"", "\"$(SRCROOT)/xbmc/interfaces/json-rpc\"", diff --git a/XBMC.xcodeproj/project.pbxproj b/XBMC.xcodeproj/project.pbxproj index 87b4f37f3144d..66f083389b202 100644 --- a/XBMC.xcodeproj/project.pbxproj +++ b/XBMC.xcodeproj/project.pbxproj @@ -677,8 +677,6 @@ C8EC5D0E1369519D00CCC10D /* XBMC_keytable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8EC5D0C1369519D00CCC10D /* XBMC_keytable.cpp */; }; DF0DF15B13A3ADA7008ED511 /* FileNFS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0DF15713A3ADA7008ED511 /* FileNFS.cpp */; }; DF0DF15C13A3ADA7008ED511 /* NFSDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0DF15913A3ADA7008ED511 /* NFSDirectory.cpp */; }; - DF79158113D4A6940018E92E /* libTcpSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF79158013D4A6940018E92E /* libTcpSocket.a */; }; - DF79158213D4A6940018E92E /* libTcpSocket.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DF79158013D4A6940018E92E /* libTcpSocket.a */; }; DF79158B13D4A6BC0018E92E /* AddonCallbacks.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF79158313D4A6BC0018E92E /* AddonCallbacks.cpp */; }; DF79158C13D4A6BC0018E92E /* AddonCallbacksAddon.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF79158513D4A6BC0018E92E /* AddonCallbacksAddon.cpp */; }; DF79158D13D4A6BC0018E92E /* AddonCallbacksGUI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF79158713D4A6BC0018E92E /* AddonCallbacksGUI.cpp */; }; @@ -2759,7 +2757,6 @@ DF0DF15813A3ADA7008ED511 /* FileNFS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FileNFS.h; sourceTree = ""; }; DF0DF15913A3ADA7008ED511 /* NFSDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NFSDirectory.cpp; sourceTree = ""; }; DF0DF15A13A3ADA7008ED511 /* NFSDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NFSDirectory.h; sourceTree = ""; }; - DF79158013D4A6940018E92E /* libTcpSocket.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTcpSocket.a; path = lib/libTcpSocket/libTcpSocket.a; sourceTree = ""; }; DF79158313D4A6BC0018E92E /* AddonCallbacks.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AddonCallbacks.cpp; sourceTree = ""; }; DF79158413D4A6BC0018E92E /* AddonCallbacks.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AddonCallbacks.h; sourceTree = ""; }; DF79158513D4A6BC0018E92E /* AddonCallbacksAddon.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AddonCallbacksAddon.cpp; sourceTree = ""; }; @@ -4198,7 +4195,7 @@ F56C8CF3131F5DFD000AD0F6 /* libiconv.dylib in Frameworks */, F56C8CF6131F5E0B000AD0F6 /* libncurses.dylib in Frameworks */, 18404DA61396C31B00863BBA /* SlingboxLib.a in Frameworks */, - DF79158113D4A6940018E92E /* libTcpSocket.a in Frameworks */, + DFC1B8F01464840E00B1BE79 /* SystemConfiguration.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -4233,7 +4230,7 @@ F5B5D64E133FC2E7007A4B4C /* librtv.a in Frameworks */, F5B5D650133FC312007A4B4C /* libxdaap.a in Frameworks */, 18404E711396E06C00863BBA /* SlingboxLib.a in Frameworks */, - DF79158213D4A6940018E92E /* libTcpSocket.a in Frameworks */, + DFC1BA3414648D6500B1BE79 /* SystemConfiguration.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -7412,7 +7409,6 @@ F57E1ED20E36E8FD00700C9D /* internal libs */ = { isa = PBXGroup; children = ( - DF79158013D4A6940018E92E /* libTcpSocket.a */, F5DC888A110A654000EE1B15 /* libapetag.a */, 43352CED1071634600706B8A /* libsquish.a */, E38E256C0D263A1C00618676 /* librtv.a */, @@ -9726,7 +9722,6 @@ "$(SRCROOT)/lib/SlingboxLib", "$(SRCROOT)/xbmc/interfaces/http-api", "$(SRCROOT)/xbmc/interfaces/json-rpc", - "\"$(SRCROOT)/lib/libTcpSocket\"", ); LINK_WITH_STANDARD_LIBRARIES = YES; OTHER_LDFLAGS = ( @@ -9826,7 +9821,6 @@ "$(SRCROOT)/lib/SlingboxLib", "$(SRCROOT)/xbmc/interfaces/http-api", "$(SRCROOT)/xbmc/interfaces/json-rpc", - "\"$(SRCROOT)/lib/libTcpSocket\"", ); LINK_WITH_STANDARD_LIBRARIES = YES; OTHER_LDFLAGS = ( @@ -9985,7 +9979,6 @@ "$(SRCROOT)/xbmc/interfaces/http-api", "$(SRCROOT)/xbmc/interfaces/json-rpc", "$(SRCROOT)/lib/SlingboxLib", - "\"$(SRCROOT)/lib/libTcpSocket\"", ); LINK_WITH_STANDARD_LIBRARIES = YES; OTHER_LDFLAGS = ( @@ -10086,7 +10079,6 @@ "$(SRCROOT)/xbmc/interfaces/http-api", "$(SRCROOT)/xbmc/interfaces/json-rpc", "$(SRCROOT)/lib/SlingboxLib", - "\"$(SRCROOT)/lib/libTcpSocket\"", ); LINK_WITH_STANDARD_LIBRARIES = YES; OTHER_LDFLAGS = ( diff --git a/lib/libPlatform/linux/os_posix.h b/lib/libPlatform/linux/os_posix.h deleted file mode 100644 index 08134cb9327fa..0000000000000 --- a/lib/libPlatform/linux/os_posix.h +++ /dev/null @@ -1,59 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2011 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#define _FILE_OFFSET_BITS 64 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef __APPLE__ -#include -#endif -#include -#include -#include - -#define LIBTYPE - -#ifndef __STL_CONFIG_H -template inline T min(T a, T b) { return a <= b ? a : b; } -template inline T max(T a, T b) { return a >= b ? a : b; } -template inline int sgn(T a) { return a < 0 ? -1 : a > 0 ? 1 : 0; } -template inline void swap(T &a, T &b) { T t = a; a = b; b = t; } -#endif - -/*! - * @return the current time in seconds since unix epoch. - */ -static inline uint64_t getcurrenttime(void) -{ - struct timeval t; - gettimeofday(&t, NULL); - return ((uint64_t)t.tv_sec * 1000) + (t.tv_usec / 1000); -} diff --git a/lib/libPlatform/os-dependent.h b/lib/libPlatform/os-dependent.h deleted file mode 100644 index 3ea7cb4483e41..0000000000000 --- a/lib/libPlatform/os-dependent.h +++ /dev/null @@ -1,39 +0,0 @@ -#pragma once -/* - * Copyright (C) 2005-2011 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#if defined(_WIN32) || defined(_WIN64) -#ifndef __WINDOWS__ -#define __WINDOWS__ -#endif -#endif - -#if defined(__WINDOWS__) -#include "windows/os_windows.h" -#else -#include "linux/os_posix.h" -#endif - -#if !defined(TRUE) -#define TRUE 1 -#endif - -#if !defined(FALSE) -#define FALSE 0 -#endif diff --git a/lib/libPlatform/project/libProcess_2010.vcxproj b/lib/libPlatform/project/libProcess_2010.vcxproj deleted file mode 100644 index 0da25cdce2afe..0000000000000 --- a/lib/libPlatform/project/libProcess_2010.vcxproj +++ /dev/null @@ -1,97 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - - - - - - - - - - - libPlatform - {E2DF1AC8-E9BF-43B8-B5D9-7EC3B513EEF1} - libPlatform - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)libs\$(TargetName)\$(Configuration)\ - $(SolutionDir)objs\$(TargetName)\$(Configuration)\ - $(SolutionDir)libs\$(TargetName)\$(Configuration)\ - $(SolutionDir)objs\$(TargetName)\$(Configuration)\ - - - - Disabled - $(ProjectDir)include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebug - - - Level3 - EditAndContinue - - - %(IgnoreSpecificDefaultLibraries) - - - - - MaxSpeed - true - $(ProjectDir)include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;%(PreprocessorDefinitions) - - - MultiThreaded - true - - - Level3 - ProgramDatabase - - - true - - - - - - \ No newline at end of file diff --git a/lib/libPlatform/project/libProcess_2010.vcxproj.filters b/lib/libPlatform/project/libProcess_2010.vcxproj.filters deleted file mode 100644 index 769b174d078de..0000000000000 --- a/lib/libPlatform/project/libProcess_2010.vcxproj.filters +++ /dev/null @@ -1,42 +0,0 @@ - - - - - {b33e3ace-f8ae-4a71-acc0-8c5156b4981f} - - - {cc151dfb-0b0b-4c7a-b72a-6091b45d0ca6} - - - {0ead3d2e-a104-491e-81d1-d9ecbf137a08} - - - {26818d35-a058-447e-a5ec-1b1e28c00ab3} - - - {813923f7-0fdc-4009-948f-f5a0c8ac4028} - - - - - Header Files - - - Header Files\windows - - - Header Files\pthread_win32 - - - Header Files\pthread_win32 - - - Header Files\pthread_win32 - - - - - Source Files\windows - - - \ No newline at end of file diff --git a/lib/libPlatform/pthread_win32/pthread.h b/lib/libPlatform/pthread_win32/pthread.h deleted file mode 100644 index a3140e17df384..0000000000000 --- a/lib/libPlatform/pthread_win32/pthread.h +++ /dev/null @@ -1,1368 +0,0 @@ -/* This is an implementation of the threads API of POSIX 1003.1-2001. - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -#if !defined( PTHREAD_H ) -#define PTHREAD_H - -/* - * See the README file for an explanation of the pthreads-win32 version - * numbering scheme and how the DLL is named etc. - */ -#define PTW32_VERSION 2,8,0,0 -#define PTW32_VERSION_STRING "2, 8, 0, 0\0" - -/* There are three implementations of cancel cleanup. - * Note that pthread.h is included in both application - * compilation units and also internally for the library. - * The code here and within the library aims to work - * for all reasonable combinations of environments. - * - * The three implementations are: - * - * WIN32 SEH - * C - * C++ - * - * Please note that exiting a push/pop block via - * "return", "exit", "break", or "continue" will - * lead to different behaviour amongst applications - * depending upon whether the library was built - * using SEH, C++, or C. For example, a library built - * with SEH will call the cleanup routine, while both - * C++ and C built versions will not. - */ - -/* - * Define defaults for cleanup code. - * Note: Unless the build explicitly defines one of the following, then - * we default to standard C style cleanup. This style uses setjmp/longjmp - * in the cancelation and thread exit implementations and therefore won't - * do stack unwinding if linked to applications that have it (e.g. - * C++ apps). This is currently consistent with most/all commercial Unix - * POSIX threads implementations. - */ -#if !defined( __CLEANUP_SEH ) && !defined( __CLEANUP_CXX ) && !defined( __CLEANUP_C ) -# define __CLEANUP_C -#endif - -#if defined( __CLEANUP_SEH ) && ( !defined( _MSC_VER ) && !defined(PTW32_RC_MSC)) -#error ERROR [__FILE__, line __LINE__]: SEH is not supported for this compiler. -#endif - -/* - * Stop here if we are being included by the resource compiler. - */ -#ifndef RC_INVOKED - -#undef PTW32_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - -#ifdef _UWIN -# define HAVE_STRUCT_TIMESPEC 1 -# define HAVE_SIGNAL_H 1 -# undef HAVE_CONFIG_H -# pragma comment(lib, "pthread") -#endif - -/* - * ------------------------------------------------------------- - * - * - * Module: pthread.h - * - * Purpose: - * Provides an implementation of PThreads based upon the - * standard: - * - * POSIX 1003.1-2001 - * and - * The Single Unix Specification version 3 - * - * (these two are equivalent) - * - * in order to enhance code portability between Windows, - * various commercial Unix implementations, and Linux. - * - * See the ANNOUNCE file for a full list of conforming - * routines and defined constants, and a list of missing - * routines and constants not defined in this implementation. - * - * Authors: - * There have been many contributors to this library. - * The initial implementation was contributed by - * John Bossom, and several others have provided major - * sections or revisions of parts of the implementation. - * Often significant effort has been contributed to - * find and fix important bugs and other problems to - * improve the reliability of the library, which sometimes - * is not reflected in the amount of code which changed as - * result. - * As much as possible, the contributors are acknowledged - * in the ChangeLog file in the source code distribution - * where their changes are noted in detail. - * - * Contributors are listed in the CONTRIBUTORS file. - * - * As usual, all bouquets go to the contributors, and all - * brickbats go to the project maintainer. - * - * Maintainer: - * The code base for this project is coordinated and - * eventually pre-tested, packaged, and made available by - * - * Ross Johnson - * - * QA Testers: - * Ultimately, the library is tested in the real world by - * a host of competent and demanding scientists and - * engineers who report bugs and/or provide solutions - * which are then fixed or incorporated into subsequent - * versions of the library. Each time a bug is fixed, a - * test case is written to prove the fix and ensure - * that later changes to the code don't reintroduce the - * same error. The number of test cases is slowly growing - * and therefore so is the code reliability. - * - * Compliance: - * See the file ANNOUNCE for the list of implemented - * and not-implemented routines and defined options. - * Of course, these are all defined is this file as well. - * - * Web site: - * The source code and other information about this library - * are available from - * - * http://sources.redhat.com/pthreads-win32/ - * - * ------------------------------------------------------------- - */ - -/* Try to avoid including windows.h */ -#if defined(__MINGW32__) && defined(__cplusplus) -#define PTW32_INCLUDE_WINDOWS_H -#endif - -#ifdef PTW32_INCLUDE_WINDOWS_H -#include -#endif - -#if defined(_MSC_VER) && _MSC_VER < 1300 || defined(__DMC__) -/* - * VC++6.0 or early compiler's header has no DWORD_PTR type. - */ -typedef unsigned long DWORD_PTR; -#endif -/* - * ----------------- - * autoconf switches - * ----------------- - */ - -#if HAVE_CONFIG_H -#include "config.h" -#endif /* HAVE_CONFIG_H */ - -#ifndef NEED_FTIME -#include -#else /* NEED_FTIME */ -/* use native WIN32 time API */ -#endif /* NEED_FTIME */ - -#if HAVE_SIGNAL_H -#include -#endif /* HAVE_SIGNAL_H */ - -#include -#include - -/* - * Boolean values to make us independent of system includes. - */ -enum { - PTW32_FALSE = 0, - PTW32_TRUE = (! PTW32_FALSE) -}; - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Several systems don't define some error numbers. - */ -#ifndef ENOTSUP -# define ENOTSUP 48 /* This is the value in Solaris. */ -#endif - -#ifndef ETIMEDOUT -# define ETIMEDOUT 10060 /* This is the value in winsock.h. */ -#endif - -#ifndef ENOSYS -# define ENOSYS 140 /* Semi-arbitrary value */ -#endif - -#ifndef EDEADLK -# ifdef EDEADLOCK -# define EDEADLK EDEADLOCK -# else -# define EDEADLK 36 /* This is the value in MSVC. */ -# endif -#endif - -#include "sched.h" - -/* - * To avoid including windows.h we define only those things that we - * actually need from it. - */ -#ifndef PTW32_INCLUDE_WINDOWS_H -#ifndef HANDLE -# define PTW32__HANDLE_DEF -# define HANDLE void * -#endif -#ifndef DWORD -# define PTW32__DWORD_DEF -# define DWORD unsigned long -#endif -#endif - -#ifndef HAVE_STRUCT_TIMESPEC -#define HAVE_STRUCT_TIMESPEC 1 -struct timespec { - long tv_sec; - long tv_nsec; -}; -#endif /* HAVE_STRUCT_TIMESPEC */ - -#ifndef SIG_BLOCK -#define SIG_BLOCK 0 -#endif /* SIG_BLOCK */ - -#ifndef SIG_UNBLOCK -#define SIG_UNBLOCK 1 -#endif /* SIG_UNBLOCK */ - -#ifndef SIG_SETMASK -#define SIG_SETMASK 2 -#endif /* SIG_SETMASK */ - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -/* - * ------------------------------------------------------------- - * - * POSIX 1003.1-2001 Options - * ========================= - * - * Options are normally set in , which is not provided - * with pthreads-win32. - * - * For conformance with the Single Unix Specification (version 3), all of the - * options below are defined, and have a value of either -1 (not supported) - * or 200112L (supported). - * - * These options can neither be left undefined nor have a value of 0, because - * either indicates that sysconf(), which is not implemented, may be used at - * runtime to check the status of the option. - * - * _POSIX_THREADS (== 200112L) - * If == 200112L, you can use threads - * - * _POSIX_THREAD_ATTR_STACKSIZE (== 200112L) - * If == 200112L, you can control the size of a thread's - * stack - * pthread_attr_getstacksize - * pthread_attr_setstacksize - * - * _POSIX_THREAD_ATTR_STACKADDR (== -1) - * If == 200112L, you can allocate and control a thread's - * stack. If not supported, the following functions - * will return ENOSYS, indicating they are not - * supported: - * pthread_attr_getstackaddr - * pthread_attr_setstackaddr - * - * _POSIX_THREAD_PRIORITY_SCHEDULING (== -1) - * If == 200112L, you can use realtime scheduling. - * This option indicates that the behaviour of some - * implemented functions conforms to the additional TPS - * requirements in the standard. E.g. rwlocks favour - * writers over readers when threads have equal priority. - * - * _POSIX_THREAD_PRIO_INHERIT (== -1) - * If == 200112L, you can create priority inheritance - * mutexes. - * pthread_mutexattr_getprotocol + - * pthread_mutexattr_setprotocol + - * - * _POSIX_THREAD_PRIO_PROTECT (== -1) - * If == 200112L, you can create priority ceiling mutexes - * Indicates the availability of: - * pthread_mutex_getprioceiling - * pthread_mutex_setprioceiling - * pthread_mutexattr_getprioceiling - * pthread_mutexattr_getprotocol + - * pthread_mutexattr_setprioceiling - * pthread_mutexattr_setprotocol + - * - * _POSIX_THREAD_PROCESS_SHARED (== -1) - * If set, you can create mutexes and condition - * variables that can be shared with another - * process.If set, indicates the availability - * of: - * pthread_mutexattr_getpshared - * pthread_mutexattr_setpshared - * pthread_condattr_getpshared - * pthread_condattr_setpshared - * - * _POSIX_THREAD_SAFE_FUNCTIONS (== 200112L) - * If == 200112L you can use the special *_r library - * functions that provide thread-safe behaviour - * - * _POSIX_READER_WRITER_LOCKS (== 200112L) - * If == 200112L, you can use read/write locks - * - * _POSIX_SPIN_LOCKS (== 200112L) - * If == 200112L, you can use spin locks - * - * _POSIX_BARRIERS (== 200112L) - * If == 200112L, you can use barriers - * - * + These functions provide both 'inherit' and/or - * 'protect' protocol, based upon these macro - * settings. - * - * ------------------------------------------------------------- - */ - -/* - * POSIX Options - */ -#undef _POSIX_THREADS -#define _POSIX_THREADS 200112L - -#undef _POSIX_READER_WRITER_LOCKS -#define _POSIX_READER_WRITER_LOCKS 200112L - -#undef _POSIX_SPIN_LOCKS -#define _POSIX_SPIN_LOCKS 200112L - -#undef _POSIX_BARRIERS -#define _POSIX_BARRIERS 200112L - -#undef _POSIX_THREAD_SAFE_FUNCTIONS -#define _POSIX_THREAD_SAFE_FUNCTIONS 200112L - -#undef _POSIX_THREAD_ATTR_STACKSIZE -#define _POSIX_THREAD_ATTR_STACKSIZE 200112L - -/* - * The following options are not supported - */ -#undef _POSIX_THREAD_ATTR_STACKADDR -#define _POSIX_THREAD_ATTR_STACKADDR -1 - -#undef _POSIX_THREAD_PRIO_INHERIT -#define _POSIX_THREAD_PRIO_INHERIT -1 - -#undef _POSIX_THREAD_PRIO_PROTECT -#define _POSIX_THREAD_PRIO_PROTECT -1 - -/* TPS is not fully supported. */ -#undef _POSIX_THREAD_PRIORITY_SCHEDULING -#define _POSIX_THREAD_PRIORITY_SCHEDULING -1 - -#undef _POSIX_THREAD_PROCESS_SHARED -#define _POSIX_THREAD_PROCESS_SHARED -1 - - -/* - * POSIX 1003.1-2001 Limits - * =========================== - * - * These limits are normally set in , which is not provided with - * pthreads-win32. - * - * PTHREAD_DESTRUCTOR_ITERATIONS - * Maximum number of attempts to destroy - * a thread's thread-specific data on - * termination (must be at least 4) - * - * PTHREAD_KEYS_MAX - * Maximum number of thread-specific data keys - * available per process (must be at least 128) - * - * PTHREAD_STACK_MIN - * Minimum supported stack size for a thread - * - * PTHREAD_THREADS_MAX - * Maximum number of threads supported per - * process (must be at least 64). - * - * SEM_NSEMS_MAX - * The maximum number of semaphores a process can have. - * (must be at least 256) - * - * SEM_VALUE_MAX - * The maximum value a semaphore can have. - * (must be at least 32767) - * - */ -#undef _POSIX_THREAD_DESTRUCTOR_ITERATIONS -#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4 - -#undef PTHREAD_DESTRUCTOR_ITERATIONS -#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS - -#undef _POSIX_THREAD_KEYS_MAX -#define _POSIX_THREAD_KEYS_MAX 128 - -#undef PTHREAD_KEYS_MAX -#define PTHREAD_KEYS_MAX _POSIX_THREAD_KEYS_MAX - -#undef PTHREAD_STACK_MIN -#define PTHREAD_STACK_MIN 0 - -#undef _POSIX_THREAD_THREADS_MAX -#define _POSIX_THREAD_THREADS_MAX 64 - - /* Arbitrary value */ -#undef PTHREAD_THREADS_MAX -#define PTHREAD_THREADS_MAX 2019 - -#undef _POSIX_SEM_NSEMS_MAX -#define _POSIX_SEM_NSEMS_MAX 256 - - /* Arbitrary value */ -#undef SEM_NSEMS_MAX -#define SEM_NSEMS_MAX 1024 - -#undef _POSIX_SEM_VALUE_MAX -#define _POSIX_SEM_VALUE_MAX 32767 - -#undef SEM_VALUE_MAX -#define SEM_VALUE_MAX INT_MAX - - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifndef PTW32_STATIC_LIB -# ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -# else -# define PTW32_DLLPORT __declspec (dllimport) -# endif -#else -# define PTW32_DLLPORT -#endif - -/* - * The Open Watcom C/C++ compiler uses a non-standard calling convention - * that passes function args in registers unless __cdecl is explicitly specified - * in exposed function prototypes. - * - * We force all calls to cdecl even though this could slow Watcom code down - * slightly. If you know that the Watcom compiler will be used to build both - * the DLL and application, then you can probably define this as a null string. - * Remember that pthread.h (this file) is used for both the DLL and application builds. - */ -#define PTW32_CDECL __cdecl - -#if defined(_UWIN) && PTW32_LEVEL >= PTW32_LEVEL_MAX -# include -#else -/* - * Generic handle type - intended to extend uniqueness beyond - * that available with a simple pointer. It should scale for either - * IA-32 or IA-64. - */ -typedef struct { - void * p; /* Pointer to actual object */ - unsigned int x; /* Extra information - reuse count etc */ -} ptw32_handle_t; - -typedef ptw32_handle_t pthread_t; -typedef struct pthread_attr_t_ * pthread_attr_t; -typedef struct pthread_once_t_ pthread_once_t; -typedef struct pthread_key_t_ * pthread_key_t; -typedef struct pthread_mutex_t_ * pthread_mutex_t; -typedef struct pthread_mutexattr_t_ * pthread_mutexattr_t; -typedef struct pthread_cond_t_ * pthread_cond_t; -typedef struct pthread_condattr_t_ * pthread_condattr_t; -#endif -typedef struct pthread_rwlock_t_ * pthread_rwlock_t; -typedef struct pthread_rwlockattr_t_ * pthread_rwlockattr_t; -typedef struct pthread_spinlock_t_ * pthread_spinlock_t; -typedef struct pthread_barrier_t_ * pthread_barrier_t; -typedef struct pthread_barrierattr_t_ * pthread_barrierattr_t; - -/* - * ==================== - * ==================== - * POSIX Threads - * ==================== - * ==================== - */ - -enum { -/* - * pthread_attr_{get,set}detachstate - */ - PTHREAD_CREATE_JOINABLE = 0, /* Default */ - PTHREAD_CREATE_DETACHED = 1, - -/* - * pthread_attr_{get,set}inheritsched - */ - PTHREAD_INHERIT_SCHED = 0, - PTHREAD_EXPLICIT_SCHED = 1, /* Default */ - -/* - * pthread_{get,set}scope - */ - PTHREAD_SCOPE_PROCESS = 0, - PTHREAD_SCOPE_SYSTEM = 1, /* Default */ - -/* - * pthread_setcancelstate paramters - */ - PTHREAD_CANCEL_ENABLE = 0, /* Default */ - PTHREAD_CANCEL_DISABLE = 1, - -/* - * pthread_setcanceltype parameters - */ - PTHREAD_CANCEL_ASYNCHRONOUS = 0, - PTHREAD_CANCEL_DEFERRED = 1, /* Default */ - -/* - * pthread_mutexattr_{get,set}pshared - * pthread_condattr_{get,set}pshared - */ - PTHREAD_PROCESS_PRIVATE = 0, - PTHREAD_PROCESS_SHARED = 1, - -/* - * pthread_barrier_wait - */ - PTHREAD_BARRIER_SERIAL_THREAD = -1 -}; - -/* - * ==================== - * ==================== - * Cancelation - * ==================== - * ==================== - */ -#define PTHREAD_CANCELED ((void *) -1) - - -/* - * ==================== - * ==================== - * Once Key - * ==================== - * ==================== - */ -#define PTHREAD_ONCE_INIT { PTW32_FALSE, 0, 0, 0} - -struct pthread_once_t_ -{ - int done; /* indicates if user function has been executed */ - void * lock; - int reserved1; - int reserved2; -}; - - -/* - * ==================== - * ==================== - * Object initialisers - * ==================== - * ==================== - */ -#define PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) -1) -#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER ((pthread_mutex_t) -2) -#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER ((pthread_mutex_t) -3) - -/* - * Compatibility with LinuxThreads - */ -#define PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP PTHREAD_RECURSIVE_MUTEX_INITIALIZER -#define PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP PTHREAD_ERRORCHECK_MUTEX_INITIALIZER - -#define PTHREAD_COND_INITIALIZER ((pthread_cond_t) -1) - -#define PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) -1) - -#define PTHREAD_SPINLOCK_INITIALIZER ((pthread_spinlock_t) -1) - - -/* - * Mutex types. - */ -enum -{ - /* Compatibility with LinuxThreads */ - PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_TIMED_NP = PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_ADAPTIVE_NP = PTHREAD_MUTEX_FAST_NP, - /* For compatibility with POSIX */ - PTHREAD_MUTEX_NORMAL = PTHREAD_MUTEX_FAST_NP, - PTHREAD_MUTEX_RECURSIVE = PTHREAD_MUTEX_RECURSIVE_NP, - PTHREAD_MUTEX_ERRORCHECK = PTHREAD_MUTEX_ERRORCHECK_NP, - PTHREAD_MUTEX_DEFAULT = PTHREAD_MUTEX_NORMAL -}; - - -typedef struct ptw32_cleanup_t ptw32_cleanup_t; - -#if defined(_MSC_VER) -/* Disable MSVC 'anachronism used' warning */ -#pragma warning( disable : 4229 ) -#endif - -typedef void (* PTW32_CDECL ptw32_cleanup_callback_t)(void *); - -#if defined(_MSC_VER) -#pragma warning( default : 4229 ) -#endif - -struct ptw32_cleanup_t -{ - ptw32_cleanup_callback_t routine; - void *arg; - struct ptw32_cleanup_t *prev; -}; - -#ifdef __CLEANUP_SEH - /* - * WIN32 SEH version of cancel cleanup. - */ - -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - ptw32_cleanup_t _cleanup; \ - \ - _cleanup.routine = (ptw32_cleanup_callback_t)(_rout); \ - _cleanup.arg = (_arg); \ - __try \ - { \ - -#define pthread_cleanup_pop( _execute ) \ - } \ - __finally \ - { \ - if( _execute || AbnormalTermination()) \ - { \ - (*(_cleanup.routine))( _cleanup.arg ); \ - } \ - } \ - } - -#else /* __CLEANUP_SEH */ - -#ifdef __CLEANUP_C - - /* - * C implementation of PThreads cancel cleanup - */ - -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - ptw32_cleanup_t _cleanup; \ - \ - ptw32_push_cleanup( &_cleanup, (ptw32_cleanup_callback_t) (_rout), (_arg) ); \ - -#define pthread_cleanup_pop( _execute ) \ - (void) ptw32_pop_cleanup( _execute ); \ - } - -#else /* __CLEANUP_C */ - -#ifdef __CLEANUP_CXX - - /* - * C++ version of cancel cleanup. - * - John E. Bossom. - */ - - class PThreadCleanup { - /* - * PThreadCleanup - * - * Purpose - * This class is a C++ helper class that is - * used to implement pthread_cleanup_push/ - * pthread_cleanup_pop. - * The destructor of this class automatically - * pops the pushed cleanup routine regardless - * of how the code exits the scope - * (i.e. such as by an exception) - */ - ptw32_cleanup_callback_t cleanUpRout; - void * obj; - int executeIt; - - public: - PThreadCleanup() : - cleanUpRout( 0 ), - obj( 0 ), - executeIt( 0 ) - /* - * No cleanup performed - */ - { - } - - PThreadCleanup( - ptw32_cleanup_callback_t routine, - void * arg ) : - cleanUpRout( routine ), - obj( arg ), - executeIt( 1 ) - /* - * Registers a cleanup routine for 'arg' - */ - { - } - - ~PThreadCleanup() - { - if ( executeIt && ((void *) cleanUpRout != (void *) 0) ) - { - (void) (*cleanUpRout)( obj ); - } - } - - void execute( int exec ) - { - executeIt = exec; - } - }; - - /* - * C++ implementation of PThreads cancel cleanup; - * This implementation takes advantage of a helper - * class who's destructor automatically calls the - * cleanup routine if we exit our scope weirdly - */ -#define pthread_cleanup_push( _rout, _arg ) \ - { \ - PThreadCleanup cleanup((ptw32_cleanup_callback_t)(_rout), \ - (void *) (_arg) ); - -#define pthread_cleanup_pop( _execute ) \ - cleanup.execute( _execute ); \ - } - -#else - -#error ERROR [__FILE__, line __LINE__]: Cleanup type undefined. - -#endif /* __CLEANUP_CXX */ - -#endif /* __CLEANUP_C */ - -#endif /* __CLEANUP_SEH */ - -/* - * =============== - * =============== - * Methods - * =============== - * =============== - */ - -/* - * PThread Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_attr_init (pthread_attr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_destroy (pthread_attr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getdetachstate (const pthread_attr_t * attr, - int *detachstate); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstackaddr (const pthread_attr_t * attr, - void **stackaddr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getstacksize (const pthread_attr_t * attr, - size_t * stacksize); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setdetachstate (pthread_attr_t * attr, - int detachstate); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstackaddr (pthread_attr_t * attr, - void *stackaddr); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setstacksize (pthread_attr_t * attr, - size_t stacksize); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedparam (const pthread_attr_t *attr, - struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedparam (pthread_attr_t *attr, - const struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setschedpolicy (pthread_attr_t *, - int); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getschedpolicy (pthread_attr_t *, - int *); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setinheritsched(pthread_attr_t * attr, - int inheritsched); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getinheritsched(pthread_attr_t * attr, - int * inheritsched); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_setscope (pthread_attr_t *, - int); - -PTW32_DLLPORT int PTW32_CDECL pthread_attr_getscope (const pthread_attr_t *, - int *); - -/* - * PThread Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_create (pthread_t * tid, - const pthread_attr_t * attr, - void *(*start) (void *), - void *arg); - -PTW32_DLLPORT int PTW32_CDECL pthread_detach (pthread_t tid); - -PTW32_DLLPORT int PTW32_CDECL pthread_equal (pthread_t t1, - pthread_t t2); - -PTW32_DLLPORT void PTW32_CDECL pthread_exit (void *value_ptr); - -PTW32_DLLPORT int PTW32_CDECL pthread_join (pthread_t thread, - void **value_ptr); - -PTW32_DLLPORT pthread_t PTW32_CDECL pthread_self (void); - -PTW32_DLLPORT int PTW32_CDECL pthread_cancel (pthread_t thread); - -PTW32_DLLPORT int PTW32_CDECL pthread_setcancelstate (int state, - int *oldstate); - -PTW32_DLLPORT int PTW32_CDECL pthread_setcanceltype (int type, - int *oldtype); - -PTW32_DLLPORT void PTW32_CDECL pthread_testcancel (void); - -PTW32_DLLPORT int PTW32_CDECL pthread_once (pthread_once_t * once_control, - void (*init_routine) (void)); - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -PTW32_DLLPORT ptw32_cleanup_t * PTW32_CDECL ptw32_pop_cleanup (int execute); - -PTW32_DLLPORT void PTW32_CDECL ptw32_push_cleanup (ptw32_cleanup_t * cleanup, - void (*routine) (void *), - void *arg); -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Thread Specific Data Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_key_create (pthread_key_t * key, - void (*destructor) (void *)); - -PTW32_DLLPORT int PTW32_CDECL pthread_key_delete (pthread_key_t key); - -PTW32_DLLPORT int PTW32_CDECL pthread_setspecific (pthread_key_t key, - const void *value); - -PTW32_DLLPORT void * PTW32_CDECL pthread_getspecific (pthread_key_t key); - - -/* - * Mutex Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_init (pthread_mutexattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_destroy (pthread_mutexattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getpshared (const pthread_mutexattr_t - * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setpshared (pthread_mutexattr_t * attr, - int pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_settype (pthread_mutexattr_t * attr, int kind); -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_gettype (pthread_mutexattr_t * attr, int *kind); - -/* - * Barrier Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_init (pthread_barrierattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_destroy (pthread_barrierattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_getpshared (const pthread_barrierattr_t - * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrierattr_setpshared (pthread_barrierattr_t * attr, - int pshared); - -/* - * Mutex Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_init (pthread_mutex_t * mutex, - const pthread_mutexattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_destroy (pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_lock (pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_timedlock(pthread_mutex_t *mutex, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_trylock (pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_mutex_unlock (pthread_mutex_t * mutex); - -/* - * Spinlock Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_spin_init (pthread_spinlock_t * lock, int pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_destroy (pthread_spinlock_t * lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_lock (pthread_spinlock_t * lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_trylock (pthread_spinlock_t * lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_spin_unlock (pthread_spinlock_t * lock); - -/* - * Barrier Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_barrier_init (pthread_barrier_t * barrier, - const pthread_barrierattr_t * attr, - unsigned int count); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrier_destroy (pthread_barrier_t * barrier); - -PTW32_DLLPORT int PTW32_CDECL pthread_barrier_wait (pthread_barrier_t * barrier); - -/* - * Condition Variable Attribute Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_init (pthread_condattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_destroy (pthread_condattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_getpshared (const pthread_condattr_t * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_condattr_setpshared (pthread_condattr_t * attr, - int pshared); - -/* - * Condition Variable Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_cond_init (pthread_cond_t * cond, - const pthread_condattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_destroy (pthread_cond_t * cond); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_wait (pthread_cond_t * cond, - pthread_mutex_t * mutex); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_timedwait (pthread_cond_t * cond, - pthread_mutex_t * mutex, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_signal (pthread_cond_t * cond); - -PTW32_DLLPORT int PTW32_CDECL pthread_cond_broadcast (pthread_cond_t * cond); - -/* - * Scheduling - */ -PTW32_DLLPORT int PTW32_CDECL pthread_setschedparam (pthread_t thread, - int policy, - const struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_getschedparam (pthread_t thread, - int *policy, - struct sched_param *param); - -PTW32_DLLPORT int PTW32_CDECL pthread_setconcurrency (int); - -PTW32_DLLPORT int PTW32_CDECL pthread_getconcurrency (void); - -/* - * Read-Write Lock Functions - */ -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_init(pthread_rwlock_t *lock, - const pthread_rwlockattr_t *attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_destroy(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_tryrdlock(pthread_rwlock_t *); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_trywrlock(pthread_rwlock_t *); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_rdlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedrdlock(pthread_rwlock_t *lock, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_wrlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_timedwrlock(pthread_rwlock_t *lock, - const struct timespec *abstime); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlock_unlock(pthread_rwlock_t *lock); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_init (pthread_rwlockattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_destroy (pthread_rwlockattr_t * attr); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_getpshared (const pthread_rwlockattr_t * attr, - int *pshared); - -PTW32_DLLPORT int PTW32_CDECL pthread_rwlockattr_setpshared (pthread_rwlockattr_t * attr, - int pshared); - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 - -/* - * Signal Functions. Should be defined in but MSVC and MinGW32 - * already have signal.h that don't define these. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_kill(pthread_t thread, int sig); - -/* - * Non-portable functions - */ - -/* - * Compatibility with Linux. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_setkind_np(pthread_mutexattr_t * attr, - int kind); -PTW32_DLLPORT int PTW32_CDECL pthread_mutexattr_getkind_np(pthread_mutexattr_t * attr, - int *kind); - -/* - * Possibly supported by other POSIX threads implementations - */ -PTW32_DLLPORT int PTW32_CDECL pthread_delay_np (struct timespec * interval); -PTW32_DLLPORT int PTW32_CDECL pthread_num_processors_np(void); - -/* - * Useful if an application wants to statically link - * the lib rather than load the DLL at run-time. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_attach_np(void); -PTW32_DLLPORT int PTW32_CDECL pthread_win32_process_detach_np(void); -PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_attach_np(void); -PTW32_DLLPORT int PTW32_CDECL pthread_win32_thread_detach_np(void); - -/* - * Features that are auto-detected at load/run time. - */ -PTW32_DLLPORT int PTW32_CDECL pthread_win32_test_features_np(int); -enum ptw32_features { - PTW32_SYSTEM_INTERLOCKED_COMPARE_EXCHANGE = 0x0001, /* System provides it. */ - PTW32_ALERTABLE_ASYNC_CANCEL = 0x0002 /* Can cancel blocked threads. */ -}; - -/* - * Register a system time change with the library. - * Causes the library to perform various functions - * in response to the change. Should be called whenever - * the application's top level window receives a - * WM_TIMECHANGE message. It can be passed directly to - * pthread_create() as a new thread if desired. - */ -PTW32_DLLPORT void * PTW32_CDECL pthread_timechange_handler_np(void *); - -#endif /*PTW32_LEVEL >= PTW32_LEVEL_MAX - 1 */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - -/* - * Returns the Win32 HANDLE for the POSIX thread. - */ -PTW32_DLLPORT HANDLE PTW32_CDECL pthread_getw32threadhandle_np(pthread_t thread); - - -/* - * Protected Methods - * - * This function blocks until the given WIN32 handle - * is signaled or pthread_cancel had been called. - * This function allows the caller to hook into the - * PThreads cancel mechanism. It is implemented using - * - * WaitForMultipleObjects - * - * on 'waitHandle' and a manually reset WIN32 Event - * used to implement pthread_cancel. The 'timeout' - * argument to TimedWait is simply passed to - * WaitForMultipleObjects. - */ -PTW32_DLLPORT int PTW32_CDECL pthreadCancelableWait (HANDLE waitHandle); -PTW32_DLLPORT int PTW32_CDECL pthreadCancelableTimedWait (HANDLE waitHandle, - DWORD timeout); - -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -/* - * Thread-Safe C Runtime Library Mappings. - */ -#ifndef _UWIN -# if defined(NEED_ERRNO) - PTW32_DLLPORT int * PTW32_CDECL _errno( void ); -# else -# ifndef errno -# if (defined(_MT) || defined(_DLL)) - __declspec(dllimport) extern int * __cdecl _errno(void); -# define errno (*_errno()) -# endif -# endif -# endif -#endif - -/* - * WIN32 C runtime library had been made thread-safe - * without affecting the user interface. Provide - * mappings from the UNIX thread-safe versions to - * the standard C runtime library calls. - * Only provide function mappings for functions that - * actually exist on WIN32. - */ - -#if !defined(__MINGW32__) -#define strtok_r( _s, _sep, _lasts ) \ - ( *(_lasts) = strtok( (_s), (_sep) ) ) -#endif /* !__MINGW32__ */ - -#define asctime_r( _tm, _buf ) \ - ( strcpy( (_buf), asctime( (_tm) ) ), \ - (_buf) ) - -#define ctime_r( _clock, _buf ) \ - ( strcpy( (_buf), ctime( (_clock) ) ), \ - (_buf) ) - -#define gmtime_r( _clock, _result ) \ - ( *(_result) = *gmtime( (_clock) ), \ - (_result) ) - -#define localtime_r( _clock, _result ) \ - ( *(_result) = *localtime( (_clock) ), \ - (_result) ) - -#define rand_r( _seed ) \ - ( _seed == _seed? rand() : rand() ) - - -/* - * Some compiler environments don't define some things. - */ -#if defined(__BORLANDC__) -# define _ftime ftime -# define _timeb timeb -#endif - -#ifdef __cplusplus - -/* - * Internal exceptions - */ -class ptw32_exception {}; -class ptw32_exception_cancel : public ptw32_exception {}; -class ptw32_exception_exit : public ptw32_exception {}; - -#endif - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX - -/* FIXME: This is only required if the library was built using SEH */ -/* - * Get internal SEH tag - */ -PTW32_DLLPORT DWORD PTW32_CDECL ptw32_get_exception_services_code(void); - -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#ifndef PTW32_BUILD - -#ifdef __CLEANUP_SEH - -/* - * Redefine the SEH __except keyword to ensure that applications - * propagate our internal exceptions up to the library's internal handlers. - */ -#define __except( E ) \ - __except( ( GetExceptionCode() == ptw32_get_exception_services_code() ) \ - ? EXCEPTION_CONTINUE_SEARCH : ( E ) ) - -#endif /* __CLEANUP_SEH */ - -#ifdef __CLEANUP_CXX - -/* - * Redefine the C++ catch keyword to ensure that applications - * propagate our internal exceptions up to the library's internal handlers. - */ -#ifdef _MSC_VER - /* - * WARNING: Replace any 'catch( ... )' with 'PtW32CatchAll' - * if you want Pthread-Win32 cancelation and pthread_exit to work. - */ - -#ifndef PtW32NoCatchWarn - -#pragma message("Specify \"/DPtW32NoCatchWarn\" compiler flag to skip this message.") -#pragma message("------------------------------------------------------------------") -#pragma message("When compiling applications with MSVC++ and C++ exception handling:") -#pragma message(" Replace any 'catch( ... )' in routines called from POSIX threads") -#pragma message(" with 'PtW32CatchAll' or 'CATCHALL' if you want POSIX thread") -#pragma message(" cancelation and pthread_exit to work. For example:") -#pragma message("") -#pragma message(" #ifdef PtW32CatchAll") -#pragma message(" PtW32CatchAll") -#pragma message(" #else") -#pragma message(" catch(...)") -#pragma message(" #endif") -#pragma message(" {") -#pragma message(" /* Catchall block processing */") -#pragma message(" }") -#pragma message("------------------------------------------------------------------") - -#endif - -#define PtW32CatchAll \ - catch( ptw32_exception & ) { throw; } \ - catch( ... ) - -#else /* _MSC_VER */ - -#define catch( E ) \ - catch( ptw32_exception & ) { throw; } \ - catch( E ) - -#endif /* _MSC_VER */ - -#endif /* __CLEANUP_CXX */ - -#endif /* ! PTW32_BUILD */ - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#ifdef PTW32__HANDLE_DEF -# undef HANDLE -#endif -#ifdef PTW32__DWORD_DEF -# undef DWORD -#endif - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* ! RC_INVOKED */ - -#endif /* PTHREAD_H */ diff --git a/lib/libPlatform/pthread_win32/pthreadVC2.lib b/lib/libPlatform/pthread_win32/pthreadVC2.lib deleted file mode 100644 index bc36770d52c3a..0000000000000 Binary files a/lib/libPlatform/pthread_win32/pthreadVC2.lib and /dev/null differ diff --git a/lib/libPlatform/pthread_win32/pthreadVC2d.lib b/lib/libPlatform/pthread_win32/pthreadVC2d.lib deleted file mode 100644 index 0df71c7dfbf37..0000000000000 Binary files a/lib/libPlatform/pthread_win32/pthreadVC2d.lib and /dev/null differ diff --git a/lib/libPlatform/pthread_win32/sched.h b/lib/libPlatform/pthread_win32/sched.h deleted file mode 100644 index dfb8e934af45b..0000000000000 --- a/lib/libPlatform/pthread_win32/sched.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Module: sched.h - * - * Purpose: - * Provides an implementation of POSIX realtime extensions - * as defined in - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ -#ifndef _SCHED_H -#define _SCHED_H - -#undef PTW32_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifndef PTW32_STATIC_LIB -# ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -# else -# define PTW32_DLLPORT __declspec (dllimport) -# endif -#else -# define PTW32_DLLPORT -#endif - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#if defined(__MINGW32__) || defined(_UWIN) -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -/* For pid_t */ -# include -/* Required by Unix 98 */ -# include -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ -#else -typedef int pid_t; -#endif - -/* Thread scheduling policies */ - -enum { - SCHED_OTHER = 0, - SCHED_FIFO, - SCHED_RR, - SCHED_MIN = SCHED_OTHER, - SCHED_MAX = SCHED_RR -}; - -struct sched_param { - int sched_priority; -}; - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -PTW32_DLLPORT int __cdecl sched_yield (void); - -PTW32_DLLPORT int __cdecl sched_get_priority_min (int policy); - -PTW32_DLLPORT int __cdecl sched_get_priority_max (int policy); - -PTW32_DLLPORT int __cdecl sched_setscheduler (pid_t pid, int policy); - -PTW32_DLLPORT int __cdecl sched_getscheduler (pid_t pid); - -/* - * Note that this macro returns ENOTSUP rather than - * ENOSYS as might be expected. However, returning ENOSYS - * should mean that sched_get_priority_{min,max} are - * not implemented as well as sched_rr_get_interval. - * This is not the case, since we just don't support - * round-robin scheduling. Therefore I have chosen to - * return the same value as sched_setscheduler when - * SCHED_RR is passed to it. - */ -#define sched_rr_get_interval(_pid, _interval) \ - ( errno = ENOTSUP, (int) -1 ) - - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* !_SCHED_H */ - diff --git a/lib/libPlatform/pthread_win32/semaphore.h b/lib/libPlatform/pthread_win32/semaphore.h deleted file mode 100644 index a3330a6388dc9..0000000000000 --- a/lib/libPlatform/pthread_win32/semaphore.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Module: semaphore.h - * - * Purpose: - * Semaphores aren't actually part of the PThreads standard. - * They are defined by the POSIX Standard: - * - * POSIX 1003.1b-1993 (POSIX.1b) - * - * -------------------------------------------------------------------------- - * - * Pthreads-win32 - POSIX Threads Library for Win32 - * Copyright(C) 1998 John E. Bossom - * Copyright(C) 1999,2005 Pthreads-win32 contributors - * - * Contact Email: rpj@callisto.canberra.edu.au - * - * The current list of contributors is contained - * in the file CONTRIBUTORS included with the source - * code distribution. The list can also be seen at the - * following World Wide Web location: - * http://sources.redhat.com/pthreads-win32/contributors.html - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library in the file COPYING.LIB; - * if not, write to the Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ -#if !defined( SEMAPHORE_H ) -#define SEMAPHORE_H - -#undef PTW32_LEVEL - -#if defined(_POSIX_SOURCE) -#define PTW32_LEVEL 0 -/* Early POSIX */ -#endif - -#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 199309 -#undef PTW32_LEVEL -#define PTW32_LEVEL 1 -/* Include 1b, 1c and 1d */ -#endif - -#if defined(INCLUDE_NP) -#undef PTW32_LEVEL -#define PTW32_LEVEL 2 -/* Include Non-Portable extensions */ -#endif - -#define PTW32_LEVEL_MAX 3 - -#if !defined(PTW32_LEVEL) -#define PTW32_LEVEL PTW32_LEVEL_MAX -/* Include everything */ -#endif - -#if __GNUC__ && ! defined (__declspec) -# error Please upgrade your GNU compiler to one that supports __declspec. -#endif - -/* - * When building the DLL code, you should define PTW32_BUILD so that - * the variables/functions are exported correctly. When using the DLL, - * do NOT define PTW32_BUILD, and then the variables/functions will - * be imported correctly. - */ -#ifndef PTW32_STATIC_LIB -# ifdef PTW32_BUILD -# define PTW32_DLLPORT __declspec (dllexport) -# else -# define PTW32_DLLPORT __declspec (dllimport) -# endif -#else -# define PTW32_DLLPORT -#endif - -/* - * This is a duplicate of what is in the autoconf config.h, - * which is only used when building the pthread-win32 libraries. - */ - -#ifndef PTW32_CONFIG_H -# if defined(WINCE) -# define NEED_ERRNO -# define NEED_SEM -# endif -# if defined(_UWIN) || defined(__MINGW32__) -# define HAVE_MODE_T -# endif -#endif - -/* - * - */ - -#if PTW32_LEVEL >= PTW32_LEVEL_MAX -#ifdef NEED_ERRNO -#include "need_errno.h" -#else -#include -#endif -#endif /* PTW32_LEVEL >= PTW32_LEVEL_MAX */ - -#define _POSIX_SEMAPHORES - -#ifdef __cplusplus -extern "C" -{ -#endif /* __cplusplus */ - -#ifndef HAVE_MODE_T -typedef unsigned int mode_t; -#endif - - -typedef struct sem_t_ * sem_t; - -PTW32_DLLPORT int __cdecl sem_init (sem_t * sem, - int pshared, - unsigned int value); - -PTW32_DLLPORT int __cdecl sem_destroy (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_trywait (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_wait (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_timedwait (sem_t * sem, - const struct timespec * abstime); - -PTW32_DLLPORT int __cdecl sem_post (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_post_multiple (sem_t * sem, - int count); - -PTW32_DLLPORT int __cdecl sem_open (const char * name, - int oflag, - mode_t mode, - unsigned int value); - -PTW32_DLLPORT int __cdecl sem_close (sem_t * sem); - -PTW32_DLLPORT int __cdecl sem_unlink (const char * name); - -PTW32_DLLPORT int __cdecl sem_getvalue (sem_t * sem, - int * sval); - -#ifdef __cplusplus -} /* End of extern "C" */ -#endif /* __cplusplus */ - -#undef PTW32_LEVEL -#undef PTW32_LEVEL_MAX - -#endif /* !SEMAPHORE_H */ diff --git a/lib/libPlatform/windows/os_windows.cpp b/lib/libPlatform/windows/os_windows.cpp deleted file mode 100644 index 81da955956473..0000000000000 --- a/lib/libPlatform/windows/os_windows.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2005-2011 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#include "os_windows.h" -#include - -int gettimeofday(struct timeval *pcur_time, struct timezone *tz) -{ - if (pcur_time == NULL) - { - SetLastError(EFAULT); - return -1; - } - struct _timeb current; - - _ftime(¤t); - - pcur_time->tv_sec = current.time; - pcur_time->tv_usec = current.millitm * 1000L; - if (tz) - { - tz->tz_minuteswest = current.timezone; /* minutes west of Greenwich */ - tz->tz_dsttime = current.dstflag; /* type of dst correction */ - } - return 0; -} diff --git a/lib/libPlatform/windows/os_windows.h b/lib/libPlatform/windows/os_windows.h deleted file mode 100644 index ae17d63b6537e..0000000000000 --- a/lib/libPlatform/windows/os_windows.h +++ /dev/null @@ -1,74 +0,0 @@ -#pragma once -/* - * Copyright (C) 2011 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#pragma warning(disable:4005) // Disable "warning C4005: '_WINSOCKAPI_' : macro redefinition" -#include -#pragma warning(default:4005) - -#include "../pthread_win32/pthread.h" - -#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS == 64 -# define __USE_FILE_OFFSET64 1 -#endif - -typedef signed __int32 int32_t; -typedef signed __int64 int64_t; -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; - -#if defined __USE_FILE_OFFSET64 -typedef int64_t off_t; -typedef uint64_t ino_t; -#endif - -#define usleep(t) Sleep((t)/1000) -#define snprintf _snprintf - -#include -#include -#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ -#pragma warning (push) -#endif -/* prevent inclusion of wingdi.h */ -#define NOGDI -#if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ -#pragma warning (pop) -#endif -#include -#include -#include - -struct timezone -{ - int tz_minuteswest; /* minutes west of Greenwich */ - int tz_dsttime; /* type of dst correction */ -}; - -/*! - \brief implements similar unix call under windows - \return 0 on success, -1 on failure (if pcur_time was NULL) - \param pcur_time points to a timeval structure, should not be NULL - \param tz points to a timezone structure, may be NULL - */ -extern int gettimeofday(struct timeval *pcur_time, struct timezone *tz); diff --git a/lib/libTcpSocket/Makefile b/lib/libTcpSocket/Makefile deleted file mode 100644 index a64b51594600f..0000000000000 --- a/lib/libTcpSocket/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -INCLUDES=-I. - -SRCS = linux/net_posix.c \ - -CFLAGS=-std=c99 -D_GNU_SOURCE -LIB=libTcpSocket.a - -include ../../Makefile.include --include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS))) diff --git a/lib/libTcpSocket/linux/net_posix.c b/lib/libTcpSocket/linux/net_posix.c deleted file mode 100644 index aa4ac83d2b20f..0000000000000 --- a/lib/libTcpSocket/linux/net_posix.c +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Networking under POSIX - * Copyright (C) 2007-2008 Andreas Öman - * Copyright (C) 2011 Team XBMC - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifdef __APPLE__ -/* Needed on Mac OS/X */ -#ifndef SOL_TCP -#define SOL_TCP IPPROTO_TCP -#endif -#include "OSXGNUReplacements.h" -#elif defined(__FreeBSD__) -#ifndef SOL_TCP -#define SOL_TCP IPPROTO_TCP -#endif -#else -#include -#endif -#include -#include -#include -#include -#include -#include - -#include "../os-dependent_socket.h" - -int -tcp_connect_poll(struct addrinfo* addr, socket_t fdSock, char *szErrbuf, size_t nErrbufSize, - int nTimeout) -{ - int nRes, nErr = 0; - socklen_t errlen = sizeof(int); - - /* switch to non blocking */ - fcntl(fdSock, F_SETFL, fcntl(fdSock, F_GETFL) | O_NONBLOCK); - - /* connect to the other side */ - nRes = connect(fdSock, addr->ai_addr, addr->ai_addrlen); - - /* poll until a connection is established */ - if (nRes == -1) - { - if (errno == EINPROGRESS) - { - struct pollfd pfd; - pfd.fd = fdSock; - pfd.events = POLLOUT; - pfd.revents = 0; - - nRes = poll(&pfd, 1, nTimeout); - if (nRes == 0) - { - snprintf(szErrbuf, nErrbufSize, "attempt timed out after %d milliseconds", nTimeout); - return SOCKET_ERROR; - } - else if (nRes == -1) - { - snprintf(szErrbuf, nErrbufSize, "poll() error '%s'", strerror(errno)); - return SOCKET_ERROR; - } - - /* check for errors */ - getsockopt(fdSock, SOL_SOCKET, SO_ERROR, (void *)&nErr, &errlen); - } - else - { - nErr = errno; - } - } - - if (nErr != 0) - { - snprintf(szErrbuf, nErrbufSize, "%s", strerror(nErr)); - return SOCKET_ERROR; - } - - /* switch back to blocking */ - fcntl(fdSock, F_SETFL, fcntl(fdSock, F_GETFL) & ~O_NONBLOCK); - - return 0; -} - -socket_t -tcp_connect_addr(struct addrinfo* addr, char *szErrbuf, size_t nErrbufSize, - int nTimeout) -{ - int nVal; - socket_t fdSock; - - /* create the socket */ - fdSock = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); - if (fdSock == -1) - { - snprintf(szErrbuf, nErrbufSize, "Unable to create socket: %s", strerror(errno)); - return SOCKET_ERROR; - } - - /* connect to the socket */ - if (tcp_connect_poll(addr, fdSock, szErrbuf, nErrbufSize, nTimeout) != 0) - { - close(fdSock); - return SOCKET_ERROR; - } - - /* set TCP_NODELAY socket option */ - nVal = 1; - setsockopt(fdSock, SOL_TCP, TCP_NODELAY, &nVal, sizeof(nVal)); - - return fdSock; -} - -socket_t -tcp_connect(const char *szHostname, int nPort, char *szErrbuf, size_t nErrbufSize, - int nTimeout) -{ - struct addrinfo hints; - struct addrinfo *result, *addr; - char service[33]; - int nRes; - socket_t fdSock = INVALID_SOCKET; - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - sprintf(service, "%d", nPort); - - nRes = getaddrinfo(szHostname, service, &hints, &result); - if (nRes) - { - switch(nRes) - { - case EAI_NONAME: - snprintf(szErrbuf, nErrbufSize, "the specified host is unknown"); - break; - - case EAI_FAIL: - snprintf(szErrbuf, nErrbufSize, "a nonrecoverable failure in name resolution occurred"); - break; - - case EAI_MEMORY: - snprintf(szErrbuf, nErrbufSize, "a memory allocation failure occurred"); - break; - - case EAI_AGAIN: - snprintf(szErrbuf, nErrbufSize, "a temporary error occurred on an authoritative name server"); - break; - - default: - snprintf(szErrbuf, nErrbufSize, "unknown error %d", nRes); - break; - } - - return SOCKET_ERROR; - } - - for(addr = result; addr; addr = addr->ai_next) - { - fdSock = tcp_connect_addr(addr, szErrbuf, nErrbufSize, nTimeout); - if (fdSock != INVALID_SOCKET) - break; - } - - freeaddrinfo(result); - return fdSock; -} - -int -tcp_read(socket_t fdSock, void *buf, size_t nLen) -{ - int x = recv(fdSock, buf, nLen, MSG_WAITALL); - - if (x == -1) - return errno; - if (x != (int)nLen) - return ECONNRESET; - - return 0; -} - -int -tcp_read_timeout(socket_t fdSock, void *buf, size_t nLen, int nTimeout) -{ - int x, tot = 0; - struct pollfd fds; - - if (nTimeout <= 0 || fdSock == INVALID_SOCKET) - return EINVAL; - - fds.fd = fdSock; - fds.events = POLLIN; - fds.revents = 0; - - while(tot != (int)nLen) - { - x = poll(&fds, 1, nTimeout); - if (x == 0) - return ETIMEDOUT; - - x = recv(fdSock, buf + tot, nLen - tot, MSG_DONTWAIT); - if (x == -1) - { - if (errno == EAGAIN) - continue; - return errno; - } - - if (x == 0) - return ECONNRESET; - - tot += x; - } - return 0; -} - -void -tcp_close(socket_t fdSock) -{ - if (fdSock != SOCKET_ERROR) - close(fdSock); -} - -void -tcp_shutdown(socket_t fdSock) -{ - if (fdSock != SOCKET_ERROR) - shutdown(fdSock, SHUT_RDWR); -} - -int -tcp_send(socket_t fdSock, void *buf, int len, int flags) -{ - if (fdSock != SOCKET_ERROR) - return (int) send(fdSock, buf, len, flags); // safe since "len" is an int - else - return -1; -} diff --git a/lib/libTcpSocket/linux/net_posix.h b/lib/libTcpSocket/linux/net_posix.h deleted file mode 100644 index e99b2666075e8..0000000000000 --- a/lib/libTcpSocket/linux/net_posix.h +++ /dev/null @@ -1,33 +0,0 @@ -#pragma once -/* - * Copyright (C) 2011 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -#define _FILE_OFFSET_BITS 64 -#include -#include -#include -#include -#include -#include -#include -#include -#include - -typedef int socket_t; -typedef socket_t SOCKET; diff --git a/lib/libTcpSocket/os-dependent_socket.h b/lib/libTcpSocket/os-dependent_socket.h deleted file mode 100644 index ade4121f056e3..0000000000000 --- a/lib/libTcpSocket/os-dependent_socket.h +++ /dev/null @@ -1,95 +0,0 @@ -#pragma once -/* - * Networking - * Copyright (C) 2007-2008 Andreas Öman - * Copyright (C) 2011 Team XBMC - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#if defined _MSC_VER || defined(_WIN32) || defined(_WIN64) -#ifndef __WINDOWS__ -#define __WINDOWS__ -#endif -#endif - -#ifndef INVALID_SOCKET -#define INVALID_SOCKET (-1) -#endif -#ifndef SOCKET_ERROR -#define SOCKET_ERROR (-1) -#endif - -#if defined(__WINDOWS__) -#include "windows/net_winsock.h" -#else -#include "linux/net_posix.h" -#endif - -#include -#include - -/*! - * @brief Establish a TCP connection to the specified host and portnumber. - * @param szHostname The name or ip address of the host to connect to. - * @param nPort The port number to connect to. - * @param szErrbuf Buffer to write an error message to. - * @param nErrbufSize The size of the error buffer. - * @param nTimeout The connection timeout in milliseconds. - * @return valid socket_t file descriptor on success, or INVALID_SOCKET / SOCKET_ERROR on failure. - */ -socket_t tcp_connect(const char *szHostname, int nPort, char *szErrbuf, - size_t nErrbufSize, int nTimeout); - -/*! - * @brief Read data from a socket opened with tcp_connect. - * @param fdSock The socket to read from. - * @param buf The buffer to write the received data to. - * @param nLen The length of the buffer. - * @return 0 on success, or the error number on error. - */ -int tcp_read(socket_t fdSock, void *buf, size_t nLen); - -/*! - * @brief Read from a socket opened with tcp_connect. - * @param fdSock The socket to read from. - * @param buf The buffer to write the received data to. - * @param nLen The length of the buffer. - * @param nTimeout The timeout in milliseconds. - * @return 0 on success, or the error number on error. - */ -int tcp_read_timeout(socket_t fdSock, void *buf, size_t nLen, int nTimeout); - -/*! - * @brief Close a socket connection opened with tcp_connect. - * @param fdSock The socket to close. - */ -void tcp_close(socket_t fdSock); - -/*! - * @brief Shutdown a socket connection opened with tcp_connect. - * @param fdSock The socket to shutdown. - */ -void tcp_shutdown(socket_t fdSock); - -/*! - * @brief Send data over a tcp socket opened with tcp_connect. - * @param fdSock The socket to write to. - * @param buf The buffer to write to the socket. - * @param len The length of the buffer. - * @param flags The flags to provide to send(). - * @return The number of bytes written. - */ -int tcp_send(socket_t fdSock, void *buf, int len, int flags); diff --git a/lib/libTcpSocket/project/libTcpSocket_2010.vcxproj b/lib/libTcpSocket/project/libTcpSocket_2010.vcxproj deleted file mode 100644 index 5c1b284e2abec..0000000000000 --- a/lib/libTcpSocket/project/libTcpSocket_2010.vcxproj +++ /dev/null @@ -1,94 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - - - - - - - - libTcpSocket - {0F78AAF3-A188-4491-8BA6-203DC0B8D7F5} - libTcpSocket - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)libs\$(TargetName)\$(Configuration)\ - $(SolutionDir)objs\$(TargetName)\$(Configuration)\ - $(SolutionDir)libs\$(TargetName)\$(Configuration)\ - $(SolutionDir)objs\$(TargetName)\$(Configuration)\ - - - - Disabled - $(ProjectDir)include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - true - Default - MultiThreadedDebug - - - Level3 - EditAndContinue - - - %(IgnoreSpecificDefaultLibraries) - - - - - MaxSpeed - true - $(ProjectDir)include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - - - MultiThreaded - true - - - Level3 - ProgramDatabase - - - true - - - - - - \ No newline at end of file diff --git a/lib/libTcpSocket/project/libTcpSocket_2010.vcxproj.filters b/lib/libTcpSocket/project/libTcpSocket_2010.vcxproj.filters deleted file mode 100644 index 469a68ab3e69e..0000000000000 --- a/lib/libTcpSocket/project/libTcpSocket_2010.vcxproj.filters +++ /dev/null @@ -1,30 +0,0 @@ - - - - - {b33e3ace-f8ae-4a71-acc0-8c5156b4981f} - - - {cc151dfb-0b0b-4c7a-b72a-6091b45d0ca6} - - - {066355e2-1c6b-4a5c-ae49-c8a5f0d49065} - - - {8cfd9b02-2a3e-4bd1-a5f8-863068fb56be} - - - - - Header Files - - - Header Files\windows - - - - - Source Files\windows - - - \ No newline at end of file diff --git a/lib/libTcpSocket/windows/net_winsock.c b/lib/libTcpSocket/windows/net_winsock.c deleted file mode 100644 index c810a1bc66ab6..0000000000000 --- a/lib/libTcpSocket/windows/net_winsock.c +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Networking under WINDOWS - * Copyright (C) 2007-2008 Andreas Öman - * Copyright (C) 2007-2008 Joakim Plate - * Copyright (C) 2011 Team XBMC - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include -#include -#include -#include -#include - -#include "../os-dependent_socket.h" - -static int socket_errno() -{ - int error = WSAGetLastError(); - switch(error) - { - case WSAEINPROGRESS: return EINPROGRESS; - case WSAECONNRESET : return ECONNRESET; - case WSAETIMEDOUT : return ETIMEDOUT; - case WSAEWOULDBLOCK: return EAGAIN; - default : return error; - } -} - -#ifndef MSG_WAITALL -#define MSG_WAITALL 0x8 -#endif - -static int recv_fixed (__in SOCKET fdSock, __out_bcount_part(len, return) __out_data_source(NETWORK) char FAR *szBuf, __in int nLen, __in int nFlags) -{ - char* org = szBuf; - int nRes = 1; - - if ((nFlags & MSG_WAITALL) == 0) - return recv(fdSock, szBuf, nLen, nFlags); - - nFlags &= ~MSG_WAITALL; - while(nLen > 0 && nRes > 0) - { - nRes = recv(fdSock, szBuf, nLen, nFlags); - if (nRes < 0) - return nRes; - - szBuf += nRes; - nLen -= nRes; - } - return szBuf - org; -} - -int -tcp_connect_poll(struct addrinfo* addr, socket_t fdSock, char *szErrbuf, size_t nErrbufSize, - int nTimeout) -{ - int nRes, nErr = 0; - socklen_t errlen = sizeof(int); - - /* switch to non blocking */ - u_long nVal = 1; - ioctlsocket(fdSock, FIONBIO, &nVal); - - /* connect to the other side */ - nRes = connect(fdSock, addr->ai_addr, addr->ai_addrlen); - - /* poll until a connection is established */ - if (nRes == -1) - { - if (socket_errno() == EINPROGRESS || - socket_errno() == EAGAIN) - { - fd_set fd_write, fd_except; - struct timeval tv; - tv.tv_sec = nTimeout / 1000; - tv.tv_usec = 1000 * (nTimeout % 1000); - - FD_ZERO(&fd_write); - FD_ZERO(&fd_except); - FD_SET(fdSock, &fd_write); - FD_SET(fdSock, &fd_except); - - nRes = select(sizeof(fdSock)*8, NULL, &fd_write, &fd_except, &tv); - if (nRes == 0) - { - _snprintf(szErrbuf, nErrbufSize, "attempt timed out after %d milliseconds", nTimeout); - return SOCKET_ERROR; - } - - else if (nRes == -1) - { - _snprintf(szErrbuf, nErrbufSize, "select() error: %s", strerror(socket_errno())); - return SOCKET_ERROR; - } - - /* check for errors */ - getsockopt(fdSock, SOL_SOCKET, SO_ERROR, (char *)&nErr, &errlen); - } - else - { - nErr = socket_errno(); - } - } - - if (nErr != 0) - { - _snprintf(szErrbuf, nErrbufSize, "%s", strerror(nErr)); - return SOCKET_ERROR; - } - - nVal = 0; - ioctlsocket(fdSock, FIONBIO, &nVal); - - return 0; -} - -socket_t -tcp_connect_addr(struct addrinfo* addr, char *szErrbuf, size_t nErrbufSize, - int nTimeout) -{ - int nVal; - socket_t fdSock; - - /* create the socket */ - fdSock = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); - if (fdSock == -1) - { - _snprintf(szErrbuf, nErrbufSize, "Unable to create socket: %s", strerror(socket_errno())); - return SOCKET_ERROR; - } - - /* connect to the socket */ - if (tcp_connect_poll(addr, fdSock, szErrbuf, nErrbufSize, nTimeout) != 0) - { - closesocket(fdSock); - return SOCKET_ERROR; - } - - /* set TCP_NODELAY socket option */ - nVal = 1; - setsockopt(fdSock, IPPROTO_TCP, TCP_NODELAY, (const char*)&nVal, sizeof(nVal)); - - return fdSock; -} - -socket_t -tcp_connect(const char *szHostname, int nPort, char *szErrbuf, size_t nErrbufSize, - int nTimeout) -{ - struct addrinfo hints; - struct addrinfo *result, *addr; - char service[33]; - int nRes; - socket_t fdSock = INVALID_SOCKET; - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - sprintf(service, "%d", nPort); - - nRes = getaddrinfo(szHostname, service, &hints, &result); - if (nRes) - { - switch(nRes) - { - case EAI_NONAME: - _snprintf(szErrbuf, nErrbufSize, "the specified host is unknown"); - break; - - case EAI_FAIL: - _snprintf(szErrbuf, nErrbufSize, "a nonrecoverable failure in name resolution occurred"); - break; - - case EAI_MEMORY: - _snprintf(szErrbuf, nErrbufSize, "a memory allocation failure occurred"); - break; - - case EAI_AGAIN: - _snprintf(szErrbuf, nErrbufSize, "a temporary error occurred on an authoritative name server"); - break; - - default: - _snprintf(szErrbuf, nErrbufSize, "unknown error %d", nRes); - break; - } - - return SOCKET_ERROR; - } - - for(addr = result; addr; addr = addr->ai_next) - { - fdSock = tcp_connect_addr(addr, szErrbuf, nErrbufSize, nTimeout); - if (fdSock != INVALID_SOCKET) - break; - } - - freeaddrinfo(result); - return fdSock; -} - -int -tcp_read(socket_t fdSock, void *buf, size_t nLen) -{ - int x = recv_fixed(fdSock, (char *)buf, nLen, MSG_WAITALL); - - if (x == -1) - return socket_errno(); - if (x != (int)nLen) - return ECONNRESET; - - return 0; -} - -int -tcp_read_timeout(socket_t fdSock, void *buf, size_t nLen, int nTimeout) -{ - int x, tot = 0, nErr; - u_long nVal; - fd_set fd_read; - struct timeval tv; - - if (nTimeout <= 0) - return EINVAL; - - while(tot != (int)nLen) - { - tv.tv_sec = nTimeout / 1000; - tv.tv_usec = 1000 * (nTimeout % 1000); - - FD_ZERO(&fd_read); - FD_SET(fdSock, &fd_read); - - x = select(fdSock + 1, &fd_read, NULL, NULL, &tv); - - if (x == 0) - return ETIMEDOUT; - - nVal = 1; - ioctlsocket(fdSock, FIONBIO, &nVal); - - x = recv_fixed(fdSock, (char *)buf + tot, nLen - tot, 0); - nErr = socket_errno(); - nVal = 0; - ioctlsocket(fdSock, FIONBIO, &nVal); - - if (x == -1) - { - if (nErr == EAGAIN) - continue; - return nErr; - } - - if (x == 0) - return ECONNRESET; - - tot += x; - } - return 0; -} - -void -tcp_close(socket_t fdSock) -{ - if (fdSock != SOCKET_ERROR) - closesocket(fdSock); -} - -void -tcp_shutdown(socket_t fdSock) -{ - if (fdSock != SOCKET_ERROR) - shutdown(fdSock, SHUT_RDWR); -} - -int -tcp_send(socket_t fdSock, char *buf, int len, int flags) -{ - if (fdSock != SOCKET_ERROR) - return send(fdSock, buf, len, flags); - else - return -1; -} diff --git a/lib/libTcpSocket/windows/net_winsock.h b/lib/libTcpSocket/windows/net_winsock.h deleted file mode 100644 index 90246cc998611..0000000000000 --- a/lib/libTcpSocket/windows/net_winsock.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once -/* - * Copyright (C) 2011 Team XBMC - * http://www.xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, write to - * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * http://www.gnu.org/copyleft/gpl.html - * - */ - -#ifndef _WINSOCKAPI_ -#define _WINSOCKAPI_ -#endif -#pragma warning(disable:4005) // Disable "warning C4005: '_WINSOCKAPI_' : macro redefinition" -#include -#pragma warning(default:4005) -#include -#include -#include -#include - -#define SHUT_RDWR SD_BOTH - -#ifndef ETIMEDOUT -#define ETIMEDOUT 138 -#endif - -typedef SOCKET socket_t; -typedef int socklen_t; diff --git a/xbmc/pvrclients/MediaPortal/project/VS2010Express/XBMC_MPTV.vcxproj b/xbmc/pvrclients/MediaPortal/project/VS2010Express/XBMC_MPTV.vcxproj index e939da757e51c..408da3e97dd28 100644 --- a/xbmc/pvrclients/MediaPortal/project/VS2010Express/XBMC_MPTV.vcxproj +++ b/xbmc/pvrclients/MediaPortal/project/VS2010Express/XBMC_MPTV.vcxproj @@ -69,7 +69,7 @@ 4996;%(DisableSpecificWarnings) - ws2_32.lib;$(SolutionDir)\libs\libTcpSocket\$(Configuration)\libTcpSocket.lib;$(SolutionDir)\libs\libPlatform\$(Configuration)\libPlatform.lib;%(AdditionalDependencies) + ws2_32.lib;%(AdditionalDependencies) ..\..\..\..\..\addons\pvr.team-mediaportal.tvserver\XBMC_MPTV_win32.pvr %(IgnoreSpecificDefaultLibraries) true @@ -100,7 +100,7 @@ ProgramDatabase - ws2_32.lib;$(SolutionDir)\libs\libTcpSocket\$(Configuration)\libTcpSocket.lib;$(SolutionDir)\libs\libPlatform\$(Configuration)\libPlatform.lib;%(AdditionalDependencies) + ws2_32.lib;%(AdditionalDependencies) ..\..\..\..\..\addons\pvr.team-mediaportal.tvserver\XBMC_MPTV_win32.pvr %(IgnoreSpecificDefaultLibraries) false @@ -163,4 +163,4 @@ - \ No newline at end of file +