1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00

importd: use Type=notify

This commit is contained in:
Mike Yuan 2024-01-09 19:51:54 +08:00
parent c3ff3175d6
commit deb869970d
No known key found for this signature in database
GPG Key ID: 417471C0A40F58B3
2 changed files with 13 additions and 13 deletions

View File

@ -12,6 +12,7 @@
#include "bus-polkit.h"
#include "common-signal.h"
#include "constants.h"
#include "daemon-util.h"
#include "env-util.h"
#include "fd-util.h"
#include "float.h"
@ -1332,18 +1333,6 @@ static bool manager_check_idle(void *userdata) {
return hashmap_isempty(m->transfers);
}
static int manager_run(Manager *m) {
assert(m);
return bus_event_loop_with_idle(
m->event,
m->bus,
"org.freedesktop.import1",
DEFAULT_EXIT_USEC,
manager_check_idle,
m);
}
static void manager_parse_env(Manager *m) {
int r;
@ -1394,7 +1383,17 @@ static int run(int argc, char *argv[]) {
if (r < 0)
return r;
r = manager_run(m);
r = sd_notify(false, NOTIFY_READY);
if (r < 0)
log_warning_errno(r, "Failed to send readiness notification, ignoring: %m");
r = bus_event_loop_with_idle(
m->event,
m->bus,
"org.freedesktop.import1",
DEFAULT_EXIT_USEC,
manager_check_idle,
m);
if (r < 0)
return log_error_errno(r, "Failed to run event loop: %m");

View File

@ -13,6 +13,7 @@ Documentation=man:systemd-importd.service(8)
Documentation=man:org.freedesktop.import1(5)
[Service]
Type=notify
ExecStart={{LIBEXECDIR}}/systemd-importd
BusName=org.freedesktop.import1
KillMode=mixed