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

pass tain_t as arguments

parent 77cba730
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,7 @@ enum sigactions_e
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_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_unsupervise(ssexec_t *info,genalloc *ga,char const *sig,char const *const *envp) ;
......
......@@ -31,27 +31,18 @@
#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 ;
//VERBO2 strerr_warni1x("initiate fifo: fifo") ;
if (!ftrigr_startf(fifo, &ttmain, &STAMP))
if (!ftrigr_startf_g(fifo, deadline))
VERBO3 { strerr_warnwu1sys("initiate fifo") ; return 0 ; }
for (unsigned int i = 0 ; i < genalloc_len(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 ;
size_t scanlen = strlen(svok) ;
char svfifo[scanlen + 6 + 1] ;
memcpy(svfifo, svok,scanlen) ;
memcpy(svfifo + scanlen, "/event",6) ;
......@@ -65,31 +56,14 @@ int svc_init_pipe(ftrigr_t *fifo,genalloc *gasv)
}
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)
{
VERBO3 strerr_warnwu2sys("subcribe to fifo: ",svfifo) ;
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 ;
end:
return 0 ;
}
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