server: use generalized commando socket for worker tasks commands
Allows to extend the use of that socket in the future, e.g., for log rotate re-open signaling. To reflect this we use a more general name, and change the commandos to a more clear namespace. Both are actually somewhat a breaking change, but the single real world issue it should be able to cause is, that one won't be able to stop task from older daemons, which still use the older abstract socket name format. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
@ -4,6 +4,34 @@
|
||||
//! services. We want async IO, so this is built on top of
|
||||
//! tokio/hyper.
|
||||
|
||||
use lazy_static::lazy_static;
|
||||
use nix::unistd::Pid;
|
||||
|
||||
use proxmox::sys::linux::procfs::PidStat;
|
||||
|
||||
use crate::buildcfg;
|
||||
|
||||
lazy_static! {
|
||||
static ref PID: i32 = unsafe { libc::getpid() };
|
||||
static ref PSTART: u64 = PidStat::read_from_pid(Pid::from_raw(*PID)).unwrap().starttime;
|
||||
}
|
||||
|
||||
pub fn pid() -> i32 {
|
||||
*PID
|
||||
}
|
||||
|
||||
pub fn pstart() -> u64 {
|
||||
*PSTART
|
||||
}
|
||||
|
||||
pub fn ctrl_sock_from_pid(pid: i32) -> String {
|
||||
format!("\0{}/control-{}.sock", buildcfg::PROXMOX_BACKUP_RUN_DIR, pid)
|
||||
}
|
||||
|
||||
pub fn our_ctrl_sock() -> String {
|
||||
ctrl_sock_from_pid(*PID)
|
||||
}
|
||||
|
||||
mod environment;
|
||||
pub use environment::*;
|
||||
|
||||
|
Reference in New Issue
Block a user