summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-08-20 17:33:39 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-08-20 17:33:39 +0000
commit3d908585178fb8e8b9201931e0d8385a98a78d5c (patch)
tree04ee279f3ebbf8ea7fcec296d1d41734ad90eec2 /src
parenta1b139e5d448b260b3f7849a5b24f45da45241a1 (diff)
downloads6-rc-3d908585178fb8e8b9201931e0d8385a98a78d5c.tar.xz
Make flags work on bundles too
Diffstat (limited to 'src')
-rw-r--r--src/s6-rc/s6-rc-compile.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/s6-rc/s6-rc-compile.c b/src/s6-rc/s6-rc-compile.c
index f2b6a84..4414ded 100644
--- a/src/s6-rc/s6-rc-compile.c
+++ b/src/s6-rc/s6-rc-compile.c
@@ -116,6 +116,7 @@ struct bundle_s
unsigned int name ; /* pos in data */
unsigned int n ;
unsigned int listindex ; /* pos in indices */
+ uint32_t annotation_flags ;
} ;
typedef struct before_s before_t, *before_t_ref ;
@@ -351,7 +352,7 @@ static uint32_t read_timeout (int dfd, char const *srcdir, char const *name, cha
return timeout ;
}
-static inline uint32_t read_flags (int dfd, char const *srcdir, char const *name)
+static uint32_t read_flags (int dfd, char const *srcdir, char const *name)
{
static char const *files[32] =
{
@@ -490,6 +491,7 @@ static inline void add_bundle (before_t *be, int dfd, char const *srcdir, char c
add_name(be, srcdir, name, SVTYPE_BUNDLE, &bundle.name, &dummy) ;
if (!add_namelist(be, dfd, srcdir, name, "contents", &bundle.listindex, &bundle.n))
strerr_diefu5sys(111, "open ", srcdir, "/", name, "/contents") ;
+ bundle.annotation_flags = read_flags(dfd, srcdir, name) ;
if (!genalloc_append(bundle_t, &be->bundles, &bundle)) dienomem() ;
}
@@ -689,6 +691,7 @@ static inline unsigned int resolve_bundles (bundle_t const *oldb, bundle_t *newb
for (; i < nbundles ; i++)
{
newb[i].name = oldb[i].name ;
+ newb[i].annotation_flags = oldb[i].annotation_flags ;
recinfo.source = i ;
resolve_bundle_rec(&recinfo, i) ;
}
@@ -899,6 +902,13 @@ static inline void flatlist_services (s6rc_db_t *db, unsigned char const *sarray
}
}
+static inline void propagate_bundle_flags (s6rc_db_t *db, bundle_t const *bundles, unsigned int nbundles, uint32_t const *bdeps)
+{
+ for (unsigned int i = 0 ; i < nbundles ; i++)
+ for (unsigned int j = 0 ; j < bundles[i].n ; j++)
+ db->services[bdeps[bundles[i].listindex + j]].flags |= bundles[i].annotation_flags ;
+}
+
/* Write the compiled database */
@@ -1517,6 +1527,7 @@ int main (int argc, char const *const *argv)
uint32_t deps[db.ndeps << 1] ;
db.deps = deps ;
flatlist_services(&db, sarray) ;
+ propagate_bundle_flags(&db, bundles, nbundles, bdeps) ;
write_compiled(compiled, &db, srcdirs, bundles, nbundles, bdeps, fdhuser, blocking) ;
}
}