Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
6
66
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Eric Vidal
66
Commits
6ee00c6a
Commit
6ee00c6a
authored
6 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
do not try to initialize an already initialized service
parent
3541b55f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib66/svc_init.c
+38
-29
38 additions, 29 deletions
src/lib66/svc_init.c
with
38 additions
and
29 deletions
src/lib66/svc_init.c
+
38
−
29
View file @
6ee00c6a
...
...
@@ -68,6 +68,11 @@ int svc_init(ssexec_t *info,char const *src, genalloc *ga)
logname
=
0
;
char
*
string
=
genalloc_s
(
ss_resolve_t
,
ga
)[
i
].
sa
.
s
;
char
*
name
=
string
+
genalloc_s
(
ss_resolve_t
,
ga
)[
i
].
name
;
if
(
s6_svc_ok
(
string
+
genalloc_s
(
ss_resolve_t
,
ga
)[
i
].
runat
))
{
VERBO1
strerr_warni3x
(
"Initialization aborted -- "
,
name
,
" already initialized"
)
;
continue
;
}
logname
=
get_rstrlen_until
(
name
,
SS_LOG_SUFFIX
)
;
if
(
logname
>
0
)
name
=
string
+
genalloc_s
(
ss_resolve_t
,
ga
)[
i
].
logassoc
;
...
...
@@ -98,6 +103,7 @@ int svc_init(ssexec_t *info,char const *src, genalloc *ga)
goto
err
;
}
}
/** if logger you need to copy again the real path */
svscanlen
=
strlen
(
string
+
genalloc_s
(
ss_resolve_t
,
ga
)[
i
].
runat
)
;
memcpy
(
svscan
,
string
+
genalloc_s
(
ss_resolve_t
,
ga
)[
i
].
runat
,
svscanlen
)
;
...
...
@@ -154,42 +160,45 @@ int svc_init(ssexec_t *info,char const *src, genalloc *ga)
}
if
(
!
genalloc_append
(
uint16_t
,
&
ids
,
&
id
))
goto
err
;
}
VERBO3
strerr_warnt2x
(
"reload scandir: "
,
info
->
scandir
.
s
)
;
if
(
scandir_send_signal
(
info
->
scandir
.
s
,
"an"
)
<=
0
)
if
(
genalloc_len
(
uint16_t
,
&
ids
))
{
VERBO3
strerr_warnwu2sys
(
"reload scandir: "
,
info
->
scandir
.
s
)
;
goto
err
;
}
VERBO3
strerr_warnt1x
(
"waiting for events on fifo"
)
;
if
(
ftrigr_wait_and_g
(
&
fifo
,
genalloc_s
(
uint16_t
,
&
ids
),
genalloc_len
(
uint16_t
,
&
ids
),
&
deadline
)
<
0
)
VERBO3
strerr_warnt2x
(
"reload scandir: "
,
info
->
scandir
.
s
)
;
if
(
scandir_send_signal
(
info
->
scandir
.
s
,
"an"
)
<=
0
)
{
VERBO3
strerr_warnwu2sys
(
"reload scandir: "
,
info
->
scandir
.
s
)
;
goto
err
;
}
for
(
unsigned
int
i
=
0
;
i
<
genalloc_len
(
stralist
,
&
gadown
)
;
i
++
)
{
VERBO3
strerr_warnt2x
(
"Delete down file at: "
,
gaistr
(
&
gadown
,
i
))
;
if
(
unlink
(
gaistr
(
&
gadown
,
i
))
<
0
&&
errno
!=
ENOENT
)
goto
err
;
}
if
(
!
ss_resolve_pointo
(
&
sares
,
info
,
SS_NOTYPE
,
SS_RESOLVE_LIVE
))
{
VERBO3
strerr_warnwu1x
(
"set revolve pointer to live"
)
;
goto
err
;
}
for
(
unsigned
int
i
=
0
;
i
<
genalloc_len
(
ss_resolve_t
,
ga
)
;
i
++
)
{
char
const
*
string
=
genalloc_s
(
ss_resolve_t
,
ga
)[
i
].
sa
.
s
;
char
const
*
name
=
string
+
genalloc_s
(
ss_resolve_t
,
ga
)[
i
].
name
;
ss_resolve_setflag
(
&
genalloc_s
(
ss_resolve_t
,
ga
)[
i
],
SS_FLAGS_INIT
,
SS_FLAGS_FALSE
)
;
ss_resolve_setflag
(
&
genalloc_s
(
ss_resolve_t
,
ga
)[
i
],
SS_FLAGS_RUN
,
SS_FLAGS_TRUE
)
;
VERBO2
strerr_warni2x
(
"Write resolve file of: "
,
name
)
;
if
(
!
ss_resolve_write
(
&
genalloc_s
(
ss_resolve_t
,
ga
)[
i
],
sares
.
s
,
name
,
writein
))
VERBO3
strerr_warnt1x
(
"waiting for events on fifo"
)
;
if
(
ftrigr_wait_and_g
(
&
fifo
,
genalloc_s
(
uint16_t
,
&
ids
),
genalloc_len
(
uint16_t
,
&
ids
),
&
deadline
)
<
0
)
goto
err
;
for
(
unsigned
int
i
=
0
;
i
<
genalloc_len
(
stralist
,
&
gadown
)
;
i
++
)
{
VERBO3
strerr_warnt2x
(
"Delete down file at: "
,
gaistr
(
&
gadown
,
i
))
;
if
(
unlink
(
gaistr
(
&
gadown
,
i
))
<
0
&&
errno
!=
ENOENT
)
goto
err
;
}
if
(
!
ss_resolve_pointo
(
&
sares
,
info
,
SS_NOTYPE
,
SS_RESOLVE_LIVE
))
{
VERBO
1
strerr_warnwu
2sys
(
"write
re
s
olve
file of: "
,
name
)
;
VERBO
3
strerr_warnwu
1x
(
"set
re
v
olve
pointer to live"
)
;
goto
err
;
}
VERBO1
strerr_warni2x
(
"Initialized successfully: "
,
name
)
;
for
(
unsigned
int
i
=
0
;
i
<
genalloc_len
(
ss_resolve_t
,
ga
)
;
i
++
)
{
char
const
*
string
=
genalloc_s
(
ss_resolve_t
,
ga
)[
i
].
sa
.
s
;
char
const
*
name
=
string
+
genalloc_s
(
ss_resolve_t
,
ga
)[
i
].
name
;
ss_resolve_setflag
(
&
genalloc_s
(
ss_resolve_t
,
ga
)[
i
],
SS_FLAGS_INIT
,
SS_FLAGS_FALSE
)
;
ss_resolve_setflag
(
&
genalloc_s
(
ss_resolve_t
,
ga
)[
i
],
SS_FLAGS_RUN
,
SS_FLAGS_TRUE
)
;
VERBO2
strerr_warni2x
(
"Write resolve file of: "
,
name
)
;
if
(
!
ss_resolve_write
(
&
genalloc_s
(
ss_resolve_t
,
ga
)[
i
],
sares
.
s
,
name
,
writein
))
{
VERBO1
strerr_warnwu2sys
(
"write resolve file of: "
,
name
)
;
goto
err
;
}
VERBO1
strerr_warni2x
(
"Initialized successfully: "
,
name
)
;
}
}
ftrigr_end
(
&
fifo
)
;
genalloc_deepfree
(
stralist
,
&
gadown
,
stra_free
)
;
genalloc_free
(
uint16_t
,
&
ids
)
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment