summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-09-26 17:14:52 +0000
committerLaurent Bercot <ska@appnovation.com>2021-09-26 17:14:52 +0000
commit4f46cd7cae34176a1ee699986380f7781feb647b (patch)
tree9fbc447266454e75c92ea4d5f01e82d1cee02d1e /src
parent7cadbf1cab5fa9bcbbf63274223d314294e33289 (diff)
downloads6-rc-4f46cd7cae34176a1ee699986380f7781feb647b.tar.xz
Add lock-fd support
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src')
-rw-r--r--src/libs6rc/s6rc_servicedir_internal.c1
-rw-r--r--src/s6-rc/s6-rc-compile.c9
2 files changed, 10 insertions, 0 deletions
diff --git a/src/libs6rc/s6rc_servicedir_internal.c b/src/libs6rc/s6rc_servicedir_internal.c
index f84b6fb..ba7e6b9 100644
--- a/src/libs6rc/s6rc_servicedir_internal.c
+++ b/src/libs6rc/s6rc_servicedir_internal.c
@@ -18,6 +18,7 @@ static s6rc_servicedir_desc_t const svdir_file_list[] =
{ .name = "run", .type = FILETYPE_NORMAL, .options = SVFILE_EXECUTABLE | SVFILE_MANDATORY | SVFILE_ATOMIC },
{ .name = "run.user", .type = FILETYPE_NORMAL, .options = SVFILE_EXECUTABLE },
{ .name = "notification-fd", .type = FILETYPE_UINT, .options = 0 },
+ { .name = "lock-fd", .type = FILETYPE_UINT, .options = 0 },
{ .name = "timeout-kill", .type = FILETYPE_UINT, .options = 0 },
{ .name = "timeout-finish", .type = FILETYPE_UINT, .options = 0 },
{ .name = "max-death-tally", .type = FILETYPE_UINT, .options = 0 },
diff --git a/src/s6-rc/s6-rc-compile.c b/src/s6-rc/s6-rc-compile.c
index 374946f..84f7bdc 100644
--- a/src/s6-rc/s6-rc-compile.c
+++ b/src/s6-rc/s6-rc-compile.c
@@ -1310,6 +1310,15 @@ static inline void write_servicedirs (char const *compiled, s6rc_db_t const *db,
strerr_warnw4x("longrun ", db->string + db->services[i].name, " has a notification-fd of ", fmt) ;
}
+ memcpy(srcfn + srcdirlen + len + 2, "lock-fd", 8) ;
+ memcpy(dstfn + clen + 14 + len, "lock-fd", 8) ;
+ if (copy_uint(compiled, srcfn, dstfn, &u) && u < 3 && verbosity)
+ {
+ char fmt[UINT_FMT] ;
+ fmt[uint_fmt(fmt, u)] = 0 ;
+ strerr_warnw4x("longrun ", db->string + db->services[i].name, " has a lock-fd of ", fmt) ;
+ }
+
memcpy(srcfn + srcdirlen + len + 2, "timeout-kill", 13) ;
memcpy(dstfn + clen + 14 + len, "timeout-kill", 13) ;
copy_uint(compiled, srcfn, dstfn, &u) ;