Vidalia
0.3.1
src
common
procutil.h
Go to the documentation of this file.
1
/*
2
** This file is part of Vidalia, and is subject to the license terms in the
3
** LICENSE file, found in the top level directory of this distribution. If you
4
** did not receive the LICENSE file with this file, you may obtain it from the
5
** Vidalia source package distributed by the Vidalia Project at
6
** http://www.torproject.org/projects/vidalia.html. No part of Vidalia,
7
** including this file, may be copied, modified, propagated, or distributed
8
** except according to the terms described in the LICENSE file.
9
*/
10
11
/*
12
** \file procutil.h
13
** \brief Process information and pidfile functions
14
*/
15
16
#ifndef _PROCUTIL_H
17
#define _PROCUTIL_H
18
19
#include <QtGlobal>
20
#if defined(Q_OS_WIN)
21
#include "
win32.h
"
22
#else
23
#include <sys/types.h>
24
#include <unistd.h>
25
#include <signal.h>
26
#include <errno.h>
27
#endif
28
29
#include <QHash>
30
31
class
QString;
32
33
/** Returns the PID of the current process. */
34
qint64
get_pid
();
35
36
/** Returns true if a process with the given PID is running. */
37
bool
is_process_running
(qint64 pid);
38
39
/** Writes the given file to disk containing the current process's PID. */
40
bool
write_pidfile
(
const
QString &pidfile, QString *errmsg = 0);
41
42
/** Reads the giiven pidfile and returns the value in it. If the file does not
43
* exist, -1 is returned. */
44
qint64
read_pidfile
(
const
QString &pidfile, QString *errmsg = 0);
45
46
/** Return a list of all currently running PIDs and their associated process
47
* names. */
48
QHash<qint64, QString>
process_list
(quint16 port = 0);
49
QHash<qint64, QString>
universal_process_list
(quint16 port);
50
51
/** Attempt to kill process <b>pid</b>. Return true if the specified process
52
* was successfully terminated. Otherwise, return false. */
53
bool
process_kill
(qint64 pid);
54
55
#endif
56
win32.h
universal_process_list
QHash< qint64, QString > universal_process_list(quint16 port)
Definition:
procutil.cpp:138
write_pidfile
bool write_pidfile(const QString &pidfile, QString *errmsg=0)
Definition:
procutil.cpp:66
process_kill
bool process_kill(qint64 pid)
Definition:
procutil.cpp:118
process_list
QHash< qint64, QString > process_list(quint16 port=0)
Definition:
procutil.cpp:112
get_pid
qint64 get_pid()
Definition:
procutil.cpp:33
is_process_running
bool is_process_running(qint64 pid)
Definition:
procutil.cpp:44
read_pidfile
qint64 read_pidfile(const QString &pidfile, QString *errmsg=0)
Definition:
procutil.cpp:89
Generated by
1.8.17