mirror of
https://github.com/KDE/konsole.git
synced 2026-06-11 07:26:10 -04:00
sync declarations with definitions (have .h and .cpp variable names match)
This commit is contained in:
@@ -67,7 +67,7 @@
|
||||
|
||||
using namespace Konsole;
|
||||
|
||||
ProcessInfo::ProcessInfo(int aPid) :
|
||||
ProcessInfo::ProcessInfo(int pid) :
|
||||
_fields(ARGUMENTS) // arguments
|
||||
// are currently always valid,
|
||||
// they just return an empty
|
||||
@@ -75,7 +75,7 @@ ProcessInfo::ProcessInfo(int aPid) :
|
||||
// if no arguments
|
||||
// have been explicitly set
|
||||
,
|
||||
_pid(aPid),
|
||||
_pid(pid),
|
||||
_parentPid(0),
|
||||
_foregroundPid(0),
|
||||
_userId(0),
|
||||
@@ -231,9 +231,9 @@ QString ProcessInfo::localHost()
|
||||
return QHostInfo::localHostName();
|
||||
}
|
||||
|
||||
void ProcessInfo::setPid(int aPid)
|
||||
void ProcessInfo::setPid(int pid)
|
||||
{
|
||||
_pid = aPid;
|
||||
_pid = pid;
|
||||
_fields |= PROCESS_ID;
|
||||
}
|
||||
|
||||
@@ -259,15 +259,15 @@ void ProcessInfo::setUserHomeDir()
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessInfo::setParentPid(int aPid)
|
||||
void ProcessInfo::setParentPid(int pid)
|
||||
{
|
||||
_parentPid = aPid;
|
||||
_parentPid = pid;
|
||||
_fields |= PARENT_PID;
|
||||
}
|
||||
|
||||
void ProcessInfo::setForegroundPid(int aPid)
|
||||
void ProcessInfo::setForegroundPid(int pid)
|
||||
{
|
||||
_foregroundPid = aPid;
|
||||
_foregroundPid = pid;
|
||||
_fields |= FOREGROUND_PID;
|
||||
}
|
||||
|
||||
@@ -331,8 +331,8 @@ void ProcessInfo::setFileError(QFile::FileError error)
|
||||
// implementations of the UnixProcessInfo abstract class.
|
||||
//
|
||||
|
||||
NullProcessInfo::NullProcessInfo(int aPid, const QString & /*titleFormat*/) :
|
||||
ProcessInfo(aPid)
|
||||
NullProcessInfo::NullProcessInfo(int pid, const QString & /*titleFormat*/) :
|
||||
ProcessInfo(pid)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -350,21 +350,21 @@ void NullProcessInfo::readUserName()
|
||||
}
|
||||
|
||||
#if !defined(Q_OS_WIN)
|
||||
UnixProcessInfo::UnixProcessInfo(int aPid, const QString &titleFormat) :
|
||||
ProcessInfo(aPid)
|
||||
UnixProcessInfo::UnixProcessInfo(int pid, const QString &titleFormat) :
|
||||
ProcessInfo(pid)
|
||||
{
|
||||
setUserNameRequired(titleFormat.contains(QLatin1String("%u")));
|
||||
}
|
||||
|
||||
void UnixProcessInfo::readProcessInfo(int aPid)
|
||||
void UnixProcessInfo::readProcessInfo(int pid)
|
||||
{
|
||||
// prevent _arguments from growing longer and longer each time this
|
||||
// method is called.
|
||||
clearArguments();
|
||||
|
||||
if (readProcInfo(aPid)) {
|
||||
readArguments(aPid);
|
||||
readCurrentDir(aPid);
|
||||
if (readProcInfo(pid)) {
|
||||
readArguments(pid);
|
||||
readCurrentDir(pid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,17 +407,17 @@ void UnixProcessInfo::readUserName()
|
||||
class LinuxProcessInfo : public UnixProcessInfo
|
||||
{
|
||||
public:
|
||||
LinuxProcessInfo(int aPid, const QString &titleFormat) :
|
||||
UnixProcessInfo(aPid, titleFormat)
|
||||
LinuxProcessInfo(int pid, const QString &titleFormat) :
|
||||
UnixProcessInfo(pid, titleFormat)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
bool readCurrentDir(int aPid) Q_DECL_OVERRIDE
|
||||
bool readCurrentDir(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
char path_buffer[MAXPATHLEN + 1];
|
||||
path_buffer[MAXPATHLEN] = 0;
|
||||
QByteArray procCwd = QFile::encodeName(QStringLiteral("/proc/%1/cwd").arg(aPid));
|
||||
QByteArray procCwd = QFile::encodeName(QStringLiteral("/proc/%1/cwd").arg(pid));
|
||||
const int length = static_cast<int>(readlink(procCwd.constData(), path_buffer, MAXPATHLEN));
|
||||
if (length == -1) {
|
||||
setError(UnknownError);
|
||||
@@ -432,7 +432,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
bool readProcInfo(int aPid) Q_DECL_OVERRIDE
|
||||
bool readProcInfo(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
// indicies of various fields within the process status file which
|
||||
// contain various information about the process
|
||||
@@ -449,7 +449,7 @@ private:
|
||||
|
||||
// For user id read process status file ( /proc/<pid>/status )
|
||||
// Can not use getuid() due to it does not work for 'su'
|
||||
QFile statusInfo(QStringLiteral("/proc/%1/status").arg(aPid));
|
||||
QFile statusInfo(QStringLiteral("/proc/%1/status").arg(pid));
|
||||
if (statusInfo.open(QIODevice::ReadOnly)) {
|
||||
QTextStream stream(&statusInfo);
|
||||
QString statusLine;
|
||||
@@ -492,7 +492,7 @@ private:
|
||||
//
|
||||
// FIELD FIELD (FIELD WITH SPACES) FIELD FIELD
|
||||
//
|
||||
QFile processInfo(QStringLiteral("/proc/%1/stat").arg(aPid));
|
||||
QFile processInfo(QStringLiteral("/proc/%1/stat").arg(pid));
|
||||
if (processInfo.open(QIODevice::ReadOnly)) {
|
||||
QTextStream stream(&processInfo);
|
||||
const QString &data = stream.readAll();
|
||||
@@ -548,18 +548,18 @@ private:
|
||||
}
|
||||
|
||||
// update object state
|
||||
setPid(aPid);
|
||||
setPid(pid);
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool readArguments(int aPid) Q_DECL_OVERRIDE
|
||||
bool readArguments(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
// read command-line arguments file found at /proc/<pid>/cmdline
|
||||
// the expected format is a list of strings delimited by null characters,
|
||||
// and ending in a double null character pair.
|
||||
|
||||
QFile argumentsFile(QStringLiteral("/proc/%1/cmdline").arg(aPid));
|
||||
QFile argumentsFile(QStringLiteral("/proc/%1/cmdline").arg(pid));
|
||||
if (argumentsFile.open(QIODevice::ReadOnly)) {
|
||||
QTextStream stream(&argumentsFile);
|
||||
const QString &data = stream.readAll();
|
||||
@@ -583,13 +583,13 @@ private:
|
||||
class FreeBSDProcessInfo : public UnixProcessInfo
|
||||
{
|
||||
public:
|
||||
FreeBSDProcessInfo(int aPid, const QString &titleFormat) :
|
||||
UnixProcessInfo(aPid, titleFormat)
|
||||
FreeBSDProcessInfo(int pid, const QString &titleFormat) :
|
||||
UnixProcessInfo(pid, titleFormat)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
bool readCurrentDir(int aPid) Q_DECL_OVERRIDE
|
||||
bool readCurrentDir(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
#if defined(HAVE_OS_DRAGONFLYBSD)
|
||||
char buf[PATH_MAX];
|
||||
@@ -599,7 +599,7 @@ protected:
|
||||
managementInfoBase[0] = CTL_KERN;
|
||||
managementInfoBase[1] = KERN_PROC;
|
||||
managementInfoBase[2] = KERN_PROC_CWD;
|
||||
managementInfoBase[3] = aPid;
|
||||
managementInfoBase[3] = pid;
|
||||
|
||||
len = sizeof(buf);
|
||||
if (sysctl(managementInfoBase, 4, buf, &len, NULL, 0) == -1) {
|
||||
@@ -613,7 +613,7 @@ protected:
|
||||
int numrecords;
|
||||
struct kinfo_file *info = 0;
|
||||
|
||||
info = kinfo_getfile(aPid, &numrecords);
|
||||
info = kinfo_getfile(pid, &numrecords);
|
||||
|
||||
if (!info) {
|
||||
return false;
|
||||
@@ -634,7 +634,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
bool readProcInfo(int aPid) Q_DECL_OVERRIDE
|
||||
bool readProcInfo(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
int managementInfoBase[4];
|
||||
size_t mibLength;
|
||||
@@ -643,7 +643,7 @@ private:
|
||||
managementInfoBase[0] = CTL_KERN;
|
||||
managementInfoBase[1] = KERN_PROC;
|
||||
managementInfoBase[2] = KERN_PROC_PID;
|
||||
managementInfoBase[3] = aPid;
|
||||
managementInfoBase[3] = pid;
|
||||
|
||||
if (sysctl(managementInfoBase, 4, NULL, &mibLength, NULL, 0) == -1) {
|
||||
return false;
|
||||
@@ -676,7 +676,7 @@ private:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool readArguments(int aPid) Q_DECL_OVERRIDE
|
||||
bool readArguments(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
char args[ARG_MAX];
|
||||
int managementInfoBase[4];
|
||||
@@ -685,7 +685,7 @@ private:
|
||||
managementInfoBase[0] = CTL_KERN;
|
||||
managementInfoBase[1] = KERN_PROC;
|
||||
managementInfoBase[2] = KERN_PROC_ARGS;
|
||||
managementInfoBase[3] = aPid;
|
||||
managementInfoBase[3] = pid;
|
||||
|
||||
len = sizeof(args);
|
||||
if (sysctl(managementInfoBase, 4, args, &len, NULL, 0) == -1) {
|
||||
@@ -708,13 +708,13 @@ private:
|
||||
class OpenBSDProcessInfo : public UnixProcessInfo
|
||||
{
|
||||
public:
|
||||
OpenBSDProcessInfo(int aPid, const QString &titleFormat) :
|
||||
UnixProcessInfo(aPid, titleFormat)
|
||||
OpenBSDProcessInfo(int pid, const QString &titleFormat) :
|
||||
UnixProcessInfo(pid, titleFormat)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
bool readCurrentDir(int aPid) Q_DECL_OVERRIDE
|
||||
bool readCurrentDir(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
char buf[PATH_MAX];
|
||||
int managementInfoBase[3];
|
||||
@@ -722,7 +722,7 @@ protected:
|
||||
|
||||
managementInfoBase[0] = CTL_KERN;
|
||||
managementInfoBase[1] = KERN_PROC_CWD;
|
||||
managementInfoBase[2] = aPid;
|
||||
managementInfoBase[2] = pid;
|
||||
|
||||
len = sizeof(buf);
|
||||
if (::sysctl(managementInfoBase, 3, buf, &len, NULL, 0) == -1) {
|
||||
@@ -735,7 +735,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
bool readProcInfo(int aPid) Q_DECL_OVERRIDE
|
||||
bool readProcInfo(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
int managementInfoBase[6];
|
||||
size_t mibLength;
|
||||
@@ -744,7 +744,7 @@ private:
|
||||
managementInfoBase[0] = CTL_KERN;
|
||||
managementInfoBase[1] = KERN_PROC;
|
||||
managementInfoBase[2] = KERN_PROC_PID;
|
||||
managementInfoBase[3] = aPid;
|
||||
managementInfoBase[3] = pid;
|
||||
managementInfoBase[4] = sizeof(struct kinfo_proc);
|
||||
managementInfoBase[5] = 1;
|
||||
|
||||
@@ -772,7 +772,7 @@ private:
|
||||
return true;
|
||||
}
|
||||
|
||||
char **readProcArgs(int aPid, int whatMib)
|
||||
char **readProcArgs(int pid, int whatMib)
|
||||
{
|
||||
void *buf = NULL;
|
||||
void *nbuf;
|
||||
@@ -782,7 +782,7 @@ private:
|
||||
|
||||
managementInfoBase[0] = CTL_KERN;
|
||||
managementInfoBase[1] = KERN_PROC_ARGS;
|
||||
managementInfoBase[2] = aPid;
|
||||
managementInfoBase[2] = pid;
|
||||
managementInfoBase[3] = whatMib;
|
||||
|
||||
do {
|
||||
@@ -805,11 +805,11 @@ private:
|
||||
return (char **)buf;
|
||||
}
|
||||
|
||||
bool readArguments(int aPid) Q_DECL_OVERRIDE
|
||||
bool readArguments(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
char **argv;
|
||||
|
||||
argv = readProcArgs(aPid, KERN_PROC_ARGV);
|
||||
argv = readProcArgs(pid, KERN_PROC_ARGV);
|
||||
if (argv == NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -826,16 +826,16 @@ private:
|
||||
class MacProcessInfo : public UnixProcessInfo
|
||||
{
|
||||
public:
|
||||
MacProcessInfo(int aPid, const QString &titleFormat) :
|
||||
UnixProcessInfo(aPid, titleFormat)
|
||||
MacProcessInfo(int pid, const QString &titleFormat) :
|
||||
UnixProcessInfo(pid, titleFormat)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
bool readCurrentDir(int aPid) Q_DECL_OVERRIDE
|
||||
bool readCurrentDir(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
struct proc_vnodepathinfo vpi;
|
||||
const int nb = proc_pidinfo(aPid, PROC_PIDVNODEPATHINFO, 0, &vpi, sizeof(vpi));
|
||||
const int nb = proc_pidinfo(pid, PROC_PIDVNODEPATHINFO, 0, &vpi, sizeof(vpi));
|
||||
if (nb == sizeof(vpi)) {
|
||||
setCurrentDir(QString::fromUtf8(vpi.pvi_cdir.vip_path));
|
||||
return true;
|
||||
@@ -844,7 +844,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
bool readProcInfo(int aPid) Q_DECL_OVERRIDE
|
||||
bool readProcInfo(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
int managementInfoBase[4];
|
||||
size_t mibLength;
|
||||
@@ -855,7 +855,7 @@ private:
|
||||
managementInfoBase[0] = CTL_KERN;
|
||||
managementInfoBase[1] = KERN_PROC;
|
||||
managementInfoBase[2] = KERN_PROC_PID;
|
||||
managementInfoBase[3] = aPid;
|
||||
managementInfoBase[3] = pid;
|
||||
|
||||
if (sysctl(managementInfoBase, 4, NULL, &mibLength, NULL, 0) == -1) {
|
||||
return false;
|
||||
@@ -900,14 +900,14 @@ private:
|
||||
|
||||
delete [] kInfoProc;
|
||||
}
|
||||
setPid(aPid);
|
||||
setPid(pid);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool readArguments(int aPid) Q_DECL_OVERRIDE
|
||||
bool readArguments(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
Q_UNUSED(aPid);
|
||||
Q_UNUSED(pid);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -927,17 +927,17 @@ private:
|
||||
class SolarisProcessInfo : public UnixProcessInfo
|
||||
{
|
||||
public:
|
||||
SolarisProcessInfo(int aPid, const QString &titleFormat) :
|
||||
UnixProcessInfo(aPid, titleFormat)
|
||||
SolarisProcessInfo(int pid, const QString &titleFormat) :
|
||||
UnixProcessInfo(pid, titleFormat)
|
||||
{
|
||||
}
|
||||
|
||||
protected:
|
||||
// FIXME: This will have the same issues as BKO 251351; the Linux
|
||||
// version uses readlink.
|
||||
bool readCurrentDir(int aPid) Q_DECL_OVERRIDE
|
||||
bool readCurrentDir(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
QFileInfo info(QString("/proc/%1/path/cwd").arg(aPid));
|
||||
QFileInfo info(QString("/proc/%1/path/cwd").arg(pid));
|
||||
const bool readable = info.isReadable();
|
||||
|
||||
if (readable && info.isSymLink()) {
|
||||
@@ -955,9 +955,9 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
bool readProcInfo(int aPid) Q_DECL_OVERRIDE
|
||||
bool readProcInfo(int pid) Q_DECL_OVERRIDE
|
||||
{
|
||||
QFile psinfo(QString("/proc/%1/psinfo").arg(aPid));
|
||||
QFile psinfo(QString("/proc/%1/psinfo").arg(pid));
|
||||
if (psinfo.open(QIODevice::ReadOnly)) {
|
||||
struct psinfo info;
|
||||
if (psinfo.read((char *)&info, sizeof(info)) != sizeof(info)) {
|
||||
@@ -967,7 +967,7 @@ private:
|
||||
setParentPid(info.pr_ppid);
|
||||
setForegroundPid(info.pr_pgid);
|
||||
setName(info.pr_fname);
|
||||
setPid(aPid);
|
||||
setPid(pid);
|
||||
|
||||
// Bogus, because we're treating the arguments as one single string
|
||||
info.pr_psargs[PRARGSZ - 1] = 0;
|
||||
@@ -1158,22 +1158,22 @@ QString SSHProcessInfo::format(const QString &input) const
|
||||
return output;
|
||||
}
|
||||
|
||||
ProcessInfo *ProcessInfo::newInstance(int aPid, const QString &titleFormat)
|
||||
ProcessInfo *ProcessInfo::newInstance(int pid, const QString &titleFormat)
|
||||
{
|
||||
ProcessInfo *info;
|
||||
#if defined(Q_OS_LINUX)
|
||||
info = new LinuxProcessInfo(aPid, titleFormat);
|
||||
info = new LinuxProcessInfo(pid, titleFormat);
|
||||
#elif defined(Q_OS_SOLARIS)
|
||||
info = new SolarisProcessInfo(aPid, titleFormat);
|
||||
info = new SolarisProcessInfo(pid, titleFormat);
|
||||
#elif defined(Q_OS_MACOS)
|
||||
info = new MacProcessInfo(aPid, titleFormat);
|
||||
info = new MacProcessInfo(pid, titleFormat);
|
||||
#elif defined(Q_OS_FREEBSD)
|
||||
info = new FreeBSDProcessInfo(aPid, titleFormat);
|
||||
info = new FreeBSDProcessInfo(pid, titleFormat);
|
||||
#elif defined(Q_OS_OPENBSD)
|
||||
info = new OpenBSDProcessInfo(aPid, titleFormat);
|
||||
info = new OpenBSDProcessInfo(pid, titleFormat);
|
||||
#else
|
||||
info = new NullProcessInfo(aPid, titleFormat);
|
||||
info = new NullProcessInfo(pid, titleFormat);
|
||||
#endif
|
||||
info->readProcessInfo(aPid);
|
||||
info->readProcessInfo(pid);
|
||||
return info;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user