* system.conf/session.conf man page
-* exec /sbin/poweroff as PID 1 and do the shutdown
-
* suspend, resume
* passphrase agent https://bugs.freedesktop.org/show_bug.cgi?id=30038
* patch kernel for cpu feature modalias for autoloading aes/kvm/...
+* patch fsck to support --lock
+
* place /etc/inittab with explaining blurb.
* pam_securetty should honour console=
* procps, psmisc, sysvinit-tools, hostname → util-linux-ng
-* nologin nach /var/run https://bugzilla.redhat.com/show_bug.cgi?id=624489
-
* make sysinit honour forcefsck/fastboot from the kernel command line fsck.mode=auto|force|skip
* pam: fix double sudo session cleanup:
m->audit_fd = -1;
#endif
- m->signal_watch.fd = m->mount_watch.fd = m->udev_watch.fd = m->epoll_fd = m->dev_autofs_fd = -1;
+ m->signal_watch.fd = m->mount_watch.fd = m->udev_watch.fd = m->epoll_fd = m->dev_autofs_fd = m->swap_watch.fd = -1;
m->current_job_id = 1; /* start as id #1, so that we can leave #0 around as "null-like" value */
if (!(m->environment = strv_copy(environ)))
mount_fd_event(m, ev->events);
break;
+ case WATCH_SWAP:
+ /* Some swap table change, intended for the swap subsystem */
+ swap_fd_event(m, ev->events);
+ break;
+
case WATCH_UDEV:
/* Some notification from udev, intended for the device subsystem */
device_fd_event(m, ev->events);
WATCH_UNIT_TIMER,
WATCH_JOB_TIMER,
WATCH_MOUNT,
+ WATCH_SWAP,
WATCH_UDEV,
WATCH_DBUS_WATCH,
WATCH_DBUS_TIMEOUT
FILE *proc_swaps;
Hashmap *swaps_by_proc_swaps;
bool request_reload;
+ Watch swap_watch;
/* Data specific to the D-Bus subsystem */
DBusConnection *api_bus, *system_bus;
m->mount_watch.fd = fileno(m->proc_self_mountinfo);
zero(ev);
- ev.events = EPOLLERR;
+ ev.events = EPOLLPRI;
ev.data.ptr = &m->mount_watch;
if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->mount_watch.fd, &ev) < 0)
int r;
assert(m);
- assert(events == EPOLLERR);
+ assert(events & EPOLLPRI);
/* The manager calls this for every fd event happening on the
* /proc/self/mountinfo file, which informs us about mounting
}
int swap_dispatch_reload(Manager *m) {
- Meta *meta;
- int r;
-
- assert(m);
+ /* This function should go as soon as the kernel properly notifies us */
if (_likely_(!m->request_reload))
return 0;
m->request_reload = false;
+ return swap_fd_event(m, EPOLLPRI);
+}
+
+int swap_fd_event(Manager *m, int events) {
+ Meta *meta;
+ int r;
+
+ assert(m);
+ assert(events & EPOLLPRI);
+
if ((r == swap_load_proc_swaps(m, true)) < 0) {
log_error("Failed to reread /proc/swaps: %s", strerror(-r));
static int swap_enumerate(Manager *m) {
int r;
+ struct epoll_event ev;
assert(m);
- if (!m->proc_swaps)
+ if (!m->proc_swaps) {
if (!(m->proc_swaps = fopen("/proc/swaps", "re")))
return -errno;
+ m->swap_watch.type = WATCH_SWAP;
+ m->swap_watch.fd = fileno(m->proc_swaps);
+
+ zero(ev);
+ ev.events = EPOLLPRI;
+ ev.data.ptr = &m->swap_watch;
+
+ if (epoll_ctl(m->epoll_fd, EPOLL_CTL_ADD, m->swap_watch.fd, &ev) < 0)
+ return -errno;
+ }
+
/* We rely on mount.c to load /etc/fstab for us */
if ((r = swap_load_proc_swaps(m, false)) < 0)
int swap_add_one_mount_link(Swap *s, Mount *m);
int swap_dispatch_reload(Manager *m);
+int swap_fd_event(Manager *m, int events);
const char* swap_state_to_string(SwapState i);
SwapState swap_state_from_string(const char *s);