git-svn-id: svn://db.shs.com.ru/pip@361 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -1,5 +1,8 @@
|
|||||||
#include "piplatform.h"
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
int main (int argc, char * argv[]) {
|
int main (int argc, char * argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "piconsole.h"
|
#include "piconsole.h"
|
||||||
#include "pipeer.h"
|
#include "pipeer.h"
|
||||||
#include "piprotocol.h"
|
#include "piprotocol.h"
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "pikbdlistener.h"
|
#include "pikbdlistener.h"
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
# include <termios.h>
|
# include <termios.h>
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "piscreen.h"
|
#include "piscreen.h"
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
# include <sys/ioctl.h>
|
# include <sys/ioctl.h>
|
||||||
|
|||||||
@@ -16,13 +16,17 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "piterminal.h"
|
#include "piterminal.h"
|
||||||
|
# include "pisharedmemory.h"
|
||||||
#ifdef CC_GCC
|
#ifdef CC_GCC
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
# include "pisharedmemory.h"
|
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <wincon.h>
|
# include <wincon.h>
|
||||||
# include <winuser.h>
|
# include <winuser.h>
|
||||||
|
|||||||
@@ -95,8 +95,8 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
# include <windef.h>
|
//# include <windef.h>
|
||||||
# include <winbase.h>
|
//# include <winbase.h>
|
||||||
# ifdef CC_VC
|
# ifdef CC_VC
|
||||||
# define SHUT_RDWR 2
|
# define SHUT_RDWR 2
|
||||||
# pragma comment(lib, "Ws2_32.lib")
|
# pragma comment(lib, "Ws2_32.lib")
|
||||||
@@ -105,11 +105,9 @@
|
|||||||
# else
|
# else
|
||||||
# define SHUT_RDWR SD_BOTH
|
# define SHUT_RDWR SD_BOTH
|
||||||
# endif
|
# endif
|
||||||
typedef int socklen_t;
|
typedef int socklen_t;
|
||||||
typedef void(*PINtSetTimerResolution)(ULONG, BOOLEAN, PULONG);
|
extern long long __pi_perf_freq;
|
||||||
extern long long __pi_perf_freq;
|
inline int random() {return rand();}
|
||||||
extern PINtSetTimerResolution setTimerResolutionAddr;
|
|
||||||
inline int random() {return rand();}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "picout.h"
|
#include "picout.h"
|
||||||
#include "piconsole.h"
|
#include "piconsole.h"
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
|||||||
@@ -18,7 +18,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "piincludes.h"
|
#include "piincludes.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "piconsole.h"
|
#include "piconsole.h"
|
||||||
|
#include "pitime.h"
|
||||||
#ifndef QNX
|
#ifndef QNX
|
||||||
# include <clocale>
|
# include <clocale>
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -19,6 +19,11 @@
|
|||||||
|
|
||||||
#include "piplatform.h"
|
#include "piplatform.h"
|
||||||
#include "piinit.h"
|
#include "piinit.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
|
#include "pitime.h"
|
||||||
#include "pisignals.h"
|
#include "pisignals.h"
|
||||||
#include "piobject.h"
|
#include "piobject.h"
|
||||||
#include "pisysteminfo.h"
|
#include "pisysteminfo.h"
|
||||||
@@ -26,7 +31,8 @@
|
|||||||
#include "piprocess.h"
|
#include "piprocess.h"
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
extern FILETIME __pi_ftjan1970;
|
extern FILETIME __pi_ftjan1970;
|
||||||
|
extern PINtSetTimerResolution setTimerResolutionAddr;
|
||||||
#else
|
#else
|
||||||
# include <pwd.h>
|
# include <pwd.h>
|
||||||
# include <sys/utsname.h>
|
# include <sys/utsname.h>
|
||||||
@@ -68,6 +74,12 @@
|
|||||||
static locale_t currentLocale_t = 0;
|
static locale_t currentLocale_t = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PRIVATE_DEFINITION_START(PIInit)
|
||||||
|
#ifdef WINDOWS
|
||||||
|
HMODULE ntlib;
|
||||||
|
ULONG prev_res;
|
||||||
|
#endif
|
||||||
|
PRIVATE_DEFINITION_END(PIInit)
|
||||||
|
|
||||||
void __sighandler__(PISignals::Signal s) {
|
void __sighandler__(PISignals::Signal s) {
|
||||||
//piCout << Hex << int(s);
|
//piCout << Hex << int(s);
|
||||||
@@ -129,9 +141,9 @@ PIInit::PIInit() {
|
|||||||
if (__pi_perf_freq == 0) __pi_perf_freq = -1;
|
if (__pi_perf_freq == 0) __pi_perf_freq = -1;
|
||||||
|
|
||||||
// Sleep precision init
|
// Sleep precision init
|
||||||
ntlib = LoadLibrary("ntdll.dll");
|
PRIVATE->ntlib = LoadLibrary("ntdll.dll");
|
||||||
if (ntlib) setTimerResolutionAddr = (PINtSetTimerResolution)GetProcAddress(ntlib, "NtSetTimerResolution");
|
if (PRIVATE->ntlib) setTimerResolutionAddr = (PINtSetTimerResolution)GetProcAddress(PRIVATE->ntlib, "NtSetTimerResolution");
|
||||||
/*if (setTimerResolution) setTimerResolutionAddr(1, TRUE, &prev_res);*/
|
/*if (setTimerResolution) setTimerResolutionAddr(1, TRUE, &(PRIVATE->prev_res));*/
|
||||||
# endif
|
# endif
|
||||||
//piDebug = true;
|
//piDebug = true;
|
||||||
# ifdef HAS_LOCALE
|
# ifdef HAS_LOCALE
|
||||||
@@ -262,9 +274,9 @@ PIInit::~PIInit() {
|
|||||||
file_charset = 0;
|
file_charset = 0;
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
WSACleanup();
|
WSACleanup();
|
||||||
//if (setTimerResolution) setTimerResolutionAddr(prev_res, TRUE, &prev_res);
|
//if (setTimerResolution) setTimerResolutionAddr(PRIVATE->prev_res, TRUE, &(PRIVATE->prev_res));
|
||||||
if (ntlib) FreeLibrary(ntlib);
|
if (PRIVATE->ntlib) FreeLibrary(PRIVATE->ntlib);
|
||||||
ntlib = 0;
|
PRIVATE->ntlib = 0;
|
||||||
#endif
|
#endif
|
||||||
#ifdef MAC_OS
|
#ifdef MAC_OS
|
||||||
mach_port_deallocate(mach_task_self(), __pi_mac_clock);
|
mach_port_deallocate(mach_task_self(), __pi_mac_clock);
|
||||||
|
|||||||
@@ -60,10 +60,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void setFileCharset(const char *charset);
|
void setFileCharset(const char *charset);
|
||||||
bool fileExists(const PIString & p);
|
bool fileExists(const PIString & p);
|
||||||
#ifdef WINDOWS
|
PRIVATE_DECLARATION
|
||||||
HMODULE ntlib;
|
|
||||||
ULONG prev_res;
|
|
||||||
#endif
|
|
||||||
char * file_charset;
|
char * file_charset;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "pitime.h"
|
#include "pitime.h"
|
||||||
#include "pisystemtests.h"
|
#include "pisystemtests.h"
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
|||||||
@@ -22,8 +22,11 @@
|
|||||||
|
|
||||||
#ifndef PITIME_H
|
#ifndef PITIME_H
|
||||||
#define PITIME_H
|
#define PITIME_H
|
||||||
|
|
||||||
#include "pistring.h"
|
#include "pistring.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
typedef void(*PINtSetTimerResolution)(ULONG, BOOLEAN, PULONG);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
//! \brief Sleep for "msecs" milliseconds
|
//! \brief Sleep for "msecs" milliseconds
|
||||||
@@ -237,6 +240,19 @@ struct PIP_EXPORT PIDateTime {
|
|||||||
PIDateTime(const PIDate & date) {year = date.year; month = date.month; day = date.day; hours = minutes = seconds = milliseconds = 0;}
|
PIDateTime(const PIDate & date) {year = date.year; month = date.month; day = date.day; hours = minutes = seconds = milliseconds = 0;}
|
||||||
PIDateTime(const PIDate & date, const PITime & time) {year = date.year; month = date.month; day = date.day; hours = time.hours; minutes = time.minutes; seconds = time.seconds; milliseconds = time.milliseconds;}
|
PIDateTime(const PIDate & date, const PITime & time) {year = date.year; month = date.month; day = date.day; hours = time.hours; minutes = time.minutes; seconds = time.seconds; milliseconds = time.milliseconds;}
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
#ifndef _SYSTEMTIME_
|
||||||
|
#define _SYSTEMTIME_
|
||||||
|
typedef struct _SYSTEMTIME {
|
||||||
|
WORD wYear;
|
||||||
|
WORD wMonth;
|
||||||
|
WORD wDayOfWeek;
|
||||||
|
WORD wDay;
|
||||||
|
WORD wHour;
|
||||||
|
WORD wMinute;
|
||||||
|
WORD wSecond;
|
||||||
|
WORD wMilliseconds;
|
||||||
|
} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
|
||||||
|
#endif
|
||||||
PIDateTime(SYSTEMTIME t);
|
PIDateTime(SYSTEMTIME t);
|
||||||
PIDateTime(FILETIME t);
|
PIDateTime(FILETIME t);
|
||||||
SYSTEMTIME toSYSTEMTIME() const;
|
SYSTEMTIME toSYSTEMTIME() const;
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "pidir.h"
|
#include "pidir.h"
|
||||||
|
|
||||||
//#if !defined(ANDROID)
|
//#if !defined(ANDROID)
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "piethernet.h"
|
#include "piethernet.h"
|
||||||
#include "piconfig.h"
|
#include "piconfig.h"
|
||||||
#include "pisysteminfo.h"
|
#include "pisysteminfo.h"
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "pifile.h"
|
#include "pifile.h"
|
||||||
#include "pidir.h"
|
#include "pidir.h"
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
@@ -33,6 +37,7 @@
|
|||||||
# define S_IFCHR 0x10
|
# define S_IFCHR 0x10
|
||||||
# define S_IFSOCK 0x20
|
# define S_IFSOCK 0x20
|
||||||
#else
|
#else
|
||||||
|
# include <stdio.h>
|
||||||
# include <sys/stat.h>
|
# include <sys/stat.h>
|
||||||
# include <sys/time.h>
|
# include <sys/time.h>
|
||||||
# include <fcntl.h>
|
# include <fcntl.h>
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "piserial.h"
|
#include "piserial.h"
|
||||||
#include "piconfig.h"
|
#include "piconfig.h"
|
||||||
#include "pidir.h"
|
#include "pidir.h"
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "pisharedmemory.h"
|
#include "pisharedmemory.h"
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "piusb.h"
|
#include "piusb.h"
|
||||||
#include "piconfig.h"
|
#include "piconfig.h"
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pilibrary.h"
|
#include "pilibrary.h"
|
||||||
#ifndef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#else
|
||||||
# include <dlfcn.h>
|
# include <dlfcn.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -17,10 +17,13 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "piprocess.h"
|
#include "pibase.h"
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
# include <winbase.h>
|
# include <windef.h>
|
||||||
#else
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
|
#include "piprocess.h"
|
||||||
|
#ifndef WINDOWS
|
||||||
# include <sys/wait.h>
|
# include <sys/wait.h>
|
||||||
# include <csignal>
|
# include <csignal>
|
||||||
#endif
|
#endif
|
||||||
@@ -31,12 +34,23 @@
|
|||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
PRIVATE_DEFINITION_START(PIProcess)
|
||||||
|
#ifdef WINDOWS
|
||||||
|
STARTUPINFOA si;
|
||||||
|
PROCESS_INFORMATION pi;
|
||||||
|
#else
|
||||||
|
pid_t pid;
|
||||||
|
#endif
|
||||||
|
PRIVATE_DEFINITION_END(PIProcess)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PIProcess::PIProcess(): PIThread() {
|
PIProcess::PIProcess(): PIThread() {
|
||||||
exit_code = -1;
|
exit_code = -1;
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
pi.dwProcessId = 0;
|
PRIVATE->pi.dwProcessId = 0;
|
||||||
#else
|
#else
|
||||||
pid = 0;
|
PRIVATE->pid = 0;
|
||||||
#endif
|
#endif
|
||||||
is_exec = false;
|
is_exec = false;
|
||||||
g_in = g_out = g_err = false;
|
g_in = g_out = g_err = false;
|
||||||
@@ -128,7 +142,7 @@ void PIProcess::startProc(bool detached) {
|
|||||||
if (!detached) execStarted(str);
|
if (!detached) execStarted(str);
|
||||||
#ifndef WINDOWS
|
#ifndef WINDOWS
|
||||||
int pid_ = fork();
|
int pid_ = fork();
|
||||||
if (!detached) pid = pid_;
|
if (!detached) PRIVATE->pid = pid_;
|
||||||
if (pid_ == 0) {
|
if (pid_ == 0) {
|
||||||
#endif
|
#endif
|
||||||
tf_in = tf_out = tf_err = 0;
|
tf_in = tf_out = tf_err = 0;
|
||||||
@@ -141,8 +155,8 @@ void PIProcess::startProc(bool detached) {
|
|||||||
if (!wd.isEmpty()) chdir(wd.data());
|
if (!wd.isEmpty()) chdir(wd.data());
|
||||||
#endif
|
#endif
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
GetStartupInfoA(&si);
|
GetStartupInfoA(&(PRIVATE->si));
|
||||||
memset(&pi, 0, sizeof(pi));
|
memset(&(PRIVATE->pi), 0, sizeof(PRIVATE->pi));
|
||||||
if(CreateProcessA(0, // No module name (use command line)
|
if(CreateProcessA(0, // No module name (use command line)
|
||||||
a, // Command line
|
a, // Command line
|
||||||
0, // Process handle not inheritable
|
0, // Process handle not inheritable
|
||||||
@@ -151,12 +165,12 @@ void PIProcess::startProc(bool detached) {
|
|||||||
detached ? DETACHED_PROCESS/*CREATE_NEW_CONSOLE*/ : 0, // Creation flags
|
detached ? DETACHED_PROCESS/*CREATE_NEW_CONSOLE*/ : 0, // Creation flags
|
||||||
0,//e, // Use environment
|
0,//e, // Use environment
|
||||||
wd.isEmpty() ? 0 : wd.data(), // Use working directory
|
wd.isEmpty() ? 0 : wd.data(), // Use working directory
|
||||||
&si, // Pointer to STARTUPINFO structure
|
&(PRIVATE->si), // Pointer to STARTUPINFO structure
|
||||||
&pi)) // Pointer to PROCESS_INFORMATION structure
|
&(PRIVATE->pi))) // Pointer to PROCESS_INFORMATION structure
|
||||||
{
|
{
|
||||||
if (!detached) WaitForSingleObject(pi.hProcess, INFINITE);
|
if (!detached) WaitForSingleObject(PRIVATE->pi.hProcess, INFINITE);
|
||||||
CloseHandle(pi.hThread);
|
CloseHandle(PRIVATE->pi.hThread);
|
||||||
CloseHandle(pi.hProcess);
|
CloseHandle(PRIVATE->pi.hProcess);
|
||||||
} else
|
} else
|
||||||
piCoutObj << "\"CreateProcess\" error, " << errorString();
|
piCoutObj << "\"CreateProcess\" error, " << errorString();
|
||||||
#else
|
#else
|
||||||
@@ -173,7 +187,7 @@ void PIProcess::startProc(bool detached) {
|
|||||||
if (tf_out != 0) fclose(tf_out);
|
if (tf_out != 0) fclose(tf_out);
|
||||||
if (tf_err != 0) fclose(tf_err);*/
|
if (tf_err != 0) fclose(tf_err);*/
|
||||||
pid_ = 0;
|
pid_ = 0;
|
||||||
if (!detached) pid = pid_;
|
if (!detached) PRIVATE->pid = pid_;
|
||||||
//cout << "wait done" << endl;
|
//cout << "wait done" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -195,13 +209,13 @@ void PIProcess::startProc(bool detached) {
|
|||||||
void PIProcess::terminate() {
|
void PIProcess::terminate() {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
if (is_exec)
|
if (is_exec)
|
||||||
if (!TerminateProcess(pi.hProcess, 0))
|
if (!TerminateProcess(PRIVATE->pi.hProcess, 0))
|
||||||
return;
|
return;
|
||||||
pi.dwProcessId = 0;
|
PRIVATE->pi.dwProcessId = 0;
|
||||||
#else
|
#else
|
||||||
if (is_exec)
|
if (is_exec)
|
||||||
kill(pid, SIGKILL);
|
kill(PRIVATE->pid, SIGKILL);
|
||||||
pid = 0;
|
PRIVATE->pid = 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,9 +229,9 @@ void PIProcess::execIndependent(const PIString & program, const PIStringList & a
|
|||||||
|
|
||||||
int PIProcess::pID() const {
|
int PIProcess::pID() const {
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
return pi.dwProcessId;
|
return PRIVATE->pi.dwProcessId;
|
||||||
#else
|
#else
|
||||||
return pid;
|
return PRIVATE->pid;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,12 +95,7 @@ private:
|
|||||||
PIByteArray out;
|
PIByteArray out;
|
||||||
PIFile f_in, f_out, f_err;
|
PIFile f_in, f_out, f_err;
|
||||||
bool g_in, g_out, g_err, t_in, t_out, t_err;
|
bool g_in, g_out, g_err, t_in, t_out, t_err;
|
||||||
#ifdef WINDOWS
|
PRIVATE_DECLARATION
|
||||||
STARTUPINFOA si;
|
|
||||||
PROCESS_INFORMATION pi;
|
|
||||||
#else
|
|
||||||
pid_t pid;
|
|
||||||
#endif
|
|
||||||
FILE * tf_in, * tf_out, * tf_err;
|
FILE * tf_in, * tf_out, * tf_err;
|
||||||
int exit_code, sz;
|
int exit_code, sz;
|
||||||
bool is_exec;
|
bool is_exec;
|
||||||
|
|||||||
@@ -16,7 +16,11 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "pisysteminfo.h"
|
#include "pisysteminfo.h"
|
||||||
#include "pidir.h"
|
#include "pidir.h"
|
||||||
#include "pitime.h"
|
#include "pitime.h"
|
||||||
|
|||||||
@@ -17,10 +17,15 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "pisystemmonitor.h"
|
#include "pisystemmonitor.h"
|
||||||
#include "pisysteminfo.h"
|
#include "pisysteminfo.h"
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
# include "tlhelp32.h"
|
# include <tlhelp32.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef CC_GCC
|
#ifdef CC_GCC
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
|||||||
@@ -18,7 +18,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "pimutex.h"
|
#include "pimutex.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/** \class PIMutex
|
/** \class PIMutex
|
||||||
* \brief Mutex
|
* \brief Mutex
|
||||||
|
|||||||
@@ -17,12 +17,18 @@
|
|||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "pibase.h"
|
||||||
|
#ifdef WINDOWS
|
||||||
|
# include <windef.h>
|
||||||
|
# include <winbase.h>
|
||||||
|
#endif
|
||||||
#include "pithread.h"
|
#include "pithread.h"
|
||||||
#include "pisystemtests.h"
|
#include "pisystemtests.h"
|
||||||
#include "piintrospection_proxy.h"
|
#include "piintrospection_proxy.h"
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
void __PISetTimerResolution() {if (setTimerResolutionAddr == NULL) return; ULONG ret; setTimerResolutionAddr(1, TRUE, &ret);}
|
extern PINtSetTimerResolution setTimerResolutionAddr;
|
||||||
|
void __PISetTimerResolution() {if (setTimerResolutionAddr == NULL) return; ULONG ret; setTimerResolutionAddr(1, TRUE, &ret);}
|
||||||
#endif
|
#endif
|
||||||
#ifdef MAC_OS
|
#ifdef MAC_OS
|
||||||
# include <pthread.h>
|
# include <pthread.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user