Commit 1a8faab3 authored by hjk's avatar hjk
Browse files

ProcessExplorer: Use 64-bit PIDs in DeviceProcessSignalOperation



This is for consistency with the return value of QProcess::processId().
No platform supported by Qt uses pid values exceeding 2^32.

Change-Id: I8dcdaf9e4640f321bf66eb200aeacdc84da5153f
Reviewed-by: default avatarDavid Schulz <david.schulz@theqtcompany.com>
Reviewed-by: default avatarDaniel Teske <daniel.teske@theqtcompany.com>
parent 014a7b33
......@@ -115,7 +115,7 @@ void Android::Internal::AndroidSignalOperation::handleTimeout()
emit finished(m_errorMessage);
}
void Android::Internal::AndroidSignalOperation::signalOperationViaADB(int pid, int signal)
void Android::Internal::AndroidSignalOperation::signalOperationViaADB(qint64 pid, int signal)
{
QTC_ASSERT(m_state == Idle, return);
m_adbProcess->disconnect(this);
......@@ -131,7 +131,7 @@ void Android::Internal::AndroidSignalOperation::signalOperationViaADB(int pid, i
<< QString::fromLatin1("/proc/%1/cmdline").arg(m_pid));
}
void Android::Internal::AndroidSignalOperation::killProcess(int pid)
void Android::Internal::AndroidSignalOperation::killProcess(qint64 pid)
{
signalOperationViaADB(pid, 9);
}
......@@ -144,7 +144,7 @@ void Android::Internal::AndroidSignalOperation::killProcess(const QString &fileP
emit finished(m_errorMessage);
}
void Android::Internal::AndroidSignalOperation::interruptProcess(int pid)
void Android::Internal::AndroidSignalOperation::interruptProcess(qint64 pid)
{
signalOperationViaADB(pid, 2);
}
......
......@@ -45,9 +45,9 @@ class AndroidSignalOperation : public ProjectExplorer::DeviceProcessSignalOperat
Q_OBJECT
public:
~AndroidSignalOperation() {}
void killProcess(int pid);
void killProcess(qint64 pid);
void killProcess(const QString &filePath);
void interruptProcess(int pid);
void interruptProcess(qint64 pid);
void interruptProcess(const QString &filePath);
protected:
......@@ -59,7 +59,7 @@ private slots:
void handleTimeout();
private:
void signalOperationViaADB(int pid, int signal);
void signalOperationViaADB(qint64 pid, int signal);
QString m_adbPath;
QProcess *m_adbProcess;
......@@ -71,7 +71,7 @@ private:
Kill
} m_state;
int m_pid;
qint64 m_pid;
int m_signal;
friend class AndroidDevice;
......
......@@ -50,7 +50,7 @@
namespace ProjectExplorer {
void DesktopProcessSignalOperation::killProcess(int pid)
void DesktopProcessSignalOperation::killProcess(qint64 pid)
{
killProcessSilently(pid);
emit finished(m_errorMessage);
......@@ -66,7 +66,7 @@ void DesktopProcessSignalOperation::killProcess(const QString &filePath)
emit finished(m_errorMessage);
}
void DesktopProcessSignalOperation::interruptProcess(int pid)
void DesktopProcessSignalOperation::interruptProcess(qint64 pid)
{
m_errorMessage.clear();
interruptProcessSilently(pid);
......@@ -83,7 +83,7 @@ void DesktopProcessSignalOperation::interruptProcess(const QString &filePath)
emit finished(m_errorMessage);
}
void DesktopProcessSignalOperation::appendMsgCannotKill(int pid, const QString &why)
void DesktopProcessSignalOperation::appendMsgCannotKill(qint64 pid, const QString &why)
{
if (!m_errorMessage.isEmpty())
m_errorMessage += QChar::fromLatin1('\n');
......@@ -91,7 +91,7 @@ void DesktopProcessSignalOperation::appendMsgCannotKill(int pid, const QString &
m_errorMessage += QLatin1Char(' ');
}
void DesktopProcessSignalOperation::appendMsgCannotInterrupt(int pid, const QString &why)
void DesktopProcessSignalOperation::appendMsgCannotInterrupt(qint64 pid, const QString &why)
{
if (!m_errorMessage.isEmpty())
m_errorMessage += QChar::fromLatin1('\n');
......@@ -99,13 +99,13 @@ void DesktopProcessSignalOperation::appendMsgCannotInterrupt(int pid, const QStr
m_errorMessage += QLatin1Char(' ');
}
void DesktopProcessSignalOperation::killProcessSilently(int pid)
void DesktopProcessSignalOperation::killProcessSilently(qint64 pid)
{
#ifdef Q_OS_WIN
const DWORD rights = PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION
|PROCESS_VM_OPERATION|PROCESS_VM_WRITE|PROCESS_VM_READ
|PROCESS_DUP_HANDLE|PROCESS_TERMINATE|PROCESS_CREATE_THREAD|PROCESS_SUSPEND_RESUME;
if (const HANDLE handle = OpenProcess(rights, FALSE, pid)) {
if (const HANDLE handle = OpenProcess(rights, FALSE, DWORD(pid))) {
if (!TerminateProcess(handle, UINT(-1)))
appendMsgCannotKill(pid, Utils::winErrorMessage(GetLastError()));
CloseHandle(handle);
......@@ -120,7 +120,7 @@ void DesktopProcessSignalOperation::killProcessSilently(int pid)
#endif // Q_OS_WIN
}
void DesktopProcessSignalOperation::interruptProcessSilently(int pid)
void DesktopProcessSignalOperation::interruptProcessSilently(qint64 pid)
{
#ifdef Q_OS_WIN
enum SpecialInterrupt { NoSpecialInterrupt, Win32Interrupt, Win64Interrupt };
......
......@@ -41,17 +41,17 @@ class PROJECTEXPLORER_EXPORT DesktopProcessSignalOperation : public DeviceProces
Q_OBJECT
public:
~DesktopProcessSignalOperation() {}
void killProcess(int pid);
void killProcess(qint64 pid);
void killProcess(const QString &filePath);
void interruptProcess(int pid);
void interruptProcess(qint64 pid);
void interruptProcess(const QString &filePath);
private:
void killProcessSilently(int pid);
void interruptProcessSilently(int pid);
void killProcessSilently(qint64 pid);
void interruptProcessSilently(qint64 pid);
void appendMsgCannotKill(int pid, const QString &why);
void appendMsgCannotInterrupt(int pid, const QString &why);
void appendMsgCannotKill(qint64 pid, const QString &why);
void appendMsgCannotInterrupt(qint64 pid, const QString &why);
protected:
explicit DesktopProcessSignalOperation() {}
......
......@@ -65,9 +65,9 @@ public:
~DeviceProcessSignalOperation() {}
typedef QSharedPointer<DeviceProcessSignalOperation> Ptr;
virtual void killProcess(int pid) = 0;
virtual void killProcess(qint64 pid) = 0;
virtual void killProcess(const QString &filePath) = 0;
virtual void interruptProcess(int pid) = 0;
virtual void interruptProcess(qint64 pid) = 0;
virtual void interruptProcess(const QString &filePath) = 0;
void setDebuggerCommand(const QString &cmd);
......
......@@ -54,7 +54,7 @@ RemoteLinuxSignalOperation::~RemoteLinuxSignalOperation()
}
}
static QString signalProcessByPidCommandLine(int pid, int signal)
static QString signalProcessByPidCommandLine(qint64 pid, int signal)
{
return QString::fromLatin1("kill -%1 %2").arg(signal).arg(pid);
}
......@@ -97,7 +97,7 @@ QString RemoteLinuxSignalOperation::interruptProcessByNameCommandLine(const QStr
return signalProcessByNameCommandLine(filePath, 2);
}
void RemoteLinuxSignalOperation::killProcess(int pid)
void RemoteLinuxSignalOperation::killProcess(qint64 pid)
{
run(signalProcessByPidCommandLine(pid, 9));
}
......@@ -107,7 +107,7 @@ void RemoteLinuxSignalOperation::killProcess(const QString &filePath)
run(killProcessByNameCommandLine(filePath));
}
void RemoteLinuxSignalOperation::interruptProcess(int pid)
void RemoteLinuxSignalOperation::interruptProcess(qint64 pid)
{
run(signalProcessByPidCommandLine(pid, 2));
}
......
......@@ -49,9 +49,9 @@ class REMOTELINUX_EXPORT RemoteLinuxSignalOperation
public:
virtual ~RemoteLinuxSignalOperation();
void killProcess(int pid);
void killProcess(qint64 pid);
void killProcess(const QString &filePath);
void interruptProcess(int pid);
void interruptProcess(qint64 pid);
void interruptProcess(const QString &filePath);
protected:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment