From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-03.1984.is (mail-03.1984.is [93.95.224.70]) by sourceware.org (Postfix) with ESMTPS id EBA713857829 for ; Sun, 7 Mar 2021 12:51:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EBA713857829 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=westerhu.is Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=victor@westerhu.is Received: from localhost by mail-03.1984.is with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lIsrX-0008JE-LV; Sun, 07 Mar 2021 12:50:23 +0000 From: Victor Westerhuis To: elfutils-devel@sourceware.org Cc: Victor Westerhuis Subject: [RFC PATCH 3/6] Notify systemd when ready and stopping Date: Sun, 7 Mar 2021 13:49:55 +0100 Message-Id: <96c549b036504af103b99910274d3896c6bb3331.1615120371.git.victor@westerhu.is> X-Mailer: git-send-email 2.30.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-14.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 07 Mar 2021 12:51:03 -0000 Signed-off-by: Victor Westerhuis --- config/debuginfod.service | 1 + debuginfod/debuginfod.cxx | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/config/debuginfod.service b/config/debuginfod.service index b64d8cb9..6c434705 100644 --- a/config/debuginfod.service +++ b/config/debuginfod.service @@ -4,6 +4,7 @@ Documentation=http://elfutils.org/ After=network.target [Service] +Type=Notify EnvironmentFile=/etc/sysconfig/debuginfod User=debuginfod Group=debuginfod diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index caced48c..4dece371 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -3576,11 +3576,17 @@ main (int argc, char *argv[]) } /* Trivial main loop! */ +#ifdef ENABLE_SYSTEMD + (void) sd_notify (false, "READY=1"); +#endif set_metric("ready", 1); while (! interrupted) pause (); scanq.nuke(); // wake up any remaining scanq-related threads, let them die set_metric("ready", 0); +#ifdef ENABLE_SYSTEMD + (void) sd_notify (false, "STOPPING=1"); +#endif if (verbose) obatched(clog) << "stopping" << endl; -- 2.30.1