Vidalia
0.3.1
Main Page
Namespaces
Classes
Files
File List
File Members
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
Generated on Mon Jan 14 2013 08:44:27 for Vidalia by
1.8.3