s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

s6_svstatus_unpack.c (598B)


      1 /* ISC license. */
      2 
      3 #include <stdint.h>
      4 #include <skalibs/uint16.h>
      5 #include <skalibs/uint64.h>
      6 #include <skalibs/tai.h>
      7 #include <s6/supervise.h>
      8 
      9 void s6_svstatus_unpack (char const *pack, s6_svstatus_t *sv)
     10 {
     11   uint64_t pid ;
     12   uint16_t wstat ;
     13   tain_unpack(pack, &sv->stamp) ;
     14   tain_unpack(pack + 12, &sv->readystamp) ;
     15   uint64_unpack_big(pack + 24, &pid) ;
     16   sv->pid = pid ;
     17   uint16_unpack_big(pack + 32, &wstat) ;
     18   sv->wstat = wstat ;
     19   sv->flagpaused = pack[34] & 1 ;
     20   sv->flagfinishing = !!(pack[34] & 2) ;
     21   sv->flagwantup = !!(pack[34] & 4) ;
     22   sv->flagready = !!(pack[34] & 8) ;
     23 }