Kea 2.7.5
|
Class to help with processing PID files. More...
#include <pid_file.h>
Public Member Functions | |
PIDFile (const std::string &filename) | |
Constructor. | |
~PIDFile () | |
Destructor. | |
int | check () const |
Read the PID in from the file and check it. | |
void | deleteFile () const |
Delete the PID file. | |
std::string | getFilename () const |
Returns the path to the PID file. | |
void | write () const |
Get PID of the current process and write it to the file. | |
void | write (int) const |
Write the PID to the file. | |
Class to help with processing PID files.
This is a utility class to manipulate PID file. It provides functions for writing and deleting a file containing a PID as well as for extracting a PID from a file and checking if the process is still running.
Definition at line 40 of file pid_file.h.
isc::util::PIDFile::PIDFile | ( | const std::string & | filename | ) |
isc::util::PIDFile::~PIDFile | ( | ) |
Destructor.
Definition at line 22 of file pid_file.cc.
int isc::util::PIDFile::check | ( | ) | const |
Read the PID in from the file and check it.
Read the PID in from the file then use it to see if a process with that PID exists. If the file doesn't exist treat it as the process not being there. If the file exists but can't be read or it doesn't have the proper format treat it as the process existing.
throws | PIDCantReadPID if it was able to open the file but was unable to read the PID from it. |
Definition at line 26 of file pid_file.cc.
References isc_throw.
void isc::util::PIDFile::deleteFile | ( | ) | const |
Delete the PID file.
throws | PIDFileError if it can't delete the PID file |
Definition at line 84 of file pid_file.cc.
References isc_throw.
|
inline |
Returns the path to the PID file.
Definition at line 82 of file pid_file.h.
void isc::util::PIDFile::write | ( | ) | const |
Get PID of the current process and write it to the file.
throws | PIDFileError if it can't open or write to the PID file. |
Definition at line 58 of file pid_file.cc.
References write().
Referenced by write().
void isc::util::PIDFile::write | ( | int | pid | ) | const |
Write the PID to the file.
pid | the pid to write to the file. |
throws | PIDFileError if it can't open or write to the PID file. |
Definition at line 63 of file pid_file.cc.
References isc_throw.