Commit dd7caf01 authored by Ophélie Gagnard's avatar Ophélie Gagnard

src: Do not run fluent-bit anymore.

Clean up.
parent 42085b4a
......@@ -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,750 +6095,473 @@ 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() # <<<<<<<<<<<<<<
* global scheduler
* scheduler = Scheduler() # <<<<<<<<<<<<<<
*
* ignore_paths = cyplist[string]()
* 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);
Cy_XDECREF(__pyx_v_4main_scheduler);
__pyx_v_4main_scheduler = __pyx_t_2;
__pyx_t_2 = 0;
__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_1;
__pyx_t_1 = 0;
/* "main.pyx":285
* scheduler = Scheduler()
/* "main.pyx":264
* scheduler = Scheduler()
*
* ignore_paths = cyplist[string]() # <<<<<<<<<<<<<<
* ignore_paths.append(b'/opt/slapgrid')
* ignore_paths.append(b'/srv/slapgrid')
* 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);
Cy_XDECREF(__pyx_v_ignore_paths);
__pyx_v_ignore_paths = __pyx_t_3;
__pyx_t_3 = 0;
__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_2;
__pyx_t_2 = 0;
/* "main.pyx":286
/* "main.pyx":265
*
* ignore_paths = cyplist[string]()
* ignore_paths.append(b'/opt/slapgrid') # <<<<<<<<<<<<<<
* ignore_paths.append(b'/srv/slapgrid')
* ignore_paths = cyplist[string]()
* ignore_paths.append(b'/opt/slapgrid') # <<<<<<<<<<<<<<
* ignore_paths.append(b'/srv/slapgrid')
*
*/
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)
Cy_GOTREF(__pyx_v_ignore_paths);
__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
* ignore_paths = cyplist[string]()
* ignore_paths.append(b'/opt/slapgrid')
* ignore_paths.append(b'/srv/slapgrid') # <<<<<<<<<<<<<<
/* "main.pyx":266
* ignore_paths = cyplist[string]()
* ignore_paths.append(b'/opt/slapgrid')
* ignore_paths.append(b'/srv/slapgrid') # <<<<<<<<<<<<<<
*
* dev_whitelist_paths = cyplist[string]()
* 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)
Cy_GOTREF(__pyx_v_ignore_paths);
__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
* ignore_paths.append(b'/srv/slapgrid')
/* "main.pyx":268
* ignore_paths.append(b'/srv/slapgrid')
*
* dev_whitelist_paths = cyplist[string]() # <<<<<<<<<<<<<<
* dev_whitelist_paths.append(b'.')
* dev_whitelist_paths.append(b'/')
* 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);
Cy_XDECREF(__pyx_v_dev_whitelist_paths);
__pyx_v_dev_whitelist_paths = __pyx_t_3;
__pyx_t_3 = 0;
__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_2;
__pyx_t_2 = 0;
/* "main.pyx":290
/* "main.pyx":269
*
* dev_whitelist_paths = cyplist[string]()
* dev_whitelist_paths.append(b'.') # <<<<<<<<<<<<<<
* dev_whitelist_paths.append(b'/')
* dev_whitelist_paths.append(b'/boot/efi')
* dev_whitelist_paths = cyplist[string]()
* dev_whitelist_paths.append(b'.') # <<<<<<<<<<<<<<
* dev_whitelist_paths.append(b'/')
* 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)
Cy_GOTREF(__pyx_v_dev_whitelist_paths);
__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
* dev_whitelist_paths = cyplist[string]()
* dev_whitelist_paths.append(b'.')
* dev_whitelist_paths.append(b'/') # <<<<<<<<<<<<<<
* dev_whitelist_paths.append(b'/boot/efi')
* dev_whitelist_paths.append(b'/root')
/* "main.pyx":270
* dev_whitelist_paths = cyplist[string]()
* dev_whitelist_paths.append(b'.')
* dev_whitelist_paths.append(b'/') # <<<<<<<<<<<<<<
* dev_whitelist_paths.append(b'/boot/efi')
* 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)
Cy_GOTREF(__pyx_v_dev_whitelist_paths);
__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
* dev_whitelist_paths.append(b'.')
* dev_whitelist_paths.append(b'/')
* dev_whitelist_paths.append(b'/boot/efi') # <<<<<<<<<<<<<<
* dev_whitelist_paths.append(b'/root')
* dev_whitelist_paths.append(b'/sysroot')
/* "main.pyx":271
* dev_whitelist_paths.append(b'.')
* dev_whitelist_paths.append(b'/')
* dev_whitelist_paths.append(b'/boot/efi') # <<<<<<<<<<<<<<
* dev_whitelist_paths.append(b'/root')
* 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)
Cy_GOTREF(__pyx_v_dev_whitelist_paths);
__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
* dev_whitelist_paths.append(b'/')
* dev_whitelist_paths.append(b'/boot/efi')
* dev_whitelist_paths.append(b'/root') # <<<<<<<<<<<<<<
* dev_whitelist_paths.append(b'/sysroot')
* dev_whitelist_paths.append(path_to_scan)
/* "main.pyx":272
* dev_whitelist_paths.append(b'/')
* dev_whitelist_paths.append(b'/boot/efi')
* dev_whitelist_paths.append(b'/root') # <<<<<<<<<<<<<<
* dev_whitelist_paths.append(b'/sysroot')
* 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)
Cy_GOTREF(__pyx_v_dev_whitelist_paths);
__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
* dev_whitelist_paths.append(b'/boot/efi')
* dev_whitelist_paths.append(b'/root')
* dev_whitelist_paths.append(b'/sysroot') # <<<<<<<<<<<<<<
* dev_whitelist_paths.append(path_to_scan)
/* "main.pyx":273
* dev_whitelist_paths.append(b'/boot/efi')
* dev_whitelist_paths.append(b'/root')
* dev_whitelist_paths.append(b'/sysroot') # <<<<<<<<<<<<<<
* 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_sysroot); if (unlikely(__pyx_t_4.is_error())) __PYX_ERR(0, 294, __pyx_L1_error)
Cy_GOTREF(__pyx_v_dev_whitelist_paths);
__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
* dev_whitelist_paths.append(b'/root')
* dev_whitelist_paths.append(b'/sysroot')
* dev_whitelist_paths.append(path_to_scan) # <<<<<<<<<<<<<<
/* "main.pyx":274
* dev_whitelist_paths.append(b'/root')
* dev_whitelist_paths.append(b'/sysroot')
* dev_whitelist_paths.append(path_to_scan) # <<<<<<<<<<<<<<
*
* dev_whitelist = cyplist[dev_t]()
* 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)
Cy_GOTREF(__pyx_v_dev_whitelist_paths);
__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
* dev_whitelist_paths.append(path_to_scan)
/* "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)
* 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);
Cy_XDECREF(__pyx_v_dev_whitelist);
__pyx_v_dev_whitelist = __pyx_t_5;
__pyx_t_5 = 0;
__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_4;
__pyx_t_4 = 0;
/* "main.pyx":298
/* "main.pyx":277
*
* dev_whitelist = cyplist[dev_t]()
* for p in dev_whitelist_paths: # <<<<<<<<<<<<<<
* p_stat = Stat(p)
* if p_stat is not NULL:
*/
Cy_GOTREF(__pyx_v_dev_whitelist_paths);
__pyx_t_6 = __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);
/* "main.pyx":299
* 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);
Cy_XDECREF(__pyx_v_p_stat);
__pyx_v_p_stat = __pyx_t_8;
__pyx_t_8 = 0;
/* "main.pyx":300
* for p in dev_whitelist_paths:
* p_stat = Stat(p)
* if p_stat is not NULL: # <<<<<<<<<<<<<<
* p_dev = p_stat.st_data.st_dev
* dev_whitelist.append(p_dev)
* dev_whitelist = cyplist[dev_t]()
* for p in dev_whitelist_paths: # <<<<<<<<<<<<<<
* p_stat = Stat(p)
* if p_stat is not NULL:
*/
Cy_GOTREF(__pyx_v_p_stat);
__pyx_t_1 = ((__pyx_v_p_stat != NULL) != 0);
if (__pyx_t_1) {
Cy_GOTREF(__pyx_v_dev_whitelist_paths);
__pyx_t_5 = __pyx_v_dev_whitelist_paths->begin();
for (;;) {
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":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_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_7;
__pyx_t_7 = 0;
/* "main.pyx":301
* p_stat = Stat(p)
* if p_stat is not NULL:
* p_dev = p_stat.st_data.st_dev # <<<<<<<<<<<<<<
* dev_whitelist.append(p_dev)
*
/* "main.pyx":279
* for p in dev_whitelist_paths:
* p_stat = Stat(p)
* if p_stat is not NULL: # <<<<<<<<<<<<<<
* p_dev = p_stat.st_data.st_dev
* dev_whitelist.append(p_dev)
*/
Cy_GOTREF(__pyx_v_p_stat);
__pyx_t_9 = __pyx_v_p_stat->st_data.st_dev;
__pyx_v_p_dev = __pyx_t_9;
Cy_GOTREF(__pyx_v_p_stat);
__pyx_t_8 = ((__pyx_v_p_stat != NULL) != 0);
if (__pyx_t_8) {
/* "main.pyx":302
* if p_stat is not NULL:
* p_dev = p_stat.st_data.st_dev
* dev_whitelist.append(p_dev) # <<<<<<<<<<<<<<
/* "main.pyx":280
* p_stat = Stat(p)
* if p_stat is not NULL:
* p_dev = p_stat.st_data.st_dev # <<<<<<<<<<<<<<
* dev_whitelist.append(p_dev)
*
* 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)
Cy_GOTREF(__pyx_v_p_stat);
__pyx_t_9 = __pyx_v_p_stat->st_data.st_dev;
__pyx_v_p_dev = __pyx_t_9;
/* "main.pyx":300
* for p in dev_whitelist_paths:
* p_stat = Stat(p)
* if p_stat is not NULL: # <<<<<<<<<<<<<<
* p_dev = p_stat.st_data.st_dev
* dev_whitelist.append(p_dev)
/* "main.pyx":281
* if p_stat is not NULL:
* p_dev = p_stat.st_data.st_dev
* dev_whitelist.append(p_dev) # <<<<<<<<<<<<<<
*
* 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, 281, __pyx_L1_error)
/* "main.pyx":298
*
* dev_whitelist = cyplist[dev_t]()
* for p in dev_whitelist_paths: # <<<<<<<<<<<<<<
* p_stat = Stat(p)
* if p_stat is not NULL:
/* "main.pyx":279
* for p in dev_whitelist_paths:
* p_stat = Stat(p)
* if p_stat is not NULL: # <<<<<<<<<<<<<<
* p_dev = p_stat.st_data.st_dev
* dev_whitelist.append(p_dev)
*/
}
__pyx_t_6 = __pyx_v_dev_whitelist_paths->end();
/* "main.pyx":304
* dev_whitelist.append(p_dev)
/* "main.pyx":277
*
* realpath(path_to_scan, resolved_scan_path) # <<<<<<<<<<<<<<
* fputs(resolved_scan_path, stderr) # DEBUG
* fputs("\n", stderr) # DEBUG
* dev_whitelist = cyplist[dev_t]()
* for p in dev_whitelist_paths: # <<<<<<<<<<<<<<
* p_stat = Stat(p)
* if p_stat is not NULL:
*/
(void)(realpath(__pyx_v_path_to_scan, __pyx_v_resolved_scan_path));
}
__pyx_t_5 = __pyx_v_dev_whitelist_paths->end();
/* "main.pyx":305
/* "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
* 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)
* realpath(path_to_scan, resolved_scan_path) # <<<<<<<<<<<<<<
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL:
*/
(void)(fputs(((char const *)"\n"), stderr));
(void)(realpath(__pyx_v_path_to_scan, __pyx_v_resolved_scan_path));
/* "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
*/
__pyx_t_11 = __pyx_f_4main_make_node(__pyx_v_resolved_scan_path, __pyx_v_resolved_scan_path);
Cy_GOTREF(__pyx_t_11);
Cy_XDECREF(__pyx_v_node);
__pyx_v_node = __pyx_t_11;
__pyx_t_11 = 0;
/* "main.pyx":309
* fflush(stderr) # DEBUG
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL: # <<<<<<<<<<<<<<
* return -1
/* "main.pyx":284
*
* 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_11 = __pyx_f_4main_make_node(__pyx_v_resolved_scan_path, __pyx_v_resolved_scan_path);
Cy_GOTREF(__pyx_t_11);
Cy_XDECREF(__pyx_v_node);
__pyx_v_node = __pyx_t_11;
__pyx_t_11 = 0;
/* "main.pyx":310
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL:
* return -1 # <<<<<<<<<<<<<<
/* "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
*
* active_node = activate(consume node)
*/
__pyx_r = -1;
goto __pyx_L0;
Cy_GOTREF(__pyx_v_node);
__pyx_t_8 = ((__pyx_v_node == NULL) != 0);
if (__pyx_t_8) {
/* "main.pyx":309
* fflush(stderr) # DEBUG
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL: # <<<<<<<<<<<<<<
* return -1
/* "main.pyx":286
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL:
* return -1 # <<<<<<<<<<<<<<
*
* active_node = activate(consume node)
*/
}
/* "main.pyx":312
* return -1
*
* active_node = activate(consume node) # <<<<<<<<<<<<<<
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
* scheduler.finish()
*/
Cy_GOTREF(__pyx_v_node);
__pyx_t_11 = __pyx_v_node;
__pyx_v_node = NULL;
__pyx_t_12 = activate(__pyx_t_11);
Cy_GOTREF(__pyx_t_12);
__pyx_t_11 = 0;
Cy_XDECREF(__pyx_v_active_node);
__pyx_v_active_node = __pyx_t_12;
__pyx_t_12 = 0;
__pyx_r = -1;
goto __pyx_L0;
/* "main.pyx":313
/* "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
*
* active_node = activate(consume node)
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths) # <<<<<<<<<<<<<<
* scheduler.finish()
* node = consume active_node
*/
Cy_GOTREF(__pyx_v_active_node);
Cy_GOTREF(__pyx_v_dev_whitelist);
__pyx_t_13 = __pyx_v_dev_whitelist;
if (__pyx_t_13 != NULL && !__pyx_t_13->CyObject_iso()) {
#ifdef WITH_THREAD
PyGILState_STATE _save = PyGILState_Ensure();
#endif
PyErr_SetString(PyExc_TypeError, "'consume' operand is not isolated");
#ifdef WITH_THREAD
PyGILState_Release(_save);
#endif
__PYX_ERR(0, 313, __pyx_L1_error)
}
__pyx_v_dev_whitelist = NULL;
Cy_GOTREF(__pyx_v_ignore_paths);
__pyx_t_14 = __pyx_v_ignore_paths;
if (__pyx_t_14 != NULL && !__pyx_t_14->CyObject_iso()) {
#ifdef WITH_THREAD
PyGILState_STATE _save = PyGILState_Ensure();
#endif
PyErr_SetString(PyExc_TypeError, "'consume' operand is not isolated");
#ifdef WITH_THREAD
PyGILState_Release(_save);
#endif
__PYX_ERR(0, 313, __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);
Cy_GOTREF(__pyx_t_15);
__pyx_t_13 = 0;
__pyx_t_14 = 0;
Cy_XDECREF(__pyx_t_15); __pyx_t_15 = NULL;
}
/* "main.pyx":314
* active_node = activate(consume node)
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
* scheduler.finish() # <<<<<<<<<<<<<<
* node = consume active_node
/* "main.pyx":288
* return -1
*
* active_node = activate(consume node) # <<<<<<<<<<<<<<
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
* scheduler.finish()
*/
Cy_GOTREF(__pyx_v_4main_scheduler);
__pyx_v_4main_scheduler->finish();
Cy_GOTREF(__pyx_v_node);
__pyx_t_11 = __pyx_v_node;
__pyx_v_node = NULL;
__pyx_t_12 = activate(__pyx_t_11);
Cy_GOTREF(__pyx_t_12);
__pyx_t_11 = 0;
Cy_XDECREF(__pyx_v_active_node);
__pyx_v_active_node = __pyx_t_12;
__pyx_t_12 = 0;
/* "main.pyx":315
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
* scheduler.finish()
* node = consume active_node # <<<<<<<<<<<<<<
/* "main.pyx":289
*
* #""" # DEBUG
* active_node = activate(consume node)
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths) # <<<<<<<<<<<<<<
* scheduler.finish()
* node = consume active_node
*/
Cy_GOTREF(__pyx_v_active_node);
__pyx_t_11 = __pyx_v_active_node;
if (__pyx_t_11 != NULL && __pyx_t_11->CyObject_GETREF() != 1) {
#ifdef WITH_THREAD
PyGILState_STATE _save = PyGILState_Ensure();
#endif
PyErr_SetString(PyExc_TypeError, "'consume' operand is not isolated");
#ifdef WITH_THREAD
PyGILState_Release(_save);
#endif
__PYX_ERR(0, 315, __pyx_L1_error)
}
__pyx_v_active_node = NULL;
Cy_XDECREF(__pyx_v_node);
__pyx_v_node = __pyx_t_11;
__pyx_t_11 = 0;
Cy_GOTREF(__pyx_v_active_node);
Cy_GOTREF(__pyx_v_dev_whitelist);
__pyx_t_13 = __pyx_v_dev_whitelist;
if (__pyx_t_13 != NULL && !__pyx_t_13->CyObject_iso()) {
#ifdef WITH_THREAD
PyGILState_STATE _save = PyGILState_Ensure();
#endif
PyErr_SetString(PyExc_TypeError, "'consume' operand is not isolated");
#ifdef WITH_THREAD
PyGILState_Release(_save);
#endif
__PYX_ERR(0, 289, __pyx_L1_error)
}
__pyx_v_dev_whitelist = NULL;
Cy_GOTREF(__pyx_v_ignore_paths);
__pyx_t_14 = __pyx_v_ignore_paths;
if (__pyx_t_14 != NULL && !__pyx_t_14->CyObject_iso()) {
#ifdef WITH_THREAD
PyGILState_STATE _save = PyGILState_Ensure();
#endif
PyErr_SetString(PyExc_TypeError, "'consume' operand is not isolated");
#ifdef WITH_THREAD
PyGILState_Release(_save);
#endif
__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);
Cy_GOTREF(__pyx_t_15);
__pyx_t_13 = 0;
__pyx_t_14 = 0;
Cy_XDECREF(__pyx_t_15); __pyx_t_15 = NULL;
/* "main.pyx":318
/* "main.pyx":290
* active_node = activate(consume node)
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
* scheduler.finish() # <<<<<<<<<<<<<<
* 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));
/* "main.pyx":322
* 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
*/
__pyx_v_result = fopen(__pyx_v_resolved_log_path, ((char const *)"w"));
/* "main.pyx":323
* fflush(stderr) # DEBUG
* result = fopen(resolved_log_path, 'w')
* if result is NULL: # <<<<<<<<<<<<<<
* fprintf(stderr, 'Error creating the log file.\n') # DEBUG
* fflush(stderr)
*/
__pyx_t_1 = ((__pyx_v_result == NULL) != 0);
if (__pyx_t_1) {
/* "main.pyx":324
* result = fopen(resolved_log_path, 'w')
* if result is NULL:
* fprintf(stderr, 'Error creating the log file.\n') # DEBUG # <<<<<<<<<<<<<<
* fflush(stderr)
* return -1
*/
(void)(fprintf(stderr, ((char const *)"Error creating the log file.\n")));
Cy_GOTREF(__pyx_v_4main_scheduler);
__pyx_v_4main_scheduler->finish();
/* "main.pyx":325
* if result is NULL:
* fprintf(stderr, 'Error creating the log file.\n') # DEBUG
* fflush(stderr) # <<<<<<<<<<<<<<
* return -1
/* "main.pyx":291
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
* scheduler.finish()
* node = consume active_node # <<<<<<<<<<<<<<
*
* realpath(log_path, resolved_log_path)
*/
(void)(fflush(stderr));
Cy_GOTREF(__pyx_v_active_node);
__pyx_t_11 = __pyx_v_active_node;
if (__pyx_t_11 != NULL && __pyx_t_11->CyObject_GETREF() != 1) {
#ifdef WITH_THREAD
PyGILState_STATE _save = PyGILState_Ensure();
#endif
PyErr_SetString(PyExc_TypeError, "'consume' operand is not isolated");
#ifdef WITH_THREAD
PyGILState_Release(_save);
#endif
__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":326
* fprintf(stderr, 'Error creating the log file.\n') # DEBUG
* fflush(stderr)
* return -1 # <<<<<<<<<<<<<<
/* "main.pyx":293
* node = consume active_node
*
* fprintf(stderr, 'Log opened successfully.\n') # DEBUG
* realpath(log_path, resolved_log_path) # <<<<<<<<<<<<<<
* result = fopen(resolved_log_path, 'w')
* if result is NULL:
*/
__pyx_r = -1;
goto __pyx_L0;
/* "main.pyx":323
* fflush(stderr) # DEBUG
* result = fopen(resolved_log_path, 'w')
* if result is NULL: # <<<<<<<<<<<<<<
* fprintf(stderr, 'Error creating the log file.\n') # DEBUG
* fflush(stderr)
*/
}
(void)(realpath(__pyx_v_log_path, __pyx_v_resolved_log_path));
/* "main.pyx":328
* return -1
/* "main.pyx":294
*
* fprintf(stderr, 'Log opened successfully.\n') # DEBUG # <<<<<<<<<<<<<<
*
* fprintf(stderr, "WRITE_NOTE STAGE\n\n") # DEBUG
* realpath(log_path, resolved_log_path)
* result = fopen(resolved_log_path, 'w') # <<<<<<<<<<<<<<
* if result is NULL:
* fprintf(stderr, 'Error creating the log file.\n')
*/
(void)(fprintf(stderr, ((char const *)"Log opened successfully.\n")));
__pyx_v_result = fopen(__pyx_v_resolved_log_path, ((char const *)"w"));
/* "main.pyx":330
* fprintf(stderr, 'Log opened successfully.\n') # DEBUG
*
* fprintf(stderr, "WRITE_NOTE STAGE\n\n") # DEBUG # <<<<<<<<<<<<<<
*
* #fscanf(address_path, "%s", ip_address)
/* "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')
* fflush(stderr)
*/
(void)(fprintf(stderr, ((char const *)"WRITE_NOTE STAGE\n\n")));
__pyx_t_8 = ((__pyx_v_result == NULL) != 0);
if (__pyx_t_8) {
/* "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')
/* "main.pyx":296
* result = fopen(resolved_log_path, 'w')
* if result is NULL:
* fprintf(stderr, 'Error creating the log file.\n') # <<<<<<<<<<<<<<
* fflush(stderr)
* return -1
*/
Cy_GOTREF(__pyx_v_node);
__pyx_v_node->write_node(__pyx_v_result);
(void)(fprintf(stderr, ((char const *)"Error creating the log file.\n")));
/* "main.pyx":336
* #fprintf(result, '{"mac_address": "%s"}\n', ip_address)
* node.write_node(result)
* fprintf(result, '{}\n') # <<<<<<<<<<<<<<
* fprintf(result, 'fluentbit_end\n')
/* "main.pyx":297
* if result is NULL:
* fprintf(stderr, 'Error creating the log file.\n')
* fflush(stderr) # <<<<<<<<<<<<<<
* return -1
*
*/
(void)(fprintf(__pyx_v_result, ((char const *)"{}\n")));
(void)(fflush(stderr));
/* "main.pyx":337
* node.write_node(result)
* fprintf(result, '{}\n')
* fprintf(result, 'fluentbit_end\n') # <<<<<<<<<<<<<<
/* "main.pyx":298
* fprintf(stderr, 'Error creating the log file.\n')
* fflush(stderr)
* return -1 # <<<<<<<<<<<<<<
*
* fclose(result)
* node.write_node(result)
*/
(void)(fprintf(__pyx_v_result, ((char const *)"fluentbit_end\n")));
__pyx_r = -1;
goto __pyx_L0;
/* "main.pyx":339
* fprintf(result, 'fluentbit_end\n')
*
* fclose(result) # <<<<<<<<<<<<<<
* #""" # DEBUG
* del scheduler
/* "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')
* fflush(stderr)
*/
(void)(fclose(__pyx_v_result));
}
/* "main.pyx":341
* fclose(result)
* #""" # DEBUG
* del scheduler # <<<<<<<<<<<<<<
/* "main.pyx":300
* return -1
*
* fprintf(stderr, "WAITING for fluent-bit to end\n\n")
*/
Cy_GOTREF(__pyx_v_4main_scheduler);
Cy_XDECREF(__pyx_v_4main_scheduler); __pyx_v_4main_scheduler = NULL;
/* "main.pyx":343
* del scheduler
* node.write_node(result) # <<<<<<<<<<<<<<
*
* 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.)
* fclose(result)
*/
(void)(fprintf(stderr, ((char const *)"WAITING for fluent-bit to end\n\n")));
Cy_GOTREF(__pyx_v_node);
__pyx_v_node->write_node(__pyx_v_result);
/* "main.pyx":344
/* "main.pyx":302
* node.write_node(result)
*
* 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
* fclose(result) # <<<<<<<<<<<<<<
* del scheduler
*
*/
(void)(fprintf(stderr, ((char const *)"WAITING ENDS\n\n")));
(void)(fclose(__pyx_v_result));
/* "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 # <<<<<<<<<<<<<<
/* "main.pyx":303
*
* return 0
* fclose(result)
* del scheduler # <<<<<<<<<<<<<<
*
* return 0
*/
(void)(fflush(stderr));
Cy_GOTREF(__pyx_v_4main_scheduler);
Cy_XDECREF(__pyx_v_4main_scheduler); __pyx_v_4main_scheduler = NULL;
/* "main.pyx":349
* fflush(stderr) # DEBUG
/* "main.pyx":305
* del scheduler
*
* return 0 # <<<<<<<<<<<<<<
* return 0 # <<<<<<<<<<<<<<
*
* cdef public int main(int argc, char* argv[]) nogil:
*/
__pyx_r = 0;
goto __pyx_L0;
}
__pyx_L3:;
__pyx_r = 0;
goto __pyx_L0;
/* "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":351
* return 0
/* "main.pyx":307
* 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":352
/* "main.pyx":308
*
* 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":353
/* "main.pyx":309
* 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":357
* cdef char* fb_conf_path = "/etc/flb.conf"
/* "main.pyx":310
* 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":358
/* "main.pyx":311
* 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":357
* cdef char* fb_conf_path = "/etc/flb.conf"
/* "main.pyx":310
* 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":359
/* "main.pyx":312
* 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":360
/* "main.pyx":313
* 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":359
/* "main.pyx":312
* 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":367
* if argc >=6:
* log_path = <char*>argv[5]
/* "main.pyx":314
* 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":368
* log_path = <char*>argv[5]
/* "main.pyx":315
* 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":351
* return 0
/* "main.pyx":307
* 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 */
......
......@@ -252,120 +252,64 @@ 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()
ignore_paths = cyplist[string]()
ignore_paths.append(b'/opt/slapgrid')
ignore_paths.append(b'/srv/slapgrid')
dev_whitelist_paths = cyplist[string]()
dev_whitelist_paths.append(b'.')
dev_whitelist_paths.append(b'/')
dev_whitelist_paths.append(b'/boot/efi')
dev_whitelist_paths.append(b'/root')
dev_whitelist_paths.append(b'/sysroot')
dev_whitelist_paths.append(path_to_scan)
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
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
active_node = activate(consume node)
active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
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
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
global scheduler
scheduler = Scheduler()
ignore_paths = cyplist[string]()
ignore_paths.append(b'/opt/slapgrid')
ignore_paths.append(b'/srv/slapgrid')
dev_whitelist_paths = cyplist[string]()
dev_whitelist_paths.append(b'.')
dev_whitelist_paths.append(b'/')
dev_whitelist_paths.append(b'/boot/efi')
dev_whitelist_paths.append(b'/root')
dev_whitelist_paths.append(b'/sysroot')
dev_whitelist_paths.append(path_to_scan)
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
dev_whitelist.append(p_dev)
realpath(path_to_scan, resolved_scan_path)
node = make_node(resolved_scan_path, resolved_scan_path)
if node is NULL:
return -1
active_node = activate(consume node)
active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
scheduler.finish()
node = consume active_node
realpath(log_path, resolved_log_path)
result = fopen(resolved_log_path, 'w')
if result is NULL:
fprintf(stderr, 'Error creating the log file.\n')
fflush(stderr)
return -1
node.write_node(result)
fclose(result)
del scheduler
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)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment