]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/login/logind-core.c
Merge pull request #16882 from weblate/weblate-systemd-master
[thirdparty/systemd.git] / src / login / logind-core.c
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2
3 #include <fcntl.h>
4 #include <sys/ioctl.h>
5 #include <sys/types.h>
6 #include <linux/vt.h>
7
8 #include "sd-device.h"
9
10 #include "alloc-util.h"
11 #include "bus-error.h"
12 #include "bus-util.h"
13 #include "cgroup-util.h"
14 #include "conf-parser.h"
15 #include "device-util.h"
16 #include "efi-loader.h"
17 #include "errno-util.h"
18 #include "fd-util.h"
19 #include "limits-util.h"
20 #include "logind.h"
21 #include "parse-util.h"
22 #include "path-util.h"
23 #include "process-util.h"
24 #include "strv.h"
25 #include "terminal-util.h"
26 #include "udev-util.h"
27 #include "user-util.h"
28 #include "userdb.h"
29 #include "utmp-wtmp.h"
30
31 void manager_reset_config(Manager *m) {
32 assert(m);
33
34 m->n_autovts = 6;
35 m->reserve_vt = 6;
36 m->remove_ipc = true;
37 m->inhibit_delay_max = 5 * USEC_PER_SEC;
38 m->user_stop_delay = 10 * USEC_PER_SEC;
39
40 m->handle_power_key = HANDLE_POWEROFF;
41 m->handle_suspend_key = HANDLE_SUSPEND;
42 m->handle_hibernate_key = HANDLE_HIBERNATE;
43 m->handle_lid_switch = HANDLE_SUSPEND;
44 m->handle_lid_switch_ep = _HANDLE_ACTION_INVALID;
45 m->handle_lid_switch_docked = HANDLE_IGNORE;
46 m->power_key_ignore_inhibited = false;
47 m->suspend_key_ignore_inhibited = false;
48 m->hibernate_key_ignore_inhibited = false;
49 m->lid_switch_ignore_inhibited = true;
50
51 m->holdoff_timeout_usec = 30 * USEC_PER_SEC;
52
53 m->idle_action_usec = 30 * USEC_PER_MINUTE;
54 m->idle_action = HANDLE_IGNORE;
55
56 m->runtime_dir_size = physical_memory_scale(10U, 100U); /* 10% */
57 m->runtime_dir_inodes = DIV_ROUND_UP(m->runtime_dir_size, 4096); /* 4k per inode */
58 m->sessions_max = 8192;
59 m->inhibitors_max = 8192;
60
61 m->kill_user_processes = KILL_USER_PROCESSES;
62
63 m->kill_only_users = strv_free(m->kill_only_users);
64 m->kill_exclude_users = strv_free(m->kill_exclude_users);
65 }
66
67 int manager_parse_config_file(Manager *m) {
68 assert(m);
69
70 return config_parse_many_nulstr(
71 PKGSYSCONFDIR "/logind.conf",
72 CONF_PATHS_NULSTR("systemd/logind.conf.d"),
73 "Login\0",
74 config_item_perf_lookup, logind_gperf_lookup,
75 CONFIG_PARSE_WARN, m,
76 NULL);
77 }
78
79 int manager_add_device(Manager *m, const char *sysfs, bool master, Device **ret_device) {
80 Device *d;
81
82 assert(m);
83 assert(sysfs);
84
85 d = hashmap_get(m->devices, sysfs);
86 if (d)
87 /* we support adding master-flags, but not removing them */
88 d->master = d->master || master;
89 else {
90 d = device_new(m, sysfs, master);
91 if (!d)
92 return -ENOMEM;
93 }
94
95 if (ret_device)
96 *ret_device = d;
97
98 return 0;
99 }
100
101 int manager_add_seat(Manager *m, const char *id, Seat **ret_seat) {
102 Seat *s;
103 int r;
104
105 assert(m);
106 assert(id);
107
108 s = hashmap_get(m->seats, id);
109 if (!s) {
110 r = seat_new(&s, m, id);
111 if (r < 0)
112 return r;
113 }
114
115 if (ret_seat)
116 *ret_seat = s;
117
118 return 0;
119 }
120
121 int manager_add_session(Manager *m, const char *id, Session **ret_session) {
122 Session *s;
123 int r;
124
125 assert(m);
126 assert(id);
127
128 s = hashmap_get(m->sessions, id);
129 if (!s) {
130 r = session_new(&s, m, id);
131 if (r < 0)
132 return r;
133 }
134
135 if (ret_session)
136 *ret_session = s;
137
138 return 0;
139 }
140
141 int manager_add_user(
142 Manager *m,
143 UserRecord *ur,
144 User **ret_user) {
145
146 User *u;
147 int r;
148
149 assert(m);
150 assert(ur);
151
152 u = hashmap_get(m->users, UID_TO_PTR(ur->uid));
153 if (!u) {
154 r = user_new(&u, m, ur);
155 if (r < 0)
156 return r;
157 }
158
159 if (ret_user)
160 *ret_user = u;
161
162 return 0;
163 }
164
165 int manager_add_user_by_name(
166 Manager *m,
167 const char *name,
168 User **ret_user) {
169
170 _cleanup_(user_record_unrefp) UserRecord *ur = NULL;
171 int r;
172
173 assert(m);
174 assert(name);
175
176 r = userdb_by_name(name, USERDB_AVOID_SHADOW, &ur);
177 if (r < 0)
178 return r;
179
180 return manager_add_user(m, ur, ret_user);
181 }
182
183 int manager_add_user_by_uid(
184 Manager *m,
185 uid_t uid,
186 User **ret_user) {
187
188 _cleanup_(user_record_unrefp) UserRecord *ur = NULL;
189 int r;
190
191 assert(m);
192 assert(uid_is_valid(uid));
193
194 r = userdb_by_uid(uid, USERDB_AVOID_SHADOW, &ur);
195 if (r < 0)
196 return r;
197
198 return manager_add_user(m, ur, ret_user);
199 }
200
201 int manager_add_inhibitor(Manager *m, const char* id, Inhibitor **ret) {
202 Inhibitor *i;
203 int r;
204
205 assert(m);
206 assert(id);
207
208 i = hashmap_get(m->inhibitors, id);
209 if (!i) {
210 r = inhibitor_new(&i, m, id);
211 if (r < 0)
212 return r;
213 }
214
215 if (ret)
216 *ret = i;
217
218 return 0;
219 }
220
221 int manager_add_button(Manager *m, const char *name, Button **ret_button) {
222 Button *b;
223
224 assert(m);
225 assert(name);
226
227 b = hashmap_get(m->buttons, name);
228 if (!b) {
229 b = button_new(m, name);
230 if (!b)
231 return -ENOMEM;
232 }
233
234 if (ret_button)
235 *ret_button = b;
236
237 return 0;
238 }
239
240 int manager_process_seat_device(Manager *m, sd_device *d) {
241 Device *device;
242 int r;
243
244 assert(m);
245
246 if (device_for_action(d, DEVICE_ACTION_REMOVE) ||
247 sd_device_has_current_tag(d, "seat") <= 0) {
248 const char *syspath;
249
250 r = sd_device_get_syspath(d, &syspath);
251 if (r < 0)
252 return 0;
253
254 device = hashmap_get(m->devices, syspath);
255 if (!device)
256 return 0;
257
258 seat_add_to_gc_queue(device->seat);
259 device_free(device);
260
261 } else {
262 const char *sn, *syspath;
263 bool master;
264 Seat *seat;
265
266 if (sd_device_get_property_value(d, "ID_SEAT", &sn) < 0 || isempty(sn))
267 sn = "seat0";
268
269 if (!seat_name_is_valid(sn)) {
270 log_device_warning(d, "Device with invalid seat name %s found, ignoring.", sn);
271 return 0;
272 }
273
274 seat = hashmap_get(m->seats, sn);
275 master = sd_device_has_current_tag(d, "master-of-seat") > 0;
276
277 /* Ignore non-master devices for unknown seats */
278 if (!master && !seat)
279 return 0;
280
281 r = sd_device_get_syspath(d, &syspath);
282 if (r < 0)
283 return r;
284
285 r = manager_add_device(m, syspath, master, &device);
286 if (r < 0)
287 return r;
288
289 if (!seat) {
290 r = manager_add_seat(m, sn, &seat);
291 if (r < 0) {
292 if (!device->seat)
293 device_free(device);
294
295 return r;
296 }
297 }
298
299 device_attach(device, seat);
300 seat_start(seat);
301 }
302
303 return 0;
304 }
305
306 int manager_process_button_device(Manager *m, sd_device *d) {
307 const char *sysname;
308 Button *b;
309 int r;
310
311 assert(m);
312
313 r = sd_device_get_sysname(d, &sysname);
314 if (r < 0)
315 return r;
316
317 if (device_for_action(d, DEVICE_ACTION_REMOVE) ||
318 sd_device_has_current_tag(d, "power-switch") <= 0) {
319
320 b = hashmap_get(m->buttons, sysname);
321 if (!b)
322 return 0;
323
324 button_free(b);
325
326 } else {
327 const char *sn;
328
329 r = manager_add_button(m, sysname, &b);
330 if (r < 0)
331 return r;
332
333 if (sd_device_get_property_value(d, "ID_SEAT", &sn) < 0 || isempty(sn))
334 sn = "seat0";
335
336 button_set_seat(b, sn);
337
338 r = button_open(b);
339 if (r < 0) /* event device doesn't have any keys or switches relevant to us? (or any other error
340 * opening the device?) let's close the button again. */
341 button_free(b);
342 }
343
344 return 0;
345 }
346
347 int manager_get_session_by_pid(Manager *m, pid_t pid, Session **ret) {
348 _cleanup_free_ char *unit = NULL;
349 Session *s;
350 int r;
351
352 assert(m);
353
354 if (!pid_is_valid(pid))
355 return -EINVAL;
356
357 s = hashmap_get(m->sessions_by_leader, PID_TO_PTR(pid));
358 if (!s) {
359 r = cg_pid_get_unit(pid, &unit);
360 if (r >= 0)
361 s = hashmap_get(m->session_units, unit);
362 }
363
364 if (ret)
365 *ret = s;
366
367 return !!s;
368 }
369
370 int manager_get_user_by_pid(Manager *m, pid_t pid, User **ret) {
371 _cleanup_free_ char *unit = NULL;
372 User *u = NULL;
373 int r;
374
375 assert(m);
376
377 if (!pid_is_valid(pid))
378 return -EINVAL;
379
380 r = cg_pid_get_slice(pid, &unit);
381 if (r >= 0)
382 u = hashmap_get(m->user_units, unit);
383
384 if (ret)
385 *ret = u;
386
387 return !!u;
388 }
389
390 int manager_get_idle_hint(Manager *m, dual_timestamp *t) {
391 Session *s;
392 bool idle_hint;
393 dual_timestamp ts = DUAL_TIMESTAMP_NULL;
394 Iterator i;
395
396 assert(m);
397
398 idle_hint = !manager_is_inhibited(m, INHIBIT_IDLE, INHIBIT_BLOCK, t, false, false, 0, NULL);
399
400 HASHMAP_FOREACH(s, m->sessions, i) {
401 dual_timestamp k;
402 int ih;
403
404 ih = session_get_idle_hint(s, &k);
405 if (ih < 0)
406 return ih;
407
408 if (!ih) {
409 if (!idle_hint) {
410 if (k.monotonic < ts.monotonic)
411 ts = k;
412 } else {
413 idle_hint = false;
414 ts = k;
415 }
416 } else if (idle_hint) {
417
418 if (k.monotonic > ts.monotonic)
419 ts = k;
420 }
421 }
422
423 if (t)
424 *t = ts;
425
426 return idle_hint;
427 }
428
429 bool manager_shall_kill(Manager *m, const char *user) {
430 assert(m);
431 assert(user);
432
433 if (!m->kill_exclude_users && streq(user, "root"))
434 return false;
435
436 if (strv_contains(m->kill_exclude_users, user))
437 return false;
438
439 if (!strv_isempty(m->kill_only_users))
440 return strv_contains(m->kill_only_users, user);
441
442 return m->kill_user_processes;
443 }
444
445 int config_parse_n_autovts(
446 const char *unit,
447 const char *filename,
448 unsigned line,
449 const char *section,
450 unsigned section_line,
451 const char *lvalue,
452 int ltype,
453 const char *rvalue,
454 void *data,
455 void *userdata) {
456
457 unsigned *n = data;
458 unsigned o;
459 int r;
460
461 assert(filename);
462 assert(lvalue);
463 assert(rvalue);
464 assert(data);
465
466 r = safe_atou(rvalue, &o);
467 if (r < 0) {
468 log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse number of autovts, ignoring: %s", rvalue);
469 return 0;
470 }
471
472 if (o > 15) {
473 log_syntax(unit, LOG_ERR, filename, line, r, "A maximum of 15 autovts are supported, ignoring: %s", rvalue);
474 return 0;
475 }
476
477 *n = o;
478 return 0;
479 }
480
481 static int vt_is_busy(unsigned vtnr) {
482 struct vt_stat vt_stat;
483 int r;
484 _cleanup_close_ int fd;
485
486 assert(vtnr >= 1);
487
488 /* VT_GETSTATE "cannot return state for more than 16 VTs, since v_state is short" */
489 assert(vtnr <= 15);
490
491 /* We explicitly open /dev/tty1 here instead of /dev/tty0. If
492 * we'd open the latter we'd open the foreground tty which
493 * hence would be unconditionally busy. By opening /dev/tty1
494 * we avoid this. Since tty1 is special and needs to be an
495 * explicitly loaded getty or DM this is safe. */
496
497 fd = open_terminal("/dev/tty1", O_RDWR|O_NOCTTY|O_CLOEXEC);
498 if (fd < 0)
499 return -errno;
500
501 if (ioctl(fd, VT_GETSTATE, &vt_stat) < 0)
502 r = -errno;
503 else
504 r = !!(vt_stat.v_state & (1 << vtnr));
505
506 return r;
507 }
508
509 int manager_spawn_autovt(Manager *m, unsigned vtnr) {
510 _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
511 char name[sizeof("autovt@tty.service") + DECIMAL_STR_MAX(unsigned)];
512 int r;
513
514 assert(m);
515 assert(vtnr >= 1);
516
517 if (vtnr > m->n_autovts &&
518 vtnr != m->reserve_vt)
519 return 0;
520
521 if (vtnr != m->reserve_vt) {
522 /* If this is the reserved TTY, we'll start the getty
523 * on it in any case, but otherwise only if it is not
524 * busy. */
525
526 r = vt_is_busy(vtnr);
527 if (r < 0)
528 return r;
529 else if (r > 0)
530 return -EBUSY;
531 }
532
533 snprintf(name, sizeof(name), "autovt@tty%u.service", vtnr);
534 r = sd_bus_call_method(
535 m->bus,
536 "org.freedesktop.systemd1",
537 "/org/freedesktop/systemd1",
538 "org.freedesktop.systemd1.Manager",
539 "StartUnit",
540 &error,
541 NULL,
542 "ss", name, "fail");
543 if (r < 0)
544 return log_error_errno(r, "Failed to start %s: %s", name, bus_error_message(&error, r));
545
546 return 0;
547 }
548
549 bool manager_is_lid_closed(Manager *m) {
550 Iterator i;
551 Button *b;
552
553 HASHMAP_FOREACH(b, m->buttons, i)
554 if (b->lid_closed)
555 return true;
556
557 return false;
558 }
559
560 static bool manager_is_docked(Manager *m) {
561 Iterator i;
562 Button *b;
563
564 HASHMAP_FOREACH(b, m->buttons, i)
565 if (b->docked)
566 return true;
567
568 return false;
569 }
570
571 static int manager_count_external_displays(Manager *m) {
572 _cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
573 sd_device *d;
574 int r, n = 0;
575
576 r = sd_device_enumerator_new(&e);
577 if (r < 0)
578 return r;
579
580 r = sd_device_enumerator_allow_uninitialized(e);
581 if (r < 0)
582 return r;
583
584 r = sd_device_enumerator_add_match_subsystem(e, "drm", true);
585 if (r < 0)
586 return r;
587
588 FOREACH_DEVICE(e, d) {
589 const char *status, *enabled, *dash, *nn, *subsys;
590 sd_device *p;
591
592 if (sd_device_get_parent(d, &p) < 0)
593 continue;
594
595 /* If the parent shares the same subsystem as the
596 * device we are looking at then it is a connector,
597 * which is what we are interested in. */
598 if (sd_device_get_subsystem(p, &subsys) < 0 || !streq(subsys, "drm"))
599 continue;
600
601 if (sd_device_get_sysname(d, &nn) < 0)
602 continue;
603
604 /* Ignore internal displays: the type is encoded in the sysfs name, as the second dash
605 * separated item (the first is the card name, the last the connector number). We implement a
606 * deny list of external displays here, rather than an allow list of internal ones, to ensure
607 * we don't block suspends too eagerly. */
608 dash = strchr(nn, '-');
609 if (!dash)
610 continue;
611
612 dash++;
613 if (!STARTSWITH_SET(dash,
614 "VGA-", "DVI-I-", "DVI-D-", "DVI-A-"
615 "Composite-", "SVIDEO-", "Component-",
616 "DIN-", "DP-", "HDMI-A-", "HDMI-B-", "TV-"))
617 continue;
618
619 /* Ignore ports that are not enabled */
620 if (sd_device_get_sysattr_value(d, "enabled", &enabled) < 0 || !streq(enabled, "enabled"))
621 continue;
622
623 /* We count any connector which is not explicitly
624 * "disconnected" as connected. */
625 if (sd_device_get_sysattr_value(d, "status", &status) < 0 || !streq(status, "disconnected"))
626 n++;
627 }
628
629 return n;
630 }
631
632 bool manager_is_docked_or_external_displays(Manager *m) {
633 int n;
634
635 /* If we are docked don't react to lid closing */
636 if (manager_is_docked(m)) {
637 log_debug("System is docked.");
638 return true;
639 }
640
641 /* If we have more than one display connected,
642 * assume that we are docked. */
643 n = manager_count_external_displays(m);
644 if (n < 0)
645 log_warning_errno(n, "Display counting failed: %m");
646 else if (n >= 1) {
647 log_debug("External (%i) displays connected.", n);
648 return true;
649 }
650
651 return false;
652 }
653
654 bool manager_is_on_external_power(void) {
655 int r;
656
657 /* For now we only check for AC power, but 'external power' can apply to anything that isn't an internal
658 * battery */
659 r = on_ac_power();
660 if (r < 0)
661 log_warning_errno(r, "Failed to read AC power status: %m");
662
663 return r != 0; /* Treat failure as 'on AC' */
664 }
665
666 bool manager_all_buttons_ignored(Manager *m) {
667 assert(m);
668
669 if (m->handle_power_key != HANDLE_IGNORE)
670 return false;
671 if (m->handle_suspend_key != HANDLE_IGNORE)
672 return false;
673 if (m->handle_hibernate_key != HANDLE_IGNORE)
674 return false;
675 if (m->handle_lid_switch != HANDLE_IGNORE)
676 return false;
677 if (!IN_SET(m->handle_lid_switch_ep, _HANDLE_ACTION_INVALID, HANDLE_IGNORE))
678 return false;
679 if (m->handle_lid_switch_docked != HANDLE_IGNORE)
680 return false;
681
682 return true;
683 }
684
685 int manager_read_utmp(Manager *m) {
686 #if ENABLE_UTMP
687 int r;
688 _cleanup_(utxent_cleanup) bool utmpx = false;
689
690 assert(m);
691
692 if (utmpxname(_PATH_UTMPX) < 0)
693 return log_error_errno(errno, "Failed to set utmp path to " _PATH_UTMPX ": %m");
694
695 utmpx = utxent_start();
696
697 for (;;) {
698 _cleanup_free_ char *t = NULL;
699 struct utmpx *u;
700 const char *c;
701 Session *s;
702
703 errno = 0;
704 u = getutxent();
705 if (!u) {
706 if (errno != 0)
707 log_warning_errno(errno, "Failed to read " _PATH_UTMPX ", ignoring: %m");
708 return 0;
709 }
710
711 if (u->ut_type != USER_PROCESS)
712 continue;
713
714 if (!pid_is_valid(u->ut_pid))
715 continue;
716
717 t = strndup(u->ut_line, sizeof(u->ut_line));
718 if (!t)
719 return log_oom();
720
721 c = path_startswith(t, "/dev/");
722 if (c) {
723 r = free_and_strdup(&t, c);
724 if (r < 0)
725 return log_oom();
726 }
727
728 if (isempty(t))
729 continue;
730
731 s = hashmap_get(m->sessions_by_leader, PID_TO_PTR(u->ut_pid));
732 if (!s)
733 continue;
734
735 if (s->tty_validity == TTY_FROM_UTMP && !streq_ptr(s->tty, t)) {
736 /* This may happen on multiplexed SSH connection (i.e. 'SSH connection sharing'). In
737 * this case PAM and utmp sessions don't match. In such a case let's invalidate the TTY
738 * information and never acquire it again. */
739
740 s->tty = mfree(s->tty);
741 s->tty_validity = TTY_UTMP_INCONSISTENT;
742 log_debug("Session '%s' has inconsistent TTY information, dropping TTY information.", s->id);
743 continue;
744 }
745
746 /* Never override what we figured out once */
747 if (s->tty || s->tty_validity >= 0)
748 continue;
749
750 s->tty = TAKE_PTR(t);
751 s->tty_validity = TTY_FROM_UTMP;
752 log_debug("Acquired TTY information '%s' from utmp for session '%s'.", s->tty, s->id);
753 }
754
755 #else
756 return 0;
757 #endif
758 }
759
760 #if ENABLE_UTMP
761 static int manager_dispatch_utmp(sd_event_source *s, const struct inotify_event *event, void *userdata) {
762 Manager *m = userdata;
763
764 assert(m);
765
766 /* If there's indication the file itself might have been removed or became otherwise unavailable, then let's
767 * reestablish the watch on whatever there's now. */
768 if ((event->mask & (IN_ATTRIB|IN_DELETE_SELF|IN_MOVE_SELF|IN_Q_OVERFLOW|IN_UNMOUNT)) != 0)
769 manager_connect_utmp(m);
770
771 (void) manager_read_utmp(m);
772 return 0;
773 }
774 #endif
775
776 void manager_connect_utmp(Manager *m) {
777 #if ENABLE_UTMP
778 sd_event_source *s = NULL;
779 int r;
780
781 assert(m);
782
783 /* Watch utmp for changes via inotify. We do this to deal with tools such as ssh, which will register the PAM
784 * session early, and acquire a TTY only much later for the connection. Thus during PAM the TTY won't be known
785 * yet. ssh will register itself with utmp when it finally acquired the TTY. Hence, let's make use of this, and
786 * watch utmp for the TTY asynchronously. We use the PAM session's leader PID as key, to find the right entry.
787 *
788 * Yes, relying on utmp is pretty ugly, but it's good enough for informational purposes, as well as idle
789 * detection (which, for tty sessions, relies on the TTY used) */
790
791 r = sd_event_add_inotify(m->event, &s, _PATH_UTMPX, IN_MODIFY|IN_MOVE_SELF|IN_DELETE_SELF|IN_ATTRIB, manager_dispatch_utmp, m);
792 if (r < 0)
793 log_full_errno(r == -ENOENT ? LOG_DEBUG: LOG_WARNING, r, "Failed to create inotify watch on " _PATH_UTMPX ", ignoring: %m");
794 else {
795 r = sd_event_source_set_priority(s, SD_EVENT_PRIORITY_IDLE);
796 if (r < 0)
797 log_warning_errno(r, "Failed to adjust utmp event source priority, ignoring: %m");
798
799 (void) sd_event_source_set_description(s, "utmp");
800 }
801
802 sd_event_source_unref(m->utmp_event_source);
803 m->utmp_event_source = s;
804 #endif
805 }
806
807 void manager_reconnect_utmp(Manager *m) {
808 #if ENABLE_UTMP
809 assert(m);
810
811 if (m->utmp_event_source)
812 return;
813
814 manager_connect_utmp(m);
815 #endif
816 }
817
818 int manager_read_efi_boot_loader_entries(Manager *m) {
819 #if ENABLE_EFI
820 int r;
821
822 assert(m);
823 if (m->efi_boot_loader_entries_set)
824 return 0;
825
826 r = efi_loader_get_entries(&m->efi_boot_loader_entries);
827 if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r)) {
828 log_debug_errno(r, "Boot loader reported no entries.");
829 m->efi_boot_loader_entries_set = true;
830 return 0;
831 }
832 if (r < 0)
833 return log_error_errno(r, "Failed to determine entries reported by boot loader: %m");
834
835 m->efi_boot_loader_entries_set = true;
836 return 1;
837 #else
838 return 0;
839 #endif
840 }