|
a/upmpd/upmpdutils.hxx |
|
b/upmpd/upmpdutils.hxx |
|
... |
|
... |
60 |
// Replace the first occurrence of regexp. cxx11 regex does not work
|
60 |
// Replace the first occurrence of regexp. cxx11 regex does not work
|
61 |
// that well yet...
|
61 |
// that well yet...
|
62 |
extern std::string regsub1(const std::string& sexp, const std::string& input,
|
62 |
extern std::string regsub1(const std::string& sexp, const std::string& input,
|
63 |
const std::string& repl);
|
63 |
const std::string& repl);
|
64 |
|
64 |
|
|
|
65 |
/// Lock/pid file class. From Recoll
|
|
|
66 |
class Pidfile {
|
|
|
67 |
public:
|
|
|
68 |
Pidfile(const std::string& path) : m_path(path), m_fd(-1) {}
|
|
|
69 |
~Pidfile();
|
|
|
70 |
/// Open/create the pid file.
|
|
|
71 |
/// @return 0 if ok, > 0 for pid of existing process, -1 for other error.
|
|
|
72 |
pid_t open();
|
|
|
73 |
/// Write pid into the pid file
|
|
|
74 |
/// @return 0 ok, -1 error
|
|
|
75 |
int write_pid();
|
|
|
76 |
/// Close the pid file (unlocks)
|
|
|
77 |
int close();
|
|
|
78 |
/// Delete the pid file
|
|
|
79 |
int remove();
|
|
|
80 |
const std::string& getreason() {return m_reason;}
|
|
|
81 |
private:
|
|
|
82 |
std::string m_path;
|
|
|
83 |
int m_fd;
|
|
|
84 |
std::string m_reason;
|
|
|
85 |
pid_t read_pid();
|
|
|
86 |
int flopen();
|
|
|
87 |
};
|
|
|
88 |
|
65 |
#endif /* _UPMPDUTILS_H_X_INCLUDED_ */
|
89 |
#endif /* _UPMPDUTILS_H_X_INCLUDED_ */
|