]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/login/logind-core.c
Merge pull request #16635 from keszybz/do-not-for-each-word
[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
395 assert(m);
396
397 idle_hint = !manager_is_inhibited(m, INHIBIT_IDLE, INHIBIT_BLOCK, t, false, false, 0, NULL);
398
399 HASHMAP_FOREACH(s, m->sessions) {
400 dual_timestamp k;
401 int ih;
402
403 ih = session_get_idle_hint(s, &k);
404 if (ih < 0)
405 return ih;
406
407 if (!ih) {
408 if (!idle_hint) {
409 if (k.monotonic < ts.monotonic)
410 ts = k;
411 } else {
412 idle_hint = false;
413 ts = k;
414 }
415 } else if (idle_hint) {
416
417 if (k.monotonic > ts.monotonic)
418 ts = k;
419 }
420 }
421
422 if (t)
423 *t = ts;
424
425 return idle_hint;
426 }
427
428 bool manager_shall_kill(Manager *m, const char *user) {
429 assert(m);
430 assert(user);
431
432 if (!m->kill_exclude_users && streq(user, "root"))
433 return false;
434
435 if (strv_contains(m->kill_exclude_users, user))
436 return false;
437
438 if (!strv_isempty(m->kill_only_users))
439 return strv_contains(m->kill_only_users, user);
440
441 return m->kill_user_processes;
442 }
443
444 int config_parse_n_autovts(
445 const char *unit,
446 const char *filename,
447 unsigned line,
448 const char *section,
449 unsigned section_line,
450 const char *lvalue,
451 int ltype,
452 const char *rvalue,
453 void *data,
454 void *userdata) {
455
456 unsigned *n = data;
457 unsigned o;
458 int r;
459
460 assert(filename);
461 assert(lvalue);
462 assert(rvalue);
463 assert(data);
464
465 r = safe_atou(rvalue, &o);
466 if (r < 0) {
467 log_syntax(unit, LOG_ERR, filename, line, r, "Failed to parse number of autovts, ignoring: %s", rvalue);
468 return 0;
469 }
470
471 if (o > 15) {
472 log_syntax(unit, LOG_ERR, filename, line, r, "A maximum of 15 autovts are supported, ignoring: %s", rvalue);
473 return 0;
474 }
475
476 *n = o;
477 return 0;
478 }
479
480 static int vt_is_busy(unsigned vtnr) {
481 struct vt_stat vt_stat;
482 int r;
483 _cleanup_close_ int fd;
484
485 assert(vtnr >= 1);
486
487 /* VT_GETSTATE "cannot return state for more than 16 VTs, since v_state is short" */
488 assert(vtnr <= 15);
489
490 /* We explicitly open /dev/tty1 here instead of /dev/tty0. If
491 * we'd open the latter we'd open the foreground tty which
492 * hence would be unconditionally busy. By opening /dev/tty1
493 * we avoid this. Since tty1 is special and needs to be an
494 * explicitly loaded getty or DM this is safe. */
495
496 fd = open_terminal("/dev/tty1", O_RDWR|O_NOCTTY|O_CLOEXEC);
497 if (fd < 0)
498 return -errno;
499
500 if (ioctl(fd, VT_GETSTATE, &vt_stat) < 0)
501 r = -errno;
502 else
503 r = !!(vt_stat.v_state & (1 << vtnr));
504
505 return r;
506 }
507
508 int manager_spawn_autovt(Manager *m, unsigned vtnr) {
509 _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL;
510 char name[sizeof("autovt@tty.service") + DECIMAL_STR_MAX(unsigned)];
511 int r;
512
513 assert(m);
514 assert(vtnr >= 1);
515
516 if (vtnr > m->n_autovts &&
517 vtnr != m->reserve_vt)
518 return 0;
519
520 if (vtnr != m->reserve_vt) {
521 /* If this is the reserved TTY, we'll start the getty
522 * on it in any case, but otherwise only if it is not
523 * busy. */
524
525 r = vt_is_busy(vtnr);
526 if (r < 0)
527 return r;
528 else if (r > 0)
529 return -EBUSY;
530 }
531
532 snprintf(name, sizeof(name), "autovt@tty%u.service", vtnr);
533 r = sd_bus_call_method(
534 m->bus,
535 "org.freedesktop.systemd1",
536 "/org/freedesktop/systemd1",
537 "org.freedesktop.systemd1.Manager",
538 "StartUnit",
539 &error,
540 NULL,
541 "ss", name, "fail");
542 if (r < 0)
543 return log_error_errno(r, "Failed to start %s: %s", name, bus_error_message(&error, r));
544
545 return 0;
546 }
547
548 bool manager_is_lid_closed(Manager *m) {
549 Button *b;
550
551 HASHMAP_FOREACH(b, m->buttons)
552 if (b->lid_closed)
553 return true;
554
555 return false;
556 }
557
558 static bool manager_is_docked(Manager *m) {
559 Button *b;
560
561 HASHMAP_FOREACH(b, m->buttons)
562 if (b->docked)
563 return true;
564
565 return false;
566 }
567
568 static int manager_count_external_displays(Manager *m) {
569 _cleanup_(sd_device_enumerator_unrefp) sd_device_enumerator *e = NULL;
570 sd_device *d;
571 int r, n = 0;
572
573 r = sd_device_enumerator_new(&e);
574 if (r < 0)
575 return r;
576
577 r = sd_device_enumerator_allow_uninitialized(e);
578 if (r < 0)
579 return r;
580
581 r = sd_device_enumerator_add_match_subsystem(e, "drm", true);
582 if (r < 0)
583 return r;
584
585 FOREACH_DEVICE(e, d) {
586 const char *status, *enabled, *dash, *nn, *subsys;
587 sd_device *p;
588
589 if (sd_device_get_parent(d, &p) < 0)
590 continue;
591
592 /* If the parent shares the same subsystem as the
593 * device we are looking at then it is a connector,
594 * which is what we are interested in. */
595 if (sd_device_get_subsystem(p, &subsys) < 0 || !streq(subsys, "drm"))
596 continue;
597
598 if (sd_device_get_sysname(d, &nn) < 0)
599 continue;
600
601 /* Ignore internal displays: the type is encoded in the sysfs name, as the second dash
602 * separated item (the first is the card name, the last the connector number). We implement a
603 * deny list of external displays here, rather than an allow list of internal ones, to ensure
604 * we don't block suspends too eagerly. */
605 dash = strchr(nn, '-');
606 if (!dash)
607 continue;
608
609 dash++;
610 if (!STARTSWITH_SET(dash,
611 "VGA-", "DVI-I-", "DVI-D-", "DVI-A-"
612 "Composite-", "SVIDEO-", "Component-",
613 "DIN-", "DP-", "HDMI-A-", "HDMI-B-", "TV-"))
614 continue;
615
616 /* Ignore ports that are not enabled */
617 if (sd_device_get_sysattr_value(d, "enabled", &enabled) < 0 || !streq(enabled, "enabled"))
618 continue;
619
620 /* We count any connector which is not explicitly
621 * "disconnected" as connected. */
622 if (sd_device_get_sysattr_value(d, "status", &status) < 0 || !streq(status, "disconnected"))
623 n++;
624 }
625
626 return n;
627 }
628
629 bool manager_is_docked_or_external_displays(Manager *m) {
630 int n;
631
632 /* If we are docked don't react to lid closing */
633 if (manager_is_docked(m)) {
634 log_debug("System is docked.");
635 return true;
636 }
637
638 /* If we have more than one display connected,
639 * assume that we are docked. */
640 n = manager_count_external_displays(m);
641 if (n < 0)
642 log_warning_errno(n, "Display counting failed: %m");
643 else if (n >= 1) {
644 log_debug("External (%i) displays connected.", n);
645 return true;
646 }
647
648 return false;
649 }
650
651 bool manager_is_on_external_power(void) {
652 int r;
653
654 /* For now we only check for AC power, but 'external power' can apply to anything that isn't an internal
655 * battery */
656 r = on_ac_power();
657 if (r < 0)
658 log_warning_errno(r, "Failed to read AC power status: %m");
659
660 return r != 0; /* Treat failure as 'on AC' */
661 }
662
663 bool manager_all_buttons_ignored(Manager *m) {
664 assert(m);
665
666 if (m->handle_power_key != HANDLE_IGNORE)
667 return false;
668 if (m->handle_suspend_key != HANDLE_IGNORE)
669 return false;
670 if (m->handle_hibernate_key != HANDLE_IGNORE)
671 return false;
672 if (m->handle_lid_switch != HANDLE_IGNORE)
673 return false;
674 if (!IN_SET(m->handle_lid_switch_ep, _HANDLE_ACTION_INVALID, HANDLE_IGNORE))
675 return false;
676 if (m->handle_lid_switch_docked != HANDLE_IGNORE)
677 return false;
678
679 return true;
680 }
681
682 int manager_read_utmp(Manager *m) {
683 #if ENABLE_UTMP
684 int r;
685 _cleanup_(utxent_cleanup) bool utmpx = false;
686
687 assert(m);
688
689 if (utmpxname(_PATH_UTMPX) < 0)
690 return log_error_errno(errno, "Failed to set utmp path to " _PATH_UTMPX ": %m");
691
692 utmpx = utxent_start();
693
694 for (;;) {
695 _cleanup_free_ char *t = NULL;
696 struct utmpx *u;
697 const char *c;
698 Session *s;
699
700 errno = 0;
701 u = getutxent();
702 if (!u) {
703 if (errno != 0)
704 log_warning_errno(errno, "Failed to read " _PATH_UTMPX ", ignoring: %m");
705 return 0;
706 }
707
708 if (u->ut_type != USER_PROCESS)
709 continue;
710
711 if (!pid_is_valid(u->ut_pid))
712 continue;
713
714 t = strndup(u->ut_line, sizeof(u->ut_line));
715 if (!t)
716 return log_oom();
717
718 c = path_startswith(t, "/dev/");
719 if (c) {
720 r = free_and_strdup(&t, c);
721 if (r < 0)
722 return log_oom();
723 }
724
725 if (isempty(t))
726 continue;
727
728 s = hashmap_get(m->sessions_by_leader, PID_TO_PTR(u->ut_pid));
729 if (!s)
730 continue;
731
732 if (s->tty_validity == TTY_FROM_UTMP && !streq_ptr(s->tty, t)) {
733 /* This may happen on multiplexed SSH connection (i.e. 'SSH connection sharing'). In
734 * this case PAM and utmp sessions don't match. In such a case let's invalidate the TTY
735 * information and never acquire it again. */
736
737 s->tty = mfree(s->tty);
738 s->tty_validity = TTY_UTMP_INCONSISTENT;
739 log_debug("Session '%s' has inconsistent TTY information, dropping TTY information.", s->id);
740 continue;
741 }
742
743 /* Never override what we figured out once */
744 if (s->tty || s->tty_validity >= 0)
745 continue;
746
747 s->tty = TAKE_PTR(t);
748 s->tty_validity = TTY_FROM_UTMP;
749 log_debug("Acquired TTY information '%s' from utmp for session '%s'.", s->tty, s->id);
750 }
751
752 #else
753 return 0;
754 #endif
755 }
756
757 #if ENABLE_UTMP
758 static int manager_dispatch_utmp(sd_event_source *s, const struct inotify_event *event, void *userdata) {
759 Manager *m = userdata;
760
761 assert(m);
762
763 /* If there's indication the file itself might have been removed or became otherwise unavailable, then let's
764 * reestablish the watch on whatever there's now. */
765 if ((event->mask & (IN_ATTRIB|IN_DELETE_SELF|IN_MOVE_SELF|IN_Q_OVERFLOW|IN_UNMOUNT)) != 0)
766 manager_connect_utmp(m);
767
768 (void) manager_read_utmp(m);
769 return 0;
770 }
771 #endif
772
773 void manager_connect_utmp(Manager *m) {
774 #if ENABLE_UTMP
775 sd_event_source *s = NULL;
776 int r;
777
778 assert(m);
779
780 /* Watch utmp for changes via inotify. We do this to deal with tools such as ssh, which will register the PAM
781 * session early, and acquire a TTY only much later for the connection. Thus during PAM the TTY won't be known
782 * yet. ssh will register itself with utmp when it finally acquired the TTY. Hence, let's make use of this, and
783 * watch utmp for the TTY asynchronously. We use the PAM session's leader PID as key, to find the right entry.
784 *
785 * Yes, relying on utmp is pretty ugly, but it's good enough for informational purposes, as well as idle
786 * detection (which, for tty sessions, relies on the TTY used) */
787
788 r = sd_event_add_inotify(m->event, &s, _PATH_UTMPX, IN_MODIFY|IN_MOVE_SELF|IN_DELETE_SELF|IN_ATTRIB, manager_dispatch_utmp, m);
789 if (r < 0)
790 log_full_errno(r == -ENOENT ? LOG_DEBUG: LOG_WARNING, r, "Failed to create inotify watch on " _PATH_UTMPX ", ignoring: %m");
791 else {
792 r = sd_event_source_set_priority(s, SD_EVENT_PRIORITY_IDLE);
793 if (r < 0)
794 log_warning_errno(r, "Failed to adjust utmp event source priority, ignoring: %m");
795
796 (void) sd_event_source_set_description(s, "utmp");
797 }
798
799 sd_event_source_unref(m->utmp_event_source);
800 m->utmp_event_source = s;
801 #endif
802 }
803
804 void manager_reconnect_utmp(Manager *m) {
805 #if ENABLE_UTMP
806 assert(m);
807
808 if (m->utmp_event_source)
809 return;
810
811 manager_connect_utmp(m);
812 #endif
813 }
814
815 int manager_read_efi_boot_loader_entries(Manager *m) {
816 #if ENABLE_EFI
817 int r;
818
819 assert(m);
820 if (m->efi_boot_loader_entries_set)
821 return 0;
822
823 r = efi_loader_get_entries(&m->efi_boot_loader_entries);
824 if (r == -ENOENT || ERRNO_IS_NOT_SUPPORTED(r)) {
825 log_debug_errno(r, "Boot loader reported no entries.");
826 m->efi_boot_loader_entries_set = true;
827 return 0;
828 }
829 if (r < 0)
830 return log_error_errno(r, "Failed to determine entries reported by boot loader: %m");
831
832 m->efi_boot_loader_entries_set = true;
833 return 1;
834 #else
835 return 0;
836 #endif
837 }