}
int verify();
int remove();
- int open(const md_config_t *conf);
+ int open(const ConfigProxy& conf);
int write();
};
return 0;
}
-int pidfh::open(const md_config_t *conf)
+int pidfh::open(const ConfigProxy& conf)
{
int len = snprintf(pf_path, sizeof(pf_path),
"%s", conf->pid_file.c_str());
};
int r = ::fcntl(pf_fd, F_SETLK, &l);
if (r < 0) {
- derr << __func__ << ": failed to lock pidfile "
- << pf_path << " because another process locked it." << dendl;
+ if (errno == EAGAIN || errno == EACCES) {
+ derr << __func__ << ": failed to lock pidfile "
+ << pf_path << " because another process locked it"
+ << "': " << cpp_strerror(errno) << dendl;
+ } else {
+ derr << __func__ << ": failed to lock pidfile "
+ << pf_path << "': " << cpp_strerror(errno) << dendl;
+ }
::close(pf_fd);
reset();
return -errno;
pfh = nullptr;
}
-int pidfile_write(const md_config_t *conf)
+int pidfile_write(const ConfigProxy& conf)
{
if (conf->pid_file.empty()) {
dout(0) << __func__ << ": ignore empty --pid-file" << dendl;
return 0;
}
- assert(pfh == nullptr);
+ ceph_assert(pfh == nullptr);
pfh = new pidfh();
if (atexit(pidfile_remove)) {