]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/unit: add get_timeout_start_usec in UnitVTable and define it for service
authorlicunlong <licunlong1@huawei.com>
Thu, 15 Jun 2023 02:47:32 +0000 (10:47 +0800)
committerlicunlong <licunlong1@huawei.com>
Fri, 16 Jun 2023 01:19:33 +0000 (09:19 +0800)
src/core/service.c
src/core/unit.h

index 38f87456749af8f20c9c136b8e110507ae58237d..171e091dff17eaedcf87eeaff205761c1347257f 100644 (file)
@@ -4607,6 +4607,11 @@ static int service_get_timeout(Unit *u, usec_t *timeout) {
         return 1;
 }
 
+static usec_t service_get_timeout_start_usec(Unit *u) {
+        Service *s = SERVICE(ASSERT_PTR(u));
+        return s->timeout_start_usec;
+}
+
 static bool pick_up_pid_from_bus_name(Service *s) {
         assert(s);
 
@@ -5145,6 +5150,7 @@ const UnitVTable service_vtable = {
         .bus_commit_properties = bus_service_commit_properties,
 
         .get_timeout = service_get_timeout,
+        .get_timeout_start_usec = service_get_timeout_start_usec,
         .needs_console = service_needs_console,
         .exit_status = service_exit_status,
         .status_text = service_status_text,
index f2d4fd6a4b2c2b0845b01a5cb25ea20a2049a7e1..3f1f58d6000b2009ab920ec168faecb00d55f8c8 100644 (file)
@@ -715,6 +715,9 @@ typedef struct UnitVTable {
         /* Returns the next timeout of a unit */
         int (*get_timeout)(Unit *u, usec_t *timeout);
 
+        /* Returns the start timeout of a unit */
+        usec_t (*get_timeout_start_usec)(Unit *u);
+
         /* Returns the main PID if there is any defined, or 0. */
         pid_t (*main_pid)(Unit *u);