aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2026-07-14 08:56:37 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2026-07-14 08:56:37 +0000
commitd72d909917dffc4f49ceddad98d06f5ae0fa30e8 (patch)
tree18be9b0a4576bbb403694e39f15a50a6db587288 /src
parentbb4adce2863ec7636d57d188904aafa659db0bc9 (diff)
downloads6-rc-d72d909917dffc4f49ceddad98d06f5ae0fa30e8.tar.gz
debug the --clean feature
Diffstat (limited to 'src')
-rw-r--r--src/libs6rc/s6rc_graph_clean.c5
-rw-r--r--src/s6-rc/s6-rc.c13
2 files changed, 11 insertions, 7 deletions
diff --git a/src/libs6rc/s6rc_graph_clean.c b/src/libs6rc/s6rc_graph_clean.c
index d450d65..29352ae 100644
--- a/src/libs6rc/s6rc_graph_clean.c
+++ b/src/libs6rc/s6rc_graph_clean.c
@@ -23,7 +23,10 @@ static void s6rc_graph_clean_rec (recinfo_t *info, uint32_t i)
{
uint32_t j = 0 ;
for (; j < info->db->services[i].ndeps[0] ; j++)
- if (info->bits[j] & info->statemask && !(info->bits[j] & info->resmask)) break ;
+ {
+ uint32_t k = info->db->deps[info->db->services[i].deps[0] + j] ;
+ if (info->bits[k] & info->statemask && !(info->bits[k] & info->resmask)) break ;
+ }
if (j >= info->db->services[i].ndeps[0])
{
info->bits[i] |= info->resmask ;
diff --git a/src/s6-rc/s6-rc.c b/src/s6-rc/s6-rc.c
index ffff5f4..96afce2 100644
--- a/src/s6-rc/s6-rc.c
+++ b/src/s6-rc/s6-rc.c
@@ -117,8 +117,8 @@ static inline int print_services (void)
if (wgolb & GOLB_CLEAN)
{
if (buffer_puts(buffer_1, i < db->nlong ? "/longrun" : "/oneshot") < 0
- || buffer_puts(buffer_1, state[i] & 0x01 ? state[i] & 0x02 ? "/up/explicit" : "/up/pulled" : "/down/ ") < 0
- || buffer_puts(buffer_1, db->services[i].flags & S6RC_DB_FLAG_ESSENTIAL ? "/essential" : db->services[i].flags & S6RC_DB_FLAG_RECOMMENDED ? "/recommended" : "/ ") < 0)
+ || buffer_puts(buffer_1, db->services[i].flags & S6RC_DB_FLAG_ESSENTIAL ? "/essential" : db->services[i].flags & S6RC_DB_FLAG_RECOMMENDED ? "/recommended" : "/") < 0
+ || buffer_puts(buffer_1, state[i] & 0x01 ? state[i] & 0x02 ? "/up/explicit" : "/up/pulled" : "/down/") < 0)
goto err ;
}
if (buffer_put(buffer_1, "\n", 1) < 0) goto err ;
@@ -321,8 +321,8 @@ static void examine (unsigned int i, int h)
}
else if (!h && !(wgolb & GOLB_HIDEESSENTIALS) && db->services[i].flags & S6RC_DB_FLAG_ESSENTIAL)
{
- if (verbosity)
- strerr_warnw("service ", name, " is marked as essential, not stopping it") ;
+ if (verbosity >= 2)
+ strerr_warni("service ", name, " is marked as essential, not stopping it") ;
}
else
{
@@ -724,7 +724,6 @@ int main (int argc, char const *const *argv)
if (what == WHAT_LIST)
{
- if (wgolb & GOLB_CLEAN) s6rc_graph_clean(db, state, 0, 1, 4) ;
if (wgolb & GOLB_DOWN) invert_selection() ;
if (!argc && !(wgolb & GOLB_SELECTLIVE))
for (uint32_t i = 0 ; i < n ; i++) state[i] |= 0x10 ;
@@ -759,6 +758,7 @@ int main (int argc, char const *const *argv)
if (what == WHAT_RELOAD) _exit(reload()) ;
+ announce() ;
if (wgolb & GOLB_PRUNE)
{
int r ;
@@ -779,8 +779,9 @@ int main (int argc, char const *const *argv)
{
int r ;
if (verbosity >= 2)
- strerr_warni("stopping non-explicitly started services") ;
+ strerr_warni("stopping pulled services") ;
s6rc_graph_clean(db, state, 0, 1, 4) ;
+ s6rc_graph_closure(db, state, 4, 0) ;
r = change(0) ;
if (r) _exit(r) ;
}