Boost C++ Libraries: Ticket #13320: It would be nice if boost::process could provide an API to get all running processes https://svn.boost.org/trac10/ticket/13320 <p> There is no Xplatform API to get all running processes, it would be noce to have one. </p> <p> Possible implementation: </p> <pre class="wiki"> typedef struct ProcessDescr { /** \brief Constructor * \param _sModuleName program's name * \param _pid program's PID */ ProcessDescr( const std::string&amp; _sModuleName, int _pid ) : sModuleName( _sModuleName ), pid( _pid ) { } /** \brief program's name */ std::string sModuleName; /** \brief program's PID */ int pid; } ProcessDescr; /** \brief List of processus descriptions */ typedef std::vector&lt;ProcessDescr&gt; ProcessList; #if defined(BOOST_WINDOWS_API) void addProcessDescr( ProcessList&amp; processes, DWORD processID ) { TCHAR szProcessName[MAX_PATH] = TEXT("&lt;unknown&gt;"); // Get a handle to the process. HANDLE hProcess = OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processID ); // Get the process name. if (NULL != hProcess ) { HMODULE hMod; DWORD cbNeeded; if ( EnumProcessModules( hProcess, &amp;hMod, sizeof(hMod), &amp;cbNeeded) ) { GetModuleBaseName( hProcess, hMod, szProcessName, sizeof(szProcessName)/sizeof(TCHAR) ); } } // Print the process name and identifier. processes.push_back( ProcessDescr( szProcessName, processID ) ); // Release the handle to the process. CloseHandle( hProcess ); } #endif void GetAllProcesses( ProcessList&amp; processes ) { #if defined(BOOST_POSIX_API) #ifdef SDE_MOBILE #ifdef SDE_ANDROID DIR *d = opendir("/proc"); if ( d != NULL ) { struct dirent * de; while((de = readdir(d)) != 0){ int pid = -1; // to be tested!!! if(isdigit(de-&gt;d_name[0])){ pid = atoi(de-&gt;d_name); } processes.push_back( ProcessDescr( de-&gt;d_name , pid ) ); } closedir(d); } #else assert( false ); #warning Unsupported platform #endif #else struct task_struct *task; for_each_process(task) { processes.push_back( ProcessDescr( task-&gt;comm , task-&gt;pid ) ); } #endif #elif defined(BOOST_WINDOWS_API) DWORD aProcesses[1024], cbNeeded, cProcesses; unsigned int i; if ( EnumProcesses( aProcesses, sizeof(aProcesses), &amp;cbNeeded ) ) { // Calculate how many process identifiers were returned. cProcesses = cbNeeded / sizeof(DWORD); // Print the name and process identifier for each process. for ( i = 0; i &lt; cProcesses; i++ ) { if( aProcesses[i] != 0 ) { addProcessDescr( processes, aProcesses[i] ); } } } #else #error Unknown platform #endif } </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/13320 Trac 1.4.3 John Maddock Thu, 10 May 2018 11:08:38 GMT component changed https://svn.boost.org/trac10/ticket/13320#comment:1 https://svn.boost.org/trac10/ticket/13320#comment:1 <ul> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">process</span> </li> </ul> Ticket