X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=unit.c;h=bd4272f6ddc92de9f95786832350e4b08f1692fd;hb=9eba9da4bce4778b4d5dd43e2c41756976a1582b;hp=7954c041854fa5a35fea717af62ac4e5ab6782a5;hpb=f50e0a012340fa8dfe6ec7f0cd869f5f3a052d7a;p=elogind.git diff --git a/unit.c b/unit.c index 7954c0418..bd4272f6d 100644 --- a/unit.c +++ b/unit.c @@ -147,6 +147,9 @@ int unit_add_name(Unit *u, const char *text) { return r; } + if (u->meta.type == _UNIT_TYPE_INVALID) + LIST_PREPEND(Meta, units_per_type, u->meta.manager->units_per_type[t], &u->meta); + u->meta.type = t; if (!u->meta.id) @@ -224,6 +227,9 @@ void unit_free(Unit *u) { SET_FOREACH(t, u->meta.names, i) hashmap_remove_value(u->meta.manager->units, t, u); + if (u->meta.type != _UNIT_TYPE_INVALID) + LIST_REMOVE(Meta, units_per_type, u->meta.manager->units_per_type[u->meta.type], &u->meta); + if (u->meta.in_load_queue) LIST_REMOVE(Meta, load_queue, u->meta.manager->load_queue, &u->meta); @@ -758,7 +764,7 @@ int unit_watch_timer(Unit *u, usec_t delay, Watch *w) { zero(ev); ev.data.ptr = w; - ev.events = POLLIN; + ev.events = EPOLLIN; if (epoll_ctl(u->meta.manager->epoll_fd, EPOLL_CTL_ADD, fd, &ev) < 0) goto fail;