$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r62049 - in sandbox/SOC/2010/process/boost/process: . detail
From: fotanus_at_[hidden]
Date: 2010-05-16 18:59:37
Author: fotanus
Date: 2010-05-16 18:59:36 EDT (Sun, 16 May 2010)
New Revision: 62049
URL: http://svn.boost.org/trac/boost/changeset/62049
Log:
Added Environment and Self classes.
Child and Process Revised; The inheritance was not removed.
create_child on win32 working.
Added:
   sandbox/SOC/2010/process/boost/process/environment.hpp   (contents, props changed)
   sandbox/SOC/2010/process/boost/process/self.hpp   (contents, props changed)
Text files modified: 
   sandbox/SOC/2010/process/boost/process/child.hpp                |    72 +++++------------                       
   sandbox/SOC/2010/process/boost/process/context.hpp              |    16 ++-                                     
   sandbox/SOC/2010/process/boost/process/detail/posix_helpers.hpp |     4                                         
   sandbox/SOC/2010/process/boost/process/detail/win32_helpers.hpp |    49 ++++++------                            
   sandbox/SOC/2010/process/boost/process/operations.hpp           |    39 +++++----                               
   sandbox/SOC/2010/process/boost/process/process.hpp              |   159 ++++++++++++++++++++++++--------------- 
   sandbox/SOC/2010/process/boost/process/status.hpp               |   108 +++++++++++++-------------              
   7 files changed, 230 insertions(+), 217 deletions(-)
Modified: sandbox/SOC/2010/process/boost/process/child.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/child.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/child.hpp	2010-05-16 18:59:36 EDT (Sun, 16 May 2010)
@@ -21,13 +21,15 @@
 #include <boost/process/config.hpp> 
 
 #if defined(BOOST_POSIX_API) 
-#  include <sys/types.h> 
-#  include <sys/wait.h> 
-#  include <cerrno> 
+        #include <sys/types.h> 
+        #include <sys/wait.h> 
+        #include <cerrno> 
+
 #elif defined(BOOST_WINDOWS_API) 
-#  include <windows.h> 
+        #include <windows.h> 
+
 #else 
-#  error "Unsupported platform." 
+        #error "Unsupported platform." 
 #endif 
 
 #include <boost/process/process.hpp> 
@@ -35,8 +37,8 @@
 
 #include <boost/process/pistream.hpp> 
 #include <boost/process/postream.hpp> 
-#include <boost/process/status.hpp> 
 #include <boost/process/detail/file_handle.hpp> 
+
 #include <boost/system/system_error.hpp> 
 #include <boost/throw_exception.hpp> 
 #include <boost/shared_ptr.hpp> 
@@ -62,10 +64,9 @@
          * standard input communication channel with the child process. 
          */ 
         postream &get_stdin() const 
-        { 
-            BOOST_ASSERT(stdin_); 
-
-            return *stdin_; 
+        {
+                BOOST_ASSERT(stdin_); 
+                return *stdin_; 
         } 
 
         /** 
@@ -77,7 +78,6 @@
         pistream &get_stdout() const 
         { 
             BOOST_ASSERT(stdout_); 
-
             return *stdout_; 
         } 
 
@@ -90,36 +90,10 @@
         pistream &get_stderr() const 
         { 
             BOOST_ASSERT(stderr_); 
-
             return *stderr_; 
         } 
 
-        /** 
-         * Blocks and waits for the child process to terminate. 
-         * 
-         * Returns a status object that represents the child process' 
-         * finalization condition. The child process object ceases to be 
-         * valid after this call. 
-         * 
-         * \remark Blocking remarks: This call blocks if the child 
-         *         process has not finalized execution and waits until 
-         *         it terminates. 
-         */ 
-        status wait() 
-        { 
-#if defined(BOOST_POSIX_API) 
-            int s; 
-            if (::waitpid(get_id(), &s, 0) == -1) 
-                boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::child::wait: waitpid(2) failed")); 
-            return status(s); 
-#elif defined(BOOST_WINDOWS_API) 
-            ::WaitForSingleObject(process_handle_.get(), INFINITE); 
-            DWORD code; 
-            if (!::GetExitCodeProcess(process_handle_.get(), &code)) 
-                boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::child::wait: GetExitCodeProcess failed")); 
-            return status(code); 
-#endif 
-        } 
+
 
         /** 
          * Creates a new child object that represents the just spawned child 
@@ -137,9 +111,9 @@
          */ 
         child(id_type id, detail::file_handle fhstdin, detail::file_handle fhstdout, detail::file_handle fhstderr, detail::file_handle fhprocess = detail::file_handle()) 
             : process(id) 
-#if defined(BOOST_WINDOWS_API) 
+        #if defined(BOOST_WINDOWS_API) 
             , process_handle_(fhprocess.release(), ::CloseHandle) 
-#endif 
+        #endif 
         { 
             if (fhstdin.valid()) 
                 stdin_.reset(new postream(fhstdin)); 
@@ -180,13 +154,13 @@
          */ 
         boost::shared_ptr<pistream> stderr_; 
 
-#if defined(BOOST_WINDOWS_API) 
-        /** 
-         * Process handle owned by RAII object. 
-         */ 
-        boost::shared_ptr<void> process_handle_; 
-#endif 
-}; 
+        #if defined(BOOST_WINDOWS_API) 
+                /** 
+                 * Process handle owned by RAII object. 
+                 */ 
+                boost::shared_ptr<void> process_handle_; 
+        #endif 
+
 
 /** 
  * Collection of child objects. 
@@ -196,7 +170,7 @@
  */ 
 typedef std::vector<child> children; 
 
+} ;
 } 
-} 
-
+}
 #endif 
Modified: sandbox/SOC/2010/process/boost/process/context.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/context.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/context.hpp	2010-05-16 18:59:36 EDT (Sun, 16 May 2010)
@@ -20,6 +20,8 @@
 #include <boost/process/config.hpp> 
 #include <map>
 #include <boost/process/stream_behavior.hpp>
+#include <boost/process/environment.hpp>
+#include <boost/process/self.hpp>
 
 
 #ifndef BOOST_PROCESS_CONTEXT_HPP 
@@ -46,21 +48,23 @@
          */
 struct context{
 
-        std::map<std::string,std::string> environment; //default: empty
+        environment_t environment; //default: empty
 
         std::string process_name; //default: empty
         //io_service *ioservice; //default: NULL
-        std::string work_dir; //default: self::get_work_dir();
+        std::string work_dir;
 
-        stream_behavior stdin_behavior; //default: inherit
-        stream_behavior stdout_behavior; //default: inherit
-        stream_behavior stderr_behavior; //default: inherit
+        stream_behavior stdin_behavior; 
+        stream_behavior stdout_behavior; 
+        stream_behavior stderr_behavior; 
 
         context(){
                 stdin_behavior = inherit;
                 stdout_behavior = inherit;
                 stderr_behavior = inherit;
-                work_dir = ""; //self::get_work_directory();
+                work_dir = self::get_work_dir();
+                environment = self::get_environment();
+
         }
 
 };
Modified: sandbox/SOC/2010/process/boost/process/detail/posix_helpers.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/detail/posix_helpers.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/detail/posix_helpers.hpp	2010-05-16 18:59:36 EDT (Sun, 16 May 2010)
@@ -114,11 +114,11 @@
  *         the environment's content. Each array entry is a 
  *         NULL-terminated string of the form var=value. 
  */ 
-inline char ** environment_to_envp( std::map<std::string,std::string> env){ 
+inline char ** environment_to_envp( environment_t env){ 
         char **envp = new char*[env.size() + 1]; 
 
         unsigned int i = 0; 
-        for (std::map<std::string,std::string>::const_iterator it = env.begin(); it != env.end(); ++it){ 
+        for (environment_t::const_iterator it = env.begin(); it != env.end(); ++it){ 
                 std::string s = (*it).first + "=" + (*it).second; 
                 envp[i] = new char[s.size() + 1]; 
                 ::strncpy(envp[i], s.c_str(), s.size() + 1); 
Modified: sandbox/SOC/2010/process/boost/process/detail/win32_helpers.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/detail/win32_helpers.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/detail/win32_helpers.hpp	2010-05-16 18:59:36 EDT (Sun, 16 May 2010)
@@ -55,7 +55,7 @@
  *         the environment's content. This string is of the form 
  *         var1=value1\\0var2=value2\\0\\0. 
  */ 
-inline boost::shared_array<char> environment_to_win32_strings(std::map<std::string,std::string> &env){ 
+inline boost::shared_array<char> environment_to_win32_strings(environment_t &env){ 
     boost::shared_array<char> envp; 
 
     if (env.empty()) 
@@ -66,7 +66,7 @@
     else 
     { 
         std::string s; 
-        for (std::map<std::string,std::string>::const_iterator it = env.begin(); it != env.end(); ++it) 
+        for (environment_t::const_iterator it = env.begin(); it != env.end(); ++it) 
         { 
             s += (*it).first + "=" + (*it).second; 
             s.push_back(0); 
@@ -135,8 +135,11 @@
     return cmdline; 
 } 
 
-
-
+/*
+ * This function configures the std stream of the new process.
+ * It recieves stream_detail from that stream and a STARTUPINFOA
+ * That will be stored the configuration. 
+ */
 void configure_win32_stream(stream_detail &sd, STARTUPINFOA *si){
 
         file_handle return_handle;
@@ -147,6 +150,7 @@
                         break; 
                 } 
                 case inherit:{
+                       
                         return_handle = file_handle::win32_dup_std(sd.stream_handler, true);
                         break; 
                 } 
@@ -195,30 +199,25 @@
 
         file_handle h;
                 
-
-        switch(sd.stream_type){
-                case stdin_type:{
-                        if(return_handle.valid())
+        if(return_handle.valid()){
+                switch(sd.stream_type){
+                        case stdin_type:{
                                 (*si).hStdInput = return_handle.get();
-                        else
-                                (*si).hStdInput =  INVALID_HANDLE_VALUE;
-                        break;
-                }
-                case stdout_type:{
-                        if(return_handle.valid())
+                                break;
+                        }
+                        case stdout_type:{
                                 (*si).hStdOutput = return_handle.get();
-                        else
-                                (*si).hStdOutput =  INVALID_HANDLE_VALUE;
-                        break;
-                }
-                case stderr_type:{
-                        if(return_handle.valid())
-                                (*si).hStdError = return_handle.get();
-                        else
-                                (*si).hStdError =  INVALID_HANDLE_VALUE;
-                        break;
-                }
+                                break;
+                        }
+                        case stderr_type:{
+                                (*si).hStdError =  return_handle.get();
+                                break;
+                        }
 
+                }
+        }
+        else{
+                si->hStdError = INVALID_HANDLE_VALUE;
         }
 
 }
Added: sandbox/SOC/2010/process/boost/process/environment.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/process/boost/process/environment.hpp	2010-05-16 18:59:36 EDT (Sun, 16 May 2010)
@@ -0,0 +1,50 @@
+// 
+// Boost.Process 
+// ~~~~~~~~~~~~~ 
+// 
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal 
+// Copyright (c) 2008, 2009 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 <string> 
+#include <map> 
+
+namespace boost { 
+namespace process { 
+
+/** 
+ * Representation of a process' environment variables. 
+ * 
+ * The environment is a map that stablishes 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<std::string, std::string> environment_t; 
+
+} 
+} 
+
+#endif 
Modified: sandbox/SOC/2010/process/boost/process/operations.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/operations.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/operations.hpp	2010-05-16 18:59:36 EDT (Sun, 16 May 2010)
@@ -63,6 +63,7 @@
 #include <stdexcept> 
 #include <cstddef> 
 
+
 namespace boost { 
 namespace process { 
 
@@ -208,16 +209,16 @@
         detail::file_handle fhstdin, fhstdout, fhstderr;
 
         detail::stream_detail stdin_stream(detail::stdin_type), 
-								stdout_stream(detail::stdout_type),
-								stderr_stream(detail::stderr_type);
+                                stdout_stream(detail::stdout_type),
+                                stderr_stream(detail::stderr_type);
 
         stdin_stream.behavior = ctx.stdin_behavior;
         stdout_stream.behavior = ctx.stdout_behavior;
         stderr_stream.behavior = ctx.stderr_behavior;
 
-		std::string p_name = ctx.process_name.empty() ? executable : ctx.process_name;
+        std::string p_name = ctx.process_name.empty() ? executable : ctx.process_name;
         args.insert(args.begin(),p_name);
-
+     
 
 #if defined(BOOST_POSIX_API)
 
@@ -231,8 +232,8 @@
                 detail::configure_posix_stream(stdout_stream);
                 detail::configure_posix_stream(stderr_stream);
 
-				std::pair<std::size_t, char**> argcv = detail::collection_to_posix_argv(args); 
-        		char **envp = detail::environment_to_envp(ctx.environment);
+                std::pair<std::size_t, char**> argcv = detail::collection_to_posix_argv(args); 
+                char **envp = detail::environment_to_envp(ctx.environment);
 
                 ::execve(executable.c_str(), argcv.second, envp); 
 
@@ -243,7 +244,7 @@
         BOOST_ASSERT(pid > 0); 
 
 
-		//TODO: turn this in a helper
+	//TODO: turn this in a helper
         if(ctx.stdin_behavior == capture){
                 stdin_stream.object.pipe_->rend().close();
                 fhstdin = stdin_stream.object.pipe_->rend().release();
@@ -278,15 +279,15 @@
                 fhstdin = stdin_stream.object.pipe_->wend();
 
         //define startup info from the new child
-        STARTUPINFOA start_up_info;
-        ::ZeroMemory(&start_up_info, sizeof(start_up_info)); 
-        start_up_info.cb = sizeof(start_up_info); 
-
-        start_up_info.dwFlags |= STARTF_USESTDHANDLES; 
-		
-	configure_win32_stream(stdin_stream, &start_up_info); 
-    	configure_win32_stream(stdout_stream, &start_up_info); 
-	configure_win32_stream(stderr_stream, &start_up_info);  
+        STARTUPINFOA startup_info;
+        ::ZeroMemory(&startup_info, sizeof(startup_info)); 
+        startup_info.cb = sizeof(startup_info); 
+	
+        //configure std stream info for the child
+	configure_win32_stream(stdin_stream, &startup_info); 
+    	configure_win32_stream(stdout_stream, &startup_info); 
+	configure_win32_stream(stderr_stream, &startup_info); 
+        
 
         //define basic info to start the process
             PROCESS_INFORMATION pi; 
@@ -299,13 +300,13 @@
 
             boost::scoped_array<char> workdir(new char[ctx.work_dir.size() + 1]); 
         ::strcpy_s(workdir.get(), ctx.work_dir.size() + 1, ctx.work_dir.c_str()); 
-		
 
-	boost::shared_array<char> envstrs = detail::environment_to_win32_strings(ctx.environment); 
+        boost::shared_array<char> envstrs = detail::environment_to_win32_strings(ctx.environment); 
+
 
            if ( ! ::CreateProcessA(exe.get(), cmdline.get(), 
                         NULL, NULL, TRUE, 0, envstrs.get(), workdir.get(), 
-			&start_up_info, &pi)) 
+			&startup_info, &pi)) 
                 boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::detail::win32_start: CreateProcess failed")); 
 
         if (! ::CloseHandle(pi.hThread)) 
Modified: sandbox/SOC/2010/process/boost/process/process.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/process.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/process.hpp	2010-05-16 18:59:36 EDT (Sun, 16 May 2010)
@@ -18,20 +18,23 @@
 #ifndef BOOST_PROCESS_PROCESS_HPP 
 #define BOOST_PROCESS_PROCESS_HPP 
 
-#include <boost/process/config.hpp> 
+
+#include <boost/process/config.hpp>
+#include <boost/process/status.hpp> 
 
 #if defined(BOOST_POSIX_API) 
-#  include <cerrno> 
-#  include <signal.h> 
+        #include <cerrno> 
+        #include <signal.h> 
 #elif defined(BOOST_WINDOWS_API) 
-#  include <cstdlib> 
-#  include <windows.h> 
+        #include <cstdlib> 
+        #include <windows.h> 
 #else 
-#  error "Unsupported platform." 
+        #error "Unsupported platform." 
 #endif 
 
 #include <boost/system/system_error.hpp> 
 #include <boost/throw_exception.hpp> 
+#include <boost/shared_ptr.hpp> 
 
 namespace boost { 
 namespace process { 
@@ -63,68 +66,100 @@
     typedef DWORD id_type; 
 #endif 
 
-    /** 
-     * Constructs a new process object. 
-     * 
-     * Creates a new process object that represents a running process 
-     * within the system. 
-     */ 
-    process(id_type id) 
-        : id_(id) 
-    { 
-    } 
+        /** 
+         * Constructs a new process object. 
+         * 
+         * Creates a new process object that represents a running process 
+         * within the system. 
+         */ 
+        process(id_type id) 
+        : id_(id){ 
+        } 
 
-    /** 
-     * Returns the process' identifier. 
-     */ 
-    id_type get_id() const 
-    { 
+        /** 
+         * Returns the process' identifier. 
+         */ 
+        id_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 in them 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 the system call used to 
-     *        terminate the process fails. 
-     */ 
-    void terminate(bool force = false) const 
-    { 
-#if defined(BOOST_POSIX_API) 
-        if (::kill(id_, force ? SIGKILL : SIGTERM) == -1) 
-            boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::process::terminate: kill(2) failed")); 
-#elif defined(BOOST_WINDOWS_API) 
-        HANDLE h = ::OpenProcess(PROCESS_TERMINATE, FALSE, id_); 
-        if (h == NULL) 
-            boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: OpenProcess failed")); 
-        if (!::TerminateProcess(h, EXIT_FAILURE)) 
-        { 
-            ::CloseHandle(h); 
-            boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: TerminateProcess failed")); 
+        /** 
+         * 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 in them 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 the system call used to 
+         *        terminate the process fails. 
+         */ 
+
+        void terminate(bool force = false) const{ 
+                #if defined(BOOST_POSIX_API) 
+                        if (::kill(id_, force ? SIGKILL : SIGTERM) == -1) 
+                                boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::process::terminate: kill(2) failed")); 
+
+                #elif defined(BOOST_WINDOWS_API) 
+                        HANDLE h = ::OpenProcess(PROCESS_TERMINATE, FALSE, id_); 
+                        if (h == NULL) 
+                                boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: OpenProcess failed")); 
+
+                        if (!::TerminateProcess(h, EXIT_FAILURE)){ 
+                                ::CloseHandle(h); 
+                                boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: TerminateProcess failed")); 
+                        } 
+                        if (!::CloseHandle(h)) 
+                                boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: CloseHandle failed")); 
+                #endif 
         } 
-        if (!::CloseHandle(h)) 
-            boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::process::terminate: CloseHandle failed")); 
-#endif 
-    } 
+        /** 
+         * Blocks and waits for the child process to terminate. 
+         * 
+         * Returns a status object that represents the child process' 
+         * finalization condition. The child process object ceases to be 
+         * valid after this call. 
+         * 
+         * \remark Blocking remarks: This call blocks if the child 
+         *         process has not finalized execution and waits until 
+         *         it terminates. 
+         */ 
+        status wait(){ 
+                #if defined(BOOST_POSIX_API) 
+                        int s; 
+                        if (::waitpid(get_id(), &s, 0) == -1) 
+                                boost::throw_exception(boost::system::system_error(boost::system::error_code(errno, boost::system::get_system_category()), "boost::process::child::wait: waitpid(2) failed")); 
+                        return status(s); 
+                #elif defined(BOOST_WINDOWS_API) 
+                        ::WaitForSingleObject(process_handle_.get(), INFINITE); 
+                        DWORD code; 
+                        if (!::GetExitCodeProcess(process_handle_.get(), &code)) 
+                                boost::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::child::wait: GetExitCodeProcess failed")); 
+                        return status(code); 
+                #endif 
+        } 
+
+        
+        #if defined(BOOST_WINDOWS_API) 
+                /** 
+                 * Process handle owned by RAII object. 
+                 */ 
+                boost::shared_ptr<void> process_handle_; 
+        #endif 
 
 private: 
-    /** 
-     * The process' identifier. 
-     */ 
-    id_type id_; 
-}; 
+        /** 
+         * The process' identifier. 
+         */ 
+        id_type id_; 
 
-} 
-} 
 
+};
+} 
+}
 #endif 
Added: sandbox/SOC/2010/process/boost/process/self.hpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/process/boost/process/self.hpp	2010-05-16 18:59:36 EDT (Sun, 16 May 2010)
@@ -0,0 +1,163 @@
+// 
+// Boost.Process 
+// ~~~~~~~~~~~~~ 
+// 
+// Copyright (c) 2006, 2007 Julio M. Merino Vidal 
+// Copyright (c) 2008, 2009 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 <boost/process/config.hpp> 
+
+#if defined(BOOST_POSIX_API) 
+        #include <unistd.h> 
+
+        #if defined(__APPLE__) 
+                #include <crt_externs.h> 
+        #endif 
+
+#elif defined(BOOST_WINDOWS_API) 
+        #include <windows.h> 
+        #include <direct.h>
+#else 
+        #error "Unsupported platform." 
+#endif 
+
+#include <boost/process/process.hpp> 
+#include <boost/process/environment.hpp> 
+#include <boost/system/system_error.hpp> 
+#include <boost/throw_exception.hpp> 
+#include <boost/noncopyable.hpp> 
+#include <string> 
+#include <iostream>
+
+#if defined(BOOST_POSIX_API) 
+extern "C" 
+{ 
+    extern char **environ; 
+} 
+#endif 
+
+namespace boost { 
+namespace process { 
+
+/** 
+ * Generic implementation of the Process concept. 
+ * 
+ * The self singleton provides access to the current process. 
+ */ 
+class self : public process, 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_t get_environment(){ 
+                environment_t 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(boost::process::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::throw_exception(boost::system::system_error(boost::system::error_code(::GetLastError(), boost::system::get_system_category()), "boost::process::self::get_environment: GetEnvironmentStrings failed")); 
+                        try{ 
+                                char *env = ms_environ; 
+                                while (*env){ 
+                                        std::string s = env; 
+                                        std::string::size_type pos = s.find('='); 
+                                        e.insert(boost::process::environment_t::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; 
+        }
+
+
+        static char * get_work_dir(){
+                #if defined(BOOST_POSIX_API) 
+                        
+                        
+                #elif defined(BOOST_WINDOWS_API) 
+                        
+                        char* buffer;
+
+                        BOOST_ASSERT( (buffer = _getcwd( NULL, 0 )) != NULL );
+                        return buffer;
+                               
+                                        
+                        
+                       
+                #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 
Modified: sandbox/SOC/2010/process/boost/process/status.hpp
==============================================================================
--- sandbox/SOC/2010/process/boost/process/status.hpp	(original)
+++ sandbox/SOC/2010/process/boost/process/status.hpp	2010-05-16 18:59:36 EDT (Sun, 16 May 2010)
@@ -21,10 +21,11 @@
 #include <boost/process/config.hpp> 
 
 #if defined(BOOST_POSIX_API) 
-#  include <sys/wait.h> 
+        #include <sys/wait.h> 
 #elif defined(BOOST_WINDOWS_API) 
+
 #else 
-#  error "Unsupported platform." 
+        #  error "Unsupported platform." 
 #endif 
 
 #include <boost/assert.hpp> 
@@ -32,7 +33,7 @@
 namespace boost { 
 namespace process { 
 
-class child; 
+class process; 
 
 /** 
  * Status returned by a finalized %child process. 
@@ -45,58 +46,57 @@
  */ 
 class status 
 { 
-    friend class child; 
-
-public: 
-    /** 
-     * Returns whether the process exited gracefully or not. 
-     */ 
-    bool exited() const 
-    { 
-#if defined(BOOST_POSIX_API) 
-        return WIFEXITED(flags_); 
-#elif defined(BOOST_WINDOWS_API) 
-        return true; 
-#endif 
-    } 
-
-    /** 
-     * If exited, returns the exit code. 
-     * 
-     * If the process exited, returns the exit code it returned. 
-     * 
-     * \pre exited() is true. 
-     */ 
-    int exit_status() const 
-    { 
-        BOOST_ASSERT(exited()); 
-#if defined(BOOST_POSIX_API) 
-        return WEXITSTATUS(flags_); 
-#elif defined(BOOST_WINDOWS_API) 
-        return flags_; 
-#endif 
-    } 
+        friend class process; 
 
-protected: 
-    /** 
-     * Creates a status object based on exit information. 
-     * 
-     * Creates a new status object representing the exit status of a 
-     * child process. 
-     * 
-     * \param flags In a POSIX system this parameter contains the 
-     *        flags returned by the ::waitpid() call. In a 
-     *        Windows system it contains the exit code only. 
-     */ 
-    status(int flags) 
-        : flags_(flags) 
-    { 
-    } 
-
-    /** 
-     * OS-specific codification of exit status. 
-     */ 
-    int flags_; 
+        public: 
+        /** 
+         * Returns whether the process exited gracefully or not. 
+         */ 
+        bool exited() const{ 
+                #if defined(BOOST_POSIX_API) 
+                        return WIFEXITED(flags_); 
+                #elif defined(BOOST_WINDOWS_API) 
+                        //TODO: Is that really right?
+                        return true; 
+                #endif 
+        } 
+
+        /** 
+         * If exited, returns the exit code. 
+         * 
+         * If the process exited, returns the exit code it returned. 
+         * 
+         * \pre exited() is true. 
+         */ 
+
+        int exit_status() const{ 
+                BOOST_ASSERT(exited()); 
+
+                #if defined(BOOST_POSIX_API) 
+                        return WEXITSTATUS(flags_); 
+                #elif defined(BOOST_WINDOWS_API) 
+                        return flags_; 
+                #endif 
+        } 
+
+        protected: 
+        /** 
+         * Creates a status object based on exit information. 
+         * 
+         * Creates a new status object representing the exit status of a 
+         * child process. 
+         * 
+         * \param flags In a POSIX system this parameter contains the 
+         *        flags returned by the ::waitpid() call. In a 
+         *        Windows system it contains the exit code only. 
+         */ 
+         status(int flags)
+                : flags_(flags){} 
+
+        /** 
+         * OS-specific codification of exit status. 
+         */ 
+        int flags_; 
 }; 
 
 }