summaryrefslogtreecommitdiff
path: root/src/include/s6-rc/db.h
blob: 8953a49458dbe7337133f59e10dad1dd4415d63a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/* ISC license. */

#ifndef S6RC_SERVICE_H
#define S6RC_SERVICE_H

#include <stdint.h>


 /* Service types and db representation in memory */

typedef enum s6rc_stype_e s6rc_stype_t, *s6rc_stype_t_ref ;
enum s6rc_stype_e
{
  S6RC_STYPE_LONGRUN,
  S6RC_STYPE_ONESHOT,
  S6RC_STYPE_EXTERNAL,
  S6RC_STYPE_BUNDLE,
  S6RC_STYPE_VIRTUAL,
  S6RC_STYPE_PHAIL
} ;

typedef struct s6rc_sid_s s6rc_sid_t, *s6rc_sid_t_ref ;
struct s6rc_sid_s
{
  uint32_t i ;
  char const *param ;
  s6rc_stype_t stype ;
} ;

typedef struct s6rc_common_s s6rc_common_t, *s6rc_common_t_ref ;
struct s6rc_common_s
{
  uint32_t name ;
  uint32_t deps[2] ;
  uint32_t ndeps[2] ;
  uint32_t flag_essential : 1 ;
  uint32_t flags : 31 ;
} ;

typedef struct s6rc_atomic_s s6rc_atomic_t, *s6rc_atomic_t_ref ;
struct s6rc_atomic_s
{
  s6rc_common_t common ;
  uint32_t timeout[2] ;
} ;

typedef struct s6rc_oneshot_s s6rc_oneshot_t, *s6rc_oneshot_t_ref ;
struct s6rc_oneshot_s
{
  s6rc_atomic_t satomic ;
  uint32_t argc[2] ;
  uint32_t argv[2] ;
} ;

typedef struct s6rc_longrun_s s6rc_longrun_t, *s6rc_longrun_t_ref ;
struct s6rc_longrun_s
{
  s6rc_atomic_t satomic ;
  s6rc_sid_t consumer ;
  uint32_t nproducers ;
  uint32_t producers ;
} ;

typedef struct s6rc_external_s s6rc_external_t, *s6rc_external_t_ref ;
struct s6rc_external_s
{
  s6rc_common_t common ;
} ;

typedef struct s6rc_bundle_s s6rc_bundle_t, *s6rc_bundle_t_ref ;
struct s6rc_bundle_s
{
  s6rc_common_t common ;
  uint32_t ncontents ;
  uint32_t contents ;
} ;

typedef struct s6rc_deptype_s s6rc_deptype_t, *s6rc_deptype_t_ref ;
struct s6rc_deptype_s
{
  uint8_t passive : 1 ;
  uint8_t soft : 1 ;
  uint8_t loose : 1 ;
} ;

typedef struct s6rc_db_s s6rc_db_t, *s6rc_db_t_ref ;
struct s6rc_db_s
{
  uint32_t ntotal ;
  uint32_t n[STYPE_PHAIL << 1] ;
  uint32_t storagelen ;
  s6rc_longrun_t *longruns ;
  s6rc_oneshot_t *oneshots ;
  s6rc_external_t *externals ;
  s6rc_bundle_t *bundles ;
  s6rc_bundle_t *virtuals ;
  s6rc_sid_t *deps[2] ;
  s6rc_deptype_t *deptypes[2] ;
  s6rc_sid_t *producers ;
  char const **argvs ;
  char *storage ;
} ;

extern s6rc_common_t const *s6rc_service_common (s6rc_db_t const *, s6rc_sid_t const *) ;

#endif