Vidalia  0.3.1
Functions
procutil.cpp File Reference
#include "procutil.h"
#include "stringutil.h"
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QTextStream>
#include <QApplication>
#include <QProcess>
#include <signal.h>

Go to the source code of this file.

Functions

qint64 get_pid ()
 
bool is_process_running (qint64 pid)
 
bool write_pidfile (const QString &pidFileName, QString *errmsg)
 
qint64 read_pidfile (const QString &pidFileName, QString *errmsg)
 
QHash< qint64, QString > process_list (quint16 port)
 
bool process_kill (qint64 pid)
 
QHash< qint64, QString > universal_process_list (quint16 port)
 

Function Documentation

◆ get_pid()

qint64 get_pid ( )

Returns the PID of the current process.

Definition at line 33 of file procutil.cpp.

Referenced by main(), and write_pidfile().

◆ is_process_running()

bool is_process_running ( qint64  pid)

Returns true if a process with the given PID is running.

Definition at line 44 of file procutil.cpp.

References win32_process_list().

Referenced by is_vidalia_running().

◆ process_kill()

bool process_kill ( qint64  pid)

Attempt to kill process pid. Return true if the specified process was successfully terminated. Otherwise, return false.

Definition at line 118 of file procutil.cpp.

Referenced by MainWindow::authenticationFailed().

◆ process_list()

QHash<qint64, QString> process_list ( quint16  port = 0)

Return a list of all currently running PIDs and their associated process names.

Definition at line 112 of file procutil.cpp.

References universal_process_list().

Referenced by MainWindow::authenticationFailed().

◆ read_pidfile()

qint64 read_pidfile ( const QString &  pidFileName,
QString *  errmsg 
)

Reads the given pidfile and returns the value contained in it. If the file does not exist 0 is returned. Returns -1 if an error occurs.

Definition at line 89 of file procutil.cpp.

Referenced by is_vidalia_running().

◆ universal_process_list()

QHash<qint64, QString> universal_process_list ( quint16  port)

Definition at line 138 of file procutil.cpp.

Referenced by process_list().

◆ write_pidfile()

bool write_pidfile ( const QString &  pidFileName,
QString *  errmsg 
)

Writes the given file to disk containing the current process's PID.

Definition at line 66 of file procutil.cpp.

References err(), and get_pid().

Referenced by main().