| [chrony-dev] [PATCH] Add -N option for s6-style service readiness notification |
[ Thread Index |
Date Index
| More chrony.tuxfamily.org/chrony-dev Archives
]
- To: chrony-dev@xxxxxxxxxxxxxxxxxxxx
- Subject: [chrony-dev] [PATCH] Add -N option for s6-style service readiness notification
- From: Emery Hemingway <emery@xxxxxxxxxxxxxxxx>
- Date: Thu, 9 Apr 2026 11:15:35 +0000
- Cc: Emery Hemingway <emery@xxxxxxxxxxxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=informatics.coop; s=jankyemail; t=1775733343; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=NPnI/1qS8dyNBeXgMcjy86Vuh5Xb/cuzb90DhZl53pE=; b=BaVhVOsgxWlMwgd+AsfqZIlg75xlyLHg96hs3zuG5dDpVAqGYY3g/T2+zN3DVypaapJ4VV X9UfF0AOSXAKtNJS4RE0fVM9ymz3j0JgsZfzN/slyDFRRWDsQCdPQcKTwY+s1L/0tizaPA fRAGgM/HfAmVl9ry9/m8YrBNrbWqFbF8T0a8127iSkabK/c/dGSnwMGjtELENC67Up9tDX mxnBX58TelT94pkWmhhV0hL4xBfVKvjPkoa8v8h+A+P0VnC1jGpPzfUIRH3+wUkS6tpB5U +eFVquXY/nj5PQhDC9hOks6493Uex65tTXzMO2wU2s5Zc31ZCoYPWSJS2muJyw==
https://skarnet.org/software/s6/notifywhenup.html
---
doc/chronyd.adoc | 4 ++++
main.c | 13 ++++++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/doc/chronyd.adoc b/doc/chronyd.adoc
index be34c96..fb22f73 100644
--- a/doc/chronyd.adoc
+++ b/doc/chronyd.adoc
@@ -201,6 +201,10 @@ still track its offset and frequency relative to the estimated true time. This
option allows *chronyd* to be started without the capability to adjust or set
the system clock (e.g. in some containers) to operate as an NTP server.
+*-N* _fd_::
+This options declares a file-descriptor that a process supervisor is reading
+for an s6-style service ready notification.
+
*-v*, *--version*::
With this option *chronyd* will print version number to the terminal and exit.
diff --git a/main.c b/main.c
index 9c90b58..62bf521 100644
--- a/main.c
+++ b/main.c
@@ -70,6 +70,8 @@ static int exit_status = 0;
static int reload = 0;
+static int notify_fd = 0;
+
static REF_Mode ref_mode = REF_ModeNormal;
/* ================================================== */
@@ -110,6 +112,11 @@ delete_pidfile(void)
static void
notify_system_manager(int start)
{
+ if (start && notify_fd) {
+ dprintf(notify_fd, "\n");
+ close(notify_fd);
+ }
+
#ifdef LINUX
/* The systemd protocol is documented in the sd_notify(3) man page */
const char *message, *path = getenv("NOTIFY_SOCKET");
@@ -454,6 +461,7 @@ print_help(const char *progname)
" -P PRIORITY\tSet process priority (0)\n"
" -m\t\tLock memory\n"
" -x\t\tDon't control clock\n"
+ " -N FD\tnotify supervisor on an open file-descriptor\n"
" -v, --version\tPrint version and exit\n"
" -h, --help\tPrint usage and exit\n",
progname, DEFAULT_CONF_FILE, DEFAULT_USER);
@@ -512,7 +520,7 @@ int main
optind = 1;
/* Parse short command-line options */
- while ((opt = getopt(argc, argv, "46df:F:hl:L:mnpP:qQrRst:u:Uvx")) != -1) {
+ while ((opt = getopt(argc, argv, "46df:F:hl:L:mn:N:pP:qQrRst:u:Uvx")) != -1) {
switch (opt) {
case '4':
case '6':
@@ -541,6 +549,9 @@ int main
case 'n':
nofork = 1;
break;
+ case 'N':
+ notify_fd = parse_int_arg(optarg);
+ break;
case 'p':
print_config = 1;
user_check = 0;
--
2.52.0
--
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble? Email listmaster@xxxxxxxxxxxxxxxxxxxx.