[Midnightbsd-cvs] [MidnightBSD/src] daa066: prowld: implement sd_notify readiness and watchdog...
Lucas Holt
noreply at github.com
Sat Apr 18 16:28:01 EDT 2026
Branch: refs/heads/feature/prowl
Home: https://github.com/MidnightBSD/src
Commit: daa0661d0490e03d6391a97e96d83c6ccfe9d771
https://github.com/MidnightBSD/src/commit/daa0661d0490e03d6391a97e96d83c6ccfe9d771
Author: Lucas Holt <luke at foolishgames.com>
Date: 2026-04-18 (Sat, 18 Apr 2026)
Changed paths:
M sbin/prowld/prowld.c
M sbin/prowld/prowld.h
M sbin/prowld/supervisor.c
Log Message:
-----------
prowld: implement sd_notify readiness and watchdog (Phase 1)
supervisor.c:
- Add TIMER_* encoding constants for the 2-bit low-field timer ident
scheme; update arm_throttle_timer/arm_stop_timer to use it
- notify_socket_path/open/close: create and manage a per-job Unix
datagram socket at PROWLD_NOTIFY_DIR/<label> registered in kqueue
with the job pointer as udata for O(1) dispatch
- arm/cancel_notify_timeout_timer: one-shot EVFILT_TIMER (TIMER_NOTIFY_TMO)
that kills the job if READY=1 is not received within exit_timeout seconds
- arm/cancel_watchdog_timer: recurring EVFILT_TIMER (TIMER_WATCHDOG) that
calls supervisor_handle_watchdog every watchdog_sec seconds
- supervisor_start: open notify socket before fork; arm notify timeout
instead of throttle timer for NOTIFY_NOTIFY jobs; arm watchdog if
watchdog_sec > 0; close notify fd in child before exec
- supervisor_stop: cancel watchdog timer before sending SIGTERM
- supervisor_reap: cancel watchdog, notify timeout, and close notify
socket on child exit
- child_setup_and_exec: inject NOTIFY_SOCKET=<path> when notify_type is
NOTIFY_NOTIFY; inject WATCHDOG_USEC/WATCHDOG_PID when watchdog_sec > 0;
always use execve when injected vars are present
- supervisor_handle_notify: recvfrom the notify datagram socket; parse
KEY=value\n lines; handle READY=1 (transition to running, cancel
timeout timer), STATUS, MAINPID (re-register EVFILT_PROC watcher),
WATCHDOG=1 (reset ping timestamp), RELOADING, STOPPING, ERRNO,
EXTEND_TIMEOUT_USEC; silently ignore unknown keys
- supervisor_handle_watchdog: kill job via supervisor_stop if time since
last WATCHDOG=1 ping exceeds watchdog_sec
- supervisor_handle_notify_timeout: kill job with SIGKILL; reap path
applies keep_alive policy normally
prowld.c:
- handle_timer_event: switch on 2-bit kind field; add cases for
TIMER_WATCHDOG and TIMER_NOTIFY_TMO
- main_loop EVFILT_READ: if kev->udata != NULL route to
supervisor_handle_notify(udata) instead of ipc_read_client
prowld.h:
- Add watchdog_timer_active and watchdog_last_ping fields to job_t
- Add prototypes for supervisor_handle_notify/watchdog/notify_timeout
AI-Assisted-by: Claude Sonnet 4.6
Signed-off-by: Lucas Holt <luke at foolishgames.com>
To unsubscribe from these emails, change your notification settings at https://github.com/MidnightBSD/src/settings/notifications
More information about the Midnightbsd-cvs
mailing list