Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
metadata-collect-agent
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
metadata-collect-agent
Commits
dd7caf01
Commit
dd7caf01
authored
Nov 09, 2022
by
Ophélie Gagnard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Do not run fluent-bit anymore.
Clean up.
parent
42085b4a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
442 additions
and
896 deletions
+442
-896
src/main.cpp
src/main.cpp
+393
-791
src/main.pyx
src/main.pyx
+49
-105
No files found.
src/main.cpp
View file @
dd7caf01
...
...
@@ -3323,7 +3323,7 @@ static CYTHON_INLINE ActhonResultInterface *__pyx_f_7runtime_7runtime_NullResult
/* Module declarations from "main" */
static
__pyx_t_7runtime_7runtime_Scheduler
*
__pyx_v_4main_scheduler
;
static
__pyx_t_4main_Node
*
__pyx_f_4main_make_node
(
std
::
string
,
std
::
string
);
/*proto*/
static
int
__pyx_f_4main_start
(
char
const
*
,
char
const
*
,
char
const
*
,
char
const
*
,
char
const
*
);
/*proto*/
static
int
__pyx_f_4main_start
(
char
const
*
,
char
const
*
);
/*proto*/
__PYX_EXTERN_C
int
main
(
int
,
char
**
);
/*proto*/
static
PyObject
*
__pyx_f_4main___pyx_unpickle_Node_cyp_cclass_wrapper__set_state
(
struct
CyPyObject
*
,
PyObject
*
);
/*proto*/
static
PyObject
*
__pyx_f_4main___pyx_unpickle_DirNode_cyp_cclass_wrapper__set_state
(
struct
CyPyObject
*
,
PyObject
*
);
/*proto*/
...
...
@@ -6055,18 +6055,14 @@ void __pyx_t_4main_SymlinkNode::write_node(FILE *__pyx_v_stream) {
/* "main.pyx":255
*
*
* cdef int start(const char *path_to_scan, const char *
fb_exec_path, const char *fb_lib_path, const char *fb_conf_path, const char *
log_path) nogil: # <<<<<<<<<<<<<<
* cdef int start(const char *path_to_scan, const char *log_path) nogil: # <<<<<<<<<<<<<<
*
*
printf("TEST TEST TEST TEST TEST\n\n") # DEBUG
*
# TODO replace 4096 by PATH_MAX (yet it will not be perfect)
*/
static
int
__pyx_f_4main_start
(
char
const
*
__pyx_v_path_to_scan
,
char
const
*
__pyx_v_
fb_exec_path
,
char
const
*
__pyx_v_fb_lib_path
,
char
const
*
__pyx_v_fb_conf_path
,
char
const
*
__pyx_v_
log_path
)
{
static
int
__pyx_f_4main_start
(
char
const
*
__pyx_v_path_to_scan
,
char
const
*
__pyx_v_log_path
)
{
char
__pyx_v_resolved_scan_path
[
0x1000
];
char
__pyx_v_resolved_log_path
[
0x1000
];
CYTHON_UNUSED
pid_t
__pyx_v_wait_error
;
char
*
__pyx_v_program_name
;
pid_t
__pyx_v_child_pid
;
int
__pyx_v_err
;
__pyx_t_13libcythonplus_4list_cyplist
<
std
::
string
>
*
__pyx_v_ignore_paths
=
NULL
;
__pyx_t_13libcythonplus_4list_cyplist
<
std
::
string
>
*
__pyx_v_dev_whitelist_paths
=
NULL
;
__pyx_t_13libcythonplus_4list_cyplist
<
dev_t
>
*
__pyx_v_dev_whitelist
=
NULL
;
...
...
@@ -6077,14 +6073,14 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_t_4main_Node
*
__pyx_v_active_node
=
NULL
;
FILE
*
__pyx_v_result
;
int
__pyx_r
;
int
__pyx_t_1
;
__pyx_t_
7runtime_7runtime_Scheduler
*
__pyx_t_2
=
NULL
;
__pyx_t_13libcythonplus_4list_cyplist
<
std
::
string
>
*
__pyx_t_3
=
NULL
;
CheckedResult
<
void
>
__pyx_t_4
;
__pyx_t_13libcythonplus_4list_cyplist
<
dev_t
>
*
__pyx_t_5
=
NULL
;
__pyx_t_13libcythonplus_4list_cyplist
<
std
::
string
>
::
__pyx_t_7cyplist_
iterator
__pyx_t_6
;
__pyx_t_
13libcythonplus_4list_cyplist
<
std
::
string
>
::
__pyx_t_7cyplist_value_type
__pyx_t_7
;
__pyx_t_6stdlib_4stat_Stat
*
__pyx_t_8
=
NULL
;
__pyx_t_7runtime_7runtime_Scheduler
*
__pyx_t_1
=
NULL
;
__pyx_t_
13libcythonplus_4list_cyplist
<
std
::
string
>
*
__pyx_t_2
=
NULL
;
CheckedResult
<
void
>
__pyx_t_3
;
__pyx_t_13libcythonplus_4list_cyplist
<
dev_t
>
*
__pyx_t_4
=
NULL
;
__pyx_t_13libcythonplus_4list_cyplist
<
std
::
string
>
::
__pyx_t_7cyplist_iterator
__pyx_t_5
;
__pyx_t_13libcythonplus_4list_cyplist
<
std
::
string
>
::
__pyx_t_7cyplist_
value_type
__pyx_t_6
;
__pyx_t_
6stdlib_4stat_Stat
*
__pyx_t_7
=
NULL
;
int
__pyx_t_8
;
dev_t
__pyx_t_9
;
CheckedResult
<
void
>
__pyx_t_10
;
__pyx_t_4main_Node
*
__pyx_t_11
=
NULL
;
...
...
@@ -6099,180 +6095,33 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
PyGILState_STATE
__pyx_gilstate_save
;
#endif
/* "main.pyx":257
* cdef int start(const char *path_to_scan, const char *fb_exec_path, const char *fb_lib_path, const char *fb_conf_path, const char *log_path) nogil:
*
* printf("TEST TEST TEST TEST TEST\n\n") # DEBUG # <<<<<<<<<<<<<<
*
* # TODO replace 4096 by PATH_MAX (yet it will not be perfect)
*/
(
void
)(
printf
(((
char
const
*
)
"TEST TEST TEST TEST TEST
\n\n
"
)));
/* "main.pyx":262
* cdef char resolved_scan_path[4096]
* cdef char resolved_log_path[4096]
* cdef pid_t wait_error = -1 # DEBUG # <<<<<<<<<<<<<<
* cdef char* program_name = <char*>"fluent-bit"
* cdef pid_t child_pid = -1 # DEBUG
*/
__pyx_v_wait_error
=
-
1
;
/* "main.pyx":263
* cdef char resolved_log_path[4096]
* cdef pid_t wait_error = -1 # DEBUG
* cdef char* program_name = <char*>"fluent-bit" # <<<<<<<<<<<<<<
* cdef pid_t child_pid = -1 # DEBUG
* child_pid = fork() # DEBUG
*/
__pyx_v_program_name
=
((
char
*
)((
char
*
)
"fluent-bit"
));
/* "main.pyx":264
* cdef pid_t wait_error = -1 # DEBUG
* cdef char* program_name = <char*>"fluent-bit"
* cdef pid_t child_pid = -1 # DEBUG # <<<<<<<<<<<<<<
* child_pid = fork() # DEBUG
* cdef int err
*/
__pyx_v_child_pid
=
-
1
;
/* "main.pyx":265
* cdef char* program_name = <char*>"fluent-bit"
* cdef pid_t child_pid = -1 # DEBUG
* child_pid = fork() # DEBUG # <<<<<<<<<<<<<<
* cdef int err
* #cdef char ip_address[100]
*/
__pyx_v_child_pid
=
fork
();
/* "main.pyx":269
* #cdef char ip_address[100]
* #cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r")
* if child_pid == 0: # CHILD # <<<<<<<<<<<<<<
* fprintf(stdout, "path_to_scan: %s\n", path_to_scan)
* fprintf(stdout, "fb_exec_path: %s\n", fb_exec_path)
*/
__pyx_t_1
=
((
__pyx_v_child_pid
==
0
)
!=
0
);
if
(
__pyx_t_1
)
{
/* "main.pyx":270
* #cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r")
* if child_pid == 0: # CHILD
* fprintf(stdout, "path_to_scan: %s\n", path_to_scan) # <<<<<<<<<<<<<<
* fprintf(stdout, "fb_exec_path: %s\n", fb_exec_path)
* fprintf(stdout, "fb_lib_path: %s\n", fb_lib_path)
*/
(
void
)(
fprintf
(
stdout
,
((
char
const
*
)
"path_to_scan: %s
\n
"
),
__pyx_v_path_to_scan
));
/* "main.pyx":271
* if child_pid == 0: # CHILD
* fprintf(stdout, "path_to_scan: %s\n", path_to_scan)
* fprintf(stdout, "fb_exec_path: %s\n", fb_exec_path) # <<<<<<<<<<<<<<
* fprintf(stdout, "fb_lib_path: %s\n", fb_lib_path)
* fprintf(stdout, "fb_conf_path: %s\n", fb_conf_path)
*/
(
void
)(
fprintf
(
stdout
,
((
char
const
*
)
"fb_exec_path: %s
\n
"
),
__pyx_v_fb_exec_path
));
/* "main.pyx":272
* fprintf(stdout, "path_to_scan: %s\n", path_to_scan)
* fprintf(stdout, "fb_exec_path: %s\n", fb_exec_path)
* fprintf(stdout, "fb_lib_path: %s\n", fb_lib_path) # <<<<<<<<<<<<<<
* fprintf(stdout, "fb_conf_path: %s\n", fb_conf_path)
* fprintf(stdout, "log_path: %s\n", log_path)
*/
(
void
)(
fprintf
(
stdout
,
((
char
const
*
)
"fb_lib_path: %s
\n
"
),
__pyx_v_fb_lib_path
));
/* "main.pyx":273
* fprintf(stdout, "fb_exec_path: %s\n", fb_exec_path)
* fprintf(stdout, "fb_lib_path: %s\n", fb_lib_path)
* fprintf(stdout, "fb_conf_path: %s\n", fb_conf_path) # <<<<<<<<<<<<<<
* fprintf(stdout, "log_path: %s\n", log_path)
* err = execlp(fb_exec_path, program_name, <char*>"-e", fb_lib_path, <char*>"-c", fb_conf_path, 0)
*/
(
void
)(
fprintf
(
stdout
,
((
char
const
*
)
"fb_conf_path: %s
\n
"
),
__pyx_v_fb_conf_path
));
/* "main.pyx":274
* fprintf(stdout, "fb_lib_path: %s\n", fb_lib_path)
* fprintf(stdout, "fb_conf_path: %s\n", fb_conf_path)
* fprintf(stdout, "log_path: %s\n", log_path) # <<<<<<<<<<<<<<
* err = execlp(fb_exec_path, program_name, <char*>"-e", fb_lib_path, <char*>"-c", fb_conf_path, 0)
* fprintf(stderr, "ERROR with execlp() in CHILD: %d\n", err)
*/
(
void
)(
fprintf
(
stdout
,
((
char
const
*
)
"log_path: %s
\n
"
),
__pyx_v_log_path
));
/* "main.pyx":275
* fprintf(stdout, "fb_conf_path: %s\n", fb_conf_path)
* fprintf(stdout, "log_path: %s\n", log_path)
* err = execlp(fb_exec_path, program_name, <char*>"-e", fb_lib_path, <char*>"-c", fb_conf_path, 0) # <<<<<<<<<<<<<<
* fprintf(stderr, "ERROR with execlp() in CHILD: %d\n", err)
* else: # PARENT
*/
__pyx_v_err
=
execlp
(
__pyx_v_fb_exec_path
,
__pyx_v_program_name
,
((
char
*
)((
char
*
)
"-e"
)),
__pyx_v_fb_lib_path
,
((
char
*
)((
char
*
)
"-c"
)),
__pyx_v_fb_conf_path
,
0
);
/* "main.pyx":276
* fprintf(stdout, "log_path: %s\n", log_path)
* err = execlp(fb_exec_path, program_name, <char*>"-e", fb_lib_path, <char*>"-c", fb_conf_path, 0)
* fprintf(stderr, "ERROR with execlp() in CHILD: %d\n", err) # <<<<<<<<<<<<<<
* else: # PARENT
* printf("WELCOME TO PARENT\n\n") # DEBUG
*/
(
void
)(
fprintf
(
stderr
,
((
char
const
*
)
"ERROR with execlp() in CHILD: %d
\n
"
),
__pyx_v_err
));
/* "main.pyx":269
* #cdef char ip_address[100]
* #cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r")
* if child_pid == 0: # CHILD # <<<<<<<<<<<<<<
* fprintf(stdout, "path_to_scan: %s\n", path_to_scan)
* fprintf(stdout, "fb_exec_path: %s\n", fb_exec_path)
*/
goto
__pyx_L3
;
}
/* "main.pyx":278
* fprintf(stderr, "ERROR with execlp() in CHILD: %d\n", err)
* else: # PARENT
* printf("WELCOME TO PARENT\n\n") # DEBUG # <<<<<<<<<<<<<<
*
* sleep(2) # TODO error handling ; check if a wait can be made to wait for the child to perform execlp() (instead of the sleep)
*/
/*else*/
{
(
void
)(
printf
(((
char
const
*
)
"WELCOME TO PARENT
\n\n
"
)));
/* "main.pyx":280
* printf("WELCOME TO PARENT\n\n") # DEBUG
*
* sleep(2) # TODO error handling ; check if a wait can be made to wait for the child to perform execlp() (instead of the sleep) # <<<<<<<<<<<<<<
*
* global scheduler
*/
(
void
)(
sleep
(
2
));
/* "main.pyx":283
*
* global scheduler
* scheduler = Scheduler() # <<<<<<<<<<<<<<
*
* ignore_paths = cyplist[string]()
*/
__pyx_t_2
=
__pyx_t_7runtime_7runtime_Scheduler
::
__pyx_f___constructor__Scheduler
((
__pyx_opt_args_9Scheduler___new__
*
)
NULL
);
Cy_GOTREF
(
__pyx_t_2
);
__pyx_t_1
=
__pyx_t_7runtime_7runtime_Scheduler
::
__pyx_f___constructor__Scheduler
((
__pyx_opt_args_9Scheduler___new__
*
)
NULL
);
Cy_GOTREF
(
__pyx_t_1
);
Cy_XDECREF
(
__pyx_v_4main_scheduler
);
__pyx_v_4main_scheduler
=
__pyx_t_2
;
__pyx_t_2
=
0
;
__pyx_v_4main_scheduler
=
__pyx_t_1
;
__pyx_t_1
=
0
;
/* "main.pyx":285
/* "main.pyx":264
* scheduler = Scheduler()
*
* ignore_paths = cyplist[string]() # <<<<<<<<<<<<<<
* ignore_paths.append(b'/opt/slapgrid')
* ignore_paths.append(b'/srv/slapgrid')
*/
__pyx_t_3
=
__pyx_t_13libcythonplus_4list_cyplist
<
std
::
string
>
::
__pyx_f___constructor__cyplist
();
Cy_GOTREF
(
__pyx_t_3
);
__pyx_t_2
=
__pyx_t_13libcythonplus_4list_cyplist
<
std
::
string
>
::
__pyx_f___constructor__cyplist
();
Cy_GOTREF
(
__pyx_t_2
);
Cy_XDECREF
(
__pyx_v_ignore_paths
);
__pyx_v_ignore_paths
=
__pyx_t_3
;
__pyx_t_3
=
0
;
__pyx_v_ignore_paths
=
__pyx_t_2
;
__pyx_t_2
=
0
;
/* "main.pyx":286
/* "main.pyx":265
*
* ignore_paths = cyplist[string]()
* ignore_paths.append(b'/opt/slapgrid') # <<<<<<<<<<<<<<
...
...
@@ -6280,9 +6129,9 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*
*/
Cy_GOTREF
(
__pyx_v_ignore_paths
);
__pyx_t_4
=
__pyx_v_ignore_paths
->
append
(
__pyx_k_opt_slapgrid
);
if
(
unlikely
(
__pyx_t_4
.
is_error
()))
__PYX_ERR
(
0
,
286
,
__pyx_L1_error
)
__pyx_t_3
=
__pyx_v_ignore_paths
->
append
(
__pyx_k_opt_slapgrid
);
if
(
unlikely
(
__pyx_t_3
.
is_error
()))
__PYX_ERR
(
0
,
265
,
__pyx_L1_error
)
/* "main.pyx":287
/* "main.pyx":266
* ignore_paths = cyplist[string]()
* ignore_paths.append(b'/opt/slapgrid')
* ignore_paths.append(b'/srv/slapgrid') # <<<<<<<<<<<<<<
...
...
@@ -6290,22 +6139,22 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* dev_whitelist_paths = cyplist[string]()
*/
Cy_GOTREF
(
__pyx_v_ignore_paths
);
__pyx_t_4
=
__pyx_v_ignore_paths
->
append
(
__pyx_k_srv_slapgrid
);
if
(
unlikely
(
__pyx_t_4
.
is_error
()))
__PYX_ERR
(
0
,
287
,
__pyx_L1_error
)
__pyx_t_3
=
__pyx_v_ignore_paths
->
append
(
__pyx_k_srv_slapgrid
);
if
(
unlikely
(
__pyx_t_3
.
is_error
()))
__PYX_ERR
(
0
,
266
,
__pyx_L1_error
)
/* "main.pyx":289
/* "main.pyx":268
* ignore_paths.append(b'/srv/slapgrid')
*
* dev_whitelist_paths = cyplist[string]() # <<<<<<<<<<<<<<
* dev_whitelist_paths.append(b'.')
* dev_whitelist_paths.append(b'/')
*/
__pyx_t_3
=
__pyx_t_13libcythonplus_4list_cyplist
<
std
::
string
>
::
__pyx_f___constructor__cyplist
();
Cy_GOTREF
(
__pyx_t_3
);
__pyx_t_2
=
__pyx_t_13libcythonplus_4list_cyplist
<
std
::
string
>
::
__pyx_f___constructor__cyplist
();
Cy_GOTREF
(
__pyx_t_2
);
Cy_XDECREF
(
__pyx_v_dev_whitelist_paths
);
__pyx_v_dev_whitelist_paths
=
__pyx_t_3
;
__pyx_t_3
=
0
;
__pyx_v_dev_whitelist_paths
=
__pyx_t_2
;
__pyx_t_2
=
0
;
/* "main.pyx":290
/* "main.pyx":269
*
* dev_whitelist_paths = cyplist[string]()
* dev_whitelist_paths.append(b'.') # <<<<<<<<<<<<<<
...
...
@@ -6313,9 +6162,9 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* dev_whitelist_paths.append(b'/boot/efi')
*/
Cy_GOTREF
(
__pyx_v_dev_whitelist_paths
);
__pyx_t_4
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_k_
);
if
(
unlikely
(
__pyx_t_4
.
is_error
()))
__PYX_ERR
(
0
,
290
,
__pyx_L1_error
)
__pyx_t_3
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_k_
);
if
(
unlikely
(
__pyx_t_3
.
is_error
()))
__PYX_ERR
(
0
,
269
,
__pyx_L1_error
)
/* "main.pyx":291
/* "main.pyx":270
* dev_whitelist_paths = cyplist[string]()
* dev_whitelist_paths.append(b'.')
* dev_whitelist_paths.append(b'/') # <<<<<<<<<<<<<<
...
...
@@ -6323,9 +6172,9 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* dev_whitelist_paths.append(b'/root')
*/
Cy_GOTREF
(
__pyx_v_dev_whitelist_paths
);
__pyx_t_4
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_k__2
);
if
(
unlikely
(
__pyx_t_4
.
is_error
()))
__PYX_ERR
(
0
,
291
,
__pyx_L1_error
)
__pyx_t_3
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_k__2
);
if
(
unlikely
(
__pyx_t_3
.
is_error
()))
__PYX_ERR
(
0
,
270
,
__pyx_L1_error
)
/* "main.pyx":292
/* "main.pyx":271
* dev_whitelist_paths.append(b'.')
* dev_whitelist_paths.append(b'/')
* dev_whitelist_paths.append(b'/boot/efi') # <<<<<<<<<<<<<<
...
...
@@ -6333,9 +6182,9 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* dev_whitelist_paths.append(b'/sysroot')
*/
Cy_GOTREF
(
__pyx_v_dev_whitelist_paths
);
__pyx_t_4
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_k_boot_efi
);
if
(
unlikely
(
__pyx_t_4
.
is_error
()))
__PYX_ERR
(
0
,
292
,
__pyx_L1_error
)
__pyx_t_3
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_k_boot_efi
);
if
(
unlikely
(
__pyx_t_3
.
is_error
()))
__PYX_ERR
(
0
,
271
,
__pyx_L1_error
)
/* "main.pyx":293
/* "main.pyx":272
* dev_whitelist_paths.append(b'/')
* dev_whitelist_paths.append(b'/boot/efi')
* dev_whitelist_paths.append(b'/root') # <<<<<<<<<<<<<<
...
...
@@ -6343,9 +6192,9 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* dev_whitelist_paths.append(path_to_scan)
*/
Cy_GOTREF
(
__pyx_v_dev_whitelist_paths
);
__pyx_t_4
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_k_root
);
if
(
unlikely
(
__pyx_t_4
.
is_error
()))
__PYX_ERR
(
0
,
293
,
__pyx_L1_error
)
__pyx_t_3
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_k_root
);
if
(
unlikely
(
__pyx_t_3
.
is_error
()))
__PYX_ERR
(
0
,
272
,
__pyx_L1_error
)
/* "main.pyx":294
/* "main.pyx":273
* dev_whitelist_paths.append(b'/boot/efi')
* dev_whitelist_paths.append(b'/root')
* dev_whitelist_paths.append(b'/sysroot') # <<<<<<<<<<<<<<
...
...
@@ -6353,9 +6202,9 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*
*/
Cy_GOTREF
(
__pyx_v_dev_whitelist_paths
);
__pyx_t_4
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_k_sysroot
);
if
(
unlikely
(
__pyx_t_4
.
is_error
()))
__PYX_ERR
(
0
,
294
,
__pyx_L1_error
)
__pyx_t_3
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_k_sysroot
);
if
(
unlikely
(
__pyx_t_3
.
is_error
()))
__PYX_ERR
(
0
,
273
,
__pyx_L1_error
)
/* "main.pyx":295
/* "main.pyx":274
* dev_whitelist_paths.append(b'/root')
* dev_whitelist_paths.append(b'/sysroot')
* dev_whitelist_paths.append(path_to_scan) # <<<<<<<<<<<<<<
...
...
@@ -6363,22 +6212,22 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* dev_whitelist = cyplist[dev_t]()
*/
Cy_GOTREF
(
__pyx_v_dev_whitelist_paths
);
__pyx_t_4
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_v_path_to_scan
);
if
(
unlikely
(
__pyx_t_4
.
is_error
()))
__PYX_ERR
(
0
,
295
,
__pyx_L1_error
)
__pyx_t_3
=
__pyx_v_dev_whitelist_paths
->
append
(
__pyx_v_path_to_scan
);
if
(
unlikely
(
__pyx_t_3
.
is_error
()))
__PYX_ERR
(
0
,
274
,
__pyx_L1_error
)
/* "main.pyx":297
/* "main.pyx":276
* dev_whitelist_paths.append(path_to_scan)
*
* dev_whitelist = cyplist[dev_t]() # <<<<<<<<<<<<<<
* for p in dev_whitelist_paths:
* p_stat = Stat(p)
*/
__pyx_t_5
=
__pyx_t_13libcythonplus_4list_cyplist
<
dev_t
>
::
__pyx_f___constructor__cyplist
();
Cy_GOTREF
(
__pyx_t_5
);
__pyx_t_4
=
__pyx_t_13libcythonplus_4list_cyplist
<
dev_t
>
::
__pyx_f___constructor__cyplist
();
Cy_GOTREF
(
__pyx_t_4
);
Cy_XDECREF
(
__pyx_v_dev_whitelist
);
__pyx_v_dev_whitelist
=
__pyx_t_5
;
__pyx_t_5
=
0
;
__pyx_v_dev_whitelist
=
__pyx_t_4
;
__pyx_t_4
=
0
;
/* "main.pyx":298
/* "main.pyx":277
*
* dev_whitelist = cyplist[dev_t]()
* for p in dev_whitelist_paths: # <<<<<<<<<<<<<<
...
...
@@ -6386,27 +6235,27 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* if p_stat is not NULL:
*/
Cy_GOTREF
(
__pyx_v_dev_whitelist_paths
);
__pyx_t_6
=
__pyx_v_dev_whitelist_paths
->
begin
();
__pyx_t_5
=
__pyx_v_dev_whitelist_paths
->
begin
();
for
(;;)
{
if
(
!
(
__pyx_t_6
!=
__pyx_v_dev_whitelist_paths
->
end
()))
break
;
__pyx_t_7
=
*
__pyx_t_6
;
++
__pyx_t_6
;
__pyx_v_p
=
__PYX_STD_MOVE_IF_SUPPORTED
(
__pyx_t_7
);
if
(
!
(
__pyx_t_5
!=
__pyx_v_dev_whitelist_paths
->
end
()))
break
;
__pyx_t_6
=
*
__pyx_t_5
;
++
__pyx_t_5
;
__pyx_v_p
=
__PYX_STD_MOVE_IF_SUPPORTED
(
__pyx_t_6
);
/* "main.pyx":299
/* "main.pyx":278
* dev_whitelist = cyplist[dev_t]()
* for p in dev_whitelist_paths:
* p_stat = Stat(p) # <<<<<<<<<<<<<<
* if p_stat is not NULL:
* p_dev = p_stat.st_data.st_dev
*/
__pyx_t_8
=
__pyx_t_6stdlib_4stat_Stat
::
__pyx_f___constructor__Stat
(
__pyx_v_p
);
Cy_GOTREF
(
__pyx_t_8
);
__pyx_t_7
=
__pyx_t_6stdlib_4stat_Stat
::
__pyx_f___constructor__Stat
(
__pyx_v_p
);
Cy_GOTREF
(
__pyx_t_7
);
Cy_XDECREF
(
__pyx_v_p_stat
);
__pyx_v_p_stat
=
__pyx_t_8
;
__pyx_t_8
=
0
;
__pyx_v_p_stat
=
__pyx_t_7
;
__pyx_t_7
=
0
;
/* "main.pyx":300
/* "main.pyx":279
* for p in dev_whitelist_paths:
* p_stat = Stat(p)
* if p_stat is not NULL: # <<<<<<<<<<<<<<
...
...
@@ -6414,10 +6263,10 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* dev_whitelist.append(p_dev)
*/
Cy_GOTREF
(
__pyx_v_p_stat
);
__pyx_t_1
=
((
__pyx_v_p_stat
!=
NULL
)
!=
0
);
if
(
__pyx_t_1
)
{
__pyx_t_8
=
((
__pyx_v_p_stat
!=
NULL
)
!=
0
);
if
(
__pyx_t_8
)
{
/* "main.pyx":301
/* "main.pyx":280
* p_stat = Stat(p)
* if p_stat is not NULL:
* p_dev = p_stat.st_data.st_dev # <<<<<<<<<<<<<<
...
...
@@ -6428,7 +6277,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_t_9
=
__pyx_v_p_stat
->
st_data
.
st_dev
;
__pyx_v_p_dev
=
__pyx_t_9
;
/* "main.pyx":302
/* "main.pyx":281
* if p_stat is not NULL:
* p_dev = p_stat.st_data.st_dev
* dev_whitelist.append(p_dev) # <<<<<<<<<<<<<<
...
...
@@ -6436,9 +6285,9 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* realpath(path_to_scan, resolved_scan_path)
*/
Cy_GOTREF
(
__pyx_v_dev_whitelist
);
__pyx_t_10
=
__pyx_v_dev_whitelist
->
append
(
__pyx_v_p_dev
);
if
(
unlikely
(
__pyx_t_10
.
is_error
()))
__PYX_ERR
(
0
,
302
,
__pyx_L1_error
)
__pyx_t_10
=
__pyx_v_dev_whitelist
->
append
(
__pyx_v_p_dev
);
if
(
unlikely
(
__pyx_t_10
.
is_error
()))
__PYX_ERR
(
0
,
281
,
__pyx_L1_error
)
/* "main.pyx":300
/* "main.pyx":279
* for p in dev_whitelist_paths:
* p_stat = Stat(p)
* if p_stat is not NULL: # <<<<<<<<<<<<<<
...
...
@@ -6447,7 +6296,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
}
/* "main.pyx":298
/* "main.pyx":277
*
* dev_whitelist = cyplist[dev_t]()
* for p in dev_whitelist_paths: # <<<<<<<<<<<<<<
...
...
@@ -6455,47 +6304,20 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* if p_stat is not NULL:
*/
}
__pyx_t_6
=
__pyx_v_dev_whitelist_paths
->
end
();
__pyx_t_5
=
__pyx_v_dev_whitelist_paths
->
end
();
/* "main.pyx":304
/* "main.pyx":283
* dev_whitelist.append(p_dev)
*
* realpath(path_to_scan, resolved_scan_path) # <<<<<<<<<<<<<<
*
fputs(resolved_scan_path, stderr) # DEBUG
*
fputs("\n", stderr) # DEBUG
*
node = make_node(resolved_scan_path, resolved_scan_path)
*
if node is NULL:
*/
(
void
)(
realpath
(
__pyx_v_path_to_scan
,
__pyx_v_resolved_scan_path
));
/* "main.pyx":305
/* "main.pyx":284
*
* realpath(path_to_scan, resolved_scan_path)
* fputs(resolved_scan_path, stderr) # DEBUG # <<<<<<<<<<<<<<
* fputs("\n", stderr) # DEBUG
* fflush(stderr) # DEBUG
*/
(
void
)(
fputs
(
__pyx_v_resolved_scan_path
,
stderr
));
/* "main.pyx":306
* realpath(path_to_scan, resolved_scan_path)
* fputs(resolved_scan_path, stderr) # DEBUG
* fputs("\n", stderr) # DEBUG # <<<<<<<<<<<<<<
* fflush(stderr) # DEBUG
* node = make_node(resolved_scan_path, resolved_scan_path)
*/
(
void
)(
fputs
(((
char
const
*
)
"
\n
"
),
stderr
));
/* "main.pyx":307
* fputs(resolved_scan_path, stderr) # DEBUG
* fputs("\n", stderr) # DEBUG
* fflush(stderr) # DEBUG # <<<<<<<<<<<<<<
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL:
*/
(
void
)(
fflush
(
stderr
));
/* "main.pyx":308
* fputs("\n", stderr) # DEBUG
* fflush(stderr) # DEBUG
* node = make_node(resolved_scan_path, resolved_scan_path) # <<<<<<<<<<<<<<
* if node is NULL:
* return -1
...
...
@@ -6506,18 +6328,18 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_v_node
=
__pyx_t_11
;
__pyx_t_11
=
0
;
/* "main.pyx":309
*
fflush(stderr) # DEBUG
/* "main.pyx":285
*
realpath(path_to_scan, resolved_scan_path)
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL: # <<<<<<<<<<<<<<
* return -1
*
*/
Cy_GOTREF
(
__pyx_v_node
);
__pyx_t_1
=
((
__pyx_v_node
==
NULL
)
!=
0
);
if
(
__pyx_t_1
)
{
__pyx_t_8
=
((
__pyx_v_node
==
NULL
)
!=
0
);
if
(
__pyx_t_8
)
{
/* "main.pyx":310
/* "main.pyx":286
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL:
* return -1 # <<<<<<<<<<<<<<
...
...
@@ -6527,8 +6349,8 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_r
=
-
1
;
goto
__pyx_L0
;
/* "main.pyx":309
*
fflush(stderr) # DEBUG
/* "main.pyx":285
*
realpath(path_to_scan, resolved_scan_path)
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL: # <<<<<<<<<<<<<<
* return -1
...
...
@@ -6536,7 +6358,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
}
/* "main.pyx":312
/* "main.pyx":288
* return -1
*
* active_node = activate(consume node) # <<<<<<<<<<<<<<
...
...
@@ -6553,7 +6375,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_v_active_node
=
__pyx_t_12
;
__pyx_t_12
=
0
;
/* "main.pyx":313
/* "main.pyx":289
*
* active_node = activate(consume node)
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths) # <<<<<<<<<<<<<<
...
...
@@ -6571,7 +6393,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
#ifdef WITH_THREAD
PyGILState_Release
(
_save
);
#endif
__PYX_ERR
(
0
,
313
,
__pyx_L1_error
)
__PYX_ERR
(
0
,
289
,
__pyx_L1_error
)
}
__pyx_v_dev_whitelist
=
NULL
;
Cy_GOTREF
(
__pyx_v_ignore_paths
);
...
...
@@ -6584,7 +6406,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
#ifdef WITH_THREAD
PyGILState_Release
(
_save
);
#endif
__PYX_ERR
(
0
,
313
,
__pyx_L1_error
)
__PYX_ERR
(
0
,
289
,
__pyx_L1_error
)
}
__pyx_v_ignore_paths
=
NULL
;
__pyx_t_15
=
__pyx_v_active_node
->
__pyx_f_active_build_node
(
NULL
,
__pyx_t_13
,
__pyx_t_14
);
...
...
@@ -6593,7 +6415,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_t_14
=
0
;
Cy_XDECREF
(
__pyx_t_15
);
__pyx_t_15
=
NULL
;
/* "main.pyx":314
/* "main.pyx":290
* active_node = activate(consume node)
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
* scheduler.finish() # <<<<<<<<<<<<<<
...
...
@@ -6603,12 +6425,12 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
Cy_GOTREF
(
__pyx_v_4main_scheduler
);
__pyx_v_4main_scheduler
->
finish
();
/* "main.pyx":315
/* "main.pyx":291
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
* scheduler.finish()
* node = consume active_node # <<<<<<<<<<<<<<
*
*
#""" # DEBUG
*
realpath(log_path, resolved_log_path)
*/
Cy_GOTREF
(
__pyx_v_active_node
);
__pyx_t_11
=
__pyx_v_active_node
;
...
...
@@ -6620,229 +6442,126 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
#ifdef WITH_THREAD
PyGILState_Release
(
_save
);
#endif
__PYX_ERR
(
0
,
315
,
__pyx_L1_error
)
__PYX_ERR
(
0
,
291
,
__pyx_L1_error
)
}
__pyx_v_active_node
=
NULL
;
Cy_XDECREF
(
__pyx_v_node
);
__pyx_v_node
=
__pyx_t_11
;
__pyx_t_11
=
0
;
/* "main.pyx":318
/* "main.pyx":293
* node = consume active_node
*
* #""" # DEBUG
* realpath(log_path, resolved_log_path) # <<<<<<<<<<<<<<
* fputs(resolved_log_path, stderr) # DEBUG
* fputs("\n", stderr) # DEBUG
*/
(
void
)(
realpath
(
__pyx_v_log_path
,
__pyx_v_resolved_log_path
));
/* "main.pyx":319
* #""" # DEBUG
* realpath(log_path, resolved_log_path)
* fputs(resolved_log_path, stderr) # DEBUG # <<<<<<<<<<<<<<
* fputs("\n", stderr) # DEBUG
* fflush(stderr) # DEBUG
*/
(
void
)(
fputs
(
__pyx_v_resolved_log_path
,
stderr
));
/* "main.pyx":320
* realpath(log_path, resolved_log_path)
* fputs(resolved_log_path, stderr) # DEBUG
* fputs("\n", stderr) # DEBUG # <<<<<<<<<<<<<<
* fflush(stderr) # DEBUG
* result = fopen(resolved_log_path, 'w')
*/
(
void
)(
fputs
(((
char
const
*
)
"
\n
"
),
stderr
));
/* "main.pyx":321
* fputs(resolved_log_path, stderr) # DEBUG
* fputs("\n", stderr) # DEBUG
* fflush(stderr) # DEBUG # <<<<<<<<<<<<<<
* result = fopen(resolved_log_path, 'w')
* if result is NULL:
*/
(
void
)(
fflush
(
stderr
));
(
void
)(
realpath
(
__pyx_v_log_path
,
__pyx_v_resolved_log_path
));
/* "main.pyx":322
*
fputs("\n", stderr) # DEBUG
*
fflush(stderr) # DEBUG
/* "main.pyx":294
*
*
realpath(log_path, resolved_log_path)
* result = fopen(resolved_log_path, 'w') # <<<<<<<<<<<<<<
* if result is NULL:
*
fprintf(stderr, 'Error creating the log file.\n') # DEBUG
*
fprintf(stderr, 'Error creating the log file.\n')
*/
__pyx_v_result
=
fopen
(
__pyx_v_resolved_log_path
,
((
char
const
*
)
"w"
));
/* "main.pyx":323
*
fflush(stderr) # DEBUG
/* "main.pyx":295
*
realpath(log_path, resolved_log_path)
* result = fopen(resolved_log_path, 'w')
* if result is NULL: # <<<<<<<<<<<<<<
*
fprintf(stderr, 'Error creating the log file.\n') # DEBUG
*
fprintf(stderr, 'Error creating the log file.\n')
* fflush(stderr)
*/
__pyx_t_1
=
((
__pyx_v_result
==
NULL
)
!=
0
);
if
(
__pyx_t_1
)
{
__pyx_t_8
=
((
__pyx_v_result
==
NULL
)
!=
0
);
if
(
__pyx_t_8
)
{
/* "main.pyx":324
/* "main.pyx":296
* result = fopen(resolved_log_path, 'w')
* if result is NULL:
*
fprintf(stderr, 'Error creating the log file.\n') # DEBUG
# <<<<<<<<<<<<<<
*
fprintf(stderr, 'Error creating the log file.\n')
# <<<<<<<<<<<<<<
* fflush(stderr)
* return -1
*/
(
void
)(
fprintf
(
stderr
,
((
char
const
*
)
"Error creating the log file.
\n
"
)));
/* "main.pyx":325
/* "main.pyx":297
* if result is NULL:
*
fprintf(stderr, 'Error creating the log file.\n') # DEBUG
*
fprintf(stderr, 'Error creating the log file.\n')
* fflush(stderr) # <<<<<<<<<<<<<<
* return -1
*
*/
(
void
)(
fflush
(
stderr
));
/* "main.pyx":326
*
fprintf(stderr, 'Error creating the log file.\n') # DEBUG
/* "main.pyx":298
*
fprintf(stderr, 'Error creating the log file.\n')
* fflush(stderr)
* return -1 # <<<<<<<<<<<<<<
*
*
fprintf(stderr, 'Log opened successfully.\n') # DEBUG
*
node.write_node(result)
*/
__pyx_r
=
-
1
;
goto
__pyx_L0
;
/* "main.pyx":323
*
fflush(stderr) # DEBUG
/* "main.pyx":295
*
realpath(log_path, resolved_log_path)
* result = fopen(resolved_log_path, 'w')
* if result is NULL: # <<<<<<<<<<<<<<
*
fprintf(stderr, 'Error creating the log file.\n') # DEBUG
*
fprintf(stderr, 'Error creating the log file.\n')
* fflush(stderr)
*/
}
/* "main.pyx":328
/* "main.pyx":300
* return -1
*
* fprintf(stderr, 'Log opened successfully.\n') # DEBUG # <<<<<<<<<<<<<<
*
* fprintf(stderr, "WRITE_NOTE STAGE\n\n") # DEBUG
*/
(
void
)(
fprintf
(
stderr
,
((
char
const
*
)
"Log opened successfully.
\n
"
)));
/* "main.pyx":330
* fprintf(stderr, 'Log opened successfully.\n') # DEBUG
*
* fprintf(stderr, "WRITE_NOTE STAGE\n\n") # DEBUG # <<<<<<<<<<<<<<
*
* #fscanf(address_path, "%s", ip_address)
*/
(
void
)(
fprintf
(
stderr
,
((
char
const
*
)
"WRITE_NOTE STAGE
\n\n
"
)));
/* "main.pyx":335
* #fclose(address_path)
* #fprintf(result, '{"mac_address": "%s"}\n', ip_address)
* node.write_node(result) # <<<<<<<<<<<<<<
*
fprintf(result, '{}\n')
*
fprintf(result, 'fluentbit_end\n'
)
*
*
fclose(result
)
*/
Cy_GOTREF
(
__pyx_v_node
);
__pyx_v_node
->
write_node
(
__pyx_v_result
);
/* "main.pyx":336
* #fprintf(result, '{"mac_address": "%s"}\n', ip_address)
* node.write_node(result)
* fprintf(result, '{}\n') # <<<<<<<<<<<<<<
* fprintf(result, 'fluentbit_end\n')
*
*/
(
void
)(
fprintf
(
__pyx_v_result
,
((
char
const
*
)
"{}
\n
"
)));
/* "main.pyx":337
/* "main.pyx":302
* node.write_node(result)
* fprintf(result, '{}\n')
* fprintf(result, 'fluentbit_end\n') # <<<<<<<<<<<<<<
*
* fclose(result)
*/
(
void
)(
fprintf
(
__pyx_v_result
,
((
char
const
*
)
"fluentbit_end
\n
"
)));
/* "main.pyx":339
* fprintf(result, 'fluentbit_end\n')
*
* fclose(result) # <<<<<<<<<<<<<<
* #""" # DEBUG
* del scheduler
*
*/
(
void
)(
fclose
(
__pyx_v_result
));
/* "main.pyx":341
/* "main.pyx":303
*
* fclose(result)
* #""" # DEBUG
* del scheduler # <<<<<<<<<<<<<<
*
*
fprintf(stderr, "WAITING for fluent-bit to end\n\n")
*
return 0
*/
Cy_GOTREF
(
__pyx_v_4main_scheduler
);
Cy_XDECREF
(
__pyx_v_4main_scheduler
);
__pyx_v_4main_scheduler
=
NULL
;
/* "main.pyx":343
/* "main.pyx":305
* del scheduler
*
* fprintf(stderr, "WAITING for fluent-bit to end\n\n") # <<<<<<<<<<<<<<
* wait_error = wait(NULL) # TODO improve this call (error handling, etc.)
* #wait_error = waitpid(child_pid, NULL, 1) # TODO improve this call (error handling, etc.)
*/
(
void
)(
fprintf
(
stderr
,
((
char
const
*
)
"WAITING for fluent-bit to end
\n\n
"
)));
/* "main.pyx":344
*
* fprintf(stderr, "WAITING for fluent-bit to end\n\n")
* wait_error = wait(NULL) # TODO improve this call (error handling, etc.) # <<<<<<<<<<<<<<
* #wait_error = waitpid(child_pid, NULL, 1) # TODO improve this call (error handling, etc.)
* fprintf(stderr, "WAITING ENDS\n\n")
*/
__pyx_v_wait_error
=
wait
(
NULL
);
/* "main.pyx":346
* wait_error = wait(NULL) # TODO improve this call (error handling, etc.)
* #wait_error = waitpid(child_pid, NULL, 1) # TODO improve this call (error handling, etc.)
* fprintf(stderr, "WAITING ENDS\n\n") # <<<<<<<<<<<<<<
* fflush(stderr) # DEBUG
*
*/
(
void
)(
fprintf
(
stderr
,
((
char
const
*
)
"WAITING ENDS
\n\n
"
)));
/* "main.pyx":347
* #wait_error = waitpid(child_pid, NULL, 1) # TODO improve this call (error handling, etc.)
* fprintf(stderr, "WAITING ENDS\n\n")
* fflush(stderr) # DEBUG # <<<<<<<<<<<<<<
*
* return 0
*/
(
void
)(
fflush
(
stderr
));
/* "main.pyx":349
* fflush(stderr) # DEBUG
*
* return 0 # <<<<<<<<<<<<<<
*
* cdef public int main(int argc, char* argv[]) nogil:
*/
__pyx_r
=
0
;
goto
__pyx_L0
;
}
__pyx_L3:
;
/* "main.pyx":255
*
*
* cdef int start(const char *path_to_scan, const char *
fb_exec_path, const char *fb_lib_path, const char *fb_conf_path, const char *
log_path) nogil: # <<<<<<<<<<<<<<
* cdef int start(const char *path_to_scan, const char *log_path) nogil: # <<<<<<<<<<<<<<
*
*
printf("TEST TEST TEST TEST TEST\n\n") # DEBUG
*
# TODO replace 4096 by PATH_MAX (yet it will not be perfect)
*/
/* function exit code */
__pyx_r
=
0
;
goto
__pyx_L0
;
__pyx_L1_error:
;
#ifdef WITH_THREAD
__pyx_gilstate_save
=
__Pyx_PyGILState_Ensure
();
...
...
@@ -6862,70 +6581,40 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
return
__pyx_r
;
}
/* "main.pyx":3
51
/* "main.pyx":3
07
* return 0
*
* cdef public int main(int argc, char* argv[]) nogil: # <<<<<<<<<<<<<<
* cdef char* path_to_scan = "/"
* cdef char*
fb_exec_path = "/sbin/fluent-bit
"
* cdef char*
log_path = "/var/log/metadata_collect.log
"
*/
int
main
(
int
__pyx_v_argc
,
char
**
__pyx_v_argv
)
{
char
*
__pyx_v_path_to_scan
;
char
*
__pyx_v_fb_exec_path
;
char
*
__pyx_v_fb_lib_path
;
char
*
__pyx_v_fb_conf_path
;
char
*
__pyx_v_log_path
;
int
__pyx_r
;
int
__pyx_t_1
;
/* "main.pyx":3
52
/* "main.pyx":3
08
*
* cdef public int main(int argc, char* argv[]) nogil:
* cdef char* path_to_scan = "/" # <<<<<<<<<<<<<<
* cdef char*
fb_exec_path = "/sbin/fluent-bit
"
*
cdef char* fb_lib_path = "/lib/libfluentbit_wendelin.so"
* cdef char*
log_path = "/var/log/metadata_collect.log
"
*
if argc >= 2:
*/
__pyx_v_path_to_scan
=
((
char
*
)
"/"
);
/* "main.pyx":3
53
/* "main.pyx":3
09
* cdef public int main(int argc, char* argv[]) nogil:
* cdef char* path_to_scan = "/"
* cdef char* fb_exec_path = "/sbin/fluent-bit" # <<<<<<<<<<<<<<
* cdef char* fb_lib_path = "/lib/libfluentbit_wendelin.so"
* cdef char* fb_conf_path = "/etc/flb.conf"
*/
__pyx_v_fb_exec_path
=
((
char
*
)
"/sbin/fluent-bit"
);
/* "main.pyx":354
* cdef char* path_to_scan = "/"
* cdef char* fb_exec_path = "/sbin/fluent-bit"
* cdef char* fb_lib_path = "/lib/libfluentbit_wendelin.so" # <<<<<<<<<<<<<<
* cdef char* fb_conf_path = "/etc/flb.conf"
* cdef char* log_path = "/var/log/metadata_collect.log"
*/
__pyx_v_fb_lib_path
=
((
char
*
)
"/lib/libfluentbit_wendelin.so"
);
/* "main.pyx":355
* cdef char* fb_exec_path = "/sbin/fluent-bit"
* cdef char* fb_lib_path = "/lib/libfluentbit_wendelin.so"
* cdef char* fb_conf_path = "/etc/flb.conf" # <<<<<<<<<<<<<<
* cdef char* log_path = "/var/log/metadata_collect.log"
* if argc >= 2:
*/
__pyx_v_fb_conf_path
=
((
char
*
)
"/etc/flb.conf"
);
/* "main.pyx":356
* cdef char* fb_lib_path = "/lib/libfluentbit_wendelin.so"
* cdef char* fb_conf_path = "/etc/flb.conf"
* cdef char* log_path = "/var/log/metadata_collect.log" # <<<<<<<<<<<<<<
* if argc >= 2:
* path_to_scan = <char*>argv[1]
*/
__pyx_v_log_path
=
((
char
*
)
"/var/log/metadata_collect.log"
);
/* "main.pyx":3
57
* cdef char*
fb_conf_path = "/etc/flb.conf
"
/* "main.pyx":3
10
* cdef char*
path_to_scan = "/
"
* cdef char* log_path = "/var/log/metadata_collect.log"
* if argc >= 2: # <<<<<<<<<<<<<<
* path_to_scan = <char*>argv[1]
...
...
@@ -6934,17 +6623,17 @@ int main(int __pyx_v_argc, char **__pyx_v_argv) {
__pyx_t_1
=
((
__pyx_v_argc
>=
2
)
!=
0
);
if
(
__pyx_t_1
)
{
/* "main.pyx":3
58
/* "main.pyx":3
11
* cdef char* log_path = "/var/log/metadata_collect.log"
* if argc >= 2:
* path_to_scan = <char*>argv[1] # <<<<<<<<<<<<<<
* if argc >= 3:
*
fb_exec
_path = <char*>argv[2]
*
log
_path = <char*>argv[2]
*/
__pyx_v_path_to_scan
=
((
char
*
)(
__pyx_v_argv
[
1
]));
/* "main.pyx":3
57
* cdef char*
fb_conf_path = "/etc/flb.conf
"
/* "main.pyx":3
10
* cdef char*
path_to_scan = "/
"
* cdef char* log_path = "/var/log/metadata_collect.log"
* if argc >= 2: # <<<<<<<<<<<<<<
* path_to_scan = <char*>argv[1]
...
...
@@ -6952,143 +6641,56 @@ int main(int __pyx_v_argc, char **__pyx_v_argv) {
*/
}
/* "main.pyx":3
59
/* "main.pyx":3
12
* if argc >= 2:
* path_to_scan = <char*>argv[1]
* if argc >= 3: # <<<<<<<<<<<<<<
*
fb_exec
_path = <char*>argv[2]
*
if argc >= 4:
*
log
_path = <char*>argv[2]
*
fputs(path_to_scan, stderr)
*/
__pyx_t_1
=
((
__pyx_v_argc
>=
3
)
!=
0
);
if
(
__pyx_t_1
)
{
/* "main.pyx":3
60
/* "main.pyx":3
13
* path_to_scan = <char*>argv[1]
* if argc >= 3:
*
fb_exec
_path = <char*>argv[2] # <<<<<<<<<<<<<<
*
if argc >= 4:
*
fb_lib_path = <char*>argv[3]
*
log
_path = <char*>argv[2] # <<<<<<<<<<<<<<
*
fputs(path_to_scan, stderr)
*
return start(<char*>path_to_scan, <char*>log_path)
*/
__pyx_v_
fb_exec
_path
=
((
char
*
)(
__pyx_v_argv
[
2
]));
__pyx_v_
log
_path
=
((
char
*
)(
__pyx_v_argv
[
2
]));
/* "main.pyx":3
59
/* "main.pyx":3
12
* if argc >= 2:
* path_to_scan = <char*>argv[1]
* if argc >= 3: # <<<<<<<<<<<<<<
* fb_exec_path = <char*>argv[2]
* if argc >= 4:
*/
}
/* "main.pyx":361
* if argc >= 3:
* fb_exec_path = <char*>argv[2]
* if argc >= 4: # <<<<<<<<<<<<<<
* fb_lib_path = <char*>argv[3]
* if argc >= 5:
*/
__pyx_t_1
=
((
__pyx_v_argc
>=
4
)
!=
0
);
if
(
__pyx_t_1
)
{
/* "main.pyx":362
* fb_exec_path = <char*>argv[2]
* if argc >= 4:
* fb_lib_path = <char*>argv[3] # <<<<<<<<<<<<<<
* if argc >= 5:
* fb_conf_path = <char*>argv[4]
*/
__pyx_v_fb_lib_path
=
((
char
*
)(
__pyx_v_argv
[
3
]));
/* "main.pyx":361
* if argc >= 3:
* fb_exec_path = <char*>argv[2]
* if argc >= 4: # <<<<<<<<<<<<<<
* fb_lib_path = <char*>argv[3]
* if argc >= 5:
*/
}
/* "main.pyx":363
* if argc >= 4:
* fb_lib_path = <char*>argv[3]
* if argc >= 5: # <<<<<<<<<<<<<<
* fb_conf_path = <char*>argv[4]
* if argc >=6:
*/
__pyx_t_1
=
((
__pyx_v_argc
>=
5
)
!=
0
);
if
(
__pyx_t_1
)
{
/* "main.pyx":364
* fb_lib_path = <char*>argv[3]
* if argc >= 5:
* fb_conf_path = <char*>argv[4] # <<<<<<<<<<<<<<
* if argc >=6:
* log_path = <char*>argv[5]
*/
__pyx_v_fb_conf_path
=
((
char
*
)(
__pyx_v_argv
[
4
]));
/* "main.pyx":363
* if argc >= 4:
* fb_lib_path = <char*>argv[3]
* if argc >= 5: # <<<<<<<<<<<<<<
* fb_conf_path = <char*>argv[4]
* if argc >=6:
*/
}
/* "main.pyx":365
* if argc >= 5:
* fb_conf_path = <char*>argv[4]
* if argc >=6: # <<<<<<<<<<<<<<
* log_path = <char*>argv[5]
* fputs(path_to_scan, stderr)
*/
__pyx_t_1
=
((
__pyx_v_argc
>=
6
)
!=
0
);
if
(
__pyx_t_1
)
{
/* "main.pyx":366
* fb_conf_path = <char*>argv[4]
* if argc >=6:
* log_path = <char*>argv[5] # <<<<<<<<<<<<<<
* fputs(path_to_scan, stderr)
* return start(<char*>path_to_scan, <char*>fb_exec_path, <char*>fb_lib_path, <char*>fb_conf_path, <char*>log_path)
*/
__pyx_v_log_path
=
((
char
*
)(
__pyx_v_argv
[
5
]));
/* "main.pyx":365
* if argc >= 5:
* fb_conf_path = <char*>argv[4]
* if argc >=6: # <<<<<<<<<<<<<<
* log_path = <char*>argv[5]
* log_path = <char*>argv[2]
* fputs(path_to_scan, stderr)
*/
}
/* "main.pyx":3
67
* if argc >=
6
:
* log_path = <char*>argv[
5
]
/* "main.pyx":3
14
* if argc >=
3
:
* log_path = <char*>argv[
2
]
* fputs(path_to_scan, stderr) # <<<<<<<<<<<<<<
* return start(<char*>path_to_scan, <char*>fb_exec_path, <char*>fb_lib_path, <char*>fb_conf_path, <char*>log_path)
*
* return start(<char*>path_to_scan, <char*>log_path)
*/
(
void
)(
fputs
(
__pyx_v_path_to_scan
,
stderr
));
/* "main.pyx":3
68
* log_path = <char*>argv[
5
]
/* "main.pyx":3
15
* log_path = <char*>argv[
2
]
* fputs(path_to_scan, stderr)
* return start(<char*>path_to_scan, <char*>fb_exec_path, <char*>fb_lib_path, <char*>fb_conf_path, <char*>log_path) # <<<<<<<<<<<<<<
*
* #def python_main():
* return start(<char*>path_to_scan, <char*>log_path) # <<<<<<<<<<<<<<
*/
__pyx_r
=
__pyx_f_4main_start
(((
char
*
)
__pyx_v_path_to_scan
),
((
char
*
)
__pyx_v_
fb_exec_path
),
((
char
*
)
__pyx_v_fb_lib_path
),
((
char
*
)
__pyx_v_fb_conf_path
),
((
char
*
)
__pyx_v_
log_path
));
__pyx_r
=
__pyx_f_4main_start
(((
char
*
)
__pyx_v_path_to_scan
),
((
char
*
)
__pyx_v_log_path
));
goto
__pyx_L0
;
/* "main.pyx":3
51
/* "main.pyx":3
07
* return 0
*
* cdef public int main(int argc, char* argv[]) nogil: # <<<<<<<<<<<<<<
* cdef char* path_to_scan = "/"
* cdef char*
fb_exec_path = "/sbin/fluent-bit
"
* cdef char*
log_path = "/var/log/metadata_collect.log
"
*/
/* function exit code */
...
...
src/main.pyx
View file @
dd7caf01
...
...
@@ -252,32 +252,11 @@ cdef cypclass SymlinkNode(Node):
fwrite
(
self
.
formatted
.
data
(),
1
,
self
.
formatted
.
size
(),
stream
)
cdef
int
start
(
const
char
*
path_to_scan
,
const
char
*
fb_exec_path
,
const
char
*
fb_lib_path
,
const
char
*
fb_conf_path
,
const
char
*
log_path
)
nogil
:
printf
(
"TEST TEST TEST TEST TEST
\
n
\
n
"
)
# DEBUG
cdef
int
start
(
const
char
*
path_to_scan
,
const
char
*
log_path
)
nogil
:
# TODO replace 4096 by PATH_MAX (yet it will not be perfect)
cdef
char
resolved_scan_path
[
4096
]
cdef
char
resolved_log_path
[
4096
]
cdef
pid_t
wait_error
=
-
1
# DEBUG
cdef
char
*
program_name
=
<
char
*>
"fluent-bit"
cdef
pid_t
child_pid
=
-
1
# DEBUG
child_pid
=
fork
()
# DEBUG
cdef
int
err
#cdef char ip_address[100]
#cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r")
if
child_pid
==
0
:
# CHILD
fprintf
(
stdout
,
"path_to_scan: %s
\
n
"
,
path_to_scan
)
fprintf
(
stdout
,
"fb_exec_path: %s
\
n
"
,
fb_exec_path
)
fprintf
(
stdout
,
"fb_lib_path: %s
\
n
"
,
fb_lib_path
)
fprintf
(
stdout
,
"fb_conf_path: %s
\
n
"
,
fb_conf_path
)
fprintf
(
stdout
,
"log_path: %s
\
n
"
,
log_path
)
err
=
execlp
(
fb_exec_path
,
program_name
,
<
char
*>
"-e"
,
fb_lib_path
,
<
char
*>
"-c"
,
fb_conf_path
,
0
)
fprintf
(
stderr
,
"ERROR with execlp() in CHILD: %d
\
n
"
,
err
)
else
:
# PARENT
printf
(
"WELCOME TO PARENT
\
n
\
n
"
)
# DEBUG
sleep
(
2
)
# TODO error handling ; check if a wait can be made to wait for the child to perform execlp() (instead of the sleep)
global
scheduler
scheduler
=
Scheduler
()
...
...
@@ -302,9 +281,6 @@ cdef int start(const char *path_to_scan, const char *fb_exec_path, const char *f
dev_whitelist
.
append
(
p_dev
)
realpath
(
path_to_scan
,
resolved_scan_path
)
fputs
(
resolved_scan_path
,
stderr
)
# DEBUG
fputs
(
"
\
n
"
,
stderr
)
# DEBUG
fflush
(
stderr
)
# DEBUG
node
=
make_node
(
resolved_scan_path
,
resolved_scan_path
)
if
node
is
NULL
:
return
-
1
...
...
@@ -314,58 +290,26 @@ cdef int start(const char *path_to_scan, const char *fb_exec_path, const char *f
scheduler
.
finish
()
node
=
consume
active_node
#""" # DEBUG
realpath
(
log_path
,
resolved_log_path
)
fputs
(
resolved_log_path
,
stderr
)
# DEBUG
fputs
(
"
\
n
"
,
stderr
)
# DEBUG
fflush
(
stderr
)
# DEBUG
result
=
fopen
(
resolved_log_path
,
'w'
)
if
result
is
NULL
:
fprintf
(
stderr
,
'Error creating the log file.
\
n
'
)
# DEBUG
fprintf
(
stderr
,
'Error creating the log file.
\
n
'
)
fflush
(
stderr
)
return
-
1
fprintf
(
stderr
,
'Log opened successfully.
\
n
'
)
# DEBUG
fprintf
(
stderr
,
"WRITE_NOTE STAGE
\
n
\
n
"
)
# DEBUG
#fscanf(address_path, "%s", ip_address)
#fclose(address_path)
#fprintf(result, '{"mac_address": "%s"}\n', ip_address)
node
.
write_node
(
result
)
fprintf
(
result
,
'{}
\
n
'
)
fprintf
(
result
,
'fluentbit_end
\
n
'
)
fclose
(
result
)
#""" # DEBUG
del
scheduler
fprintf
(
stderr
,
"WAITING for fluent-bit to end
\
n
\
n
"
)
wait_error
=
wait
(
NULL
)
# TODO improve this call (error handling, etc.)
#wait_error = waitpid(child_pid, NULL, 1) # TODO improve this call (error handling, etc.)
fprintf
(
stderr
,
"WAITING ENDS
\
n
\
n
"
)
fflush
(
stderr
)
# DEBUG
return
0
cdef
public
int
main
(
int
argc
,
char
*
argv
[])
nogil
:
cdef
char
*
path_to_scan
=
"/"
cdef
char
*
fb_exec_path
=
"/sbin/fluent-bit"
cdef
char
*
fb_lib_path
=
"/lib/libfluentbit_wendelin.so"
cdef
char
*
fb_conf_path
=
"/etc/flb.conf"
cdef
char
*
log_path
=
"/var/log/metadata_collect.log"
if
argc
>=
2
:
path_to_scan
=
<
char
*>
argv
[
1
]
if
argc
>=
3
:
fb_exec_path
=
<
char
*>
argv
[
2
]
if
argc
>=
4
:
fb_lib_path
=
<
char
*>
argv
[
3
]
if
argc
>=
5
:
fb_conf_path
=
<
char
*>
argv
[
4
]
if
argc
>=
6
:
log_path
=
<
char
*>
argv
[
5
]
log_path
=
<
char
*>
argv
[
2
]
fputs
(
path_to_scan
,
stderr
)
return
start
(
<
char
*>
path_to_scan
,
<
char
*>
fb_exec_path
,
<
char
*>
fb_lib_path
,
<
char
*>
fb_conf_path
,
<
char
*>
log_path
)
#def python_main():
# start(<char*>'.')
return
start
(
<
char
*>
path_to_scan
,
<
char
*>
log_path
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment