From 15e3e402c59089514f590bab8804f0ed60f0fee3 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 7 May 2024 22:06:36 +0000 Subject: Add process group support to s6-supervise Signed-off-by: Laurent Bercot --- src/libs6/s6_svstatus_pack.c | 5 +++-- src/libs6/s6_svstatus_unpack.c | 12 +++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'src/libs6') diff --git a/src/libs6/s6_svstatus_pack.c b/src/libs6/s6_svstatus_pack.c index a769c08..5e1c7d8 100644 --- a/src/libs6/s6_svstatus_pack.c +++ b/src/libs6/s6_svstatus_pack.c @@ -11,8 +11,9 @@ void s6_svstatus_pack (char *pack, s6_svstatus_t const *sv) tain_pack(pack, &sv->stamp) ; tain_pack(pack + 12, &sv->readystamp) ; uint64_pack_big(pack + 24, (uint64_t)sv->pid) ; - uint16_pack_big(pack + 32, (uint16_t)sv->wstat) ; - pack[34] = + uint64_pack_big(pack + 32, (uint64_t)sv->pgid) ; + uint16_pack_big(pack + 40, (uint16_t)sv->wstat) ; + pack[42] = sv->flagpaused | (sv->flagfinishing << 1) | (sv->flagwantup << 2) | diff --git a/src/libs6/s6_svstatus_unpack.c b/src/libs6/s6_svstatus_unpack.c index 59df671..b9b5d78 100644 --- a/src/libs6/s6_svstatus_unpack.c +++ b/src/libs6/s6_svstatus_unpack.c @@ -14,10 +14,12 @@ void s6_svstatus_unpack (char const *pack, s6_svstatus_t *sv) tain_unpack(pack + 12, &sv->readystamp) ; uint64_unpack_big(pack + 24, &pid) ; sv->pid = pid ; - uint16_unpack_big(pack + 32, &wstat) ; + uint64_unpack_big(pack + 32, &pid) ; + sv->pgid = pid ; + uint16_unpack_big(pack + 40, &wstat) ; sv->wstat = wstat ; - sv->flagpaused = pack[34] & 1 ; - sv->flagfinishing = !!(pack[34] & 2) ; - sv->flagwantup = !!(pack[34] & 4) ; - sv->flagready = !!(pack[34] & 8) ; + sv->flagpaused = pack[42] & 1 ; + sv->flagfinishing = !!(pack[42] & 2) ; + sv->flagwantup = !!(pack[42] & 4) ; + sv->flagready = !!(pack[42] & 8) ; } -- cgit v1.2.3