From 632bc71c2a75bd3494cc337778f8f6f8cd5034ea Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Fri, 26 Oct 2012 01:01:54 -0400 Subject: [PATCH] adding Boost.Process --- CMakeCache.txt | 502 ------------------ .../boost/process/include/boost/process.hpp | 25 + .../process/include/boost/process/all.hpp | 40 ++ .../process/include/boost/process/child.hpp | 92 ++++ .../process/include/boost/process/config.hpp | 74 +++ .../process/include/boost/process/context.hpp | 133 +++++ .../boost/process/detail/basic_status.hpp | 69 +++ .../process/detail/basic_status_service.hpp | 318 +++++++++++ .../boost/process/detail/posix_helpers.hpp | 106 ++++ .../boost/process/detail/status_impl.hpp | 190 +++++++ .../boost/process/detail/systembuf.hpp | 228 ++++++++ .../boost/process/detail/windows_helpers.hpp | 138 +++++ .../include/boost/process/environment.hpp | 52 ++ .../process/include/boost/process/handle.hpp | 231 ++++++++ .../include/boost/process/operations.hpp | 433 +++++++++++++++ .../include/boost/process/pid_type.hpp | 56 ++ .../process/include/boost/process/pipe.hpp | 49 ++ .../include/boost/process/pistream.hpp | 114 ++++ .../include/boost/process/postream.hpp | 115 ++++ .../process/include/boost/process/process.hpp | 212 ++++++++ .../process/include/boost/process/self.hpp | 188 +++++++ .../process/include/boost/process/status.hpp | 41 ++ .../include/boost/process/stream_behavior.hpp | 326 ++++++++++++ .../include/boost/process/stream_ends.hpp | 68 +++ .../include/boost/process/stream_id.hpp | 50 ++ .../include/boost/process/stream_type.hpp | 45 ++ 26 files changed, 3393 insertions(+), 502 deletions(-) delete mode 100644 CMakeCache.txt create mode 100644 vendor/boost/process/include/boost/process.hpp create mode 100644 vendor/boost/process/include/boost/process/all.hpp create mode 100644 vendor/boost/process/include/boost/process/child.hpp create mode 100644 vendor/boost/process/include/boost/process/config.hpp create mode 100644 vendor/boost/process/include/boost/process/context.hpp create mode 100644 vendor/boost/process/include/boost/process/detail/basic_status.hpp create mode 100644 vendor/boost/process/include/boost/process/detail/basic_status_service.hpp create mode 100644 vendor/boost/process/include/boost/process/detail/posix_helpers.hpp create mode 100644 vendor/boost/process/include/boost/process/detail/status_impl.hpp create mode 100644 vendor/boost/process/include/boost/process/detail/systembuf.hpp create mode 100644 vendor/boost/process/include/boost/process/detail/windows_helpers.hpp create mode 100644 vendor/boost/process/include/boost/process/environment.hpp create mode 100644 vendor/boost/process/include/boost/process/handle.hpp create mode 100644 vendor/boost/process/include/boost/process/operations.hpp create mode 100644 vendor/boost/process/include/boost/process/pid_type.hpp create mode 100644 vendor/boost/process/include/boost/process/pipe.hpp create mode 100644 vendor/boost/process/include/boost/process/pistream.hpp create mode 100644 vendor/boost/process/include/boost/process/postream.hpp create mode 100644 vendor/boost/process/include/boost/process/process.hpp create mode 100644 vendor/boost/process/include/boost/process/self.hpp create mode 100644 vendor/boost/process/include/boost/process/status.hpp create mode 100644 vendor/boost/process/include/boost/process/stream_behavior.hpp create mode 100644 vendor/boost/process/include/boost/process/stream_ends.hpp create mode 100644 vendor/boost/process/include/boost/process/stream_id.hpp create mode 100644 vendor/boost/process/include/boost/process/stream_type.hpp diff --git a/CMakeCache.txt b/CMakeCache.txt deleted file mode 100644 index eb87577..0000000 --- a/CMakeCache.txt +++ /dev/null @@ -1,502 +0,0 @@ -# This is the CMakeCache file. -# For build in directory: /Users/dlarimer/projects/tornet/fc -# It was generated by CMake: /opt/local/bin/cmake -# You can edit this file to change values found and used by cmake. -# If you do not want to change any of the values, simply exit the editor. -# If you do want to change a value, simply edit, save, and exit the editor. -# The syntax for the file is as follows: -# KEY:TYPE=VALUE -# KEY is the name of a variable in the cache. -# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!. -# VALUE is the current value for the KEY. - -######################## -# EXTERNAL cache entries -######################## - -//The Boost CHRONO library -Boost_CHRONO_LIBRARY:FILEPATH=/usr/local/lib/libboost_chrono.a - -//Boost chrono library (debug) -Boost_CHRONO_LIBRARY_DEBUG:FILEPATH=/usr/local/lib/libboost_chrono.a - -//Boost chrono library (release) -Boost_CHRONO_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libboost_chrono.a - -//The Boost CONTEXT library -Boost_CONTEXT_LIBRARY:FILEPATH=/usr/local/lib/libboost_context.a - -//Boost context library (debug) -Boost_CONTEXT_LIBRARY_DEBUG:FILEPATH=/usr/local/lib/libboost_context.a - -//Boost context library (release) -Boost_CONTEXT_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libboost_context.a - -//The Boost DATE_TIME library -Boost_DATE_TIME_LIBRARY:FILEPATH=/usr/local/lib/libboost_date_time.a - -//Boost date_time library (debug) -Boost_DATE_TIME_LIBRARY_DEBUG:FILEPATH=/usr/local/lib/libboost_date_time.a - -//Boost date_time library (release) -Boost_DATE_TIME_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libboost_date_time.a - -//The directory containing a CMake configuration file for Boost. -Boost_DIR:PATH=Boost_DIR-NOTFOUND - -//The Boost FILESYSTEM library -Boost_FILESYSTEM_LIBRARY:FILEPATH=/usr/local/lib/libboost_filesystem.a - -//Boost filesystem library (debug) -Boost_FILESYSTEM_LIBRARY_DEBUG:FILEPATH=/usr/local/lib/libboost_filesystem.a - -//Boost filesystem library (release) -Boost_FILESYSTEM_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libboost_filesystem.a - -//Path to a file. -Boost_INCLUDE_DIR:PATH=/usr/local/include - -//Boost library directory -Boost_LIBRARY_DIRS:FILEPATH=/usr/local/lib - -//The Boost PROGRAM_OPTIONS library -Boost_PROGRAM_OPTIONS_LIBRARY:FILEPATH=/usr/local/lib/libboost_program_options.a - -//Boost program_options library (debug) -Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG:FILEPATH=/usr/local/lib/libboost_program_options.a - -//Boost program_options library (release) -Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libboost_program_options.a - -//The Boost SERIALIZATION library -Boost_SERIALIZATION_LIBRARY:FILEPATH=/usr/local/lib/libboost_serialization.a - -//Boost serialization library (debug) -Boost_SERIALIZATION_LIBRARY_DEBUG:FILEPATH=/usr/local/lib/libboost_serialization.a - -//Boost serialization library (release) -Boost_SERIALIZATION_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libboost_serialization.a - -//The Boost SIGNALS library -Boost_SIGNALS_LIBRARY:FILEPATH=/usr/local/lib/libboost_signals.a - -//Boost signals library (debug) -Boost_SIGNALS_LIBRARY_DEBUG:FILEPATH=/usr/local/lib/libboost_signals.a - -//Boost signals library (release) -Boost_SIGNALS_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libboost_signals.a - -//The Boost SYSTEM library -Boost_SYSTEM_LIBRARY:FILEPATH=/usr/local/lib/libboost_system.a - -//Boost system library (debug) -Boost_SYSTEM_LIBRARY_DEBUG:FILEPATH=/usr/local/lib/libboost_system.a - -//Boost system library (release) -Boost_SYSTEM_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libboost_system.a - -//The Boost THREAD library -Boost_THREAD_LIBRARY:FILEPATH=/usr/local/lib/libboost_thread.a - -//Boost thread library (debug) -Boost_THREAD_LIBRARY_DEBUG:FILEPATH=/usr/local/lib/libboost_thread.a - -//Boost thread library (release) -Boost_THREAD_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libboost_thread.a - -//The Boost UNIT_TEST_FRAMEWORK library -Boost_UNIT_TEST_FRAMEWORK_LIBRARY:FILEPATH=/usr/local/lib/libboost_unit_test_framework.a - -//Boost unit_test_framework library (debug) -Boost_UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG:FILEPATH=/usr/local/lib/libboost_unit_test_framework.a - -//Boost unit_test_framework library (release) -Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE:FILEPATH=/usr/local/lib/libboost_unit_test_framework.a - -//Path to a program. -CMAKE_AR:FILEPATH=/opt/local/bin/ar - -//Choose the type of build, options are: None(CMAKE_CXX_FLAGS or -// CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel. -CMAKE_BUILD_TYPE:STRING= - -//Enable/Disable color output during build. -CMAKE_COLOR_MAKEFILE:BOOL=ON - -//CXX compiler. -CMAKE_CXX_COMPILER:FILEPATH=/opt/local/bin/c++ - -//Flags used by the compiler during all build types. -CMAKE_CXX_FLAGS:STRING= - -//Flags used by the compiler during debug builds. -CMAKE_CXX_FLAGS_DEBUG:STRING=-g - -//Flags used by the compiler during release minsize builds. -CMAKE_CXX_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the compiler during release builds (/MD /Ob1 /Oi -// /Ot /Oy /Gs will produce slightly less optimized but smaller -// files). -CMAKE_CXX_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the compiler during Release with Debug Info builds. -CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=-O2 -g - -//C compiler. -CMAKE_C_COMPILER:FILEPATH=/opt/local/bin/gcc - -//Flags used by the compiler during all build types. -CMAKE_C_FLAGS:STRING= - -//Flags used by the compiler during debug builds. -CMAKE_C_FLAGS_DEBUG:STRING=-g - -//Flags used by the compiler during release minsize builds. -CMAKE_C_FLAGS_MINSIZEREL:STRING=-Os -DNDEBUG - -//Flags used by the compiler during release builds (/MD /Ob1 /Oi -// /Ot /Oy /Gs will produce slightly less optimized but smaller -// files). -CMAKE_C_FLAGS_RELEASE:STRING=-O3 -DNDEBUG - -//Flags used by the compiler during Release with Debug Info builds. -CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=-O2 -g - -//Flags used by the linker. -CMAKE_EXE_LINKER_FLAGS:STRING=' ' - -//Flags used by the linker during debug builds. -CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Enable/Disable output of compile commands during generation. -CMAKE_EXPORT_COMPILE_COMMANDS:BOOL=OFF - -//Path to a program. -CMAKE_INSTALL_NAME_TOOL:FILEPATH=/opt/local/bin/install_name_tool - -//Install path prefix, prepended onto install directories. -CMAKE_INSTALL_PREFIX:PATH=/usr/local - -//Path to a program. -CMAKE_LINKER:FILEPATH=/opt/local/bin/ld - -//Path to a program. -CMAKE_MAKE_PROGRAM:FILEPATH=/usr/bin/make - -//Flags used by the linker during the creation of modules. -CMAKE_MODULE_LINKER_FLAGS:STRING=' ' - -//Flags used by the linker during debug builds. -CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//Path to a program. -CMAKE_NM:FILEPATH=/opt/local/bin/nm - -//Path to a program. -CMAKE_OBJCOPY:FILEPATH=CMAKE_OBJCOPY-NOTFOUND - -//Path to a program. -CMAKE_OBJDUMP:FILEPATH=CMAKE_OBJDUMP-NOTFOUND - -//Build architectures for OSX -CMAKE_OSX_ARCHITECTURES:STRING= - -//Minimum OS X version to target for deployment (at runtime); newer -// APIs weak linked. Set to empty string for default value. -CMAKE_OSX_DEPLOYMENT_TARGET:STRING= - -//The product will be built against the headers and libraries located -// inside the indicated SDK. -CMAKE_OSX_SYSROOT:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk - -//Value Computed by CMake -CMAKE_PROJECT_NAME:STATIC=fc - -//Path to a program. -CMAKE_RANLIB:FILEPATH=/opt/local/bin/ranlib - -//Flags used by the linker during the creation of dll's. -CMAKE_SHARED_LINKER_FLAGS:STRING=' ' - -//Flags used by the linker during debug builds. -CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING= - -//Flags used by the linker during release minsize builds. -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING= - -//Flags used by the linker during release builds. -CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING= - -//Flags used by the linker during Release with Debug Info builds. -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING= - -//If set, runtime paths are not added when installing shared libraries, -// but are added when building. -CMAKE_SKIP_INSTALL_RPATH:BOOL=NO - -//If set, runtime paths are not added when using shared libraries. -CMAKE_SKIP_RPATH:BOOL=NO - -//Path to a program. -CMAKE_STRIP:FILEPATH=/opt/local/bin/strip - -//If true, cmake will use relative paths in makefiles and projects. -CMAKE_USE_RELATIVE_PATHS:BOOL=OFF - -//If this value is on, makefiles will be generated without the -// .SILENT directive, and all commands will be echoed to the console -// during the make. This is useful for debugging only. With Visual -// Studio IDE projects all commands are done without /nologo. -CMAKE_VERBOSE_MAKEFILE:BOOL=FALSE - -//Path to a program. -CMAKE_XCODE_SELECT:FILEPATH=/usr/bin/xcode-select - -//OFF -UNITY_BUILD:BOOL=OFF - -//Value Computed by CMake -fc_BINARY_DIR:STATIC=/Users/dlarimer/Downloads/fc - -//Dependencies for target -fc_LIB_DEPENDS:STATIC= - -//Value Computed by CMake -fc_SOURCE_DIR:STATIC=/Users/dlarimer/Downloads/fc - - -######################## -# INTERNAL cache entries -######################## - -//Whether the Boost CHRONO library found -Boost_CHRONO_FOUND:INTERNAL=ON -//ADVANCED property for variable: Boost_CHRONO_LIBRARY -Boost_CHRONO_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_CHRONO_LIBRARY_DEBUG -Boost_CHRONO_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_CHRONO_LIBRARY_RELEASE -Boost_CHRONO_LIBRARY_RELEASE-ADVANCED:INTERNAL=1 -//Whether the Boost CONTEXT library found -Boost_CONTEXT_FOUND:INTERNAL=ON -//ADVANCED property for variable: Boost_CONTEXT_LIBRARY -Boost_CONTEXT_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_CONTEXT_LIBRARY_DEBUG -Boost_CONTEXT_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_CONTEXT_LIBRARY_RELEASE -Boost_CONTEXT_LIBRARY_RELEASE-ADVANCED:INTERNAL=1 -//Whether the Boost DATE_TIME library found -Boost_DATE_TIME_FOUND:INTERNAL=ON -//ADVANCED property for variable: Boost_DATE_TIME_LIBRARY -Boost_DATE_TIME_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_DATE_TIME_LIBRARY_DEBUG -Boost_DATE_TIME_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_DATE_TIME_LIBRARY_RELEASE -Boost_DATE_TIME_LIBRARY_RELEASE-ADVANCED:INTERNAL=1 -//Whether the Boost FILESYSTEM library found -Boost_FILESYSTEM_FOUND:INTERNAL=ON -//ADVANCED property for variable: Boost_FILESYSTEM_LIBRARY -Boost_FILESYSTEM_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_FILESYSTEM_LIBRARY_DEBUG -Boost_FILESYSTEM_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_FILESYSTEM_LIBRARY_RELEASE -Boost_FILESYSTEM_LIBRARY_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_INCLUDE_DIR -Boost_INCLUDE_DIR-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_LIBRARY_DIRS -Boost_LIBRARY_DIRS-ADVANCED:INTERNAL=1 -//The library version string for boost libraries -Boost_LIB_VERSION:INTERNAL=1_51 -//Whether the Boost PROGRAM_OPTIONS library found -Boost_PROGRAM_OPTIONS_FOUND:INTERNAL=ON -//ADVANCED property for variable: Boost_PROGRAM_OPTIONS_LIBRARY -Boost_PROGRAM_OPTIONS_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG -Boost_PROGRAM_OPTIONS_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE -Boost_PROGRAM_OPTIONS_LIBRARY_RELEASE-ADVANCED:INTERNAL=1 -//Whether the Boost SERIALIZATION library found -Boost_SERIALIZATION_FOUND:INTERNAL=ON -//ADVANCED property for variable: Boost_SERIALIZATION_LIBRARY -Boost_SERIALIZATION_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_SERIALIZATION_LIBRARY_DEBUG -Boost_SERIALIZATION_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_SERIALIZATION_LIBRARY_RELEASE -Boost_SERIALIZATION_LIBRARY_RELEASE-ADVANCED:INTERNAL=1 -//Whether the Boost SIGNALS library found -Boost_SIGNALS_FOUND:INTERNAL=ON -//ADVANCED property for variable: Boost_SIGNALS_LIBRARY -Boost_SIGNALS_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_SIGNALS_LIBRARY_DEBUG -Boost_SIGNALS_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_SIGNALS_LIBRARY_RELEASE -Boost_SIGNALS_LIBRARY_RELEASE-ADVANCED:INTERNAL=1 -//Whether the Boost SYSTEM library found -Boost_SYSTEM_FOUND:INTERNAL=ON -//ADVANCED property for variable: Boost_SYSTEM_LIBRARY -Boost_SYSTEM_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_SYSTEM_LIBRARY_DEBUG -Boost_SYSTEM_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_SYSTEM_LIBRARY_RELEASE -Boost_SYSTEM_LIBRARY_RELEASE-ADVANCED:INTERNAL=1 -//Whether the Boost THREAD library found -Boost_THREAD_FOUND:INTERNAL=ON -//ADVANCED property for variable: Boost_THREAD_LIBRARY -Boost_THREAD_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_THREAD_LIBRARY_DEBUG -Boost_THREAD_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_THREAD_LIBRARY_RELEASE -Boost_THREAD_LIBRARY_RELEASE-ADVANCED:INTERNAL=1 -//Whether the Boost UNIT_TEST_FRAMEWORK library found -Boost_UNIT_TEST_FRAMEWORK_FOUND:INTERNAL=ON -//ADVANCED property for variable: Boost_UNIT_TEST_FRAMEWORK_LIBRARY -Boost_UNIT_TEST_FRAMEWORK_LIBRARY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG -Boost_UNIT_TEST_FRAMEWORK_LIBRARY_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE -Boost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE-ADVANCED:INTERNAL=1 -//The version number for boost libraries -Boost_VERSION:INTERNAL=105100 -//ADVANCED property for variable: CMAKE_AR -CMAKE_AR-ADVANCED:INTERNAL=1 -//What is the target build tool cmake is generating for. -CMAKE_BUILD_TOOL:INTERNAL=/usr/bin/make -//This is the directory where this CMakeCache.txt was created -CMAKE_CACHEFILE_DIR:INTERNAL=/Users/dlarimer/projects/tornet/fc -//Major version of cmake used to create the current loaded cache -CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2 -//Minor version of cmake used to create the current loaded cache -CMAKE_CACHE_MINOR_VERSION:INTERNAL=8 -//Patch version of cmake used to create the current loaded cache -CMAKE_CACHE_PATCH_VERSION:INTERNAL=8 -//ADVANCED property for variable: CMAKE_COLOR_MAKEFILE -CMAKE_COLOR_MAKEFILE-ADVANCED:INTERNAL=1 -//Path to CMake executable. -CMAKE_COMMAND:INTERNAL=/opt/local/bin/cmake -//Path to cpack program executable. -CMAKE_CPACK_COMMAND:INTERNAL=/opt/local/bin/cpack -//Path to ctest program executable. -CMAKE_CTEST_COMMAND:INTERNAL=/opt/local/bin/ctest -//ADVANCED property for variable: CMAKE_CXX_COMPILER -CMAKE_CXX_COMPILER-ADVANCED:INTERNAL=1 -CMAKE_CXX_COMPILER_WORKS:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS -CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG -CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL -CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE -CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO -CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_COMPILER -CMAKE_C_COMPILER-ADVANCED:INTERNAL=1 -CMAKE_C_COMPILER_WORKS:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS -CMAKE_C_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG -CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL -CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE -CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO -CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//Result of TRY_COMPILE -CMAKE_DETERMINE_CXX_ABI_COMPILED:INTERNAL=TRUE -//Result of TRY_COMPILE -CMAKE_DETERMINE_C_ABI_COMPILED:INTERNAL=TRUE -//Path to cache edit program executable. -CMAKE_EDIT_COMMAND:INTERNAL=/opt/local/bin/ccmake -//Executable file format -CMAKE_EXECUTABLE_FORMAT:INTERNAL=Unknown -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS -CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG -CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL -CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE -CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_EXPORT_COMPILE_COMMANDS -CMAKE_EXPORT_COMPILE_COMMANDS-ADVANCED:INTERNAL=1 -//Name of generator. -CMAKE_GENERATOR:INTERNAL=Unix Makefiles -//Start directory with the top level CMakeLists.txt file for this -// project -CMAKE_HOME_DIRECTORY:INTERNAL=/Users/dlarimer/Downloads/fc -//ADVANCED property for variable: CMAKE_INSTALL_NAME_TOOL -CMAKE_INSTALL_NAME_TOOL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_LINKER -CMAKE_LINKER-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MAKE_PROGRAM -CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS -CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG -CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL -CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE -CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_NM -CMAKE_NM-ADVANCED:INTERNAL=1 -//number of local generators -CMAKE_NUMBER_OF_LOCAL_GENERATORS:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJCOPY -CMAKE_OBJCOPY-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_OBJDUMP -CMAKE_OBJDUMP-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_RANLIB -CMAKE_RANLIB-ADVANCED:INTERNAL=1 -//Path to CMake installation. -CMAKE_ROOT:INTERNAL=/opt/local/share/cmake-2.8 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS -CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG -CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL -CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE -CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO -CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH -CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_SKIP_RPATH -CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_STRIP -CMAKE_STRIP-ADVANCED:INTERNAL=1 -//uname command -CMAKE_UNAME:INTERNAL=/usr/bin/uname -//ADVANCED property for variable: CMAKE_USE_RELATIVE_PATHS -CMAKE_USE_RELATIVE_PATHS-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE -CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1 -//ADVANCED property for variable: CMAKE_XCODE_SELECT -CMAKE_XCODE_SELECT-ADVANCED:INTERNAL=1 - diff --git a/vendor/boost/process/include/boost/process.hpp b/vendor/boost/process/include/boost/process.hpp new file mode 100644 index 0000000..98e3c89 --- /dev/null +++ b/vendor/boost/process/include/boost/process.hpp @@ -0,0 +1,25 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process.hpp + * + * Convenience header that includes all public Boost.Process header files. + */ + +#ifndef BOOST_PROCESS_HPP +#define BOOST_PROCESS_HPP + +#include + +#endif diff --git a/vendor/boost/process/include/boost/process/all.hpp b/vendor/boost/process/include/boost/process/all.hpp new file mode 100644 index 0000000..f30e566 --- /dev/null +++ b/vendor/boost/process/include/boost/process/all.hpp @@ -0,0 +1,40 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/all.hpp + * + * Convenience header that includes all public Boost.Process header files. + */ + +#ifndef BOOST_PROCESS_ALL_HPP +#define BOOST_PROCESS_ALL_HPP + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#endif diff --git a/vendor/boost/process/include/boost/process/child.hpp b/vendor/boost/process/include/boost/process/child.hpp new file mode 100644 index 0000000..f0a632a --- /dev/null +++ b/vendor/boost/process/include/boost/process/child.hpp @@ -0,0 +1,92 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/child.hpp + * + * Includes the declaration of the child class. + */ + +#ifndef BOOST_PROCESS_CHILD_HPP +#define BOOST_PROCESS_CHILD_HPP + +#include + +#if defined(BOOST_POSIX_API) +#elif defined(BOOST_WINDOWS_API) +# include +#else +# error "Unsupported platform." +#endif + +#include +#include +#include +#include +#include + +namespace boost { +namespace process { + +/** + * The child class provides access to a child process. + */ +class child : public process +{ +public: + /** + * Creates a new child object that represents the just spawned child + * process \a id. + */ + child(pid_type id, std::map handles) + : process(id), + handles_(handles) + { + } + +#if defined(BOOST_WINDOWS_API) + /** + * Creates a new child object that represents the just spawned child + * process \a id. + * + * This operation is only available on Windows systems. + */ + child(handle hprocess, std::map handles) + : process(hprocess), + handles_(handles) + { + } +#endif + + /** + * Gets a handle to a stream attached to the child. + * + * If the handle doesn't exist an invalid handle is returned. + */ + handle get_handle(stream_id id) const + { + std::map::const_iterator it = handles_.find(id); + return (it != handles_.end()) ? it->second : handle(); + } + +private: + /** + * Handles providing access to streams attached to the child process. + */ + std::map handles_; +}; + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/config.hpp b/vendor/boost/process/include/boost/process/config.hpp new file mode 100644 index 0000000..7ce15eb --- /dev/null +++ b/vendor/boost/process/include/boost/process/config.hpp @@ -0,0 +1,74 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/config.hpp + * + * Defines macros that are used by the library to determine the operating + * system it is running under and the features it supports. + */ + +#ifndef BOOST_PROCESS_CONFIG_HPP +#define BOOST_PROCESS_CONFIG_HPP + +#include +#include +#include +#include + +#if defined(BOOST_POSIX_API) +# include +#elif defined(BOOST_WINDOWS_API) +# include +#endif + +#if defined(BOOST_POSIX_API) || defined(BOOST_PROCESS_DOXYGEN) +# if !defined(BOOST_PROCESS_POSIX_PATH_MAX) || defined(BOOST_PROCESS_DOXYGEN) +/** + * Specifies the system's maximal supported path length. + * + * The macro BOOST_PROCESS_POSIX_PATH_MAX is set to a positive integer + * value which specifies the system's maximal supported path length. It is + * only used if neither PATH_MAX nor _PC_PATH_MAX and HAVE_PATHCONF are defined. + * The maximal supported path length is required by + * boost::process::self::get_work_dir(). Please note that this function is + * also called by the constructor of boost::process::context. + */ +# define BOOST_PROCESS_POSIX_PATH_MAX 259 +# endif +#endif + +/** \cond */ +#define BOOST_PROCESS_SOURCE_LOCATION \ + "in file '" __FILE__ "', line " BOOST_STRINGIZE(__LINE__) ": " + +#if defined(BOOST_POSIX_API) +# define BOOST_PROCESS_LAST_ERROR errno +#elif defined(BOOST_WINDOWS_API) +# define BOOST_PROCESS_LAST_ERROR GetLastError() +#endif + +#define BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR(what) \ + boost::throw_exception(boost::system::system_error( \ + boost::system::error_code(BOOST_PROCESS_LAST_ERROR, \ + boost::system::get_system_category()), \ + BOOST_PROCESS_SOURCE_LOCATION what)) + +#define BOOST_PROCESS_THROW_ERROR(error, what) \ + boost::throw_exception(boost::system::system_error( \ + boost::system::error_code(error, \ + boost::system::get_system_category()), \ + BOOST_PROCESS_SOURCE_LOCATION what)) +/** \endcond */ + +#endif diff --git a/vendor/boost/process/include/boost/process/context.hpp b/vendor/boost/process/include/boost/process/context.hpp new file mode 100644 index 0000000..6d4a8d0 --- /dev/null +++ b/vendor/boost/process/include/boost/process/context.hpp @@ -0,0 +1,133 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/context.hpp + * + * Includes the declaration of the context class. + */ + +#ifndef BOOST_PROCESS_CONTEXT_HPP +#define BOOST_PROCESS_CONTEXT_HPP + +#include + +#if defined(BOOST_POSIX_API) +# include +#elif defined(BOOST_WINDOWS_API) +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace process { + +/** + * Context class to define how a child process is created. + * + * The context class is used to configure streams, to set the work directory + * and define environment variables. It is also used to change a process + * name (the variable commonly known as argv[0]). + */ +struct context +{ + typedef std::map > + streams_t; + + /** + * Streams. + * + * Streams of a child process can be configured through factory functions + * which return a pair of handles - one handle to use as a stream end + * in the child process and possibly another handle to use as a stream end + * in the parent process (if a pipe is setup both processes can communicate + * with each other). + */ + streams_t streams; + + /** + * Process name. + * + * The child process can access the process name via a variable + * commonly known as argv[0]. + */ + std::string process_name; + + /** + * Work directory. + */ + std::string work_dir; + + /** + * Environment variables. + */ + environment env; + + /** + * Constructs a process context. + * + * The default behavior of standard streams is to inherit them. The current + * work directory is also the work directory of the child process. The child + * process also inherits all environment variables. + */ + context() + : work_dir(self::get_work_dir()), + env(self::get_environment()) + { +#if 0 // this default behavior will throw in non-console apps +#if defined(BOOST_POSIX_API) + streams[stdin_id] = behavior::inherit(STDIN_FILENO); + streams[stdout_id] = behavior::inherit(STDOUT_FILENO); + streams[stderr_id] = behavior::inherit(STDERR_FILENO); +#elif defined(BOOST_WINDOWS_API) + streams[stdin_id] = behavior::inherit(GetStdHandle(STD_INPUT_HANDLE)); + streams[stdout_id] = behavior::inherit(GetStdHandle(STD_OUTPUT_HANDLE)); + streams[stderr_id] = behavior::inherit(GetStdHandle(STD_ERROR_HANDLE)); +#endif +#endif + } + +#if defined(BOOST_POSIX_API) || defined(BOOST_PROCESS_DOXYGEN) + /** + * Setups a child process. + * + * This is an extension point to support more configuration options for + * child processes. You can initialize \a setup with a user-defined function + * which is called when a child process is created. + * + * On POSIX platforms setup() is called in the child process. That's why in + * a multithreaded application only async-signal-safe functions must be + * called in the function \a setup is bound to. + * + * On Windows platforms setup() is called in the parent process. A + * reference to a STARTUPINFOA structure is passed as parameter. + */ + boost::function setup; +#elif defined(BOOST_WINDOWS_API) + boost::function setup; +#endif +}; + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/detail/basic_status.hpp b/vendor/boost/process/include/boost/process/detail/basic_status.hpp new file mode 100644 index 0000000..2da361a --- /dev/null +++ b/vendor/boost/process/include/boost/process/detail/basic_status.hpp @@ -0,0 +1,69 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/detail/basic_status.hpp + * + * Includes the declaration of the basic status class. + */ + +#ifndef BOOST_PROCESS_DETAIL_BASIC_STATUS_HPP +#define BOOST_PROCESS_DETAIL_BASIC_STATUS_HPP + +#include +#include +#include + +namespace boost { +namespace process { +namespace detail { + +/** + * The basic_status class to wait for processes to exit. + * + * The basic_status class is a Boost.Asio I/O object and supports synchronous + * and asynchronous wait operations. It must be instantiated with a Service. + */ +template +class basic_status + : public boost::asio::basic_io_object +{ +public: + explicit basic_status(boost::asio::io_service &io_service) + : boost::asio::basic_io_object(io_service) + { + } + + /** + * Waits synchronously for a process to exit. + */ + int wait(pid_type pid) + { + return this->service.wait(this->implementation, pid); + } + + /** + * Waits asynchronously for a process to exit. + */ + template + void async_wait(pid_type pid, Handler handler) + { + this->service.async_wait(this->implementation, pid, handler); + } +}; + +} +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/detail/basic_status_service.hpp b/vendor/boost/process/include/boost/process/detail/basic_status_service.hpp new file mode 100644 index 0000000..97c8162 --- /dev/null +++ b/vendor/boost/process/include/boost/process/detail/basic_status_service.hpp @@ -0,0 +1,318 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/detail/basic_status_service.hpp + * + * Includes the declaration of the basic status service class. + */ + +#ifndef BOOST_PROCESS_DETAIL_BASIC_STATUS_SERVICE_HPP +#define BOOST_PROCESS_DETAIL_BASIC_STATUS_SERVICE_HPP + +#include + +#if defined(BOOST_POSIX_API) +# include +# include +# include +# include +#elif defined(BOOST_WINDOWS_API) +# include +#else +# error "Unsupported platform." +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace process { +namespace detail { + +/** + * The basic_status_service class provides the service to wait for processes + * synchronously and asynchronously. + */ +template +class basic_status_service + : public boost::asio::detail::service_base +{ +public: + explicit basic_status_service(boost::asio::io_service &io_service) + : boost::asio::detail::service_base(io_service), +#if defined(BOOST_POSIX_API) + interrupt_pid_(-1), + pids_(0) +#elif defined(BOOST_WINDOWS_API) + run_(true) +#endif + { +#if defined(BOOST_WINDOWS_API) + handles_.push_back(CreateEvent(NULL, FALSE, FALSE, NULL)); + if (handles_[0] == NULL) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CreateEvent() failed"); + work_thread_ = boost::thread( + &basic_status_service::work_thread, this); +#endif + } + + ~basic_status_service() + { +#if defined(BOOST_POSIX_API) + boost::unique_lock lock(work_thread_mutex_); + bool worker_thread_active = (pids_ != 0); + lock.unlock(); + if (worker_thread_active) + { + stop_work_thread(); + work_thread_.join(); + } +#elif defined(BOOST_WINDOWS_API) + stop_work_thread(); + work_thread_.join(); + CloseHandle(handles_[0]); +#endif + } + + typedef boost::shared_ptr implementation_type; + + void construct(implementation_type &impl) + { + impl = boost::make_shared(); + boost::unique_lock lock(work_thread_mutex_); + impls_.push_back(impl); + } + + void destroy(implementation_type &impl) + { + boost::unique_lock lock(work_thread_mutex_); + typename std::vector::iterator it = + std::find(impls_.begin(), impls_.end(), impl); + if (it != impls_.end()) + impls_.erase(it); +#if defined(BOOST_WINDOWS_API) + interrupt_work_thread(); + work_thread_cond_.wait(work_thread_mutex_); + impl->clear(handles_); + work_thread_cond_.notify_all(); +#endif + impl.reset(); + } + + int wait(implementation_type &impl, pid_type pid) + { + boost::system::error_code ec; + int status = impl->wait(pid, ec); +#if defined(BOOST_POSIX_API) + if (ec.value() == ECHILD) + { + boost::unique_lock lock(work_thread_mutex_); + boost::unordered_map::iterator it = statuses_.find(pid); + if (it == statuses_.end()) + { + work_thread_cond_.wait(work_thread_mutex_); + it = statuses_.find(pid); + } + if (it != statuses_.end()) + { + status = it->second; + statuses_.erase(it); + ec.clear(); + } + } +#endif + boost::asio::detail::throw_error(ec); + return status; + } + + template + void async_wait(implementation_type &impl, pid_type pid, Handler handler) + { +#if defined(BOOST_POSIX_API) + boost::unique_lock lock(work_thread_mutex_); + if (++pids_ == 1) + { + work_.reset(new boost::asio::io_service::work( + this->get_io_service())); + work_thread_ = boost::thread( + &basic_status_service::work_thread, + this); + } + impl->async_wait(pid, this->get_io_service().wrap(handler)); +#elif defined(BOOST_WINDOWS_API) + HANDLE handle = OpenProcess(SYNCHRONIZE | PROCESS_QUERY_INFORMATION, + FALSE, pid); + if (handle == NULL) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("OpenProcess() failed"); + boost::unique_lock lock(work_thread_mutex_); + if (!work_) + work_.reset(new boost::asio::io_service::work( + this->get_io_service())); + interrupt_work_thread(); + work_thread_cond_.wait(work_thread_mutex_); + handles_.push_back(handle); + impl->async_wait(handle, this->get_io_service().wrap(handler)); + work_thread_cond_.notify_all(); +#endif + } + +private: + void shutdown_service() + { +#if defined(BOOST_WINDOWS_API) + boost::unique_lock lock(work_thread_mutex_); + work_.reset(); +#endif + } + + void work_thread() + { +#if defined(BOOST_POSIX_API) + for (;;) + { + int status; + pid_t pid = ::wait(&status); + if (pid == -1) + { + if (errno != EINTR) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("wait(2) failed"); + } + else if (interrupted(pid)) + { + // On POSIX the only reason to interrupt is to break out. + break; + } + else + { + boost::unique_lock lock(work_thread_mutex_); + bool regchild = false; + for (typename std::vector::iterator it = + impls_.begin(); it != impls_.end(); ++it) + regchild |= (*it)->complete(pid, status); + if (regchild && --pids_ == 0) + { + work_.reset(); + break; + } + else if (!regchild) + { + statuses_.insert(boost::unordered_map:: + value_type(pid, status)); + work_thread_cond_.notify_all(); + } + } + } +#elif defined(BOOST_WINDOWS_API) + for (;;) + { + DWORD res = WaitForMultipleObjects(handles_.size(), &handles_[0], + FALSE, INFINITE); + if (res == WAIT_FAILED) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR( + "WaitForMultipleObjects() failed"); + else if (res - WAIT_OBJECT_0 == 0) + { + boost::unique_lock lock(work_thread_mutex_); + if (!run_) + break; + work_thread_cond_.notify_all(); + work_thread_cond_.wait(work_thread_mutex_); + } + else if (res - WAIT_OBJECT_0 > 0) + { + HANDLE handle = handles_[res - WAIT_OBJECT_0]; + DWORD exit_code; + if (!GetExitCodeProcess(handle, &exit_code)) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR( + "GetExitCodeProcess() failed"); + boost::unique_lock lock(work_thread_mutex_); + for (typename std::vector::iterator it = + impls_.begin(); it != impls_.end(); ++it) + (*it)->complete(handle, exit_code); + std::vector::iterator it = handles_.begin(); + std::advance(it, res - WAIT_OBJECT_0); + handles_.erase(it); + if (handles_.size() == 1) + work_.reset(); + } + } +#endif + } + + void interrupt_work_thread() + { +#if defined(BOOST_POSIX_API) + // By creating a child process which immediately exits + // we interrupt wait(). + std::vector args; + args.push_back("-c"); + args.push_back("'exit'"); + interrupt_pid_ = create_child("/bin/sh", args).get_id(); +#elif defined(BOOST_WINDOWS_API) + // By signaling the event in the first slot WaitForMultipleObjects() + // will return. The work thread won't do anything except checking if + // it should continue to run. + if (!SetEvent(handles_[0])) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("SetEvent() failed"); +#endif + } + +#if defined(BOOST_POSIX_API) + bool interrupted(pid_t pid) + { + boost::mutex::scoped_lock lock(work_thread_mutex_); + return interrupt_pid_ == pid; + } +#endif + + void stop_work_thread() + { + boost::mutex::scoped_lock lock(work_thread_mutex_); +#if defined(BOOST_WINDOWS_API) + // Access to run_ must be sychronized with running(). + run_ = false; +#endif + // Access to interrupt_pid_ must be sychronized with interrupted(). + interrupt_work_thread(); + } + + boost::scoped_ptr work_; + std::vector impls_; + boost::mutex work_thread_mutex_; + boost::thread work_thread_; + boost::condition_variable_any work_thread_cond_; +#if defined(BOOST_POSIX_API) + pid_t interrupt_pid_; + int pids_; + boost::unordered_map statuses_; +#elif defined(BOOST_WINDOWS_API) + bool run_; + std::vector handles_; +#endif +}; + +} +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/detail/posix_helpers.hpp b/vendor/boost/process/include/boost/process/detail/posix_helpers.hpp new file mode 100644 index 0000000..993e2e0 --- /dev/null +++ b/vendor/boost/process/include/boost/process/detail/posix_helpers.hpp @@ -0,0 +1,106 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/detail/posix_helpers.hpp + * + * Includes the declaration of helper functions for POSIX systems. + */ + +#ifndef BOOST_PROCESS_POSIX_HELPERS_HPP +#define BOOST_PROCESS_POSIX_HELPERS_HPP + +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace process { +namespace detail { + +/** + * Converts an environment to a char** table as used by execve(). + * + * Converts the environment's contents to the format used by the + * execve() system call. The returned char** array is allocated + * in dynamic memory; the caller must free it when not used any + * more. Each entry is also allocated in dynamic memory and is a + * NULL-terminated string of the form var=value; these must also be + * released by the caller. + * + * This operation is only available on POSIX systems. + * + * \return The first argument of the pair is an integer that indicates + * how many strings are stored in the second argument. The + * second argument is a NULL-terminated, dynamically allocated + * array of dynamically allocated strings representing the + * enviroment's content. Each array entry is a NULL-terminated + * string of the form var=value. The caller is responsible for + * freeing them. + */ +inline std::pair environment_to_envp(const environment + &env) +{ + std::size_t nargs = env.size(); + char **envp = new char*[nargs + 1]; + environment::size_type i = 0; + for (environment::const_iterator it = env.begin(); it != env.end(); ++it) + { + std::string s = it->first + "=" + it->second; + envp[i] = new char[s.size() + 1]; + std::strncpy(envp[i], s.c_str(), s.size() + 1); + ++i; + } + envp[i] = 0; + return std::pair(nargs, envp); +} + +/** + * Converts the command line to an array of C strings. + * + * Converts the command line's list of arguments to the format expected + * by the \a argv parameter in the POSIX execve() system call. + * + * This operation is only available on POSIX systems. + * + * \return The first argument of the pair is an integer that indicates + * how many strings are stored in the second argument. The + * second argument is a NULL-terminated, dynamically allocated + * array of dynamically allocated strings holding the arguments + * to the executable. The caller is responsible for freeing them. + */ +template +inline std::pair collection_to_argv(const Arguments &args) +{ + std::size_t nargs = args.size(); + char **argv = new char*[nargs + 1]; + typename Arguments::size_type i = 0; + for (typename Arguments::const_iterator it = args.begin(); it != args.end(); + ++it) + { + argv[i] = new char[it->size() + 1]; + std::strncpy(argv[i], it->c_str(), it->size() + 1); + ++i; + } + argv[nargs] = 0; + return std::pair(nargs, argv); +} + +} +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/detail/status_impl.hpp b/vendor/boost/process/include/boost/process/detail/status_impl.hpp new file mode 100644 index 0000000..618db49 --- /dev/null +++ b/vendor/boost/process/include/boost/process/detail/status_impl.hpp @@ -0,0 +1,190 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/detail/status_impl.hpp + * + * Includes the declaration of the status implementation class. + */ + +#ifndef BOOST_PROCESS_DETAIL_STATUS_IMPL_HPP +#define BOOST_PROCESS_DETAIL_STATUS_IMPL_HPP + +#include + +#if defined(BOOST_POSIX_API) +# include +# include +# include +# include +#elif defined(BOOST_WINDOWS_API) +# include +#else +# error "Unsupported platform." +#endif + +#include +#include +#include +#include + +namespace boost { +namespace process { +namespace detail { + +#if defined(BOOST_POSIX_API) +typedef pid_t phandle; +#elif defined(BOOST_WINDOWS_API) +typedef HANDLE phandle; +#endif + +struct operation +{ + virtual ~operation(){} + virtual void operator()(int exit_code) + { +#if defined(BOOST_MSVC) + exit_code; +#endif + } +}; + +template +class wrapped_handler : public operation +{ +public: + wrapped_handler(Handler handler) + : handler_(handler) + { + } + + void operator()(int exit_code) + { + handler_(boost::system::error_code(), exit_code); + } + +private: + Handler handler_; +}; + +/** + * The status_impl class saves internal data of every status I/O object. + */ +class status_impl +{ +public: +#if defined(BOOST_WINDOWS_API) + template + void clear(Container &handles) + { + for (operations_type::iterator it = ops_.begin(); it != ops_.end(); + ++it) + { + for (typename Container::iterator it2 = handles.begin(); it2 != + handles.end(); ++it2) + { + if (*it2 == it->first) + { + handles.erase(it2); + break; + } + } + CloseHandle(it->first); + } + } +#endif + + int wait(pid_type pid, boost::system::error_code &ec) + { +#if defined(BOOST_POSIX_API) + pid_t p; + int status; + do + { + p = waitpid(pid, &status, 0); + } while (p == -1 && errno == EINTR); + if (p == -1) + { + ec = boost::system::error_code(errno, + boost::system::get_system_category()); + return -1; + } + return status; +#elif defined(BOOST_WINDOWS_API) + HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, + pid); + if (h == NULL) + { + ec = boost::system::error_code(GetLastError(), + boost::system::get_system_category()); + return -1; + } + + if (WaitForSingleObject(h, INFINITE) == WAIT_FAILED) + { + CloseHandle(h); + ec = boost::system::error_code(GetLastError(), + boost::system::get_system_category()); + return -1; + } + + DWORD exit_code; + if (!GetExitCodeProcess(h, &exit_code)) + { + CloseHandle(h); + ec = boost::system::error_code(GetLastError(), + boost::system::get_system_category()); + return -1; + } + if (!CloseHandle(h)) + { + ec = boost::system::error_code(GetLastError(), + boost::system::get_system_category()); + return -1; + } + return exit_code; +#endif + } + + template + void async_wait(phandle ph, Handler handler) + { + ops_.insert(ph, new wrapped_handler(handler)); + } + + bool complete(phandle ph, int exit_code) + { + boost::iterator_range r = + ops_.equal_range(ph); + if (r.empty()) + return false; + for (operations_type::iterator it = r.begin(); it != r.end(); ++it) + (*it->second)(exit_code); + ops_.erase(r.begin(), r.end()); +#if defined(BOOST_WINDOWS_API) + if (!CloseHandle(ph)) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CloseHandle() failed"); +#endif + return true; + } + +private: + typedef boost::ptr_unordered_multimap operations_type; + operations_type ops_; +}; + +} +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/detail/systembuf.hpp b/vendor/boost/process/include/boost/process/detail/systembuf.hpp new file mode 100644 index 0000000..d6dce50 --- /dev/null +++ b/vendor/boost/process/include/boost/process/detail/systembuf.hpp @@ -0,0 +1,228 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/detail/systembuf.hpp + * + * Includes the declaration of the systembuf class. + */ + +#ifndef BOOST_PROCESS_DETAIL_SYSTEMBUF_HPP +#define BOOST_PROCESS_DETAIL_SYSTEMBUF_HPP + +#include + +#if defined(BOOST_POSIX_API) +# include +# include +#elif defined(BOOST_WINDOWS_API) +# include +#else +# error "Unsupported platform." +#endif + +#include +#include +#include +#include +#include + +namespace boost { +namespace process { + +class postream; + +namespace detail { + +/** + * std::streambuf implementation for handles. + * + * systembuf provides a std::streambuf implementation for handles. + * Contrarywise to the handle class, this class does \b not take + * ownership of the native handle; this should be taken care of + * somewhere else. + * + * This class follows the expected semantics of a std::streambuf object. + * However, it is not copyable to avoid introducing inconsistences with + * the on-disk file and the in-memory buffers. + */ +class systembuf : public std::streambuf, public boost::noncopyable +{ + friend class boost::process::postream; + +public: +#if defined(BOOST_PROCESS_DOXYGEN) + /** + * Opaque name for the native handle type. + */ + typedef NativeHandleType handle_type; +#elif defined(BOOST_POSIX_API) + typedef int handle_type; +#elif defined(BOOST_WINDOWS_API) + typedef HANDLE handle_type; +#endif + + /** + * Constructs a new systembuf for the given handle. + * + * This constructor creates a new systembuf object that reads or + * writes data from/to the \a h native handle. This handle + * is \b not owned by the created systembuf object; the code + * should take care of it externally. + * + * This class buffers input and output; the buffer size may be + * tuned through the \a bufsize parameter, which defaults to 8192 + * bytes. + * + * \see pistream and postream + */ + explicit systembuf(handle_type h, std::size_t bufsize = 8192) + : handle_(h), + bufsize_(bufsize), + read_buf_(new char[bufsize]), + write_buf_(new char[bufsize]) + { +#if defined(BOOST_POSIX_API) + BOOST_ASSERT(handle_ >= 0); +#elif defined(BOOST_WINDOWS_API) + BOOST_ASSERT(handle_ != INVALID_HANDLE_VALUE); +#endif + BOOST_ASSERT(bufsize_ > 0); + setp(write_buf_.get(), write_buf_.get() + bufsize_); + } + +protected: + /** + * Reads new data from the native handle. + * + * This operation is called by input methods when there is no more + * data in the input buffer. The function fills the buffer with new + * data, if available. + * + * \pre All input positions are exhausted (gptr() >= egptr()). + * \post The input buffer has new data, if available. + * \returns traits_type::eof() if a read error occurrs or there are + * no more data to be read. Otherwise returns + * traits_type::to_int_type(*gptr()). + */ + virtual int_type underflow() + { + BOOST_ASSERT(gptr() >= egptr()); + + bool ok; +#if defined(BOOST_POSIX_API) + ssize_t cnt = read(handle_, read_buf_.get(), bufsize_); + ok = (cnt != -1 && cnt != 0); +#elif defined(BOOST_WINDOWS_API) + DWORD cnt; + BOOL res = ReadFile(handle_, read_buf_.get(), bufsize_, &cnt, NULL); + ok = (res && cnt > 0); +#endif + + if (!ok) + return traits_type::eof(); + else + { + setg(read_buf_.get(), read_buf_.get(), read_buf_.get() + cnt); + return traits_type::to_int_type(*gptr()); + } + } + + /** + * Makes room in the write buffer for additional data. + * + * This operation is called by output methods when there is no more + * space in the output buffer to hold a new element. The function + * first flushes the buffer's contents to disk and then clears it to + * leave room for more characters. The given \a c character is + * stored at the beginning of the new space. + * + * \pre All output positions are exhausted (pptr() >= epptr()). + * \post The output buffer has more space if no errors occurred + * during the write to disk. + * \post *(pptr() - 1) is \a c. + * \returns traits_type::eof() if a write error occurrs. Otherwise + * returns traits_type::not_eof(c). + */ + virtual int_type overflow(int c) + { + BOOST_ASSERT(pptr() >= epptr()); + + if (sync() == -1) + return traits_type::eof(); + + if (!traits_type::eq_int_type(c, traits_type::eof())) + { + traits_type::assign(*pptr(), static_cast( + c)); + pbump(1); + } + + return traits_type::not_eof(c); + } + + /** + * Flushes the output buffer to disk. + * + * Synchronizes the systembuf buffers with the contents of the file + * associated to this object through the native handle. The output buffer + * is flushed to disk and cleared to leave new room for more data. + * + * \returns 0 on success, -1 if an error occurred. + */ + virtual int sync() + { +#if defined(BOOST_POSIX_API) + ssize_t cnt = pptr() - pbase(); + bool ok = (write(handle_, pbase(), cnt) == cnt); + if (ok) + pbump(-cnt); + return ok ? 0 : -1; +#elif defined(BOOST_WINDOWS_API) + long cnt = pptr() - pbase(); + DWORD rcnt; + BOOL res = WriteFile(handle_, pbase(), cnt, &rcnt, NULL); + bool ok = (res && static_cast(rcnt) == cnt); + if (ok) + pbump(-cnt); + return ok ? 0 : -1; +#endif + } + +private: + /** + * Native handle used by the systembuf object. + */ + handle_type handle_; + + /** + * Internal buffer size used during read and write operations. + */ + std::size_t bufsize_; + + /** + * Internal buffer used during read operations. + */ + boost::scoped_array read_buf_; + + /** + * Internal buffer used during write operations. + */ + boost::scoped_array write_buf_; +}; + +} +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/detail/windows_helpers.hpp b/vendor/boost/process/include/boost/process/detail/windows_helpers.hpp new file mode 100644 index 0000000..5656aaa --- /dev/null +++ b/vendor/boost/process/include/boost/process/detail/windows_helpers.hpp @@ -0,0 +1,138 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/detail/windows_helpers.hpp + * + * Includes the declaration of helper functions for Windows systems. + */ + +#ifndef BOOST_PROCESS_WINDOWS_HELPERS_HPP +#define BOOST_PROCESS_WINDOWS_HELPERS_HPP + +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace process { +namespace detail { + +/** + * Converts an environment to a string used by CreateProcess(). + * + * Converts the environment's contents to the format used by the + * CreateProcess() system call. The returned char* string is + * allocated in dynamic memory; the caller must free it when not + * used any more. This is enforced by the use of a shared pointer. + * + * This operation is only available on Windows systems. + * + * \return A dynamically allocated char* string that represents + * the environment's content. This string is of the form + * var1=value1\\0var2=value2\\0\\0. + */ +inline boost::shared_array environment_to_windows_strings(environment + &env) +{ + boost::shared_array envp; + + if (env.empty()) + { + envp.reset(new char[2]); + ZeroMemory(envp.get(), 2); + } + else + { + std::string s; + for (environment::const_iterator it = env.begin(); it != env.end(); + ++it) + { + s += it->first + "=" + it->second; + s.push_back(0); + } + envp.reset(new char[s.size() + 1]); +#if (BOOST_MSVC >= 1400) + memcpy_s(envp.get(), s.size() + 1, s.c_str(), s.size() + 1); +#else + memcpy(envp.get(), s.c_str(), s.size() + 1); +#endif + } + + return envp; +} + +/** + * Converts the command line to a plain string. + * + * Converts the command line's list of arguments to the format expected by the + * \a lpCommandLine parameter in the CreateProcess() system call. + * + * This operation is only available on Windows systems. + * + * \return A dynamically allocated string holding the command line + * to be passed to the executable. It is returned in a + * shared_array object to ensure its release at some point. + */ +template +inline boost::shared_array collection_to_windows_cmdline(const Arguments + &args) +{ + typedef std::vector arguments_t; + arguments_t args2; + typename Arguments::size_type i = 0; + std::size_t size = 0; + for (typename Arguments::const_iterator it = args.begin(); it != args.end(); + ++it) + { + std::string arg = *it; + + std::string::size_type pos = 0; + while ( (pos = arg.find('"', pos)) != std::string::npos) + { + arg.replace(pos, 1, "\\\""); + pos += 2; + } + + if (arg.find(' ') != std::string::npos) + arg = '\"' + arg + '\"'; + + if (i++ != args.size() - 1) + arg += ' '; + + args2.push_back(arg); + size += arg.size() + 1; + } + + boost::shared_array cmdline(new char[size]); + cmdline.get()[0] = '\0'; + for (arguments_t::size_type i = 0; i < args.size(); ++i) +#if (BOOST_MSVC >= 1400) + strcat_s(cmdline.get(), size, args2[i].c_str()); +#else + strncat(cmdline.get(), args2[i].c_str(), args2[i].size()); +#endif + + return cmdline; +} + +} +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/environment.hpp b/vendor/boost/process/include/boost/process/environment.hpp new file mode 100644 index 0000000..daf44e3 --- /dev/null +++ b/vendor/boost/process/include/boost/process/environment.hpp @@ -0,0 +1,52 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/environment.hpp + * + * Includes the declaration of the environment class. + */ + +#ifndef BOOST_PROCESS_ENVIRONMENT_HPP +#define BOOST_PROCESS_ENVIRONMENT_HPP + +#include +#include + +namespace boost { +namespace process { + +/** + * Representation of a process' environment variables. + * + * The environment is a map that establishes an unidirectional + * association between variable names and their values and is + * represented by a string to string map. + * + * Variables may be defined to the empty string. Be aware that doing so + * is not portable: POSIX systems will treat such variables as being + * defined to the empty value, but Windows systems are not able to + * distinguish them from undefined variables. + * + * Neither POSIX nor Windows systems support a variable with no name. + * + * It is worthy to note that the environment is sorted alphabetically. + * This is provided for-free by the map container used to implement this + * type, and this behavior is required by Windows systems. + */ +typedef std::map environment; + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/handle.hpp b/vendor/boost/process/include/boost/process/handle.hpp new file mode 100644 index 0000000..b880a3e --- /dev/null +++ b/vendor/boost/process/include/boost/process/handle.hpp @@ -0,0 +1,231 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/handle.hpp + * + * Includes the declaration of the handle class. + */ + +#ifndef BOOST_PROCESS_HANDLE_HPP +#define BOOST_PROCESS_HANDLE_HPP + +#include + +#if defined(BOOST_POSIX_API) +# include +#elif defined(BOOST_WINDOWS_API) +# include +#else +# error "Unsupported platform." +#endif + +#include +#include + +namespace boost { +namespace process { + +/** + * RAII model for handles. + * + * The \a handle class is a RAII model for native handles. This class wraps + * one of such handles grabbing its ownership, and automaticaly closes it + * upon destruction. It is used to avoid leaking open handles, shall an + * unexpected execution trace occur. + */ +class handle +{ +public: +#if defined(BOOST_PROCESS_DOXYGEN) + /** + * Opaque name for the native handle type. + * + * On POSIX systems \a NativeSystemHandle is an integer type while it is + * a \a HANDLE on Windows systems. + */ + typedef NativeSystemHandle native_type; +#elif defined(BOOST_POSIX_API) + typedef int native_type; +#elif defined(BOOST_WINDOWS_API) + typedef HANDLE native_type; +#endif + + /** + * Constructs an invalid handle. + * + * \see valid() + */ + handle() + { + } + + /** + * RAII settings to specify if handle should be automatically closed. + */ + enum close_type { do_close, dont_close }; + + /** + * Constructs a handle from a native handle. + * + * This constructor creates a new \a handle object that takes + * ownership of the given \a native handle. If \a close is set to + * handle::dont_close the \a native handle is not closed upon destruction. + * The user must not close \a native if it is owned by a \a handle object. + * Ownership can be reclaimed using release(). + * + * \see release() + */ + handle(native_type native, close_type close = handle::do_close) + : impl_(boost::make_shared(native, close)) + { + } + + /** + * Checks whether the handle is valid or not. + * + * \return true if the handle is valid; false otherwise. + */ + bool valid() const + { + return impl_ && impl_->valid(); + } + + /** + * Closes the handle. + * + * \post The handle is invalid. + * \post The native handle is closed. + */ + void close() + { + if (impl_) + impl_->close(); + } + + /** + * Gets the native handle. + * + * The caller can issue any operation on it except closing it. + * If closing is required, release() shall be used. + * + * \return The native handle. + */ + native_type native() const + { + return impl_ ? impl_->native() : invalid_handle(); + } + + /** + * Reclaims ownership of the native handle. + * + * The caller is responsible of closing the native handle. + * + * \post The handle is invalid. + * \return The native handle. + */ + native_type release() + { + return impl_ ? impl_->release() : invalid_handle(); + } + +private: + class impl + { + public: + typedef handle::native_type native_type; + + impl(native_type native, close_type close) + : native_(native), + close_(close) + { + } + + ~impl() + { + if (valid() && close_ == handle::do_close) + { +#if defined(BOOST_POSIX_API) + ::close(native_); +#elif defined(BOOST_WINDOWS_API) + CloseHandle(native_); +#endif + } + } + + bool valid() const + { + return native_ != handle::invalid_handle(); + } + + void close() + { + if (valid()) + { +#if defined(BOOST_POSIX_API) + ::close(native_); +#elif defined(BOOST_WINDOWS_API) + CloseHandle(native_); +#endif + native_ = handle::invalid_handle(); + } + } + + native_type native() const + { + return native_; + } + + native_type release() + { + native_type native = native_; + native_ = handle::invalid_handle(); + return native; + } + + private: + native_type native_; + close_type close_; + }; + + /** + * Implementation of handle to store native handle value. + * + * A shared pointer is used as handles represent system resources. If a + * handle is closed and becomes invalid the state of copies of the handle + * object will be updated as they all share the handle implementation. + */ + boost::shared_ptr impl_; + + /** + * Constant function representing an invalid handle value. + * + * Returns the platform-specific handle value that represents an + * invalid handle. This is a constant function rather than a regular + * constant because, in the latter case, we cannot define it under + * Windows due to the value being of a complex type. + */ + static const native_type invalid_handle() + { +#if defined(BOOST_POSIX_API) + return -1; +#elif defined(BOOST_WINDOWS_API) + return INVALID_HANDLE_VALUE; +#endif + } +}; + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/operations.hpp b/vendor/boost/process/include/boost/process/operations.hpp new file mode 100644 index 0000000..5fcdd04 --- /dev/null +++ b/vendor/boost/process/include/boost/process/operations.hpp @@ -0,0 +1,433 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/operations.hpp + * + * Provides miscellaneous free functions. + */ + +#ifndef BOOST_PROCESS_OPERATIONS_HPP +#define BOOST_PROCESS_OPERATIONS_HPP + +#include + +#if defined(BOOST_POSIX_API) +# include +# include +# include +# include +# include +# include +# if defined(__CYGWIN__) +# include +# include +# endif +#elif defined(BOOST_WINDOWS_API) +# include +# include +# include +# include +#else +# error "Unsupported platform." +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace boost { +namespace process { + +/** + * Locates the executable program \a file in all the directory components + * specified in \a path. If \a path is empty, the value of the PATH + * environment variable is used. + * + * The path variable is interpreted following the same conventions used + * to parse the PATH environment variable in the underlying platform. + * + * \throw boost::filesystem::filesystem_error If the file cannot be found + * in the path. + */ +inline std::string find_executable_in_path(const std::string &file, + std::string path = "") +{ +#if defined(BOOST_POSIX_API) + BOOST_ASSERT(file.find('/') == std::string::npos); +#elif defined(BOOST_WINDOWS_API) + BOOST_ASSERT(file.find_first_of("\\/") == std::string::npos); +#endif + + std::string result; + +#if defined(BOOST_POSIX_API) + if (path.empty()) + { + const char *envpath = getenv("PATH"); + if (!envpath) + boost::throw_exception(boost::filesystem::filesystem_error( + BOOST_PROCESS_SOURCE_LOCATION "file not found", file, + boost::system::errc::make_error_code( + boost::system::errc::no_such_file_or_directory))); + path = envpath; + } + BOOST_ASSERT(!path.empty()); + +#if defined(__CYGWIN__) + if (!cygwin_posix_path_list_p(path.c_str())) + { + int size = cygwin_win32_to_posix_path_list_buf_size(path.c_str()); + boost::scoped_array cygpath(new char[size]); + cygwin_win32_to_posix_path_list(path.c_str(), cygpath.get()); + path = cygpath.get(); + } +#endif + + std::string::size_type pos1 = 0, pos2; + do + { + pos2 = path.find(':', pos1); + std::string dir = (pos2 != std::string::npos) ? + path.substr(pos1, pos2 - pos1) : path.substr(pos1); + std::string f = dir + + (boost::algorithm::ends_with(dir, "/") ? "" : "/") + file; + if (!access(f.c_str(), X_OK)) + result = f; + pos1 = pos2 + 1; + } while (pos2 != std::string::npos && result.empty()); +#elif defined(BOOST_WINDOWS_API) + const char *exts[] = { "", ".exe", ".com", ".bat", NULL }; + const char **ext = exts; + while (*ext) + { + char buf[MAX_PATH]; + char *dummy; + DWORD size = SearchPathA(path.empty() ? NULL : path.c_str(), + file.c_str(), *ext, MAX_PATH, buf, &dummy); + BOOST_ASSERT(size < MAX_PATH); + if (size > 0) + { + result = buf; + break; + } + ++ext; + } +#endif + + if (result.empty()) + boost::throw_exception(boost::filesystem::filesystem_error( + BOOST_PROCESS_SOURCE_LOCATION "file not found", file, + boost::system::errc::make_error_code( + boost::system::errc::no_such_file_or_directory))); + + return result; +} + +/** + * Extracts the program name from a given executable. + * + * \return The program name. On Windows the program name + * is returned without a file extension. + */ +inline std::string executable_to_progname(const std::string &exe) +{ + std::string::size_type begin = 0; + std::string::size_type end = std::string::npos; + +#if defined(BOOST_POSIX_API) + std::string::size_type slash = exe.rfind('/'); +#elif defined(BOOST_WINDOWS_API) + std::string::size_type slash = exe.find_last_of("/\\"); +#endif + if (slash != std::string::npos) + begin = slash + 1; + +#if defined(BOOST_WINDOWS_API) + if (exe.size() > 4 && (boost::algorithm::iends_with(exe, ".exe") || + boost::algorithm::iends_with(exe, ".com") || + boost::algorithm::iends_with(exe, ".bat"))) + end = exe.size() - 4; +#endif + + return exe.substr(begin, end - begin); +} + +/** + * Starts a new child process. + * + * Launches a new process based on the binary image specified by the + * executable, the set of arguments passed to it and the execution context. + * + * \remark Blocking remarks: This function may block if the device holding the + * executable blocks when loading the image. This might happen if, e.g., + * the binary is being loaded from a network share. + * + * \return A handle to the new child process. + */ +template +inline child create_child(const std::string &executable, Arguments args, + Context ctx) +{ + typedef std::map handles_t; + handles_t handles; + typename Context::streams_t::iterator it = ctx.streams.begin(); + for (; it != ctx.streams.end(); ++it) + { + if (it->first == stdin_id) + handles[it->first] = it->second(input_stream); + else if (it->first == stdout_id) + handles[it->first] = it->second(output_stream); + else if (it->first == stderr_id) + handles[it->first] = it->second(output_stream); +#if defined(BOOST_POSIX_API) + else + handles[it->first] = it->second(unknown_stream); +#endif + } + + std::string p_name = ctx.process_name.empty() ? + executable_to_progname(executable) : ctx.process_name; + args.insert(args.begin(), p_name); + +#if defined(BOOST_POSIX_API) + // Between fork() and execve() only async-signal-safe functions + // must be called if multithreaded applications should be supported. + // That's why the following code is executed before fork() is called. +#if defined(F_MAXFD) + int maxdescs = fcntl(-1, F_MAXFD, 0); + if (maxdescs == -1) + maxdescs = sysconf(_SC_OPEN_MAX); +#else + int maxdescs = sysconf(_SC_OPEN_MAX); +#endif + if (maxdescs == -1) + maxdescs = 1024; + std::vector closeflags(maxdescs, true); + std::pair argv = detail::collection_to_argv(args); + std::pair envp = + detail::environment_to_envp(ctx.env); + + const char *work_dir = ctx.work_dir.c_str(); + + pid_t pid = fork(); + if (pid == -1) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("fork(2) failed"); + else if (pid == 0) + { + if (chdir(work_dir) == -1) + { + write(STDERR_FILENO, "chdir() failed\n", 15); + _exit(127); + } + + for (handles_t::iterator it = handles.begin(); it != handles.end(); + ++it) + { + if (it->second.child.valid()) + { + handles_t::iterator it2 = it; + ++it2; + for (; it2 != handles.end(); ++it2) + { + if (it2->second.child.native() == it->first) + { + int fd = fcntl(it2->second.child.native(), F_DUPFD, + it->first + 1); + if (fd == -1) + { + write(STDERR_FILENO, "fcntl() failed\n", 15); + _exit(127); + } + it2->second.child = fd; + } + } + + if (dup2(it->second.child.native(), it->first) == -1) + { + write(STDERR_FILENO, "dup2() failed\n", 14); + _exit(127); + } + closeflags[it->first] = false; + } + } + + if (ctx.setup) + ctx.setup(); + + for (std::size_t i = 0; i < closeflags.size(); ++i) + { + if (closeflags[i]) + close(i); + } + + execve(executable.c_str(), argv.second, envp.second); + + // Actually we should delete argv and envp data. As we must not + // call any non-async-signal-safe functions though we simply exit. + write(STDERR_FILENO, "execve() failed\n", 16); + _exit(127); + } + else + { + BOOST_ASSERT(pid > 0); + + for (std::size_t i = 0; i < argv.first; ++i) + delete[] argv.second[i]; + delete[] argv.second; + + for (std::size_t i = 0; i < envp.first; ++i) + delete[] envp.second[i]; + delete[] envp.second; + + std::map parent_ends; + for (handles_t::iterator it = handles.begin(); it != handles.end(); + ++it) + parent_ends[it->first] = it->second.parent; + + return child(pid, parent_ends); + } +#elif defined(BOOST_WINDOWS_API) + STARTUPINFOA startup_info; + ZeroMemory(&startup_info, sizeof(startup_info)); + startup_info.cb = sizeof(startup_info); + startup_info.dwFlags |= STARTF_USESTDHANDLES; + startup_info.hStdInput = handles[stdin_id].child.native(); + startup_info.hStdOutput = handles[stdout_id].child.native(); + startup_info.hStdError = handles[stderr_id].child.native(); + + if (ctx.setup) + ctx.setup(startup_info); + + PROCESS_INFORMATION pi; + ZeroMemory(&pi, sizeof(pi)); + + boost::shared_array cmdline = + detail::collection_to_windows_cmdline(args); + + boost::scoped_array exe(new char[executable.size() + 1]); +#if (BOOST_MSVC >= 1400) + strcpy_s(exe.get(), executable.size() + 1, executable.c_str()); +#else + strcpy(exe.get(), executable.c_str()); +#endif + + boost::scoped_array workdir(new char[ctx.work_dir.size() + 1]); +#if (BOOST_MSVC >= 1400) + strcpy_s(workdir.get(), ctx.work_dir.size() + 1, ctx.work_dir.c_str()); +#else + strcpy(workdir.get(), ctx.work_dir.c_str()); +#endif + + boost::shared_array envstrs = + detail::environment_to_windows_strings(ctx.env); + + if (CreateProcessA(exe.get(), cmdline.get(), NULL, NULL, TRUE, 0, + envstrs.get(), workdir.get(), &startup_info, &pi) == 0) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CreateProcess() failed"); + + handle hprocess(pi.hProcess); + + if (!CloseHandle(pi.hThread)) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CloseHandle() failed"); + + std::map parent_ends; + parent_ends[stdin_id] = handles[stdin_id].parent; + parent_ends[stdout_id] = handles[stdout_id].parent; + parent_ends[stderr_id] = handles[stderr_id].parent; + + return child(hprocess, parent_ends); +#endif +} + +/** + * \overload + */ +inline child create_child(const std::string &executable) +{ + return create_child(executable, std::vector(), context()); +} + +/** + * \overload + */ +template +inline child create_child(const std::string &executable, Arguments args) +{ + return create_child(executable, args, context()); +} + +/** + * Starts a shell-based command. + * + * Executes the given command through the default system shell. The + * command is subject to pattern expansion, redirection and pipelining. + * The shell is launched as described by the parameters in the context. + * + * This function behaves similarly to the system(3) system call. In a + * POSIX system, the command is fed to /bin/sh whereas under a Windows + * system, it is fed to cmd.exe. It is difficult to write portable + * commands, but this function comes in handy in multiple situations. + * + * \remark Blocking remarks: This function may block if the device holding the + * executable blocks when loading the image. This might happen if, e.g., + * the binary is being loaded from a network share. + * + * \return A handle to the new child process. + */ +template +inline child shell(const std::string &command, Context ctx) +{ +#if defined(BOOST_POSIX_API) + std::string executable = "/bin/sh"; + std::vector args; + args.push_back("-c"); + args.push_back(command); +#elif defined(BOOST_WINDOWS_API) + char sysdir[MAX_PATH]; + UINT size = GetSystemDirectoryA(sysdir, sizeof(sysdir)); + if (!size) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("GetSystemDirectory() failed"); + std::string executable = std::string(sysdir) + + (sysdir[size - 1] != '\\' ? "\\cmd.exe" : "cmd.exe"); + std::vector args; + args.push_back("/c"); + args.push_back(command); +#endif + return create_child(executable, args, ctx); +} + +/** + * \overload + */ +inline child shell(const std::string &command) +{ + return shell(command, context()); +} + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/pid_type.hpp b/vendor/boost/process/include/boost/process/pid_type.hpp new file mode 100644 index 0000000..49dc51e --- /dev/null +++ b/vendor/boost/process/include/boost/process/pid_type.hpp @@ -0,0 +1,56 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/pid_type.hpp + * + * Includes the declaration of the pid type. + */ + +#ifndef BOOST_PROCESS_PID_TYPE_HPP +#define BOOST_PROCESS_PID_TYPE_HPP + +#include + +#if defined(BOOST_POSIX_API) +# include +#elif defined(BOOST_WINDOWS_API) +# include +#endif + +namespace boost { +namespace process { + +#if defined(BOOST_PROCESS_DOXYGEN) +/** + * Opaque name for the process identifier type. + * + * Each operating system identifies processes using a specific type. + * The \a pid_type type is used to transparently refer to a process + * regardless of the operating system. + * + * This type is guaranteed to be an integral type on all supported + * platforms. On POSIX systems it is defined as pid_t, on Windows systems as + * DWORD. + */ +typedef NativeProcessId pid_type; +#elif defined(BOOST_POSIX_API) +typedef pid_t pid_type; +#elif defined(BOOST_WINDOWS_API) +typedef DWORD pid_type; +#endif + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/pipe.hpp b/vendor/boost/process/include/boost/process/pipe.hpp new file mode 100644 index 0000000..23eb0a8 --- /dev/null +++ b/vendor/boost/process/include/boost/process/pipe.hpp @@ -0,0 +1,49 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/pipe.hpp + * + * Includes the declaration of the pipe class. + */ + +#ifndef BOOST_PROCESS_PIPE_HPP +#define BOOST_PROCESS_PIPE_HPP + +#include +#include + +namespace boost { +namespace process { + +#if defined(BOOST_PROCESS_DOXYGEN) +/** + * The pipe class is a type definition for stream-based classes defined by + * Boost.Asio. + * + * The type definition is provided for convenience. You can also use Boost.Asio + * classes directly for asynchronous I/O operations. + */ +typedef BoostAsioPipe pipe; +#elif defined(BOOST_POSIX_API) +typedef boost::asio::posix::stream_descriptor pipe; +#elif defined(BOOST_WINDOWS_API) +typedef boost::asio::windows::stream_handle pipe; +#else +# error "Unsupported platform." +#endif + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/pistream.hpp b/vendor/boost/process/include/boost/process/pistream.hpp new file mode 100644 index 0000000..9bb252f --- /dev/null +++ b/vendor/boost/process/include/boost/process/pistream.hpp @@ -0,0 +1,114 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/pistream.hpp + * + * Includes the declaration of the pistream class. + */ + +#ifndef BOOST_PROCESS_PISTREAM_HPP +#define BOOST_PROCESS_PISTREAM_HPP + +#include +#include +#include +#include + +namespace boost { +namespace process { + +/** + * Child process' output stream. + * + * The pistream class represents an output communication channel with the + * child process. The child process writes data to this stream and the + * parent process can read it through the pistream object. In other + * words, from the child's point of view, the communication channel is an + * output one, but from the parent's point of view it is an input one; + * hence the confusing pistream name. + * + * pistream objects cannot be copied because they buffer data + * that flows through the communication channel. + * + * A pistream object behaves as a std::istream stream in all senses. + * The class is only provided because it must provide a method to let + * the caller explicitly close the communication channel. + * + * \remark Blocking remarks: Functions that read data from this + * stream can block if the associated handle blocks during + * the read. As this class is used to communicate with child + * processes through anonymous pipes, the most typical blocking + * condition happens when the child has no more data to send to + * the pipe's system buffer. When this happens, the buffer + * eventually empties and the system blocks until the writer + * generates some data. + */ +class pistream : public std::istream, public boost::noncopyable +{ +public: + /** + * Creates a new process' output stream. + */ + explicit pistream(boost::process::handle h) + : std::istream(0), + handle_(h), + systembuf_(handle_.native()) + { + rdbuf(&systembuf_); + } + + /** + * Returns the handle managed by this stream. + */ + const boost::process::handle &handle() const + { + return handle_; + } + + /** + * Returns the handle managed by this stream. + */ + boost::process::handle &handle() + { + return handle_; + } + + /** + * Closes the handle managed by this stream. + * + * Explicitly closes the handle managed by this stream. This + * function can be used by the user to tell the child process it's + * not willing to receive more data. + */ + void close() + { + handle_.close(); + } + +private: + /** + * The handle managed by this stream. + */ + boost::process::handle handle_; + + /** + * The systembuf object used to manage this stream's data. + */ + detail::systembuf systembuf_; +}; + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/postream.hpp b/vendor/boost/process/include/boost/process/postream.hpp new file mode 100644 index 0000000..23c34a9 --- /dev/null +++ b/vendor/boost/process/include/boost/process/postream.hpp @@ -0,0 +1,115 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/postream.hpp + * + * Includes the declaration of the postream class. + */ + +#ifndef BOOST_PROCESS_POSTREAM_HPP +#define BOOST_PROCESS_POSTREAM_HPP + +#include +#include +#include +#include + +namespace boost { +namespace process { + +/** + * Child process' input stream. + * + * The postream class represents an input communication channel with the + * child process. The child process reads data from this stream and the + * parent process can write to it through the postream object. In other + * words, from the child's point of view, the communication channel is an + * input one, but from the parent's point of view it is an output one; + * hence the confusing postream name. + * + * postream objects cannot be copied because they buffer data that flows + * through the communication channel. + * + * A postream object behaves as a std::ostream stream in all senses. + * The class is only provided because it must provide a method to let + * the caller explicitly close the communication channel. + * + * \remark Blocking remarks: Functions that write data to this + * stream can block if the associated handle blocks during + * the write. As this class is used to communicate with child + * processes through anonymous pipes, the most typical blocking + * condition happens when the child is not processing the data + * in the pipe's system buffer. When this happens, the buffer + * eventually fills up and the system blocks until the reader + * consumes some data, leaving some new room. + */ +class postream : public std::ostream, public boost::noncopyable +{ +public: + /** + * Creates a new process' input stream. + */ + explicit postream(boost::process::handle h) + : std::ostream(0), + handle_(h), + systembuf_(handle_.native()) + { + rdbuf(&systembuf_); + } + + /** + * Returns the handle managed by this stream. + */ + const boost::process::handle &handle() const + { + return handle_; + } + + /** + * Returns the handle managed by this stream. + */ + boost::process::handle &handle() + { + return handle_; + } + + /** + * Closes the handle managed by this stream. + * + * Explicitly closes the handle managed by this stream. This + * function can be used by the user to tell the child process there + * is no more data to send. + */ + void close() + { + systembuf_.sync(); + handle_.close(); + } + +private: + /** + * The handle managed by this stream. + */ + boost::process::handle handle_; + + /** + * The systembuf object used to manage this stream's data. + */ + detail::systembuf systembuf_; +}; + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/process.hpp b/vendor/boost/process/include/boost/process/process.hpp new file mode 100644 index 0000000..8858954 --- /dev/null +++ b/vendor/boost/process/include/boost/process/process.hpp @@ -0,0 +1,212 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/process.hpp + * + * Includes the declaration of the process class. + */ + +#ifndef BOOST_PROCESS_PROCESS_HPP +#define BOOST_PROCESS_PROCESS_HPP + +#include + +#if defined(BOOST_POSIX_API) +# include +# include +# include +# include +# include +#elif defined(BOOST_WINDOWS_API) +# include +# include +# include +#else +# error "Unsupported platform." +#endif + +#include + +namespace boost { +namespace process { + +/** + * Process class to represent any running process. + */ +class process +{ +public: + /** + * Constructs a new process object. + * + * Creates a new process object that represents a running process + * within the system. + * + * On Windows the process is opened and a handle saved. This is required + * to avoid the operating system removing process resources when the + * process exits. The handle is closed when the process instance (and all + * of its copies) is destroyed. + */ + process(pid_type id) + : id_(id) +#if defined(BOOST_WINDOWS_API) + , handle_(open_process(id)) +#endif + { + } + +#if defined(BOOST_WINDOWS_API) || defined(BOOST_PROCESS_DOXYGEN) + /** + * Constructs a new process object. + * + * Creates a new process object that represents a running process + * within the system. + * + * This operation is only available on Windows systems. The handle is + * closed when the process instance (and all of its copies) is destroyed. + */ + process(handle h) + : id_(GetProcessId(h.native())), + handle_(h) + { + } +#endif + + /** + * Returns the process identifier. + */ + pid_type get_id() const + { + return id_; + } + + /** + * Terminates the process execution. + * + * Forces the termination of the process execution. Some platforms + * allow processes to ignore some external termination notifications + * or to capture them for a proper exit cleanup. You can set the + * \a force flag to true to force their termination regardless + * of any exit handler. + * + * After this call, accessing this object can be dangerous because the + * process identifier may have been reused by a different process. It + * might still be valid, though, if the process has refused to die. + * + * \throw boost::system::system_error If system calls used to terminate the + * process fail. + */ + void terminate(bool force = false) const + { +#if defined(BOOST_POSIX_API) + if (kill(id_, force ? SIGKILL : SIGTERM) == -1) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("kill(2) failed"); +#elif defined(BOOST_WINDOWS_API) +#if defined(BOOST_MSVC) + force; +#endif + HANDLE h = OpenProcess(PROCESS_TERMINATE, FALSE, id_); + if (h == NULL) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("OpenProcess() failed"); + if (!TerminateProcess(h, EXIT_FAILURE)) + { + CloseHandle(h); + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("TerminateProcess() failed"); + } + if (!CloseHandle(h)) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CloseHandle() failed"); +#endif + } + + /** + * Blocks and waits for the process to terminate. + * + * Returns an exit code. The process object ceases to be valid after this + * call. + * + * \remark Blocking remarks: This call blocks if the process has not + * finalized execution and waits until it terminates. + * + * \throw boost::system::system_error If system calls used to wait for the + * process fail. + */ + int wait() const + { +#if defined(BOOST_POSIX_API) + pid_t p; + int status; + do + { + p = waitpid(id_, &status, 0); + } while (p == -1 && errno == EINTR); + if (p == -1) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("waitpid(2) failed"); + return status; +#elif defined(BOOST_WINDOWS_API) + HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, + id_); + if (h == NULL) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("OpenProcess() failed"); + if (WaitForSingleObject(h, INFINITE) == WAIT_FAILED) + { + CloseHandle(h); + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR( + "WaitForSingleObject() failed"); + } + DWORD exit_code; + if (!GetExitCodeProcess(h, &exit_code)) + { + CloseHandle(h); + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR( + "GetExitCodeProcess() failed"); + } + if (!CloseHandle(h)) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CloseHandle() failed"); + return exit_code; +#endif + } + +private: + /** + * The process identifier. + */ + pid_type id_; + +#if defined(BOOST_WINDOWS_API) + /** + * Opens a process and returns a handle. + * + * OpenProcess() returns NULL and not INVALID_HANDLE_VALUE on failure. + * That's why the return value is manually checked in this helper function + * instead of simply passing it to the constructor of the handle class. + */ + HANDLE open_process(pid_type id) + { + HANDLE h = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, id); + if (h == NULL) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("OpenProcess() failed"); + return h; + } + + /** + * The process handle. + */ + handle handle_; +#endif +}; + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/self.hpp b/vendor/boost/process/include/boost/process/self.hpp new file mode 100644 index 0000000..704501c --- /dev/null +++ b/vendor/boost/process/include/boost/process/self.hpp @@ -0,0 +1,188 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/self.hpp + * + * Includes the declaration of the self class. + */ + +#ifndef BOOST_PROCESS_SELF_HPP +#define BOOST_PROCESS_SELF_HPP + +#include + +#if defined(BOOST_POSIX_API) +# include +# include +# include +# include +# if defined(__APPLE__) +# include +# endif +#elif defined(BOOST_WINDOWS_API) +# include +#else +# error "Unsupported platform." +#endif + +#include +#include +#include +#include +#include + +#if defined(BOOST_POSIX_API) +extern "C" +{ + extern char **environ; +} +#endif + +namespace boost { +namespace process { + +/** + * The self class provides access to the process itself. + */ +class self : public process, public boost::noncopyable +{ +public: + /** + * Returns the self instance representing the caller's process. + */ + static self &get_instance() + { + static self *instance = 0; + if (!instance) + instance = new self; + return *instance; + } + + /** + * Returns the current environment. + * + * Returns the current process environment variables. Modifying the + * returned object has no effect on the current environment. + */ + static environment get_environment() + { + environment e; + +#if defined(BOOST_POSIX_API) +# if defined(__APPLE__) + char **env = *_NSGetEnviron(); +# else + char **env = environ; +# endif + + while (*env) + { + std::string s = *env; + std::string::size_type pos = s.find('='); + e.insert(environment::value_type(s.substr(0, pos), + s.substr(pos + 1))); + ++env; + } +#elif defined(BOOST_WINDOWS_API) +# ifdef GetEnvironmentStrings +# undef GetEnvironmentStrings +# endif + + char *ms_environ = GetEnvironmentStrings(); + if (!ms_environ) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR( + "GetEnvironmentStrings() failed"); + try + { + char *env = ms_environ; + while (*env) + { + std::string s = env; + std::string::size_type pos = s.find('='); + e.insert(environment::value_type(s.substr(0, pos), + s.substr(pos + 1))); + env += s.size() + 1; + } + } + catch (...) + { + FreeEnvironmentStringsA(ms_environ); + throw; + } + FreeEnvironmentStringsA(ms_environ); +#endif + + return e; + } + + /** + * Returns the current work directory. + */ + static std::string get_work_dir() + { +#if defined(BOOST_POSIX_API) +#if defined(PATH_MAX) + char buffer[PATH_MAX]; + char *cwd = buffer; + long size = PATH_MAX; +#elif defined(_PC_PATH_MAX) + errno = 0; + long size = pathconf("/", _PC_PATH_MAX); + if (size == -1 && errno) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("pathconf(2) failed"); + else if (size == -1) + size = BOOST_PROCESS_POSIX_PATH_MAX; + BOOST_ASSERT(size > 0); + boost::scoped_array buffer(new char[size]); + char *cwd = buffer.get(); +#else + char buffer[BOOST_PROCESS_POSIX_PATH_MAX]; + char *cwd = buffer; + long size = BOOST_PROCESS_POSIX_PATH_MAX; +#endif + if (!getcwd(cwd, size)) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("getcwd(2) failed"); + BOOST_ASSERT(cwd[0] != '\0'); + return cwd; +#elif defined(BOOST_WINDOWS_API) + BOOST_ASSERT(MAX_PATH > 0); + char cwd[MAX_PATH]; + if (!GetCurrentDirectoryA(sizeof(cwd), cwd)) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR( + "GetCurrentDirectory() failed"); + BOOST_ASSERT(cwd[0] != '\0'); + return cwd; +#endif + } + +private: + /** + * Constructs a new self object. + * + * Creates a new self object that represents the current process. + */ + self() : +#if defined(BOOST_POSIX_API) + process(getpid()) +#elif defined(BOOST_WINDOWS_API) + process(GetCurrentProcessId()) +#endif + { + } +}; + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/status.hpp b/vendor/boost/process/include/boost/process/status.hpp new file mode 100644 index 0000000..55b89f3 --- /dev/null +++ b/vendor/boost/process/include/boost/process/status.hpp @@ -0,0 +1,41 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/status.hpp + * + * Includes the declaration of the status class. + */ + +#ifndef BOOST_PROCESS_STATUS_HPP +#define BOOST_PROCESS_STATUS_HPP + +#include +#include +#include + +namespace boost { +namespace process { + +/** + * The status class to wait for processes to exit. + * + * The status class is a Boost.Asio I/O object and supports synchronous + * and asynchronous wait operations. + */ +typedef detail::basic_status > status; + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/stream_behavior.hpp b/vendor/boost/process/include/boost/process/stream_behavior.hpp new file mode 100644 index 0000000..2911f56 --- /dev/null +++ b/vendor/boost/process/include/boost/process/stream_behavior.hpp @@ -0,0 +1,326 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/stream_behavior.hpp + * + * Includes the declaration of stream behavior classes. + */ + +#ifndef BOOST_PROCESS_STREAM_BEHAVIOR_HPP +#define BOOST_PROCESS_STREAM_BEHAVIOR_HPP + +#include + +#if defined(BOOST_POSIX_API) +# include +# include +# include +#elif defined(BOOST_WINDOWS_API) +# include +# include +#endif + +#include +#include +#include +#include +#include + +namespace boost { +namespace process { +namespace behavior { + +/** + * Stream behavior to close streams of a child process. + * + * A child process will not be able to use the stream. + */ +class close +{ +public: + stream_ends operator()(stream_type) const + { + return stream_ends(); + } +}; + +/** + * Stream behavior to make a child process inherit streams. + * + * A child process will use the very same stream of its parent process. + */ +class inherit +{ +public: + inherit(handle::native_type h) + : h_(h, handle::dont_close) + { +#if defined(BOOST_WINDOWS_API) + if (h != INVALID_HANDLE_VALUE) + { + if (!SetHandleInformation(h_.native(), HANDLE_FLAG_INHERIT, + HANDLE_FLAG_INHERIT)) + { + HANDLE proc = GetCurrentProcess(); + HANDLE dup; + if (!DuplicateHandle(proc, h_.native(), proc, &dup, 0, + TRUE, DUPLICATE_SAME_ACCESS)) + { + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR( + "DuplicateHandle() failed"); + } + h_ = dup; + } + } +#endif + } + + stream_ends operator()(stream_type) const + { + return stream_ends(h_, handle()); + } + +private: + handle h_; +}; + +/** + * Stream behavior to redirect streams with a pipe. + * + * A child process will be able to communicate with its parent process. + */ +class pipe +{ +public: +#if defined(BOOST_POSIX_API) + pipe() + : stype_(unknown_stream) + { + } + + pipe(stream_type stype) + : stype_(stype) + { + } +#endif + + stream_ends operator()(stream_type stype) const + { + handle::native_type ends[2]; +#if defined(BOOST_POSIX_API) + if (::pipe(ends) == -1) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("pipe(2) failed"); + if (stype_ != unknown_stream) + stype = stype_; +#elif defined(BOOST_WINDOWS_API) + SECURITY_ATTRIBUTES sa; + ZeroMemory(&sa, sizeof(sa)); + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = FALSE; + if (!CreatePipe(&ends[0], &ends[1], &sa, 0)) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CreatePipe() failed"); +#endif + handle child_end = ends[stype == input_stream ? 0 : 1]; + handle parent_end = ends[stype == input_stream ? 1 : 0]; +#if defined(BOOST_WINDOWS_API) + if (!SetHandleInformation(child_end.native(), HANDLE_FLAG_INHERIT, + HANDLE_FLAG_INHERIT)) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR( + "SetHandleInformation() failed"); +#endif + return stream_ends(child_end, parent_end); + } + +#if defined(BOOST_POSIX_API) +private: + stream_type stype_; +#endif +}; + +/** + * Stream behavior to redirect streams with a named pipe. + * + * A child process will be able to communicate with its parent process. + */ +class named_pipe +{ +public: + named_pipe(const std::string &name) + : name_(name) +#if defined(BOOST_POSIX_API) + , stype_(unknown_stream) +#endif + { + } + +#if defined(BOOST_POSIX_API) + named_pipe(const std::string &name, stream_type stype) + : name_(name), + stype_(stype) + { + } +#endif + + stream_ends operator()(stream_type stype) const + { +#if defined(BOOST_POSIX_API) + if (mkfifo(name_.c_str(), S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) == -1) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("mkfifo(3) failed"); + handle child_end = open(name_.c_str(), O_RDONLY | O_NONBLOCK); + if (!child_end.valid()) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("open(2) failed"); + int opts = fcntl(child_end.native(), F_GETFL); + if (opts == -1) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("fcntl(2) failed"); + opts ^= O_NONBLOCK; + if (fcntl(child_end.native(), F_SETFL, opts) == -1) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("fcntl(2) failed"); + handle parent_end = open(name_.c_str(), O_WRONLY); + if (!parent_end.valid()) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("open(2) failed"); + if (stype_ != unknown_stream) + stype = stype_; +#elif defined(BOOST_WINDOWS_API) + SECURITY_ATTRIBUTES sa; + ZeroMemory(&sa, sizeof(sa)); + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; + handle child_end = CreateNamedPipeA(name_.c_str(), PIPE_ACCESS_INBOUND | + FILE_FLAG_OVERLAPPED, 0, 1, 8192, 8192, 0, &sa); + if (!child_end.valid()) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CreateNamedPipe() failed"); + handle parent_end = CreateFileA(name_.c_str(), GENERIC_WRITE, 0, NULL, + OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); + if (!parent_end.valid()) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CreateFile() failed"); +#endif + if (stype == output_stream) + std::swap(child_end, parent_end); +#if defined(BOOST_WINDOWS_API) + if (!SetHandleInformation(child_end.native(), HANDLE_FLAG_INHERIT, + HANDLE_FLAG_INHERIT)) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR( + "SetHandleInformation() failed"); +#endif + return stream_ends(child_end, parent_end); + } + +private: + std::string name_; + +#if defined(BOOST_POSIX_API) + stream_type stype_; +#endif +}; + +/** + * Stream behavior to redirect streams with a pipe which supports asynchronous + * I/O. + * + * As platforms require different types of pipes for asynchronous I/O this + * stream behavior is provided for convenience. It uses the minimum required + * pipe type on a platform in order to be able to use asynchronous I/O. + */ +#if defined(BOOST_POSIX_API) || defined(BOOST_PROCESS_DOXYGEN) +typedef pipe async_pipe; +#elif defined(BOOST_WINDOWS_API) +class async_pipe +{ +public: + stream_ends operator()(stream_type stype) const + { + UUID uuid; + RPC_STATUS s = UuidCreateSequential(&uuid); + if (s != RPC_S_OK && s != RPC_S_UUID_LOCAL_ONLY) + BOOST_PROCESS_THROW_ERROR(s, "UuidCreateSequential() failed"); + unsigned char *c; + s = UuidToStringA(&uuid, &c); + if (s != RPC_S_OK) + BOOST_PROCESS_THROW_ERROR(s, "UuidToString() failed"); + std::string name; + try + { + name = reinterpret_cast(c); + } + catch (...) + { + RpcStringFreeA(&c); + throw; + } + RpcStringFreeA(&c); + named_pipe p("\\\\.\\pipe\\boost_process_" + name); + return p(stype); + } +}; +#endif + +/** + * Stream behavior to mute streams. + * + * A child process will be able to use streams. But data written to an + * output stream is discarded and data read from an input stream is 0. + */ +class null +{ +public: +#if defined(BOOST_POSIX_API) + null() + : stype_(unknown_stream) + { + } + + null(stream_type stype) + : stype_(stype) + { + } +#endif + + stream_ends operator()(stream_type stype) const + { +#if defined(BOOST_POSIX_API) + if (stype_ != unknown_stream) + stype = stype_; + std::string filename = (stype == input_stream) ? "/dev/zero" : + "/dev/null"; + int flag = (stype == input_stream) ? O_RDONLY : O_WRONLY; + handle child_end = open(filename.c_str(), flag); + if (!child_end.valid()) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("open(2) failed"); +#elif defined(BOOST_WINDOWS_API) + DWORD access = (stype == input_stream) ? GENERIC_READ : GENERIC_WRITE; + handle child_end = CreateFileA("NUL", access, 0, NULL, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, NULL); + if (!child_end.valid()) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR("CreateFile() failed"); + if (!SetHandleInformation(child_end.native(), HANDLE_FLAG_INHERIT, + HANDLE_FLAG_INHERIT)) + BOOST_PROCESS_THROW_LAST_SYSTEM_ERROR( + "SetHandleInformation() failed"); +#endif + return stream_ends(child_end, handle()); + } + +#if defined(BOOST_POSIX_API) +private: + stream_type stype_; +#endif +}; + +} +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/stream_ends.hpp b/vendor/boost/process/include/boost/process/stream_ends.hpp new file mode 100644 index 0000000..2ae87a1 --- /dev/null +++ b/vendor/boost/process/include/boost/process/stream_ends.hpp @@ -0,0 +1,68 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/stream_ends.hpp + * + * Includes the declaration of the stream_ends class. + */ + +#ifndef BOOST_PROCESS_STREAM_ENDS_HPP +#define BOOST_PROCESS_STREAM_ENDS_HPP + +#include +#include + +namespace boost { +namespace process { + +/** + * A pair of handles to configure streams. + * + * Stream behaviors return a pair of handles to specify how a child's stream + * should be configured and possibly the opposite end of a child's end. This + * is the end remaining in the parent process and which can be used for example + * to communicate with a child process through its standard streams. + */ +struct stream_ends { + /** + * The child's end. + */ + handle child; + + /** + * The parent's end. + */ + handle parent; + + /** + * Standard constructor creating two invalid handles. + */ + stream_ends() + { + } + + /** + * Helper constructor to easily initialize handles. + */ + stream_ends(handle c, handle p) + : child(c), + parent(p) + { + } +}; + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/stream_id.hpp b/vendor/boost/process/include/boost/process/stream_id.hpp new file mode 100644 index 0000000..cb098c7 --- /dev/null +++ b/vendor/boost/process/include/boost/process/stream_id.hpp @@ -0,0 +1,50 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/stream_id.hpp + * + * Includes the declaration of the stream_id type. + */ + +#ifndef BOOST_PROCESS_STREAM_ID_HPP +#define BOOST_PROCESS_STREAM_ID_HPP + +#include + +namespace boost { +namespace process { + +/** + * Standard stream id to refer to standard streams in a cross-platform manner. + */ +enum std_stream_id { stdin_id, stdout_id, stderr_id }; + +#if defined(BOOST_PROCESS_DOXYGEN) +/** + * Stream id type. + * + * Depending on the platform the stream id type is defined to refer to standard + * streams only or to support more streams. + */ +typedef NativeStreamId stream_id; +#elif defined(BOOST_POSIX_API) +typedef int stream_id; +#elif defined(BOOST_WINDOWS_API) +typedef std_stream_id stream_id; +#endif + +} +} + +#endif diff --git a/vendor/boost/process/include/boost/process/stream_type.hpp b/vendor/boost/process/include/boost/process/stream_type.hpp new file mode 100644 index 0000000..d78c1f9 --- /dev/null +++ b/vendor/boost/process/include/boost/process/stream_type.hpp @@ -0,0 +1,45 @@ +// +// Boost.Process +// ~~~~~~~~~~~~~ +// +// Copyright (c) 2006, 2007 Julio M. Merino Vidal +// Copyright (c) 2008 Ilya Sokolov, Boris Schaeling +// Copyright (c) 2009 Boris Schaeling +// Copyright (c) 2010 Felipe Tanus, Boris Schaeling +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// + +/** + * \file boost/process/stream_type.hpp + * + * Includes the declaration of the stream_type enumeration. + */ + +#ifndef BOOST_PROCESS_STREAM_TYPE_HPP +#define BOOST_PROCESS_STREAM_TYPE_HPP + +#include + +namespace boost { +namespace process { + +/** + * Stream type to differentiate between input and output streams. + * + * On POSIX systems another value unknown_stream is defined. It is passed + * to stream behaviors for file descriptors greater than 2. + */ +enum stream_type { + input_stream, + output_stream +#if defined(BOOST_POSIX_API) + , unknown_stream +#endif +}; + +} +} + +#endif