FreeBSD: which services still run replaced code (procstat -v), or none #33

Open
opened 2026-11-26 17:55:45 +00:00 by christianmanivong · 0 comments
Owner

NetOrk/netork#2750 decided the BSD drivers carry no get_services_need_restart for now: napalm-device-types' ServicesRestartMixin reads needs-restarting, needrestart or /proc/<pid>/maps and names systemd units through /proc/<pid>/cgroup. FreeBSD and OpenBSD have none of these, so mixing it in would read nothing, or worse, read clean. Without the method netOrk shows the reading as not made.

A FreeBSD reading of its own could work like this (not verified on a host yet):

  • procstat -a -v as root lists every process's mappings. A vn mapping with execute permission whose path is empty points at a vnode that has no name any more, which after pkg upgrade is a replaced library or binary. Whether an empty path can also mean "name not in the name cache" on UFS and ZFS has to be checked on a real host before an empty path counts as replaced.
  • sysutils/checkrestart does this already, but it is a port, not base.
  • A process is not a service on FreeBSD: there is no cgroup. The rc.d service behind a PID would come from service <name> status ("is running as pid N") for the enabled services, as get_services already reads them. A process no service claims is a process.
  • OpenBSD has no such view (no procstat; procmap needs kern.allowkmem), so it stays without the reading.

Until a FreeBSD host's output is recorded (tests/fixtures/, as for every other parser here), it stays unbuilt: a reading that cannot tell an unnamed vnode from a replaced one must not answer "nothing to restart".

NetOrk/netork#2750 decided the BSD drivers carry no `get_services_need_restart` for now: napalm-device-types' `ServicesRestartMixin` reads `needs-restarting`, `needrestart` or `/proc/<pid>/maps` and names systemd units through `/proc/<pid>/cgroup`. FreeBSD and OpenBSD have none of these, so mixing it in would read nothing, or worse, read clean. Without the method netOrk shows the reading as not made. A FreeBSD reading of its own could work like this (not verified on a host yet): - `procstat -a -v` as root lists every process's mappings. A `vn` mapping with execute permission whose path is empty points at a vnode that has no name any more, which after `pkg upgrade` is a replaced library or binary. Whether an empty path can also mean "name not in the name cache" on UFS and ZFS has to be checked on a real host before an empty path counts as replaced. - `sysutils/checkrestart` does this already, but it is a port, not base. - A process is not a service on FreeBSD: there is no cgroup. The rc.d service behind a PID would come from `service <name> status` ("is running as pid N") for the enabled services, as `get_services` already reads them. A process no service claims is a process. - OpenBSD has no such view (no procstat; `procmap` needs `kern.allowkmem`), so it stays without the reading. Until a FreeBSD host's output is recorded (`tests/fixtures/`, as for every other parser here), it stays unbuilt: a reading that cannot tell an unnamed vnode from a replaced one must not answer "nothing to restart".
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: NAPALM/napalm-bsd#33