Skip to content
Snippets Groups Projects
Commit 85c1e1d0 authored by Eric Vidal's avatar Eric Vidal :speech_balloon:
Browse files

Merge branch 'async' into dev

parents b553427a 78da40a8
No related branches found
No related tags found
No related merge requests found
...@@ -31,6 +31,8 @@ ...@@ -31,6 +31,8 @@
#define SS_TREE_LEN (sizeof SS_TREE - 1) #define SS_TREE_LEN (sizeof SS_TREE - 1)
#define SS_NOTIFICATION "notification-fd" #define SS_NOTIFICATION "notification-fd"
#define SS_NOTIFICATION_LEN (sizeof SS_NOTIFICATION - 1) #define SS_NOTIFICATION_LEN (sizeof SS_NOTIFICATION - 1)
#define SS_MAXDEATHTALLY "max-death-tally"
#define SS_MAXDEATHTALLY_LEN (sizeof SS_MAXDEATHTALLY - 1)
/**tree dir*/ /**tree dir*/
#define SS_RULES "/rules" #define SS_RULES "/rules"
#define SS_RULES_LEN (sizeof SS_RULES - 1) #define SS_RULES_LEN (sizeof SS_RULES - 1)
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include <66/resolve.h> #include <66/resolve.h>
#include <66/ssexec.h> #include <66/ssexec.h>
typedef struct ss_resolve_sig_s ss_resolve_sig_t, *ss_resovle_sig_t_ref ; typedef struct ss_resolve_sig_s ss_resolve_sig_t, *ss_resolve_sig_t_ref ;
struct ss_resolve_sig_s struct ss_resolve_sig_s
{ {
ss_resolve_t res ; ss_resolve_t res ;
...@@ -77,7 +77,7 @@ enum sigactions_e ...@@ -77,7 +77,7 @@ enum sigactions_e
extern int svc_switch_to(ssexec_t *info,unsigned int where) ; extern int svc_switch_to(ssexec_t *info,unsigned int where) ;
extern int svc_init(ssexec_t *info,char const *src, genalloc *ga) ; extern int svc_init(ssexec_t *info,char const *src, genalloc *ga) ;
extern int svc_init_pipe(ftrigr_t *fifo,genalloc *gasv) ; extern int svc_init_pipe(ftrigr_t *fifo,genalloc *gasv,tain_t *deadline) ;
extern int svc_send(ssexec_t *info,genalloc *ga,char const *sig,char const *const *envp) ; extern int svc_send(ssexec_t *info,genalloc *ga,char const *sig,char const *const *envp) ;
extern int svc_unsupervise(ssexec_t *info,genalloc *ga,char const *sig,char const *const *envp) ; extern int svc_unsupervise(ssexec_t *info,genalloc *ga,char const *sig,char const *const *envp) ;
......
...@@ -100,7 +100,7 @@ char const *help_stop = ...@@ -100,7 +100,7 @@ char const *help_stop =
" -K: kill the service(s) and keep it down\n" " -K: kill the service(s) and keep it down\n"
; ;
char const *usage_svctl = "66-svctl [ -h ] [ -v verbosity ] [ -l live ] [ -t tree ] [ -T timeout ] [ -n death ] [ -u | U | d | D | r | R | K | X ] service(s)" ; char const *usage_svctl = "66-svctl [ -h ] [ -v verbosity ] [ -l live ] [ -t tree ] [ -T timeout ] [ -n death ] [ -u | d | r | K | X ] service(s)" ;
char const *help_svctl = char const *help_svctl =
"66-svctl <options> tree\n" "66-svctl <options> tree\n"
...@@ -113,11 +113,8 @@ char const *help_svctl = ...@@ -113,11 +113,8 @@ char const *help_svctl =
" -T: service timeout\n" " -T: service timeout\n"
" -n: number of death\n" " -n: number of death\n"
" -u: bring up the service(s)\n" " -u: bring up the service(s)\n"
" -U: really up\n"
" -d: bring down the service(s)\n" " -d: bring down the service(s)\n"
" -D: really down\n"
" -r: reload\n" " -r: reload\n"
" -R: reload and really up\n"
" -X: bring down the service(s) and the kill his supervisor\n" " -X: bring down the service(s) and the kill his supervisor\n"
" -K: kill the service(s) and keep it down\n" " -K: kill the service(s) and keep it down\n"
; ;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
*/ */
#include <string.h> #include <string.h>
//#include <stdio.h> #include <stdio.h>
#include <oblibs/obgetopt.h> #include <oblibs/obgetopt.h>
#include <oblibs/error2.h> #include <oblibs/error2.h>
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
static int empty = 0 ; static int empty = 0 ;
static unsigned int RELOAD = 0 ; static unsigned int RELOAD = 0 ;
static unsigned int DEADLINE = 0 ; static unsigned int DEADLINE = 0 ;
static char *SIG = "-U" ; static char *SIG = "-u" ;
static genalloc nclassic = GENALLOC_ZERO ; //resolve_t type static genalloc nclassic = GENALLOC_ZERO ; //resolve_t type
static genalloc nrc = GENALLOC_ZERO ; //resolve_t type static genalloc nrc = GENALLOC_ZERO ; //resolve_t type
...@@ -63,7 +63,7 @@ int svc_sanitize(ssexec_t *info, char const *const *envp) ...@@ -63,7 +63,7 @@ int svc_sanitize(ssexec_t *info, char const *const *envp)
VERBO1 strerr_warnwu1sys("publish service graph") ; VERBO1 strerr_warnwu1sys("publish service graph") ;
goto err ; goto err ;
} }
if (!svc_unsupervise(info,&graph_reload_cl.sorted,"-D",envp)) goto err ; if (!svc_unsupervise(info,&graph_reload_cl.sorted,"-d",envp)) goto err ;
genalloc_reverse(ss_resolve_t,&graph_reload_cl.sorted) ; genalloc_reverse(ss_resolve_t,&graph_reload_cl.sorted) ;
if (!svc_init(info,sares.s,&graph_reload_cl.sorted)) if (!svc_init(info,sares.s,&graph_reload_cl.sorted))
{ {
...@@ -202,7 +202,7 @@ int ssexec_start(int argc, char const *const *argv,char const *const *envp,ssexe ...@@ -202,7 +202,7 @@ int ssexec_start(int argc, char const *const *argv,char const *const *envp,ssexe
// be sure that the global var are set correctly // be sure that the global var are set correctly
RELOAD = 0 ; RELOAD = 0 ;
DEADLINE = 0 ; DEADLINE = 0 ;
SIG = "-U" ; SIG = "-u" ;
if (info->timeout) DEADLINE = info->timeout ; if (info->timeout) DEADLINE = info->timeout ;
...@@ -228,7 +228,7 @@ int ssexec_start(int argc, char const *const *argv,char const *const *envp,ssexe ...@@ -228,7 +228,7 @@ int ssexec_start(int argc, char const *const *argv,char const *const *envp,ssexe
switch (opt) switch (opt)
{ {
case 'r' : if (RELOAD) exitusage(usage_start) ; RELOAD = 1 ; SIG = "-r" ; break ; case 'r' : if (RELOAD) exitusage(usage_start) ; RELOAD = 1 ; SIG = "-r" ; break ;
case 'R' : if (RELOAD) exitusage(usage_start) ; RELOAD = 2 ; SIG = "-U" ; break ; case 'R' : if (RELOAD) exitusage(usage_start) ; RELOAD = 2 ; SIG = "-u" ; break ;
default : exitusage(usage_start) ; default : exitusage(usage_start) ;
} }
} }
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
static unsigned int DEADLINE = 0 ; static unsigned int DEADLINE = 0 ;
static unsigned int UNSUP = 0 ; static unsigned int UNSUP = 0 ;
static char *SIG = "-D" ; static char *SIG = "-d" ;
static ss_resolve_graph_t graph_unsup_cl = RESOLVE_GRAPH_ZERO ; static ss_resolve_graph_t graph_unsup_cl = RESOLVE_GRAPH_ZERO ;
static ss_resolve_graph_t graph_cl = RESOLVE_GRAPH_ZERO ; static ss_resolve_graph_t graph_cl = RESOLVE_GRAPH_ZERO ;
...@@ -115,7 +115,7 @@ int ssexec_stop(int argc, char const *const *argv,char const *const *envp,ssexec ...@@ -115,7 +115,7 @@ int ssexec_stop(int argc, char const *const *argv,char const *const *envp,ssexec
// be sure that the global var are set correctly // be sure that the global var are set correctly
DEADLINE = 0 ; DEADLINE = 0 ;
UNSUP = 0 ; UNSUP = 0 ;
SIG = "-D" ; SIG = "-d" ;
if (info->timeout) DEADLINE = info->timeout ; if (info->timeout) DEADLINE = info->timeout ;
......
This diff is collapsed.
...@@ -31,27 +31,18 @@ ...@@ -31,27 +31,18 @@
#include <66/resolve.h> #include <66/resolve.h>
int svc_init_pipe(ftrigr_t *fifo,genalloc *gasv) int svc_init_pipe(ftrigr_t *fifo,genalloc *gasv,tain_t *deadline)
{ {
tain_t ttmain ;
tain_now_g() ;
tain_addsec(&ttmain,&STAMP,2) ;
ss_resolve_sig_t *svc ; ss_resolve_sig_t *svc ;
//VERBO2 strerr_warni1x("initiate fifo: fifo") ; if (!ftrigr_startf_g(fifo, deadline))
if (!ftrigr_startf(fifo, &ttmain, &STAMP))
VERBO3 { strerr_warnwu1sys("initiate fifo") ; return 0 ; } VERBO3 { strerr_warnwu1sys("initiate fifo") ; return 0 ; }
for (unsigned int i = 0 ; i < genalloc_len(ss_resolve_sig_t,gasv) ; i++) for (unsigned int i = 0 ; i < genalloc_len(ss_resolve_sig_t,gasv) ; i++)
{ {
svc = &genalloc_s(ss_resolve_sig_t,gasv)[i] ; svc = &genalloc_s(ss_resolve_sig_t,gasv)[i] ;
int r ;
size_t siglen = strlen(svc->sigtosend) ;
char *svok = svc->res.sa.s + svc->res.runat ; char *svok = svc->res.sa.s + svc->res.runat ;
size_t scanlen = strlen(svok) ; size_t scanlen = strlen(svok) ;
char svfifo[scanlen + 6 + 1] ; char svfifo[scanlen + 6 + 1] ;
memcpy(svfifo, svok,scanlen) ; memcpy(svfifo, svok,scanlen) ;
memcpy(svfifo + scanlen, "/event",6) ; memcpy(svfifo + scanlen, "/event",6) ;
...@@ -65,31 +56,14 @@ int svc_init_pipe(ftrigr_t *fifo,genalloc *gasv) ...@@ -65,31 +56,14 @@ int svc_init_pipe(ftrigr_t *fifo,genalloc *gasv)
} }
VERBO3 strerr_warnt2x("subcribe to fifo: ",svfifo) ; VERBO3 strerr_warnt2x("subcribe to fifo: ",svfifo) ;
svc->ids = ftrigr_subscribe_g(fifo, svfifo, "[DuUdOxs]", FTRIGR_REPEAT, &ttmain) ; svc->ids = ftrigr_subscribe_g(fifo, svfifo, "[DuUdOxs]", FTRIGR_REPEAT, deadline) ;
if (!svc->ids) if (!svc->ids)
{ {
VERBO3 strerr_warnwu2sys("subcribe to fifo: ",svfifo) ; VERBO3 strerr_warnwu2sys("subcribe to fifo: ",svfifo) ;
goto end ; goto end ;
} }
VERBO3 strerr_warnt6x("send signal: ",svc->sigtosend," to: ", svok,"/",S6_SUPERVISE_CTLDIR) ;
r = s6_svc_writectl(svok, S6_SUPERVISE_CTLDIR, svc->sigtosend, siglen) ;
if (r < 0)
{
VERBO3 strerr_warnwu3sys("something is wrong with the ",svok, "/" S6_SUPERVISE_CTLDIR " directory. errno reported") ;
goto end ;
}
if (!r)
{
VERBO3 strerr_warnw3x("sv: ",svok, " is not supervised") ;
goto end ;
}
} }
return 1 ; return 1 ;
end: end:
return 0 ; return 0 ;
} }
...@@ -22,15 +22,13 @@ ...@@ -22,15 +22,13 @@
#include <66/resolve.h> #include <66/resolve.h>
#include <66/ssexec.h> #include <66/ssexec.h>
int svc_send(ssexec_t *info,genalloc *ga,char const *sig,char const *const *envp) int svc_send(ssexec_t *info,genalloc *ga,char const *sig,char const *const *envp)
{ {
unsigned int i = 0 ; unsigned int i = 0 ;
int nargc = 3 + genalloc_len(ss_resolve_t,ga) ; int nargc = 3 + genalloc_len(ss_resolve_t,ga) ;
char const *newargv[nargc] ; char const *newargv[nargc] ;
unsigned int m = 0 ; unsigned int m = 0 ;
newargv[m++] = "fake_name" ; newargv[m++] = "fake_name" ;
newargv[m++] = sig ; newargv[m++] = sig ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment