Commit 3d4df09b authored by Ophélie Gagnard's avatar Ophélie Gagnard

src/main.*: Improve arguments handling.

parent 87d20032
......@@ -6234,8 +6234,8 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* #cdef char ip_address[100]
* #cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r")
* if child_pid == 0: # CHILD # <<<<<<<<<<<<<<
* 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)
* 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) {
......@@ -6243,14 +6243,59 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
/* "main.pyx":284
* #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":285
* 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":286
* 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":287
* 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":288
* 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":289
* 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":285
* if child_pid == 0: # CHILD
/* "main.pyx":290
* 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
......@@ -6262,13 +6307,13 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
* #cdef char ip_address[100]
* #cdef FILE *address_path = fopen("/sys/class/net/ens3/address", "r")
* if child_pid == 0: # CHILD # <<<<<<<<<<<<<<
* 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)
* 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":287
/* "main.pyx":292
* fprintf(stderr, "ERROR with execlp() in CHILD: %d\n", err)
* else: # PARENT
* printf("WELCOME TO PARENT\n\n") # DEBUG # <<<<<<<<<<<<<<
......@@ -6278,7 +6323,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
/*else*/ {
(void)(printf(((char const *)"WELCOME TO PARENT\n\n")));
/* "main.pyx":289
/* "main.pyx":294
* 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) # <<<<<<<<<<<<<<
......@@ -6287,7 +6332,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(sleep(2));
/* "main.pyx":292
/* "main.pyx":297
*
* global scheduler
* scheduler = Scheduler() # <<<<<<<<<<<<<<
......@@ -6300,7 +6345,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_v_4main_scheduler = __pyx_t_2;
__pyx_t_2 = 0;
/* "main.pyx":294
/* "main.pyx":299
* scheduler = Scheduler()
*
* ignore_paths = cyplist[string]() # <<<<<<<<<<<<<<
......@@ -6313,7 +6358,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_v_ignore_paths = __pyx_t_3;
__pyx_t_3 = 0;
/* "main.pyx":295
/* "main.pyx":300
*
* ignore_paths = cyplist[string]()
* ignore_paths.append(b'/opt/slapgrid') # <<<<<<<<<<<<<<
......@@ -6321,9 +6366,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, 295, __pyx_L1_error)
__pyx_t_4 = __pyx_v_ignore_paths->append(__pyx_k_opt_slapgrid); if (unlikely(__pyx_t_4.is_error())) __PYX_ERR(0, 300, __pyx_L1_error)
/* "main.pyx":296
/* "main.pyx":301
* ignore_paths = cyplist[string]()
* ignore_paths.append(b'/opt/slapgrid')
* ignore_paths.append(b'/srv/slapgrid') # <<<<<<<<<<<<<<
......@@ -6331,9 +6376,9 @@ 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, 296, __pyx_L1_error)
__pyx_t_4 = __pyx_v_ignore_paths->append(__pyx_k_srv_slapgrid); if (unlikely(__pyx_t_4.is_error())) __PYX_ERR(0, 301, __pyx_L1_error)
/* "main.pyx":298
/* "main.pyx":303
* ignore_paths.append(b'/srv/slapgrid')
*
* dev_whitelist_paths = cyplist[string]() # <<<<<<<<<<<<<<
......@@ -6346,7 +6391,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_v_dev_whitelist_paths = __pyx_t_3;
__pyx_t_3 = 0;
/* "main.pyx":299
/* "main.pyx":304
*
* dev_whitelist_paths = cyplist[string]()
* dev_whitelist_paths.append(b'.') # <<<<<<<<<<<<<<
......@@ -6354,9 +6399,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, 299, __pyx_L1_error)
__pyx_t_4 = __pyx_v_dev_whitelist_paths->append(__pyx_k_); if (unlikely(__pyx_t_4.is_error())) __PYX_ERR(0, 304, __pyx_L1_error)
/* "main.pyx":300
/* "main.pyx":305
* dev_whitelist_paths = cyplist[string]()
* dev_whitelist_paths.append(b'.')
* dev_whitelist_paths.append(b'/') # <<<<<<<<<<<<<<
......@@ -6364,9 +6409,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, 300, __pyx_L1_error)
__pyx_t_4 = __pyx_v_dev_whitelist_paths->append(__pyx_k__2); if (unlikely(__pyx_t_4.is_error())) __PYX_ERR(0, 305, __pyx_L1_error)
/* "main.pyx":301
/* "main.pyx":306
* dev_whitelist_paths.append(b'.')
* dev_whitelist_paths.append(b'/')
* dev_whitelist_paths.append(b'/boot/efi') # <<<<<<<<<<<<<<
......@@ -6374,9 +6419,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, 301, __pyx_L1_error)
__pyx_t_4 = __pyx_v_dev_whitelist_paths->append(__pyx_k_boot_efi); if (unlikely(__pyx_t_4.is_error())) __PYX_ERR(0, 306, __pyx_L1_error)
/* "main.pyx":302
/* "main.pyx":307
* dev_whitelist_paths.append(b'/')
* dev_whitelist_paths.append(b'/boot/efi')
* dev_whitelist_paths.append(b'/root') # <<<<<<<<<<<<<<
......@@ -6384,9 +6429,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, 302, __pyx_L1_error)
__pyx_t_4 = __pyx_v_dev_whitelist_paths->append(__pyx_k_root); if (unlikely(__pyx_t_4.is_error())) __PYX_ERR(0, 307, __pyx_L1_error)
/* "main.pyx":303
/* "main.pyx":308
* dev_whitelist_paths.append(b'/boot/efi')
* dev_whitelist_paths.append(b'/root')
* dev_whitelist_paths.append(b'/sysroot') # <<<<<<<<<<<<<<
......@@ -6394,9 +6439,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, 303, __pyx_L1_error)
__pyx_t_4 = __pyx_v_dev_whitelist_paths->append(__pyx_k_sysroot); if (unlikely(__pyx_t_4.is_error())) __PYX_ERR(0, 308, __pyx_L1_error)
/* "main.pyx":304
/* "main.pyx":309
* dev_whitelist_paths.append(b'/root')
* dev_whitelist_paths.append(b'/sysroot')
* dev_whitelist_paths.append(path_to_scan) # <<<<<<<<<<<<<<
......@@ -6404,9 +6449,9 @@ 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, 304, __pyx_L1_error)
__pyx_t_4 = __pyx_v_dev_whitelist_paths->append(__pyx_v_path_to_scan); if (unlikely(__pyx_t_4.is_error())) __PYX_ERR(0, 309, __pyx_L1_error)
/* "main.pyx":306
/* "main.pyx":311
* dev_whitelist_paths.append(path_to_scan)
*
* dev_whitelist = cyplist[dev_t]() # <<<<<<<<<<<<<<
......@@ -6419,7 +6464,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_v_dev_whitelist = __pyx_t_5;
__pyx_t_5 = 0;
/* "main.pyx":307
/* "main.pyx":312
*
* dev_whitelist = cyplist[dev_t]()
* for p in dev_whitelist_paths: # <<<<<<<<<<<<<<
......@@ -6434,7 +6479,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
++__pyx_t_6;
__pyx_v_p = __PYX_STD_MOVE_IF_SUPPORTED(__pyx_t_7);
/* "main.pyx":308
/* "main.pyx":313
* dev_whitelist = cyplist[dev_t]()
* for p in dev_whitelist_paths:
* p_stat = Stat(p) # <<<<<<<<<<<<<<
......@@ -6447,7 +6492,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_v_p_stat = __pyx_t_8;
__pyx_t_8 = 0;
/* "main.pyx":309
/* "main.pyx":314
* for p in dev_whitelist_paths:
* p_stat = Stat(p)
* if p_stat is not NULL: # <<<<<<<<<<<<<<
......@@ -6458,7 +6503,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_t_1 = ((__pyx_v_p_stat != NULL) != 0);
if (__pyx_t_1) {
/* "main.pyx":310
/* "main.pyx":315
* p_stat = Stat(p)
* if p_stat is not NULL:
* p_dev = p_stat.st_data.st_dev # <<<<<<<<<<<<<<
......@@ -6469,7 +6514,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":311
/* "main.pyx":316
* if p_stat is not NULL:
* p_dev = p_stat.st_data.st_dev
* dev_whitelist.append(p_dev) # <<<<<<<<<<<<<<
......@@ -6477,9 +6522,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, 311, __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, 316, __pyx_L1_error)
/* "main.pyx":309
/* "main.pyx":314
* for p in dev_whitelist_paths:
* p_stat = Stat(p)
* if p_stat is not NULL: # <<<<<<<<<<<<<<
......@@ -6488,7 +6533,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
}
/* "main.pyx":307
/* "main.pyx":312
*
* dev_whitelist = cyplist[dev_t]()
* for p in dev_whitelist_paths: # <<<<<<<<<<<<<<
......@@ -6498,7 +6543,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
}
__pyx_t_6 = __pyx_v_dev_whitelist_paths->end();
/* "main.pyx":313
/* "main.pyx":318
* dev_whitelist.append(p_dev)
*
* realpath(path_to_scan, resolved_scan_path) # <<<<<<<<<<<<<<
......@@ -6507,7 +6552,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(realpath(__pyx_v_path_to_scan, __pyx_v_resolved_scan_path));
/* "main.pyx":314
/* "main.pyx":319
*
* realpath(path_to_scan, resolved_scan_path)
* fprintf(stderr, resolved_scan_path) # DEBUG # <<<<<<<<<<<<<<
......@@ -6516,7 +6561,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fprintf(stderr, __pyx_v_resolved_scan_path));
/* "main.pyx":315
/* "main.pyx":320
* realpath(path_to_scan, resolved_scan_path)
* fprintf(stderr, resolved_scan_path) # DEBUG
* fprintf(stderr, "\n") # DEBUG # <<<<<<<<<<<<<<
......@@ -6525,7 +6570,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fprintf(stderr, ((char const *)"\n")));
/* "main.pyx":316
/* "main.pyx":321
* fprintf(stderr, resolved_scan_path) # DEBUG
* fprintf(stderr, "\n") # DEBUG
* fflush(stderr) # DEBUG # <<<<<<<<<<<<<<
......@@ -6534,7 +6579,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fflush(stderr));
/* "main.pyx":317
/* "main.pyx":322
* fprintf(stderr, "\n") # DEBUG
* fflush(stderr) # DEBUG
* node = make_node(resolved_scan_path, resolved_scan_path) # <<<<<<<<<<<<<<
......@@ -6547,7 +6592,7 @@ 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":318
/* "main.pyx":323
* fflush(stderr) # DEBUG
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL: # <<<<<<<<<<<<<<
......@@ -6558,7 +6603,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_t_1 = ((__pyx_v_node == NULL) != 0);
if (__pyx_t_1) {
/* "main.pyx":319
/* "main.pyx":324
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL:
* return -1 # <<<<<<<<<<<<<<
......@@ -6568,7 +6613,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_r = -1;
goto __pyx_L0;
/* "main.pyx":318
/* "main.pyx":323
* fflush(stderr) # DEBUG
* node = make_node(resolved_scan_path, resolved_scan_path)
* if node is NULL: # <<<<<<<<<<<<<<
......@@ -6577,7 +6622,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
}
/* "main.pyx":321
/* "main.pyx":326
* return -1
*
* active_node = activate(consume node) # <<<<<<<<<<<<<<
......@@ -6594,7 +6639,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":322
/* "main.pyx":327
*
* active_node = activate(consume node)
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths) # <<<<<<<<<<<<<<
......@@ -6612,7 +6657,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, 322, __pyx_L1_error)
__PYX_ERR(0, 327, __pyx_L1_error)
}
__pyx_v_dev_whitelist = NULL;
Cy_GOTREF(__pyx_v_ignore_paths);
......@@ -6625,7 +6670,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, 322, __pyx_L1_error)
__PYX_ERR(0, 327, __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);
......@@ -6634,7 +6679,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":323
/* "main.pyx":328
* active_node = activate(consume node)
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
* scheduler.finish() # <<<<<<<<<<<<<<
......@@ -6644,7 +6689,7 @@ 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":324
/* "main.pyx":329
* active_node.build_node(NULL, consume dev_whitelist, consume ignore_paths)
* scheduler.finish()
* node = consume active_node # <<<<<<<<<<<<<<
......@@ -6661,14 +6706,14 @@ 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, 324, __pyx_L1_error)
__PYX_ERR(0, 329, __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":327
/* "main.pyx":332
*
* #""" # DEBUG
* realpath(log_path, resolved_log_path) # <<<<<<<<<<<<<<
......@@ -6677,7 +6722,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(realpath(__pyx_v_log_path, __pyx_v_resolved_log_path));
/* "main.pyx":328
/* "main.pyx":333
* #""" # DEBUG
* realpath(log_path, resolved_log_path)
* fprintf(stderr, resolved_log_path) # DEBUG # <<<<<<<<<<<<<<
......@@ -6686,7 +6731,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fprintf(stderr, __pyx_v_resolved_log_path));
/* "main.pyx":329
/* "main.pyx":334
* realpath(log_path, resolved_log_path)
* fprintf(stderr, resolved_log_path) # DEBUG
* fprintf(stderr, "\n") # DEBUG # <<<<<<<<<<<<<<
......@@ -6695,7 +6740,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fprintf(stderr, ((char const *)"\n")));
/* "main.pyx":330
/* "main.pyx":335
* fprintf(stderr, resolved_log_path) # DEBUG
* fprintf(stderr, "\n") # DEBUG
* fflush(stderr) # DEBUG # <<<<<<<<<<<<<<
......@@ -6704,7 +6749,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fflush(stderr));
/* "main.pyx":331
/* "main.pyx":336
* fprintf(stderr, "\n") # DEBUG
* fflush(stderr) # DEBUG
* result = fopen(resolved_log_path, 'w') # <<<<<<<<<<<<<<
......@@ -6713,7 +6758,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
__pyx_v_result = fopen(__pyx_v_resolved_log_path, ((char const *)"w"));
/* "main.pyx":332
/* "main.pyx":337
* fflush(stderr) # DEBUG
* result = fopen(resolved_log_path, 'w')
* if result is NULL: # <<<<<<<<<<<<<<
......@@ -6723,7 +6768,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_t_1 = ((__pyx_v_result == NULL) != 0);
if (__pyx_t_1) {
/* "main.pyx":333
/* "main.pyx":338
* result = fopen(resolved_log_path, 'w')
* if result is NULL:
* fprintf(stderr, 'Error creating the log file.\n') # DEBUG # <<<<<<<<<<<<<<
......@@ -6732,7 +6777,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fprintf(stderr, ((char const *)"Error creating the log file.\n")));
/* "main.pyx":334
/* "main.pyx":339
* if result is NULL:
* fprintf(stderr, 'Error creating the log file.\n') # DEBUG
* fflush(stderr) # <<<<<<<<<<<<<<
......@@ -6741,7 +6786,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fflush(stderr));
/* "main.pyx":335
/* "main.pyx":340
* fprintf(stderr, 'Error creating the log file.\n') # DEBUG
* fflush(stderr)
* return -1 # <<<<<<<<<<<<<<
......@@ -6751,7 +6796,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
__pyx_r = -1;
goto __pyx_L0;
/* "main.pyx":332
/* "main.pyx":337
* fflush(stderr) # DEBUG
* result = fopen(resolved_log_path, 'w')
* if result is NULL: # <<<<<<<<<<<<<<
......@@ -6760,7 +6805,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
}
/* "main.pyx":337
/* "main.pyx":342
* return -1
*
* fprintf(stderr, 'Log opened successfully.\n') # DEBUG # <<<<<<<<<<<<<<
......@@ -6769,7 +6814,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fprintf(stderr, ((char const *)"Log opened successfully.\n")));
/* "main.pyx":339
/* "main.pyx":344
* fprintf(stderr, 'Log opened successfully.\n') # DEBUG
*
* fprintf(stderr, "WRITE_NOTE STAGE\n\n") # DEBUG # <<<<<<<<<<<<<<
......@@ -6778,7 +6823,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fprintf(stderr, ((char const *)"WRITE_NOTE STAGE\n\n")));
/* "main.pyx":344
/* "main.pyx":349
* #fclose(address_path)
* #fprintf(result, '{"mac_address": "%s"}\n', ip_address)
* node.write_node(result) # <<<<<<<<<<<<<<
......@@ -6788,7 +6833,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
Cy_GOTREF(__pyx_v_node);
__pyx_v_node->write_node(__pyx_v_result);
/* "main.pyx":345
/* "main.pyx":350
* #fprintf(result, '{"mac_address": "%s"}\n', ip_address)
* node.write_node(result)
* fprintf(result, '{}\n') # <<<<<<<<<<<<<<
......@@ -6797,7 +6842,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fprintf(__pyx_v_result, ((char const *)"{}\n")));
/* "main.pyx":346
/* "main.pyx":351
* node.write_node(result)
* fprintf(result, '{}\n')
* fprintf(result, 'fluentbit_end\n') # <<<<<<<<<<<<<<
......@@ -6806,7 +6851,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fprintf(__pyx_v_result, ((char const *)"fluentbit_end\n")));
/* "main.pyx":348
/* "main.pyx":353
* fprintf(result, 'fluentbit_end\n')
*
* fclose(result) # <<<<<<<<<<<<<<
......@@ -6815,7 +6860,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fclose(__pyx_v_result));
/* "main.pyx":350
/* "main.pyx":355
* fclose(result)
* #""" # DEBUG
* del scheduler # <<<<<<<<<<<<<<
......@@ -6825,7 +6870,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
Cy_GOTREF(__pyx_v_4main_scheduler);
Cy_XDECREF(__pyx_v_4main_scheduler); __pyx_v_4main_scheduler = NULL;
/* "main.pyx":352
/* "main.pyx":357
* del scheduler
*
* fprintf(stderr, "WAITING for fluent-bit to end\n\n") # <<<<<<<<<<<<<<
......@@ -6834,7 +6879,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fprintf(stderr, ((char const *)"WAITING for fluent-bit to end\n\n")));
/* "main.pyx":353
/* "main.pyx":358
*
* fprintf(stderr, "WAITING for fluent-bit to end\n\n")
* wait_error = wait(NULL) # TODO improve this call (error handling, etc.) # <<<<<<<<<<<<<<
......@@ -6843,7 +6888,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
__pyx_v_wait_error = wait(NULL);
/* "main.pyx":355
/* "main.pyx":360
* 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") # <<<<<<<<<<<<<<
......@@ -6852,7 +6897,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fprintf(stderr, ((char const *)"WAITING ENDS\n\n")));
/* "main.pyx":356
/* "main.pyx":361
* #wait_error = waitpid(child_pid, NULL, 1) # TODO improve this call (error handling, etc.)
* fprintf(stderr, "WAITING ENDS\n\n")
* fflush(stderr) # DEBUG # <<<<<<<<<<<<<<
......@@ -6861,7 +6906,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
*/
(void)(fflush(stderr));
/* "main.pyx":358
/* "main.pyx":363
* fflush(stderr) # DEBUG
*
* return 0 # <<<<<<<<<<<<<<
......@@ -6903,7 +6948,7 @@ static int __pyx_f_4main_start(char const *__pyx_v_path_to_scan, char const *__p
return __pyx_r;
}
/* "main.pyx":360
/* "main.pyx":365
* return 0
*
* cdef public int main(int argc, char* argv[]) nogil: # <<<<<<<<<<<<<<
......@@ -6918,8 +6963,9 @@ int main(int __pyx_v_argc, char **__pyx_v_argv) {
char *__pyx_v_fb_conf_path;
char *__pyx_v_log_path;
int __pyx_r;
int __pyx_t_1;
/* "main.pyx":361
/* "main.pyx":366
*
* cdef public int main(int argc, char* argv[]) nogil:
* cdef char* path_to_scan = "/" # <<<<<<<<<<<<<<
......@@ -6928,7 +6974,7 @@ int main(int __pyx_v_argc, char **__pyx_v_argv) {
*/
__pyx_v_path_to_scan = ((char *)"/");
/* "main.pyx":362
/* "main.pyx":367
* cdef public int main(int argc, char* argv[]) nogil:
* cdef char* path_to_scan = "/"
* cdef char* fb_exec_path = "/sbin/fluent-bit" # <<<<<<<<<<<<<<
......@@ -6937,7 +6983,7 @@ int main(int __pyx_v_argc, char **__pyx_v_argv) {
*/
__pyx_v_fb_exec_path = ((char *)"/sbin/fluent-bit");
/* "main.pyx":363
/* "main.pyx":368
* cdef char* path_to_scan = "/"
* cdef char* fb_exec_path = "/sbin/fluent-bit"
* cdef char* fb_lib_path = "/etc/fluentbit_wendelin.so" # <<<<<<<<<<<<<<
......@@ -6946,111 +6992,166 @@ int main(int __pyx_v_argc, char **__pyx_v_argv) {
*/
__pyx_v_fb_lib_path = ((char *)"/etc/fluentbit_wendelin.so");
/* "main.pyx":364
/* "main.pyx":369
* cdef char* fb_exec_path = "/sbin/fluent-bit"
* cdef char* fb_lib_path = "/etc/fluentbit_wendelin.so"
* cdef char* fb_conf_path = "/etc/flb.conf" # <<<<<<<<<<<<<<
* cdef char* log_path = "/var/log/metadata_collect.log"
* if argc == 2:
* if argc >= 2:
*/
__pyx_v_fb_conf_path = ((char *)"/etc/flb.conf");
/* "main.pyx":365
/* "main.pyx":370
* cdef char* fb_lib_path = "/etc/fluentbit_wendelin.so"
* cdef char* fb_conf_path = "/etc/flb.conf"
* cdef char* log_path = "/var/log/metadata_collect.log" # <<<<<<<<<<<<<<
* if argc == 2:
* if argc >= 2:
* path_to_scan = <char*>argv[1]
*/
__pyx_v_log_path = ((char *)"/var/log/metadata_collect.log");
/* "main.pyx":366
/* "main.pyx":371
* cdef char* fb_conf_path = "/etc/flb.conf"
* cdef char* log_path = "/var/log/metadata_collect.log"
* if argc == 2: # <<<<<<<<<<<<<<
* if argc >= 2: # <<<<<<<<<<<<<<
* path_to_scan = <char*>argv[1]
* elif argc == 6:
* if argc >= 3:
*/
switch (__pyx_v_argc) {
case 2:
__pyx_t_1 = ((__pyx_v_argc >= 2) != 0);
if (__pyx_t_1) {
/* "main.pyx":367
/* "main.pyx":372
* cdef char* log_path = "/var/log/metadata_collect.log"
* if argc == 2:
* if argc >= 2:
* path_to_scan = <char*>argv[1] # <<<<<<<<<<<<<<
* elif argc == 6:
* path_to_scan = <char*>argv[1]
* if argc >= 3:
* fb_exec_path = <char*>argv[2]
*/
__pyx_v_path_to_scan = ((char *)(__pyx_v_argv[1]));
/* "main.pyx":366
/* "main.pyx":371
* cdef char* fb_conf_path = "/etc/flb.conf"
* cdef char* log_path = "/var/log/metadata_collect.log"
* if argc == 2: # <<<<<<<<<<<<<<
* if argc >= 2: # <<<<<<<<<<<<<<
* path_to_scan = <char*>argv[1]
* elif argc == 6:
* if argc >= 3:
*/
break;
case 6:
}
/* "main.pyx":369
/* "main.pyx":373
* if argc >= 2:
* path_to_scan = <char*>argv[1]
* elif argc == 6:
* path_to_scan = <char*>argv[1] # <<<<<<<<<<<<<<
* if argc >= 3: # <<<<<<<<<<<<<<
* fb_exec_path = <char*>argv[2]
* fb_lib_path = <char*>argv[3]
* if argc >= 4:
*/
__pyx_v_path_to_scan = ((char *)(__pyx_v_argv[1]));
__pyx_t_1 = ((__pyx_v_argc >= 3) != 0);
if (__pyx_t_1) {
/* "main.pyx":370
* elif argc == 6:
/* "main.pyx":374
* path_to_scan = <char*>argv[1]
* if argc >= 3:
* fb_exec_path = <char*>argv[2] # <<<<<<<<<<<<<<
* if argc >= 4:
* fb_lib_path = <char*>argv[3]
* fb_conf_path = <char*>argv[4]
*/
__pyx_v_fb_exec_path = ((char *)(__pyx_v_argv[2]));
/* "main.pyx":371
/* "main.pyx":373
* if argc >= 2:
* path_to_scan = <char*>argv[1]
* if argc >= 3: # <<<<<<<<<<<<<<
* fb_exec_path = <char*>argv[2]
* if argc >= 4:
*/
}
/* "main.pyx":375
* 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":376
* fb_exec_path = <char*>argv[2]
* if argc >= 4:
* fb_lib_path = <char*>argv[3] # <<<<<<<<<<<<<<
* if argc >= 5:
* fb_conf_path = <char*>argv[4]
* log_path = <char*>argv[5]
*/
__pyx_v_fb_lib_path = ((char *)(__pyx_v_argv[3]));
/* "main.pyx":372
/* "main.pyx":375
* if argc >= 3:
* fb_exec_path = <char*>argv[2]
* if argc >= 4: # <<<<<<<<<<<<<<
* fb_lib_path = <char*>argv[3]
* if argc >= 5:
*/
}
/* "main.pyx":377
* 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":378
* fb_lib_path = <char*>argv[3]
* if argc >= 5:
* fb_conf_path = <char*>argv[4] # <<<<<<<<<<<<<<
* if argc >=6:
* log_path = <char*>argv[5]
* return start(<char*>path_to_scan, <char*>fb_exec_path, <char*>fb_lib_path, <char*>fb_conf_path, <char*>log_path)
*/
__pyx_v_fb_conf_path = ((char *)(__pyx_v_argv[4]));
/* "main.pyx":373
/* "main.pyx":377
* if argc >= 4:
* fb_lib_path = <char*>argv[3]
* if argc >= 5: # <<<<<<<<<<<<<<
* fb_conf_path = <char*>argv[4]
* if argc >=6:
*/
}
/* "main.pyx":379
* if argc >= 5:
* fb_conf_path = <char*>argv[4]
* if argc >=6: # <<<<<<<<<<<<<<
* log_path = <char*>argv[5]
* return start(<char*>path_to_scan, <char*>fb_exec_path, <char*>fb_lib_path, <char*>fb_conf_path, <char*>log_path)
*/
__pyx_t_1 = ((__pyx_v_argc >= 6) != 0);
if (__pyx_t_1) {
/* "main.pyx":380
* fb_conf_path = <char*>argv[4]
* if argc >=6:
* log_path = <char*>argv[5] # <<<<<<<<<<<<<<
* 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":368
* if argc == 2:
* path_to_scan = <char*>argv[1]
* elif argc == 6: # <<<<<<<<<<<<<<
* path_to_scan = <char*>argv[1]
* fb_exec_path = <char*>argv[2]
/* "main.pyx":379
* if argc >= 5:
* fb_conf_path = <char*>argv[4]
* if argc >=6: # <<<<<<<<<<<<<<
* log_path = <char*>argv[5]
* return start(<char*>path_to_scan, <char*>fb_exec_path, <char*>fb_lib_path, <char*>fb_conf_path, <char*>log_path)
*/
break;
default: break;
}
/* "main.pyx":374
* fb_conf_path = <char*>argv[4]
/* "main.pyx":381
* if argc >=6:
* log_path = <char*>argv[5]
* return start(<char*>path_to_scan, <char*>fb_exec_path, <char*>fb_lib_path, <char*>fb_conf_path, <char*>log_path) # <<<<<<<<<<<<<<
*
......@@ -7059,7 +7160,7 @@ int main(int __pyx_v_argc, char **__pyx_v_argv) {
__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));
goto __pyx_L0;
/* "main.pyx":360
/* "main.pyx":365
* return 0
*
* cdef public int main(int argc, char* argv[]) nogil: # <<<<<<<<<<<<<<
......
......@@ -281,6 +281,11 @@ cdef int start(const char *path_to_scan, const char *fb_exec_path, const char *f
#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
......@@ -363,13 +368,15 @@ cdef public int main(int argc, char* argv[]) nogil:
cdef char* fb_lib_path = "/etc/fluentbit_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]
elif argc == 6:
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]
return start(<char*>path_to_scan, <char*>fb_exec_path, <char*>fb_lib_path, <char*>fb_conf_path, <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