1 #include <sys/types.h> // pid_t
2 #include <unistd.h> // getpid
14 : fileName("/var/run/gssmd.pid")
19 PIDFile::PIDFile(const std::string & file)
27 if (unlink(fileName.c_str())) {
28 logger << "Failed to unlink pid-file: " << strerror(errno) << std::endl;
33 void PIDFile::_create()
35 std::ofstream file(fileName.c_str());
37 if (!file.is_open()) {
38 logger << "Failed to create pid-file: " << strerror(errno) << std::endl;
44 logger << "PID: " << pid << std::endl;