Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
Zipr Toolchain
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
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Open Source Software
Zipr Toolchain
Commits
d55212b5
Commit
d55212b5
authored
6 years ago
by
Matthew McGill
Browse files
Options
Downloads
Patches
Plain Diff
thanos integration
Former-commit-id: d4a44ba95dd70512940b1962a9ad9b885864ba41
parent
e6e92705
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tools/thanos/thanos.cpp
+21
-27
21 additions, 27 deletions
tools/thanos/thanos.cpp
with
21 additions
and
27 deletions
tools/thanos/thanos.cpp
+
21
−
27
View file @
d55212b5
...
@@ -94,27 +94,34 @@ int main(int argc, char *argv[])
...
@@ -94,27 +94,34 @@ int main(int argc, char *argv[])
{
{
if
(
strncmp
(
buf
+
12
,
" OPTIONAL "
,
10
)
==
0
||
strncmp
(
buf
+
12
,
" CRITICAL "
,
10
)
==
0
)
if
(
strncmp
(
buf
+
12
,
" OPTIONAL "
,
10
)
==
0
||
strncmp
(
buf
+
12
,
" CRITICAL "
,
10
)
==
0
)
{
{
char
*
end
=
strchr
(
buf
,
'\n'
);
char
*
command_start
=
buf
+
12
+
10
;
if
(
!
end
||
(
end
==
buf
+
22
))
char
*
command_end
=
strchr
(
buf
,
'\n'
);
if
(
!
command_end
||
(
command_end
==
command_start
))
{
{
res
=
write
(
outfd
,
(
void
*
)
"ERR_INVALID_CMD
\n
"
,
16
);
res
=
write
(
outfd
,
(
void
*
)
"ERR_INVALID_CMD
\n
"
,
16
);
}
}
else
else
{
{
*
end
=
'\0'
;
// parse command string into argv, argc
string
command
(
buf
+
22
);
// simple parsing relies on ps_analyze.sh separating
// step arguments with single spaces.
size_t
step_name_end
=
command
.
find_first_of
(
" "
);
*
command_end
=
'\0'
;
char
*
step_name
;
if
(
step_name_end
==
string
::
npos
)
size_t
max_args
=
((
command_end
-
command_start
)
/
2
)
+
1
;
{
char
**
argv
=
(
char
**
)
malloc
(
max_args
);
step_name
=
(
buf
+
22
);
int
argc
=
0
;
}
else
argv
[
argc
++
]
=
command_start
;
char
*
command_remaining
=
strchr
(
command_start
,
' '
);
while
(
command_remaining
!=
NULL
)
{
{
step_name
=
(
char
*
)
(
command
.
substr
(
0
,
step_name_end
)).
c_str
();
*
command_remaining
=
'\0'
;
argv
[
argc
++
]
=
command_remaining
+
1
;
command_remaining
=
strchr
(
command_remaining
,
' '
);
}
}
argv
=
(
char
**
)
realloc
(
argv
,
argc
);
char
*
step_name
=
argv
[
0
];
void
*
dlhdl
=
dlopen
((
plugin_path
.
append
(
step_name
)).
c_str
(),
RTLD_NOW
);
void
*
dlhdl
=
dlopen
((
plugin_path
.
append
(
step_name
)).
c_str
(),
RTLD_NOW
);
if
(
dlhdl
==
NULL
)
if
(
dlhdl
==
NULL
)
{
{
...
@@ -134,19 +141,6 @@ int main(int argc, char *argv[])
...
@@ -134,19 +141,6 @@ int main(int argc, char *argv[])
TransformStep_t
*
the_step
=
(
*
func
)();
TransformStep_t
*
the_step
=
(
*
func
)();
assert
(
the_step
!=
NULL
);
assert
(
the_step
!=
NULL
);
int
argc
=
(
int
)
count
(
command
.
begin
(),
command
.
end
(),
' '
)
+
1
;
char
**
argv
=
(
char
**
)
malloc
(
argc
);
argv
[
0
]
=
buf
+
22
;
size_t
pos
=
0
;
int
arg_num
=
1
;
while
((
pos
=
command
.
find_first_of
(
" "
,
pos
))
!=
string
::
npos
)
{
*
(
buf
+
22
+
pos
)
=
'\0'
;
argv
[
arg_num
]
=
buf
+
22
+
pos
+
1
;
++
arg_num
;
++
pos
;
}
assert
(
arg_num
==
argc
);
bool
step_optional
=
true
;
bool
step_optional
=
true
;
if
(
strncmp
(
buf
+
12
,
" CRITICAL "
,
10
)
==
0
)
if
(
strncmp
(
buf
+
12
,
" CRITICAL "
,
10
)
==
0
)
{
{
...
@@ -210,7 +204,7 @@ int execute_step(int argc, char* argv[], bool step_optional,
...
@@ -210,7 +204,7 @@ int execute_step(int argc, char* argv[], bool step_optional,
// FOR TESTING: print args
// FOR TESTING: print args
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
for
(
int
i
=
0
;
i
<
argc
;
i
++
)
{
{
printf
(
"%s "
,
argv
[
argc
]);
printf
(
"%s "
,
argv
[
i
]);
}
}
printf
(
"
\n
"
);
printf
(
"
\n
"
);
return
15
;
// for test
return
15
;
// for test
...
...
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