Skip to main content

set_daemon_process_name

Function set_daemon_process_name 

Source
pub fn set_daemon_process_name()
Expand description

Rename the running process so process managers can distinguish the gateway daemon from interactive term-session clients. Best-effort and cosmetic: a failure is ignored and never affects functionality.

Platform behavior (and limitations):

  • Linux: PR_SET_NAME sets the process comm (capped at 15 bytes → term-session-d), so ps -comm, top, and htop show the renamed value. This is the most complete rename on any platform.
  • macOS: pthread_setname_np sets the thread name, not the process comm — ps -o comm and Activity Monitor’s process list still show term-session. The renamed value is only visible in Activity Monitor’s per-thread view (and sample). This is an OS limitation: macOS has no portable user-space API to rename the process comm. Daemon disambiguation on macOS therefore relies primarily on the --daemon argv flag and the Gateway Daemon PID header printed by term-session list.
  • Windows: SetThreadDescription sets the thread description, which Process Explorer / Process Hacker show in the Description column.