mirror of
https://github.com/troglobit/finit.git
synced 2026-10-23 11:44:37 +00:00
Add basic support for runlevels and bugfix FIFO I/O plugins
Like most other init implementations do, when entering runlevel 1, finit creates the file /etc/nologin to prevent users from logging in during single-user mode, this file is then removed upon leaving runlevel 1. Also, bugfix how FIFO I/O plugins are handled in finit. A FIFO will need to be reopened by the server side when the client closes the pipe. Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
ec95243dad
commit
c3b76fdccf
7 files changed
+237
-57
No files matched your search
@@ -189,15 +189,20 @@ void plugin_run_hooks(hook_point_t no)
|
||||
}
|
||||
|
||||
/* Generic libev I/O callback, looks up correct plugin and calls its callback */
|
||||
static void generic_io_cb(int fd, int events)
|
||||
static void generic_io_cb(struct pollfd *io)
|
||||
{
|
||||
plugin_t *p, *tmp;
|
||||
|
||||
/* Find matching plugin, pick first matching fd */
|
||||
PLUGIN_ITERATOR(p, tmp) {
|
||||
if (is_io_plugin(p) && p->io.fd == fd) {
|
||||
if (is_io_plugin(p) && p->io.fd == io->fd) {
|
||||
_d("Calling I/O %s from runloop...", basename(p->name));
|
||||
p->io.cb(p->io.arg, fd, events);
|
||||
p->io.cb(p->io.arg, io->fd, io->events);
|
||||
|
||||
/* Update fd, may be changed by plugin callback, e.g., if FIFO */
|
||||
io->fd = p->io.fd;
|
||||
io->events = p->io.flags;
|
||||
io->revents = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -221,7 +226,7 @@ void plugin_monitor(void)
|
||||
/* Traverse all I/O fds and run callbacks */
|
||||
for (i = 0; i < num_fds; i++) {
|
||||
if (fds[i].revents)
|
||||
generic_io_cb(fds[i].fd, fds[i].revents);
|
||||
generic_io_cb(&fds[i]);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
Reference in new issue
Block a user