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
0ccf1492
Commit
0ccf1492
authored
1 year ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
add TORELOAD flag definition
parent
9d1eca12
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/sanitize/sanitize_init.c
+22
-17
22 additions, 17 deletions
src/lib66/sanitize/sanitize_init.c
with
22 additions
and
17 deletions
src/lib66/sanitize/sanitize_init.c
+
22
−
17
View file @
0ccf1492
...
...
@@ -12,8 +12,6 @@
* except according to the terms contained in the LICENSE file./
*/
#include
<66/svc.h>
#include
<string.h>
#include
<stdlib.h>
...
...
@@ -24,6 +22,7 @@
#include
<oblibs/environ.h>
#include
<skalibs/types.h>
#include
<skalibs/genalloc.h>
#include
<skalibs/tai.h>
#include
<skalibs/djbunix.h>
#include
<skalibs/unix-transactional.h>
//atomic_symlink
...
...
@@ -40,17 +39,18 @@
#include
<66/enum.h>
#include
<66/sanitize.h>
void
sanitize_init
(
unsigned
int
*
alist
,
unsigned
int
alen
,
graph_t
*
g
,
resolve_service_t
*
ares
,
unsigned
int
areslen
,
uint32_t
flags
)
void
sanitize_init
(
unsigned
int
*
alist
,
unsigned
int
alen
,
graph_t
*
g
,
resolve_service_t
*
ares
,
unsigned
int
areslen
)
{
log_flow
()
;
ftrigr_t
fifo
=
FTRIGR_ZERO
;
uint32_t
earlier
=
FLAGS_ISSET
(
flags
,
STATE_FLAGS_ISEARLIER
)
;
uint32_t
earlier
;
gid_t
gid
=
getgid
()
;
int
is_supervised
=
0
,
is_init
;
unsigned
int
pos
=
0
,
nsv
=
0
;
unsigned
int
real
[
alen
]
;
unsigned
int
msg
[
areslen
]
;
ss_state_t
sta
=
STATE_ZERO
;
memset
(
msg
,
0
,
areslen
)
;
...
...
@@ -61,24 +61,26 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
for
(;
pos
<
alen
;
pos
++
)
{
char
*
name
=
g
->
data
.
s
+
genalloc_s
(
graph_hash_t
,
&
g
->
hash
)[
alist
[
pos
]].
vertex
;
int
aresid
=
service_resolve_array_search
(
ares
,
areslen
,
name
)
;
if
(
aresid
<
0
)
log_dieu
(
LOG_EXIT_SYS
,
"find ares id -- please make a bug reports"
)
;
if
(
!
state_read
(
&
sta
,
&
ares
[
aresid
]))
log_dieu
(
LOG_EXIT_SYS
,
"read state file of: "
,
name
)
;
earlier
=
service_is
(
&
sta
,
STATE_FLAGS_ISEARLIER
)
==
STATE_FLAGS_TRUE
?
1
:
0
;
char
*
sa
=
ares
[
aresid
].
sa
.
s
;
char
*
scandir
=
sa
+
ares
[
aresid
].
live
.
scandir
;
size_t
scandirlen
=
strlen
(
scandir
)
;
is_init
=
access
(
sa
+
ares
[
aresid
].
live
.
statedir
,
F_OK
)
;
if
(
is_init
<
0
||
FLAGS_ISSET
(
flags
,
STATE_FLAGS_TOINIT
))
sanitize_livestate
(
&
ares
[
aresid
]
,
STATE_FLAGS_UNKNOWN
)
;
if
(
is_init
<
0
||
service_is
(
&
sta
,
STATE_FLAGS_TOINIT
)
==
STATE_FLAGS_TRUE
)
sanitize_livestate
(
&
ares
[
aresid
])
;
/**
* Bundle, module type are not a daemons. We don't need
* to supervise it.
* Special case for Oneshot, we only deal with
* the scandir symlink.
* */
* Bundle and module type are not a daemons. We don't need to supervise it.
* Special case for Oneshot, we only deal with the scandir symlink. */
if
(
ares
[
aresid
].
type
==
TYPE_BUNDLE
||
ares
[
aresid
].
type
==
TYPE_MODULE
)
continue
;
...
...
@@ -92,7 +94,7 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
if
(
is_supervised
==
-
1
)
{
sanitize_scandir
(
&
ares
[
aresid
]
,
STATE_FLAGS_TOINIT
)
;
sanitize_scandir
(
&
ares
[
aresid
])
;
if
(
ares
[
aresid
].
type
==
TYPE_ONESHOT
)
continue
;
...
...
@@ -108,8 +110,7 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
if
(
!
earlier
&&
is_supervised
)
{
if
(
!
FLAGS_ISSET
(
flags
,
STATE_FLAGS_TORELOAD
)
&&
!
FLAGS_ISSET
(
flags
,
STATE_FLAGS_TORESTART
))
sanitize_fdholder
(
&
ares
[
aresid
],
STATE_FLAGS_TRUE
)
;
sanitize_fdholder
(
&
ares
[
aresid
],
STATE_FLAGS_TRUE
)
;
log_trace
(
"create fifo: "
,
sa
+
ares
[
aresid
].
live
.
eventdir
)
;
if
(
!
ftrigw_fifodir_make
(
sa
+
ares
[
aresid
].
live
.
eventdir
,
gid
,
0
))
...
...
@@ -147,12 +148,16 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
if
(
!
ids
[
nids
++
])
log_dieusys
(
LOG_EXIT_SYS
,
"subcribe to fifo: "
,
eventdir
)
;
if
(
!
state_messenger
(
&
ares
[
real
[
pos
]],
STATE_FLAGS_TORELOAD
,
STATE_FLAGS_TRUE
))
log_dieusys
(
LOG_EXIT_SYS
,
"send message to state of: "
,
sa
+
ares
[
real
[
pos
]].
name
)
;
}
}
if
(
nids
)
{
sanitize_scandir
(
&
ares
[
real
[
0
]]
,
STATE_FLAGS_TORELOAD
)
;
sanitize_scandir
(
&
ares
[
real
[
0
]])
;
log_trace
(
"waiting for events on fifo..."
)
;
if
(
ftrigr_wait_and_g
(
&
fifo
,
ids
,
nids
,
&
deadline
)
<
0
)
...
...
@@ -162,7 +167,7 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
}
if
(
earlier
)
sanitize_scandir
(
&
ares
[
0
]
,
STATE_FLAGS_ISEARLIER
)
;
sanitize_scandir
(
&
ares
[
0
])
;
/**
* We pass through here even for Bundle, Module and Oneshot.
...
...
@@ -171,7 +176,6 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
* */
for
(
pos
=
0
;
pos
<
alen
;
pos
++
)
{
char
*
name
=
g
->
data
.
s
+
genalloc_s
(
graph_hash_t
,
&
g
->
hash
)[
alist
[
pos
]].
vertex
;
int
aresid
=
service_resolve_array_search
(
ares
,
areslen
,
name
)
;
if
(
aresid
<
0
)
...
...
@@ -181,6 +185,7 @@ void sanitize_init(unsigned int *alist, unsigned int alen, graph_t *g, resolve_s
if
(
ares
[
aresid
].
type
==
TYPE_CLASSIC
||
ares
[
aresid
].
type
==
TYPE_ONESHOT
)
{
log_trace
(
"clean event directory: "
,
sa
+
ares
[
aresid
].
live
.
eventdir
)
;
if
(
!
ftrigw_clean
(
sa
+
ares
[
aresid
].
live
.
eventdir
))
log_warnu
(
"clean event directory: "
,
sa
+
ares
[
aresid
].
live
.
eventdir
)
;
...
...
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