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
73c8df5d
Commit
73c8df5d
authored
6 years ago
by
Eric Vidal
Browse files
Options
Downloads
Patches
Plain Diff
do not initiate empty db
parent
c969977d
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/ssexec_init.c
+48
-38
48 additions, 38 deletions
src/lib66/ssexec_init.c
with
48 additions
and
38 deletions
src/lib66/ssexec_init.c
+
48
−
38
View file @
73c8df5d
...
...
@@ -15,6 +15,7 @@
#include
<string.h>
#include
<sys/stat.h>
#include
<stdlib.h>
#include
<stdio.h>
#include
<oblibs/obgetopt.h>
#include
<oblibs/string.h>
...
...
@@ -41,7 +42,7 @@
#include
<66/ssexec.h>
#include
<66/rc.h>
#include
<stdio.h>
int
ssexec_init
(
int
argc
,
char
const
*
const
*
argv
,
char
const
*
const
*
envp
,
ssexec_t
*
info
)
{
...
...
@@ -51,7 +52,7 @@ int ssexec_init(int argc, char const *const *argv,char const *const *envp,ssexec
genalloc
gares
=
GENALLOC_ZERO
;
//ss_resolve_t type
stralloc
ressrc
=
STRALLOC_ZERO
;
stralloc
resdst
=
STRALLOC_ZERO
;
stralloc
s
rc
=
STRALLOC_ZERO
;
stralloc
s
ares
=
STRALLOC_ZERO
;
ss_resolve_t
res
=
RESOLVE_ZERO
;
classic
=
db
=
earlier
=
0
;
...
...
@@ -73,7 +74,7 @@ int ssexec_init(int argc, char const *const *argv,char const *const *envp,ssexec
if
(
r
!=
1
)
earlier
=
1
;
r
=
scan_mode
(
info
->
livetree
.
s
,
S_IFDIR
)
;
if
(
r
<
0
)
strerr_dief2x
(
111
,
info
->
livetree
.
s
,
" conflict
ing
format"
)
;
if
(
r
<
0
)
strerr_dief2x
(
111
,
info
->
livetree
.
s
,
" conflict
ed
format"
)
;
if
(
!
r
)
{
VERBO2
strerr_warni2x
(
"create directory: "
,
info
->
livetree
.
s
)
;
...
...
@@ -91,23 +92,23 @@ int ssexec_init(int argc, char const *const *argv,char const *const *envp,ssexec
svdir
[
svdirlen
+
SS_SVC_LEN
]
=
0
;
/** resolve live dir*/
if
(
!
ss_resolve_pointo
(
&
s
rc
,
info
,
SS_NOTYPE
,
SS_RESOLVE_SRC
))
strerr_diefu1sys
(
111
,
"set revolve pointer to source"
)
;
if
(
!
ss_resolve_pointo
(
&
s
ares
,
info
,
SS_NOTYPE
,
SS_RESOLVE_SRC
))
strerr_diefu1sys
(
111
,
"set revolve pointer to source"
)
;
if
(
!
stralloc_copy
(
&
ressrc
,
&
s
rc
))
retstralloc
(
111
,
"main"
)
;
if
(
!
stralloc_copy
(
&
ressrc
,
&
s
ares
))
retstralloc
(
111
,
"main"
)
;
ressrc
.
len
--
;
if
(
!
stralloc_cats
(
&
ressrc
,
SS_RESOLVE
))
retstralloc
(
111
,
"main"
)
;
if
(
!
stralloc_0
(
&
ressrc
))
retstralloc
(
111
,
"main"
)
;
if
(
!
ss_resolve_pointo
(
&
s
rc
,
info
,
SS_NOTYPE
,
SS_RESOLVE_LIVE
))
strerr_diefu1sys
(
111
,
"set revolve pointer to source"
)
;
r
=
scan_mode
(
s
rc
.
s
,
S_IFDIR
)
;
if
(
r
<
0
)
strerr_dief2x
(
111
,
s
rc
.
s
,
" conflicting format"
)
;
if
(
!
ss_resolve_pointo
(
&
s
ares
,
info
,
SS_NOTYPE
,
SS_RESOLVE_LIVE
))
strerr_diefu1sys
(
111
,
"set revolve pointer to source"
)
;
r
=
scan_mode
(
s
ares
.
s
,
S_IFDIR
)
;
if
(
r
<
0
)
strerr_dief2x
(
111
,
s
ares
.
s
,
" conflicting format"
)
;
if
(
!
r
)
{
VERBO2
strerr_warni3x
(
"create directory: "
,
s
rc
.
s
,
SS_RESOLVE
)
;
r
=
dir_create_under
(
s
rc
.
s
,
SS_RESOLVE
+
1
,
0700
)
;
if
(
!
r
)
strerr_diefu3sys
(
111
,
"create directory: "
,
s
rc
.
s
,
SS_RESOLVE
)
;
VERBO2
strerr_warni3x
(
"create directory: "
,
s
ares
.
s
,
SS_RESOLVE
)
;
r
=
dir_create_under
(
s
ares
.
s
,
SS_RESOLVE
+
1
,
0700
)
;
if
(
!
r
)
strerr_diefu3sys
(
111
,
"create directory: "
,
s
ares
.
s
,
SS_RESOLVE
)
;
}
if
(
!
stralloc_copy
(
&
resdst
,
&
s
rc
))
retstralloc
(
111
,
"main"
)
;
if
(
!
stralloc_copy
(
&
resdst
,
&
s
ares
))
retstralloc
(
111
,
"main"
)
;
resdst
.
len
--
;
if
(
!
stralloc_cats
(
&
resdst
,
SS_RESOLVE
))
retstralloc
(
111
,
"main"
)
;
if
(
!
stralloc_0
(
&
resdst
))
retstralloc
(
111
,
"main"
)
;
...
...
@@ -124,7 +125,9 @@ int ssexec_init(int argc, char const *const *argv,char const *const *envp,ssexec
if
(
!
dir_cmp
(
svdir
,
info
->
scandir
.
s
,
""
,
&
gasvc
))
strerr_diefu4x
(
111
,
"compare "
,
svdir
,
" to "
,
info
->
scandir
.
s
)
;
if
(
!
genalloc_len
(
stralist
,
&
gasvc
))
{
VERBO1
strerr_warni3x
(
"svc service of tree: "
,
info
->
treename
.
s
,
" already initiated"
)
;
VERBO1
strerr_warni2x
(
"Initialization aborted -- no classic services into tree: "
,
info
->
treename
.
s
)
;
genalloc_deepfree
(
ss_resolve_t
,
&
gares
,
ss_resolve_free
)
;
genalloc_deepfree
(
stralist
,
&
gasvc
,
stra_free
)
;
goto
follow
;
}
...
...
@@ -133,9 +136,9 @@ int ssexec_init(int argc, char const *const *argv,char const *const *envp,ssexec
char
*
name
=
gaistr
(
&
gasvc
,
i
)
;
ss_resolve_t
tmp
=
RESOLVE_ZERO
;
if
(
!
ss_resolve_check
(
info
,
name
,
SS_RESOLVE_LIVE
))
strerr_dief2sys
(
110
,
"unknow service: "
,
name
)
;
if
(
!
ss_resolve_read
(
&
tmp
,
src
.
s
,
name
))
strerr_diefu2sys
(
111
,
"read resolve file of: "
,
name
)
;
if
(
!
genalloc_append
(
ss_resolve_t
,
&
gares
,
&
tmp
))
strerr_diefu3x
(
111
,
"add: "
,
name
,
" on genalloc"
)
;
if
(
!
ss_resolve_read
(
&
tmp
,
sares
.
s
,
name
))
strerr_diefu2sys
(
111
,
"read resolve file of: "
,
name
)
;
if
(
!
ss_resolve_add_deps
(
&
gares
,
&
tmp
,
info
))
strerr_diefu2sys
(
111
,
"resolve dependencies of: "
,
name
)
;
ss_resolve_free
(
&
tmp
)
;
}
/** reverse to start first the logger */
genalloc_reverse
(
ss_resolve_t
,
&
gares
)
;
...
...
@@ -164,7 +167,7 @@ int ssexec_init(int argc, char const *const *argv,char const *const *envp,ssexec
follow:
stralloc_free
(
&
s
rc
)
;
stralloc_free
(
&
s
ares
)
;
ss_resolve_free
(
&
res
)
;
genalloc_deepfree
(
ss_resolve_t
,
&
gares
,
ss_resolve_free
)
;
genalloc_deepfree
(
stralist
,
&
gasvc
,
stra_free
)
;
...
...
@@ -182,31 +185,38 @@ int ssexec_init(int argc, char const *const *argv,char const *const *envp,ssexec
}
else
strerr_dief3x
(
110
,
"scandir: "
,
info
->
scandir
.
s
,
" is not running"
)
;
}
else
goto
end
;
if
(
!
ss_resolve_pointo
(
&
sares
,
info
,
SS_NOTYPE
,
SS_RESOLVE_SRC
))
VERBO1
strerr_diefu1x
(
111
,
"set revolve pointer to source"
)
;
if
(
!
ss_resolve_check
(
info
,
SS_MASTER
+
1
,
SS_RESOLVE_SRC
))
strerr_diefu1x
(
111
,
"find inner bundle -- please make a bug report"
)
;
if
(
!
ss_resolve_read
(
&
res
,
sares
.
s
,
SS_MASTER
+
1
))
strerr_diefu1sys
(
111
,
"read resolve file of inner bundle"
)
;
if
(
!
res
.
ndeps
)
{
if
(
!
ss_resolve_pointo
(
&
src
,
info
,
SS_NOTYPE
,
SS_RESOLVE_SRC
))
VERBO1
strerr_diefu1x
(
111
,
"set revolve pointer to source"
)
;
if
(
!
ss_resolve_check
(
info
,
SS_MASTER
+
1
,
SS_RESOLVE_SRC
))
strerr_diefu1x
(
111
,
"find inner bundle -- please make a bug report"
)
;
if
(
!
ss_resolve_read
(
&
res
,
src
.
s
,
SS_MASTER
+
1
))
strerr_diefu1sys
(
111
,
"read resolve file of inner bundle"
)
;
if
(
!
clean_val
(
&
gasvc
,
res
.
sa
.
s
+
res
.
deps
))
strerr_diefu1sys
(
111
,
"clean dependencies of inner bundle"
)
;
for
(
unsigned
int
i
=
0
;
i
<
genalloc_len
(
stralist
,
&
gasvc
)
;
i
++
)
{
char
*
name
=
gaistr
(
&
gasvc
,
i
)
;
ss_resolve_t
tmp
=
RESOLVE_ZERO
;
if
(
!
ss_resolve_check
(
info
,
name
,
SS_RESOLVE_SRC
))
strerr_dief2sys
(
110
,
"unknow service: "
,
name
)
;
if
(
!
ss_resolve_read
(
&
tmp
,
src
.
s
,
name
))
strerr_diefu2sys
(
111
,
"read resolve file of: "
,
name
)
;
if
(
!
genalloc_append
(
ss_resolve_t
,
&
gares
,
&
tmp
))
strerr_diefu3x
(
111
,
"add: "
,
name
,
" on genalloc"
)
;
if
(
!
ss_resolve_add_deps
(
&
gares
,
&
tmp
,
info
))
strerr_diefu2sys
(
111
,
"resolve dependencies of: "
,
name
)
;
}
if
(
!
rc_init
(
info
,
&
gares
,
envp
))
strerr_diefu2sys
(
111
,
"initiate db of tree: "
,
info
->
treename
.
s
)
;
genalloc_deepfree
(
ss_resolve_t
,
&
gares
,
ss_resolve_free
)
;
genalloc_deepfree
(
stralist
,
&
gasvc
,
stra_free
)
;
VERBO1
strerr_warni2x
(
"Initialization aborted -- no atomic services into tree: "
,
info
->
treename
.
s
)
;
stralloc_free
(
&
sares
)
;
ss_resolve_free
(
&
res
)
;
stralloc_free
(
&
src
)
;
goto
end
;
}
if
(
!
clean_val
(
&
gasvc
,
res
.
sa
.
s
+
res
.
deps
))
strerr_diefu1sys
(
111
,
"clean dependencies of inner bundle"
)
;
for
(
unsigned
int
i
=
0
;
i
<
genalloc_len
(
stralist
,
&
gasvc
)
;
i
++
)
{
char
*
name
=
gaistr
(
&
gasvc
,
i
)
;
ss_resolve_t
tmp
=
RESOLVE_ZERO
;
if
(
!
ss_resolve_check
(
info
,
name
,
SS_RESOLVE_SRC
))
strerr_dief2sys
(
110
,
"unknow service: "
,
name
)
;
if
(
!
ss_resolve_read
(
&
tmp
,
sares
.
s
,
name
))
strerr_diefu2sys
(
111
,
"read resolve file of: "
,
name
)
;
if
(
!
ss_resolve_add_deps
(
&
gares
,
&
tmp
,
info
))
strerr_diefu2sys
(
111
,
"resolve dependencies of: "
,
name
)
;
ss_resolve_free
(
&
tmp
)
;
}
if
(
!
rc_init
(
info
,
&
gares
,
envp
))
strerr_diefu2sys
(
111
,
"initiate db of tree: "
,
info
->
treename
.
s
)
;
genalloc_deepfree
(
ss_resolve_t
,
&
gares
,
ss_resolve_free
)
;
genalloc_deepfree
(
stralist
,
&
gasvc
,
stra_free
)
;
ss_resolve_free
(
&
res
)
;
stralloc_free
(
&
sares
)
;
end:
return
0
;
}
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