libmoost
|
Create a process pid file. More...
#include <pidfile.hpp>
Public Member Functions | |
pidfile (pid_t const pid, std::string const &process_name, boost::filesystem::path const &rundir) | |
Construct a pidfile object. | |
pidfile (std::string const &process_name, boost::filesystem::path const &rundir) | |
Construct a pidfile object. | |
pidfile (pid_t const pid, boost::filesystem::path const &filepath) | |
Construct a pidfile object. | |
pidfile (boost::filesystem::path const &filepath) | |
Construct a pidfile object. | |
~pidfile () | |
Destruct a pidfile object. | |
bool | create () const |
Create a new pid file. | |
bool | create (pid_t const pid) |
Create a new pid file. | |
bool | remove () const |
Remove pid file. | |
Static Public Member Functions | |
static boost::filesystem::path | get_default_rundir () |
Get the default run directory. | |
Private Attributes | |
pid_t | pid_ |
boost::filesystem::path | filepath_ |
Create a process pid file.
Will create the pid on construction and remove on destruction.
Definition at line 45 of file pidfile.hpp.
moost::process::pidfile::pidfile | ( | pid_t const | pid, |
std::string const & | process_name, | ||
boost::filesystem::path const & | rundir | ||
) | [inline] |
Construct a pidfile object.
Construct a pidfile object with the pid set
if | it fails to create the pid file a runtime_error will be emitted. |
the | pid that will be associated with this instance |
process_name | The name of the process to associate with this pidfile |
rundir | The run directory where the pid file will be created You should use get_default_rundir() unless you wish to specify a non-standard location |
Definition at line 63 of file pidfile.hpp.
moost::process::pidfile::pidfile | ( | std::string const & | process_name, |
boost::filesystem::path const & | rundir | ||
) | [inline, explicit] |
Construct a pidfile object.
Construct a pidfile object with the pid unset at this time (-1)
process_name | The name of the process to associate with this pidfile |
rundir | The run directory where the pid file will be created You should use get_default_rundir() unless you wish to specify a non-standard location |
Definition at line 86 of file pidfile.hpp.
moost::process::pidfile::pidfile | ( | pid_t const | pid, |
boost::filesystem::path const & | filepath | ||
) | [inline] |
Construct a pidfile object.
Construct a pidfile object with the pid set
if | it fails to create the pid file a runtime_error will be emitted. |
the | pid that will be associated with this instance |
filepath | the file name and path of the pidfile |
Definition at line 107 of file pidfile.hpp.
moost::process::pidfile::pidfile | ( | boost::filesystem::path const & | filepath | ) | [inline, explicit] |
Construct a pidfile object.
Construct a pidfile object with the pid unset at this time (-1)
filepath | the file name and path of the pidfile |
Definition at line 127 of file pidfile.hpp.
moost::process::pidfile::~pidfile | ( | ) | [inline] |
Destruct a pidfile object.
Destruct a pidfile object, removing the pid file in the process
Definition at line 140 of file pidfile.hpp.
bool moost::process::pidfile::create | ( | ) | const [inline] |
Create a new pid file.
Using the last assigned pid, a new pid file will be created (any old one is removed first)
if | the pid has not been set a runtime_error will be emitted. |
Definition at line 158 of file pidfile.hpp.
bool moost::process::pidfile::create | ( | pid_t const | pid | ) | [inline] |
Create a new pid file.
Set a new pid for this instance and use it to create a new pid file
the | pid that will be associated with this instance |
Definition at line 180 of file pidfile.hpp.
static boost::filesystem::path moost::process::pidfile::get_default_rundir | ( | ) | [inline, static] |
Get the default run directory.
Get the default run directory where the pidfile should be created for this platform. You can use any directory you like but it is generally best to stick to using the default for the platform.
Definition at line 205 of file pidfile.hpp.
bool moost::process::pidfile::remove | ( | ) | const [inline] |
Remove pid file.
Remove the pid file associated with this instance
Definition at line 192 of file pidfile.hpp.
boost::filesystem::path moost::process::pidfile::filepath_ [private] |
Definition at line 213 of file pidfile.hpp.
pid_t moost::process::pidfile::pid_ [private] |
Definition at line 212 of file pidfile.hpp.