summaryrefslogtreecommitdiff
path: root/src/libs6rc/s6rc_service_common.c
blob: f3146be541047209b3f86c41475d9aeffd0293c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* ISC license. */

#include <stdint.h>

#include <s6-rc/db.h>

s6rc_common_t const *s6rc_service_common (s6rc_db_t const *db, s6rc_sid_t const *id)
{
  uint32_t i = id->i + (id->param ? db->n[id->stype] : 0) ;
  switch (id->stype)
  {
    case STYPE_LONGRUN :  return &db->longruns[i].common ;
    case STYPE_ONESHOT :  return &db->oneshots[i].common ;
    case STYPE_EXTERNAL : return &db->externals[i].common ;
    case STYPE_BUNDLE :   return &db->bundles[i].common ;
    case STYPE_VIRTUAL :  return &db->virtuals[i].common ;
    default : return 0 ;
  }
}