diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2015-07-20 20:20:54 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2015-07-20 20:20:54 +0000 |
commit | a3cdeecf0033919e3b5a79c17c19b5ac98719256 (patch) | |
tree | 92a930930f18a4f8ae897b1a69c39358137ce1e2 /src/libs6/s6_svstatus_unpack.c | |
parent | bd34de9054cec794d96b0fde1eee9100e1d34215 (diff) | |
download | s6-a3cdeecf0033919e3b5a79c17c19b5ac98719256.tar.xz |
- Add timeout-finish support and "down-readiness"
- LOTS of refactoring to make this work
- Remove s6-notifywhenup
- s6-supervise now rocks the casbah
- rc for 2.2.0.0
Diffstat (limited to 'src/libs6/s6_svstatus_unpack.c')
-rw-r--r-- | src/libs6/s6_svstatus_unpack.c | 37 |
1 files changed, 14 insertions, 23 deletions
diff --git a/src/libs6/s6_svstatus_unpack.c b/src/libs6/s6_svstatus_unpack.c index 3fbc205..2e78dcb 100644 --- a/src/libs6/s6_svstatus_unpack.c +++ b/src/libs6/s6_svstatus_unpack.c @@ -1,33 +1,24 @@ /* ISC license. */ -#include <skalibs/uint32.h> +#include <sys/types.h> +#include <skalibs/uint16.h> #include <skalibs/uint64.h> #include <skalibs/tai.h> #include <s6/s6-supervise.h> void s6_svstatus_unpack (char const *pack, s6_svstatus_t *sv) { - uint32 pid ; - uint64 wstat ; + uint64 pid ; + uint16 wstat ; tain_unpack(pack, &sv->stamp) ; - uint32_unpack(pack + 12, &pid) ; - sv->pid = (unsigned int)pid ; - uint64_unpack(pack + 18, &wstat) ; - sv->wstat = (unsigned int)wstat ; - sv->flagpaused = pack[16] & 1 ; - sv->flagfinishing = (pack[16] >> 1) & 1 ; - switch (pack[17]) - { - case 'u' : - sv->flagwant = 1 ; - sv->flagwantup = 1 ; - break ; - case 'd' : - sv->flagwant = 1 ; - sv->flagwantup = 0 ; - break ; - default : - sv->flagwant = 0 ; - sv->flagwantup = 0 ; - } + tain_unpack(pack + 12, &sv->readystamp) ; + uint64_unpack_big(pack + 24, &pid) ; + sv->pid = (pid_t)pid ; + uint16_unpack_big(pack + 32, &wstat) ; + sv->wstat = (int)wstat ; + sv->flagpaused = pack[34] & 1 ; + sv->flagfinishing = !!(pack[34] & 2) ; + sv->flagwant = !!(pack[34] & 4) ; + sv->flagwantup = !!(pack[34] & 8) ; + sv->flagready = !!(pack[34] & 16) ; } |