procutil.h

Go to the documentation of this file.
00001 /*
00002 **  This file is part of Vidalia, and is subject to the license terms in the
00003 **  LICENSE file, found in the top level directory of this distribution. If you
00004 **  did not receive the LICENSE file with this file, you may obtain it from the
00005 **  Vidalia source package distributed by the Vidalia Project at
00006 **  http://www.vidalia-project.net/. No part of Vidalia, including this file,
00007 **  may be copied, modified, propagated, or distributed except according to the
00008 **  terms described in the LICENSE file.
00009 */
00010 
00011 /*
00012 ** \file procutil.h
00013 ** \version $Id: procutil.h 3751 2009-05-01 03:26:38Z edmanm $
00014 ** \brief Process information and pidfile functions
00015 */
00016 
00017 #ifndef _PROCUTIL_H
00018 #define _PROCUTIL_H
00019 
00020 #include <QtGlobal>
00021 #if defined(Q_OS_WIN)
00022 #include "win32.h"
00023 #else
00024 #include <sys/types.h>
00025 #include <unistd.h>
00026 #include <signal.h>
00027 #include <errno.h>
00028 #endif
00029 
00030 #include <QHash>
00031 
00032 class QString;
00033 
00034 /** Returns the PID of the current process. */
00035 qint64 get_pid();
00036 
00037 /** Returns true if a process with the given PID is running. */
00038 bool is_process_running(qint64 pid);
00039 
00040 /** Writes the given file to disk containing the current process's PID. */
00041 bool write_pidfile(const QString &pidfile, QString *errmsg = 0);
00042 
00043 /** Reads the giiven pidfile and returns the value in it. If the file does not
00044  * exist, -1 is returned. */
00045 qint64 read_pidfile(const QString &pidfile, QString *errmsg = 0);
00046 
00047 /** Return a list of all currently running PIDs and their associated process
00048  * names. */
00049 QHash<qint64, QString> process_list();
00050 
00051 /** Attempt to kill process <b>pid</b>. Return true if the specified process
00052  * was successfully terminated. Otherwise, return false. */
00053 bool process_kill(qint64 pid);
00054 
00055 #endif
00056 
Generated on Mon Aug 30 23:09:50 2010 for Vidalia by  doxygen 1.6.3