2013-03-07 10:36:28 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 BlackBerry Limited. All rights reserved.
|
2013-03-07 10:36:28 +01:00
|
|
|
**
|
2013-10-11 17:44:13 +02:00
|
|
|
** Contact: BlackBerry (qt@blackberry.com)
|
2013-03-07 10:36:28 +01:00
|
|
|
** Contact: KDAB (info@kdab.com)
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
2014-10-01 13:21:18 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2013-03-07 10:36:28 +01:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2013-03-07 10:36:28 +01:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2013-09-16 15:30:30 +02:00
|
|
|
#include "qnxdeviceprocesssignaloperation.h"
|
2013-03-07 10:36:28 +01:00
|
|
|
|
|
|
|
|
using namespace Qnx;
|
|
|
|
|
using namespace Qnx::Internal;
|
|
|
|
|
|
2013-09-16 15:30:30 +02:00
|
|
|
QnxDeviceProcessSignalOperation::QnxDeviceProcessSignalOperation(
|
2014-05-19 23:35:05 +03:00
|
|
|
const QSsh::SshConnectionParameters &sshParameters)
|
2013-09-16 15:30:30 +02:00
|
|
|
: RemoteLinux::RemoteLinuxSignalOperation(sshParameters)
|
2013-03-07 10:36:28 +01:00
|
|
|
{
|
2013-09-16 15:30:30 +02:00
|
|
|
}
|
2013-03-07 10:36:28 +01:00
|
|
|
|
2013-10-18 15:49:23 +02:00
|
|
|
static QString signalProcessByNameQnxCommandLine(const QString &filePath, int sig)
|
2013-09-16 15:30:30 +02:00
|
|
|
{
|
|
|
|
|
QString executable = filePath;
|
2013-10-18 15:49:23 +02:00
|
|
|
return QString::fromLatin1("for PID in $(ps -f -o pid,comm | grep %1 | awk '/%1/ {print $1}'); "
|
2013-03-07 10:36:28 +01:00
|
|
|
"do "
|
2013-08-08 14:05:11 +02:00
|
|
|
"kill -%2 $PID; "
|
2013-09-16 15:30:30 +02:00
|
|
|
"done").arg(executable.replace(QLatin1String("/"), QLatin1String("\\/"))).arg(sig);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QnxDeviceProcessSignalOperation::killProcessByNameCommandLine(
|
|
|
|
|
const QString &filePath) const
|
|
|
|
|
{
|
2013-10-18 15:49:23 +02:00
|
|
|
return QString::fromLatin1("%1; %2").arg(signalProcessByNameQnxCommandLine(filePath, 15),
|
|
|
|
|
signalProcessByNameQnxCommandLine(filePath, 9));
|
2013-09-16 15:30:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString QnxDeviceProcessSignalOperation::interruptProcessByNameCommandLine(
|
|
|
|
|
const QString &filePath) const
|
|
|
|
|
{
|
2013-10-18 15:49:23 +02:00
|
|
|
return signalProcessByNameQnxCommandLine(filePath, 2);
|
2013-09-16 15:30:30 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BlackBerryDeviceProcessSignalOperation::BlackBerryDeviceProcessSignalOperation(
|
2014-05-19 23:35:05 +03:00
|
|
|
const QSsh::SshConnectionParameters &sshParameters)
|
2013-09-16 15:30:30 +02:00
|
|
|
: RemoteLinux::RemoteLinuxSignalOperation(sshParameters)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-18 15:49:23 +02:00
|
|
|
static QString signalProcessByNameBlackBerryCommandLine(const QString &filePath, int sig)
|
2013-09-16 15:30:30 +02:00
|
|
|
{
|
|
|
|
|
QString executable = filePath;
|
2013-10-18 15:49:23 +02:00
|
|
|
return QString::fromLatin1("for PID in $(pidin -F \"%a %A\" | grep \"%1\" | awk '/%1/ {print $1}'); "
|
2013-09-16 15:30:30 +02:00
|
|
|
"do "
|
|
|
|
|
"kill -%2 $PID; "
|
|
|
|
|
"done").arg(executable.replace(QLatin1String("/"), QLatin1String("\\/"))).arg(sig);
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
2013-09-16 15:30:30 +02:00
|
|
|
QString BlackBerryDeviceProcessSignalOperation::killProcessByNameCommandLine(const QString &filePath) const
|
2013-08-08 14:05:11 +02:00
|
|
|
{
|
2013-10-18 15:49:23 +02:00
|
|
|
return QString::fromLatin1("%1; %2").arg(signalProcessByNameBlackBerryCommandLine(filePath, 15),
|
|
|
|
|
signalProcessByNameBlackBerryCommandLine(filePath, 9));
|
2013-08-08 14:05:11 +02:00
|
|
|
}
|
|
|
|
|
|
2013-09-16 15:30:30 +02:00
|
|
|
QString BlackBerryDeviceProcessSignalOperation::interruptProcessByNameCommandLine(const QString &filePath) const
|
2013-08-08 14:05:11 +02:00
|
|
|
{
|
2013-10-18 15:49:23 +02:00
|
|
|
return signalProcessByNameBlackBerryCommandLine(filePath, 2);
|
2013-03-07 10:36:28 +01:00
|
|
|
}
|