mirror of
https://github.com/systemd/systemd.git
synced 2025-05-25 10:50:37 +03:00
localed: modernization
This commit is contained in:
parent
9737e2c850
commit
33354ffb14
@ -15,6 +15,7 @@
|
|||||||
#include "bus-polkit.h"
|
#include "bus-polkit.h"
|
||||||
#include "bus-unit-util.h"
|
#include "bus-unit-util.h"
|
||||||
#include "constants.h"
|
#include "constants.h"
|
||||||
|
#include "daemon-util.h"
|
||||||
#include "kbd-util.h"
|
#include "kbd-util.h"
|
||||||
#include "localed-util.h"
|
#include "localed-util.h"
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
@ -647,26 +648,24 @@ static int run(int argc, char *argv[]) {
|
|||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
assert_se(sigprocmask_many(SIG_BLOCK, NULL, SIGTERM, SIGINT, -1) >= 0);
|
|
||||||
|
|
||||||
r = sd_event_default(&event);
|
r = sd_event_default(&event);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to allocate event loop: %m");
|
return log_error_errno(r, "Failed to allocate event loop: %m");
|
||||||
|
|
||||||
(void) sd_event_set_watchdog(event, true);
|
(void) sd_event_set_watchdog(event, true);
|
||||||
|
|
||||||
r = sd_event_add_signal(event, NULL, SIGINT, NULL, NULL);
|
r = sd_event_set_signal_exit(event, true);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to install SIGINT handler: %m");
|
return log_error_errno(r, "Failed to install SIGINT/SIGTERM handlers: %m");
|
||||||
|
|
||||||
r = sd_event_add_signal(event, NULL, SIGTERM, NULL, NULL);
|
|
||||||
if (r < 0)
|
|
||||||
return log_error_errno(r, "Failed to install SIGTERM handler: %m");
|
|
||||||
|
|
||||||
r = connect_bus(&context, event, &bus);
|
r = connect_bus(&context, event, &bus);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
|
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(event, bus, "org.freedesktop.locale1", DEFAULT_EXIT_USEC, NULL, NULL);
|
r = bus_event_loop_with_idle(event, bus, "org.freedesktop.locale1", DEFAULT_EXIT_USEC, NULL, NULL);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to run event loop: %m");
|
return log_error_errno(r, "Failed to run event loop: %m");
|
||||||
|
@ -15,6 +15,7 @@ Documentation=man:vconsole.conf(5)
|
|||||||
Documentation=man:org.freedesktop.locale1(5)
|
Documentation=man:org.freedesktop.locale1(5)
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
Type=notify
|
||||||
BusName=org.freedesktop.locale1
|
BusName=org.freedesktop.locale1
|
||||||
CapabilityBoundingSet=
|
CapabilityBoundingSet=
|
||||||
ExecStart={{LIBEXECDIR}}/systemd-localed
|
ExecStart={{LIBEXECDIR}}/systemd-localed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user