#include <linux/vt.h>
#include "logind.h"
+#include "sd-daemon.h"
#include "dbus-common.h"
#include "dbus-loop.h"
#include "strv.h"
return r;
}
-
int manager_dispatch_vcsa_udev(Manager *m) {
struct udev_device *d;
int r = 0;
m->console_active_fd = open("/sys/class/tty/tty0/active", O_RDONLY|O_NOCTTY|O_CLOEXEC);
if (m->console_active_fd < 0) {
+
+ /* On certain architectures (S390 and Xen), /dev/tty0
+ does not exist, so don't fail if we can't open it.*/
+ if (errno == ENOENT)
+ return 0;
+
log_error("Failed to open /sys/class/tty/tty0/active: %m");
return -errno;
}
ev.events = EPOLLIN;
ev.data.u32 = FD_SEAT_UDEV;
- if (m->n_autovts <= 0)
+ /* Don't bother watching VCSA devices, if nobody cares */
+ if (m->n_autovts <= 0 || m->console_active_fd < 0)
return 0;
if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->udev_seat_fd, &ev) < 0)
if (m->epoll_fd < 0)
return -errno;
- /* Connect to udev */
- r = manager_connect_udev(m);
+ /* Connect to console */
+ r = manager_connect_console(m);
if (r < 0)
return r;
- /* Connect to console */
- r = manager_connect_console(m);
+ /* Connect to udev */
+ r = manager_connect_udev(m);
if (r < 0)
return r;
goto finish;
}
+ log_debug("systemd-logind running as pid %lu", (unsigned long) getpid());
+
+ sd_notify(false,
+ "READY=1\n"
+ "STATUS=Processing requests...");
+
r = manager_run(m);
+ log_debug("systemd-logind stopped as pid %lu", (unsigned long) getpid());
+
finish:
+ sd_notify(false,
+ "STATUS=Shutting down...");
+
if (m)
manager_free(m);