![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Macros | |
| #define | __n_assert(__ptr, __ret) |
| macro to assert things | |
| #define | _nstr(__PTR) |
| N_STR or "NULL" string for logging purposes. | |
| #define | _nstrp(__PTR) |
| N_STR or NULL pointer for testing purposes. | |
| #define | _str(__PTR) |
| define true | |
| #define | _strp(__PTR) |
| String or NULL pointer for testing purposes. | |
| #define | _strw(__PTR) |
| String or " " string for config purposes. | |
| #define | Alloca(__ptr, __size) |
| Malloca Handler to get errors and set to 0. | |
| #define | BYTEORDER_BIG_ENDIAN 1 |
| Big endian macro value. | |
| #define | BYTEORDER_LITTLE_ENDIAN 0 |
| Little endian macro value. | |
| #define | CALL_RETRY(__retvar, __expression, __max_tries) |
| TEMP_FAILURE gnu macro portable version. | |
| #define | checkerror() |
| check for errors | |
| #define | CONCAT(a, b) |
| Concatenate two macro. | |
| #define | CONCAT_BUILDER(a, b) |
| CONCAT macro helper. | |
| #define | DEFAULT 1000 |
| Default APP_STATUS Value. | |
| #define | endif |
| close a ifwhatever block | |
| #define | equal_if(__a, __cond, __b) |
| if( a , condition, b ) then a = b | |
| #define | FALL_THROUGH |
| set windows if true | |
| #define | FORCE_INLINE static inline __attribute__((always_inline)) |
| FORCE_INLINE portable macro. | |
| #define | Free(__ptr) |
| Free Handler to get errors. | |
| #define | FreeNoLog(__ptr) |
| Free Handler without log. | |
| #define | GET 4321 |
| Flag for GET something , passing as a function parameter. | |
| #define | get_error() |
| pop up errors if any | |
| #define | iffalse if( FALSE == |
| error checker type if( toto == FALSE ) | |
| #define | ifnull if( ! |
| error checker type if( !toto ) | |
| #define | iftrue if( TRUE == |
| error checker type if( toto == FALSE ) | |
| #define | ifzero if( 0 == |
| error checker type if( 0 != toto ) | |
| #define | init_error_check() |
| init error checking in a function | |
| #define | init_lock(__rwlock_mutex) |
| Macro for initializing a rwlock. | |
| #define | Malloc(__ptr, __struct, __size) |
| Malloc Handler to get errors and set to 0. | |
| #define | N_DAEMON_NO_CHDIR 64 |
| daemonize flag: do not call chdir("/") | |
| #define | N_DAEMON_NO_CLOSE 2 |
| daemonize flag: no descriptor close at all | |
| #define | N_DAEMON_NO_DOUBLE_FORK 8 |
| daemonize flag: do not double fork | |
| #define | N_DAEMON_NO_SETSID 16 |
| daemonize flag: do not call setsid | |
| #define | N_DAEMON_NO_SIGCHLD_HANDLER 256 |
| daemonize flag: do not use internal zombie SIGCHLD handler | |
| #define | N_DAEMON_NO_SIGCHLD_IGN 128 |
| daemonize flag: do not ignore SIGCHLD | |
| #define | N_DAEMON_NO_STD_REDIRECT 4 |
| daemonize flag: just do not redirect stdin/out/err to /dev/null | |
| #define | N_DAEMON_NO_UMASK 32 |
| daemonize flag: do not call umask( 0 ) | |
| #define | next_even(__val) |
| next even helper | |
| #define | next_odd(__val) |
| next odd helper | |
| #define | PAUSED 1004 |
| Value of the state of an application who is paused. | |
| #define | randomize() |
| Initialize the random sequence with time. | |
| #define | read_lock(__rwlock_mutex) |
| Macro for acquiring a read lock on a rwlock mutex. | |
| #define | Realloc(__ptr, __struct, __size) |
| Realloc Handler to get errors. | |
| #define | Reallocz(__ptr, __struct, __old_size, __size) |
| Realloc + zero new memory zone Handler to get errors. | |
| #define | RUNNING 1001 |
| Value of the state of an application who is running. | |
| #define | rw_lock_destroy(__rwlock_mutex) |
| Macro to destroy rwlock mutex. | |
| #define | RWLOCK_LOGLEVEL LOG_NULL |
| flag to tell the API to disable DEBUG log on locks | |
| #define | SET 1234 |
| Flag for SET something , passing as a function parameter. | |
| #define | STOPPED 1003 |
| Value of the state of an application who is stopped. | |
| #define | STOPWANTED 1002 |
| Value of the state of an application who want to stop his activity. | |
| #define | unlock(__rwlock_mutex) |
| Macro for releasing read/write lock a rwlock mutex. | |
| #define | write_lock(__rwlock_mutex) |
| Macro for acquiring a write lock on a rwlock mutex. | |
Functions | |
| int | file_exist (const char *filename) |
| test file presence | |
| int | get_computer_name (char *computer_name, size_t len) |
| get the computer name into the given buffer | |
| char * | get_prog_dir (void) |
| get running program directory | |
| char * | get_prog_name (void) |
| get running program name | |
| void | log_environment (int loglevel) |
| log environment variables at the given log level | |
| void | n_abort (char const *format,...) |
| htonl for 64 bits numbers | |
| int | n_daemonize (void) |
| daemonize the current process | |
| int | n_daemonize_ex (int mode) |
| daemonize the current process with the given mode flags | |
| char * | n_get_file_extension (char path[]) |
| get the file extension from a path | |
| void | N_HIDE_STR (char *buf,...) |
| reconstruct hidden string from variadic char arguments | |
| int | n_open_with_default (const char *path) |
| Open a file or a URL with whatever the desktop opens it with. | |
| int | n_popen (char *cmd, size_t read_buf_size, void **nstr_output, int *ret) |
| shortcut for popen usage | |
| int | n_spawn_detached (const char *program, const char *const *args) |
| Start a program and do not wait for it. | |
| int | n_spawn_pipe_close (N_SPAWN_PIPE **pipe, int stop, int *exit_code) |
| End a program's input, or end the program, and wait for it. | |
| N_SPAWN_PIPE * | n_spawn_pipe_open (const char *program, const char *const *args, const char *log_path) |
| Start a program whose standard input is fed by the caller. | |
| int | n_spawn_pipe_write (N_SPAWN_PIPE *pipe, const void *data, size_t len) |
| Write to a program's standard input, all of it. | |
| int | n_spawn_wait (const char *program, const char *const *args, int *exit_code) |
| Run a program with arguments and wait for it to finish. | |
| int | n_spawn_wait_cancel (const char *program, const char *const *args, int *exit_code, const volatile int *cancel) |
| Run a program and wait for it, ending it early when asked. | |
| void | sigchld_handler (int sig) |
| reap zombie processes | |
| int | sigchld_handler_installer (void) |
| install signal SIGCHLD handler | |
| pid_t | system_nb (const char *command, int *infp, int *outfp) |
| non-blocking system call | |
| #define __n_assert | ( | __ptr, | |
| __ret ) |
macro to assert things
Definition at line 279 of file n_common.h.
Referenced by __stack_pop(), __stack_push(), _destroy_ht(), _destroy_ht_trie(), _empty_ht(), _empty_ht_trie(), _find_window_node(), _form_decode_dup(), _free_nstr(), _ht_check_trie_divergence(), _ht_depth_first_search(), _ht_find_longest_prefix_trie(), _ht_get_double(), _ht_get_double_trie(), _ht_get_int(), _ht_get_int_trie(), _ht_get_node(), _ht_get_node_trie(), _ht_get_ptr(), _ht_get_ptr_trie(), _ht_get_string(), _ht_get_string_trie(), _ht_is_leaf_node_trie(), _ht_new_double_node(), _ht_new_int_node(), _ht_new_node(), _ht_new_node_trie(), _ht_new_ptr_node(), _ht_new_string_node(), _ht_new_string_ptr_node(), _ht_node_destroy(), _ht_print(), _ht_print_trie(), _ht_put_double(), _ht_put_double_trie(), _ht_put_int(), _ht_put_int_trie(), _ht_put_ptr(), _ht_put_ptr_trie(), _ht_put_string(), _ht_put_string_ptr(), _ht_put_string_ptr_trie(), _ht_put_string_trie(), _ht_remove(), _ht_remove_trie(), _ht_search(), _ht_search_trie(), _n_nodup_log(), _netw_crypto_setup_failed(), _netw_ssl_server_defaults(), _new_widget(), _register_widget(), _sse_read_byte(), _sse_write(), _ws_read(), _ws_write(), add_bmp_to_lib(), add_bytes_to_msg(), add_emitter(), add_int_to_msg(), add_nb_to_msg(), add_nstrdup_to_msg(), add_nstrptr_to_msg(), add_particle(), add_particle_at(), add_strdup_to_msg(), avro_decode_bytes_raw(), avro_decode_container(), avro_decode_datum(), avro_decode_long(), avro_encode_container(), avro_encode_datum(), avro_encode_long(), avro_file_to_json(), avro_json_to_file(), avro_nstr_avro_to_json(), avro_nstr_json_to_avro(), avro_schema_from_cjson(), avro_schema_parse(), avro_schema_parse_nstr(), avro_schema_to_json(), char_to_nstr(), char_to_nstr_ex(), char_to_nstr_nocopy(), check_n_log_dup(), check_n_log_dup_indexed(), client_worker_echo(), client_worker_fast(), close_nodup_log(), CompressData(), create_anim_library(), create_msg(), delete_bmp_from_lib(), delete_msg(), delete_stack(), destroy_anim_lib(), destroy_config_file(), destroy_ht(), destroy_n_fluid(), destroy_threaded_pool(), dispatch_to_pool(), dr_entity_check_threshold(), dr_entity_compute(), dr_entity_create(), dr_entity_destroy(), dr_entity_receive_state(), dr_entity_set_algo(), dr_entity_set_blend_mode(), dr_entity_set_blend_time(), dr_entity_set_position(), dr_entity_set_threshold(), draw_particle(), dump_nodup_log(), empty_ht(), empty_msg(), empty_nodup_table(), empty_nstr(), file_to_nstr(), free_emitters(), free_particle_system(), free_quadtree(), get_bytes_from_msg(), get_config_section_value(), get_int_from_msg(), get_keyboard(), get_msec(), get_nb_config_file_sections(), get_nb_config_file_sections_entries(), get_nb_from_msg(), get_net_datas(), get_nodup_indexed_key(), get_nodup_key(), get_nstr_from_msg(), get_sec(), get_str_from_msg(), get_usec(), handle_client(), handle_inline_and_count(), handle_request(), ht_duplicate(), ht_get_completion_list(), ht_get_double(), ht_get_int(), ht_get_node(), ht_get_node_ex(), ht_get_optimal_size(), ht_get_ptr(), ht_get_ptr_ex(), ht_get_string(), ht_get_table_collision_percentage(), ht_node_type(), ht_optimize(), ht_print(), ht_put_double(), ht_put_int(), ht_put_ptr(), ht_put_ptr_ex(), ht_put_string(), ht_put_string_ptr(), ht_remove(), ht_remove_ex(), ht_resize(), ht_search(), init_particle_system(), insert(), iso_corner_to_screen(), iso_generate_transition_masks(), iso_generate_transition_tiles(), iso_map_build_draw_order(), iso_map_calc_transitions(), iso_map_calc_transitions_full(), iso_map_corner_heights(), iso_map_draw(), iso_map_free(), iso_map_get_ability(), iso_map_get_height(), iso_map_get_terrain(), iso_map_interpolate_height(), iso_map_lerp_projection(), iso_map_load(), iso_map_new(), iso_map_randomize(), iso_map_save(), iso_map_set_ability(), iso_map_set_height(), iso_map_set_projection(), iso_map_set_projection_custom(), iso_map_set_projection_target(), iso_map_set_segments(), iso_map_set_terrain(), iso_map_should_transition(), iso_map_should_transition_smooth(), iso_map_smooth_corner_heights(), iso_map_to_screen(), iso_map_to_screen_f(), iso_mask_tile_to_diamond(), iso_screen_to_map(), iso_screen_to_map_height(), iso_screen_to_map_height_f(), join(), list_destroy(), list_empty(), list_empty_with_f(), list_node_pop(), list_node_push(), list_node_shift(), list_node_unshift(), list_pop_f(), list_push(), list_push_sorted(), list_search(), list_search_with_f(), list_shift_f(), list_unshift(), list_unshift_sorted(), load_app_state(), load_config_file(), main(), main(), main(), make_msg_from_str(), make_str_from_msg(), manage_particle(), manage_particle_ex(), move_particles(), n_atlas_destroy(), n_atlas_draw_cell(), n_atlas_page_ready(), n_atlas_set_page(), n_base64_decode(), n_base64_decode_len(), n_base64_encode(), n_base64_encode_len(), n_clock_sync_delete(), n_clock_sync_mark_sent(), n_clock_sync_new(), n_clock_sync_process_response(), n_clock_sync_seed(), n_clock_sync_server_time(), n_clock_sync_should_send(), n_diff_to_unified(), n_disk_cache_expire(), n_disk_cache_get(), n_disk_cache_open(), n_disk_cache_path(), n_disk_cache_prune(), n_disk_cache_prune_group(), n_disk_cache_put(), n_disk_cache_remove(), n_disk_cache_size(), n_file_copy_verified(), n_file_read_bounded(), n_file_same_content(), n_file_write_atomic(), n_fluid_advectSmoke(), n_fluid_advectVel(), n_fluid_avgU(), n_fluid_avgV(), n_fluid_draw(), n_fluid_extrapolate(), n_fluid_integrate(), n_fluid_resetObstacles(), n_fluid_sampleField(), n_fluid_setObstacle(), n_fluid_setObstacleFromBitmap(), n_fluid_simulate(), n_fluid_simulate_threaded(), n_fluid_solveIncompressibility(), n_free_file_info(), n_get_file_extension(), n_git_ahead_behind(), n_git_checkout_commit(), n_git_checkout_path(), n_git_close(), n_git_commit(), n_git_create_branch(), n_git_current_branch(), n_git_delete_branch(), n_git_diff_commits(), n_git_diff_workdir(), n_git_fetch(), n_git_init_ex(), n_git_list_branches(), n_git_log(), n_git_open(), n_git_pull(), n_git_push(), n_git_remote_set_url(), n_git_set_remote_auth(), n_git_stage(), n_git_stage_all(), n_git_status(), n_git_switch_branch(), n_git_unstage(), n_gui_add_button(), n_gui_add_checkbox(), n_gui_add_combobox(), n_gui_add_custom(), n_gui_add_datagrid(), n_gui_add_dropmenu(), n_gui_add_hexview(), n_gui_add_image(), n_gui_add_label(), n_gui_add_listbox(), n_gui_add_markdownview(), n_gui_add_progressbar(), n_gui_add_radiolist(), n_gui_add_scrollbar(), n_gui_add_slider(), n_gui_add_splitpane(), n_gui_add_syntaxview(), n_gui_add_textarea(), n_gui_add_window(), n_gui_apply_adaptive_resize(), n_gui_button_get_label(), n_gui_checkbox_get_label(), n_gui_checkbox_set_label(), n_gui_close_menus(), n_gui_color_picker_get(), n_gui_color_picker_new(), n_gui_color_picker_open(), n_gui_colorwheel_new(), n_gui_combobox_set_flags(), n_gui_count_detached(), n_gui_curve_new(), n_gui_custom_set_destroy(), n_gui_custom_set_mouse(), n_gui_destroy_ctx(), n_gui_detect_dpi_scale(), n_gui_double_clicked_widget(), n_gui_draw(), n_gui_draw_detached(), n_gui_dropmenu_set_open(), n_gui_focus_takes_key(), n_gui_focus_window(), n_gui_get_dpi_scale(), n_gui_get_event_queue(), n_gui_get_focus(), n_gui_get_resize_mode(), n_gui_get_topmost_open_window(), n_gui_get_widget(), n_gui_grid_index_at(), n_gui_grid_new(), n_gui_hovered_widget(), n_gui_label_fits(), n_gui_label_get_text(), n_gui_load_layout_json(), n_gui_load_theme_json(), n_gui_lower_window(), n_gui_maximize_window(), n_gui_menu_is_open(), n_gui_new_ctx(), n_gui_popup_new(), n_gui_process_event(), n_gui_raise_window(), n_gui_save_layout_json(), n_gui_save_theme_json(), n_gui_screen_to_virtual(), n_gui_set_cursor(), n_gui_set_default_font(), n_gui_set_display(), n_gui_set_display_size(), n_gui_set_double_click_radius(), n_gui_set_double_click_time(), n_gui_set_dpi_scale(), n_gui_set_event_queue(), n_gui_set_focus(), n_gui_set_resize_mode(), n_gui_set_shape_mode(), n_gui_set_virtual_size(), n_gui_splitpane_band(), n_gui_update_transform(), n_gui_wants_mouse(), n_gui_was_double_click(), n_gui_widget_is_visible(), n_gui_widget_screen_rect(), n_gui_widget_set_rect(), n_gui_window_apply_autofit(), n_gui_window_attach(), n_gui_window_button_rect(), n_gui_window_detach(), n_gui_window_find_button(), n_gui_window_from_display(), n_gui_window_get_display(), n_gui_window_get_resize_policy(), n_gui_window_get_zorder(), n_gui_window_get_zvalue(), n_gui_window_is_detached(), n_gui_window_is_maximised(), n_gui_window_native_is_hidden(), n_gui_window_set_autofit(), n_gui_window_set_caption(), n_gui_window_set_close_callback(), n_gui_window_set_content_draw_callback(), n_gui_window_set_maximize_callback(), n_gui_window_set_minimize_callback(), n_gui_window_set_native_icons(), n_gui_window_set_rect_axes(), n_gui_window_set_resize_policy(), n_gui_window_set_tb_btn_theme(), n_gui_window_set_tb_button_bitmaps(), n_gui_window_set_tb_close_theme(), n_gui_window_set_wheel_scrollbar(), n_gui_window_set_zorder(), n_gui_window_update_normalized(), n_hex_decode(), n_hex_decode_to(), n_hex_encode(), n_hex_encode_to(), n_html_escape(), n_http2_server_goaway(), n_http2_server_handshake(), n_http2_server_new(), n_http2_server_respond(), n_http2_server_rst_stream(), n_http2_server_run(), n_http_form_multipart_parse(), n_http_form_parse(), n_http_percent_decode(), n_http_response_new(), n_http_response_write(), n_http_server_config_defaults(), n_http_server_new(), n_http_server_read_body(), n_http_server_read_body_to_fd(), n_http_server_run(), n_http_server_stats(), n_http_set_cookie_build(), n_icc_from_buffer(), n_icc_from_file(), n_iso_camera_center_on(), n_iso_camera_follow(), n_iso_camera_free(), n_iso_camera_new(), n_iso_camera_screen_to_world(), n_iso_camera_scroll(), n_iso_camera_world_to_screen(), n_iso_camera_zoom(), n_kafka_add_header(), n_kafka_add_header_ex(), n_kafka_delete(), n_kafka_delivery_message_callback(), n_kafka_disable_event_consumption(), n_kafka_disable_event_production(), n_kafka_dump_unprocessed(), n_kafka_enable_event_consumption(), n_kafka_enable_event_production(), n_kafka_event_destroy(), n_kafka_event_destroy_ptr(), n_kafka_get_event(), n_kafka_get_schema_from_char(), n_kafka_get_schema_from_nstr(), n_kafka_get_status(), n_kafka_load_config(), n_kafka_load_unprocessed(), n_kafka_mkdir_p(), n_kafka_move_file_to_sended(), n_kafka_new(), n_kafka_new_event(), n_kafka_new_event_from_char(), n_kafka_new_event_from_file(), n_kafka_new_event_from_string(), n_kafka_new_headers(), n_kafka_poll(), n_kafka_produce(), n_kafka_put_schema_in_char(), n_kafka_put_schema_in_nstr(), n_kafka_set_error_timeout(), n_kafka_set_sended_dir(), n_kafka_start_polling_thread(), n_kafka_stop_polling_thread(), n_mock_server_free(), n_mock_server_run(), n_mock_server_start(), n_mock_server_stop(), n_module_open(), n_module_symbol(), n_open_with_default(), n_popen(), n_pretty_js(), n_pretty_json(), n_pretty_json_lenient(), n_pretty_xml(), n_random_hex_token(), n_router_add(), n_router_check(), n_scan_dir(), n_spawn_detached(), n_spawn_pipe_open(), n_spawn_pipe_write(), n_spawn_wait_cancel(), n_sse_conn_free(), n_sse_connect(), n_sse_stop(), n_tiff_find(), n_tiff_get_ascii(), n_tiff_get_doubles(), n_tiff_parse(), n_tiff_parse_ifd(), n_vigenere_cypher(), n_vigenere_cypher_thread(), n_vigenere_decode_file(), n_vigenere_decode_file_qa(), n_vigenere_decode_qa(), n_vigenere_encode_file(), n_vigenere_encode_file_qa(), n_vigenere_encode_qa(), n_vigenere_get_answer(), n_ws_close(), n_ws_conn_free(), n_ws_connect(), n_ws_recv(), n_ws_send(), n_x509_generate_ca(), n_x509_keypair_pem(), n_x509_mint_host_cert(), netmsg_make_ident(), netmsg_make_ping(), netmsg_make_position_msg(), netmsg_make_quit_msg(), netmsg_make_string_msg(), netw_accept_from_ex(), netw_accept_pool_create(), netw_accept_pool_destroy(), netw_accept_pool_get_stats(), netw_accept_pool_start(), netw_accept_pool_stop(), netw_accept_pool_thread_func(), netw_accept_pool_wait(), netw_accept_ssl_with_sni_cb(), netw_add_msg(), netw_add_msg_ex(), netw_adopt_client_fd(), netw_bind_udp(), netw_build_http_response(), netw_calculate_urlencoded_size(), netw_close(), netw_connect_check(), netw_connect_ex_to(), netw_connect_nonblock(), netw_connect_udp(), netw_destroy_pool(), netw_extract_http_info(), netw_extract_http_request_type(), netw_get_http_date(), netw_get_ident(), netw_get_msg(), netw_get_ping(), netw_get_position(), netw_get_queue_status(), netw_get_quit(), netw_get_string(), netw_get_url_from_http_request(), netw_guess_http_content_type(), netw_make_listening(), netw_msg_get_type(), netw_new(), netw_new_pool(), netw_parse_post_data(), netw_pool_add(), netw_pool_broadcast(), netw_pool_nbclients(), netw_pool_netw_close(), netw_pool_remove(), netw_recv_func(), netw_send_func(), netw_send_ident(), netw_send_ping(), netw_send_position(), netw_send_quit(), netw_send_string_to(), netw_send_string_to_all(), netw_set(), netw_set_blocking(), netw_set_compression_mode(), netw_set_crypto(), netw_set_crypto_chain(), netw_set_crypto_chain_pem(), netw_set_crypto_pem(), netw_set_crypto_pem_ctx(), netw_set_user_id(), netw_setsockopt(), netw_ssl_connect_client_to(), netw_ssl_do_handshake(), netw_ssl_get_alpn(), netw_ssl_get_sni(), netw_ssl_get_verify_result(), netw_ssl_handshake_once(), netw_ssl_server_ctx_new(), netw_ssl_server_handshake_ex(), netw_ssl_server_handshake_once(), netw_ssl_set_alpn(), netw_ssl_set_ca(), netw_ssl_set_ciphers(), netw_ssl_set_client_cert(), netw_ssl_set_verify(), netw_ssl_set_versions(), netw_ssl_start_client(), netw_start_thr_engine(), netw_stop_thr_engine(), netw_udp_recvfrom(), netw_udp_sendto(), netw_urldecode(), netw_urlencode(), netw_wait_msg(), new_generic_list(), new_ht(), new_ht_trie(), new_list_node(), new_n_atlas(), new_n_fluid(), new_nstr(), new_stack(), new_tree(), nfgets(), npcre_clean_match(), npcre_delete(), npcre_match(), npcre_match_capture(), npcre_new(), npcre_replace(), nstr_to_fd(), nstr_to_file(), nstrcat_bytes_ex(), nstrcat_ex(), nstrdup(), nstrprintf_cat_ex(), nstrprintf_ex(), occupy_thread(), on_accept_pooled(), open_sysjrnl(), print_list_info(), recv_data(), recv_data_once(), recv_ssl_data(), recv_ssl_data_once(), recv_udp_data(), refresh_thread_pool(), remove_emitter(), remove_list_node_f(), resize_nstr(), send_data(), send_data_once(), send_net_datas(), send_ssl_data(), send_ssl_data_once(), send_udp_data(), set_log_file(), set_log_file_fd(), set_thread_pool_discard(), skipu(), skipw(), split(), split_count(), ssl_harden_context(), ssl_network_thread(), stack_peek(), stack_pop_b(), stack_pop_c(), stack_pop_d(), stack_pop_f(), stack_pop_i32(), stack_pop_i8(), stack_pop_p(), stack_pop_ui32(), stack_pop_ui8(), start_HiTimer(), str_sanitize_ex(), str_to_int_ex(), str_to_int_nolog(), str_to_long_ex(), str_to_long_long_ex(), strcpy_u(), strlo(), strup(), system_nb(), trajectory_add_point(), trajectory_clear_points(), trajectory_compute(), trajectory_delete(), trajectory_distance(), trajectory_get_acceleration(), trajectory_get_orientation(), trajectory_get_position(), trajectory_get_speed(), trajectory_new(), trajectory_set_end(), trajectory_set_start(), trajectory_update(), tree_insert_child(), trim(), trim_nocopy(), UncompressData(), unzip4_nstr(), unzip_nstr(), update_anim(), update_physics_position(), update_physics_position_nb(), update_physics_position_reverse(), update_physics_position_reverse_nb(), userlist_add_msg_to_ex(), userlist_add_user(), userlist_del_user(), userlist_destroy(), userlist_new(), userlist_send_waiting_msgs(), userlist_set_position_behavior(), userlist_user_add_waiting_msg(), userlist_user_send_waiting_msgs(), wait_for_synced_threaded_pool(), wait_for_threaded_pool(), worker_handle_client(), write_config_file(), zip4_nstr(), and zip_nstr().
| #define _nstr | ( | __PTR | ) |
N_STR or "NULL" string for logging purposes.
Definition at line 199 of file n_common.h.
Referenced by get_config_section_value(), get_nb_config_file_sections_entries(), handle_request(), load_config_file(), main(), main(), main(), n_get_current_dir_hd_serial(), n_kafka_delivery_message_callback(), n_kafka_dump_unprocessed(), n_kafka_load_config(), n_kafka_move_file_to_sended(), n_vigenere_cypher(), n_vigenere_decode_file(), n_vigenere_decode_file_qa(), n_vigenere_encode_file(), n_vigenere_encode_file_qa(), n_vigenere_get_question(), netw_pool_add(), and netw_pool_remove().
| #define _nstrp | ( | __PTR | ) |
N_STR or NULL pointer for testing purposes.
Definition at line 201 of file n_common.h.
Referenced by main(), and n_kafka_load_config().
| #define _str | ( | __PTR | ) |
define true
define TRUE
define false
define FALSE
returned by N_STRLIST functions to tell the caller that the list is empty
String or "NULL" string for logging purposes
Definition at line 193 of file n_common.h.
Referenced by _n_log(), _netw_ssl_handshake_step(), avro_json_to_file(), avro_nstr_json_to_avro(), char_to_nstr_ex(), dump_nodup_log(), handle_request(), load_config_file(), main(), main(), main(), n_get_current_dir_hd_serial(), n_kafka_load_config(), n_kafka_poll(), n_kafka_polling_thread(), netw_accept_from_ex(), netw_bind_udp(), netw_close(), netw_connect(), netw_connect_check(), netw_connect_ex_to(), netw_connect_to(), netw_connect_udp(), netw_make_listening(), netw_recv_func(), netw_send_func(), netw_set_blocking(), netw_setsockopt(), netw_ssl_connect(), netw_ssl_do_handshake(), netw_ssl_set_ca(), netw_start_thr_engine(), netw_udp_recvfrom(), netw_udp_sendto(), nstr_to_file(), open_safe_logging(), recv_data(), recv_data_once(), recv_php(), recv_ssl_data(), recv_ssl_data_once(), recv_udp_data(), send_data(), send_data_once(), send_php(), send_ssl_data(), send_ssl_data_once(), send_udp_data(), server_fn(), set_log_file(), and write_config_file().
| #define _strp | ( | __PTR | ) |
String or NULL pointer for testing purposes.
Definition at line 195 of file n_common.h.
| #define _strw | ( | __PTR | ) |
String or " " string for config purposes.
Definition at line 197 of file n_common.h.
| #define Alloca | ( | __ptr, | |
| __size ) |
Malloca Handler to get errors and set to 0.
Definition at line 216 of file n_common.h.
Referenced by handle_request(), and main().
| #define BYTEORDER_BIG_ENDIAN 1 |
Big endian macro value.
Definition at line 101 of file n_common.h.
| #define BYTEORDER_LITTLE_ENDIAN 0 |
Little endian macro value.
Definition at line 99 of file n_common.h.
| #define CALL_RETRY | ( | __retvar, | |
| __expression, | |||
| __max_tries ) |
TEMP_FAILURE gnu macro portable version.
Definition at line 286 of file n_common.h.
| #define checkerror | ( | ) |
check for errors
Definition at line 318 of file n_common.h.
Referenced by main().
| #define CONCAT | ( | a, | |
| b ) |
| #define CONCAT_BUILDER | ( | a, | |
| b ) |
| #define DEFAULT 1000 |
Default APP_STATUS Value.
Definition at line 427 of file n_common.h.
| #define endif |
close a ifwhatever block
Definition at line 325 of file n_common.h.
Referenced by main(), n_http_server_run(), netw_accept_from_ex(), netw_close(), recv_data(), recv_data_once(), recv_ssl_data(), recv_ssl_data_once(), send_data(), send_data_once(), send_ssl_data(), send_ssl_data_once(), and send_udp_data().
| #define equal_if | ( | __a, | |
| __cond, | |||
| __b ) |
if( a , condition, b ) then a = b
Definition at line 335 of file n_common.h.
| #define FALL_THROUGH |
set windows if true
fall through macro for switch cases, avoid warning at compilation
Definition at line 72 of file n_common.h.
Referenced by main(), MurmurHash3_x64_128(), MurmurHash3_x86_128(), and MurmurHash3_x86_32().
| #define FORCE_INLINE static inline __attribute__((always_inline)) |
FORCE_INLINE portable macro.
Definition at line 164 of file n_common.h.
Referenced by fmix32(), fmix64(), getblock32(), getblock64(), and inlined_func().
| #define Free | ( | __ptr | ) |
Free Handler to get errors.
Definition at line 263 of file n_common.h.
Referenced by _a4_wrap(), _destroy_ht(), _destroy_ht_trie(), _form_decode_dup(), _ht_new_node(), _ht_new_node_trie(), _ht_node_destroy(), _ht_put_string(), _ht_put_string_ptr(), _ht_put_string_trie(), _ht_remove_trie(), _n_form_field_free(), _n_html_attr_free(), _n_html_form_free(), _n_html_parse_tag(), _n_html_tag_free(), _n_nodup_log(), _n_nodup_log_indexed(), _ngui_publish_primary_selection(), _out_finish(), _serve(), _sort_windows_by_zorder(), _worker(), add_bmp_to_lib(), add_emitter(), add_int_to_msg(), add_nb_to_msg(), allegro_exit(), avro_decode_container(), avro_decode_datum(), avro_encode_container(), avro_encode_datum(), avro_schema_from_cjson(), avro_schema_to_json(), char_to_nstr_ex(), check_n_log_dup(), check_n_log_dup_indexed(), close_safe_logging(), create_anim_library(), create_msg(), create_quadtree(), delete_msg(), delete_stack(), destroy_anim_lib(), destroy_bitmap(), destroy_config_file(), destroy_config_file_section(), destroy_data(), destroy_font(), destroy_game_env(), destroy_midi(), destroy_sample(), destroy_threaded_pool(), dr_entity_destroy(), dump_nodup_log(), free_emitters(), free_particle_system(), free_split_result(), get_bytes_from_msg(), get_int_from_msg(), get_nb_from_msg(), get_nodup_indexed_key(), get_nodup_key(), get_str_from_msg(), handle_request(), ht_get_completion_list(), iso_map_free(), iso_map_new(), lexMenuDestroy(), list_destroy(), list_empty(), list_empty_with_f(), list_pop_f(), list_shift_f(), load_config_file(), main(), main(), main(), make_msg_from_str(), make_str_from_msg(), manage_particle_ex(), mp_part_free(), n_atlas_destroy(), n_clock_sync_delete(), n_cookiejar_free(), n_cookiejar_new(), n_disk_cache_close(), n_disk_cache_open(), n_file_copy_verified(), n_file_read_bounded(), n_file_streams_equal(), n_file_write_atomic(), n_get_current_dir_hd_serial(), n_gui_add_button(), n_gui_add_checkbox(), n_gui_add_combobox(), n_gui_add_custom(), n_gui_add_datagrid(), n_gui_add_dropmenu(), n_gui_add_hexview(), n_gui_add_image(), n_gui_add_label(), n_gui_add_listbox(), n_gui_add_markdownview(), n_gui_add_progressbar(), n_gui_add_radiolist(), n_gui_add_scrollbar(), n_gui_add_slider(), n_gui_add_splitpane(), n_gui_add_syntaxview(), n_gui_add_textarea(), n_gui_add_window(), n_gui_color_picker_free(), n_gui_color_picker_new(), n_gui_destroy_ctx(), n_gui_new_ctx(), n_gui_process_event(), n_html_to_text(), n_http_form_multipart_parse(), n_http_form_parse(), n_http_percent_decode(), n_http_response_write(), n_iso_camera_free(), n_kafka_delete(), n_kafka_new(), n_module_close(), n_pretty_js(), n_pretty_json_lenient(), n_pretty_xml(), n_random_hex_token(), n_router_add(), n_sitemap_extract_urls(), n_spawn_pipe_close(), n_spawn_pipe_open(), n_tiff_free(), n_tiff_parse_ifd(), n_vigenere_cypher(), n_vigenere_cypher_thread(), netw_accept_pool_create(), netw_accept_pool_destroy(), netw_close(), netw_destroy_pool(), netw_new(), netw_new_pool(), netw_send_func(), netw_urldecode(), new_ht(), new_ht_trie(), new_n_atlas(), new_nstr(), new_stack(), new_thread_pool(), nstrdup(), open_safe_logging(), poll_network_msgs(), pop_exception(), recv_php(), refresh_thread_pool(), remove_emitter(), remove_list_node_f(), resize_nstr(), ssl_network_thread(), str_to_int_ex(), str_to_int_nolog(), str_to_long_ex(), str_to_long_long_ex(), test_atomic_file(), test_decode_errors(), test_decode_roundtrip(), trajectory_delete(), tree_create_node(), tree_insert_child(), userlist_destroy(), userlist_new(), and worker_handle_client().
| #define FreeNoLog | ( | __ptr | ) |
Free Handler without log.
Definition at line 272 of file n_common.h.
Referenced by _destroy_widget(), _destroy_window(), _dropmenu_entries_grow(), _emit(), _free_nstr(), _ht_node_destroy(), _ht_put_double_trie(), _ht_put_int_trie(), _ht_put_ptr_trie(), _ht_put_string_ptr_trie(), _ht_put_string_trie(), _items_grow(), _line_free(), _myers(), _n_form_field_free(), _n_git_commit_info_destroy(), _n_git_diff_print_cb(), _n_git_status_entry_destroy(), _n_git_string_destroy(), _n_gui_kv_content_free(), _n_html_attr_free(), _n_html_form_free(), _n_html_parse_tag(), _n_html_tag_free(), _n_log(), _out_finish(), _popup_append(), _popup_layout(), _text_free(), _text_load(), _textarea_copy_to_clipboard(), avro_schema_free(), build_syntaxview_window(), close_sysjrnl(), delete_bmp_from_lib(), destroy_anim_lib(), destroy_n_fluid(), free_entry(), free_entry_def(), free_nstr_nolog(), free_nstr_ptr(), free_nstr_ptr_nolog(), free_particle_system(), get_bytes_from_msg(), main(), main(), mp_part_free(), n_cookie_free(), n_diff_result_free(), n_diff_to_unified(), n_git_close(), n_git_init_ex(), n_git_open(), n_git_set_remote_auth(), n_gui_datagrid_add_column(), n_gui_datagrid_add_row(), n_gui_datagrid_clear_rows(), n_gui_datagrid_sort(), n_gui_destroy_ctx(), n_gui_hexview_set_data(), n_gui_kvtable_free(), n_gui_kvtable_set_placeholders(), n_gui_load_layout_json(), n_gui_load_theme_json(), n_gui_markdownview_set_text(), n_gui_popup_free(), n_gui_popup_set_title(), n_gui_sectionlist_free(), n_gui_set_widget_tooltip(), n_gui_syntaxview_set_text(), n_gui_tab_free(), n_gui_textarea_set_placeholder(), n_gui_textarea_set_suggest(), n_gui_tree_create(), n_gui_tree_free(), n_gui_tree_state_free(), n_http_form_free(), n_http_form_multipart_free(), n_http_form_parse(), n_http_response_add_header(), n_http_response_free(), n_http_response_remove_header(), n_http_response_set_header(), n_http_server_free(), n_kafka_delete(), n_kafka_event_destroy_ptr(), n_kafka_polling_thread(), n_kafka_set_sended_dir(), n_mock_server_free(), n_mock_server_start(), n_proxy_cfg_free(), n_proxy_cfg_parse(), n_router_add(), n_router_free(), n_sse_conn_free(), n_tiff_free(), n_url_free(), n_ws_conn_free(), n_ws_send(), netw_accept_from_ex(), netw_bind_udp(), netw_close(), netw_connect_check(), netw_connect_ex_to(), netw_connect_udp(), netw_info_destroy(), netw_make_listening(), netw_set_blocking(), netw_set_crypto(), netw_setsockopt(), netw_udp_recvfrom(), netw_udp_sendto(), new_n_fluid(), npcre_delete(), npcre_replace(), recv_data(), recv_data_once(), recv_php(), recv_ssl_data(), recv_ssl_data_once(), recv_udp_data(), send_data(), send_data_once(), send_php(), send_ssl_data(), send_ssl_data_once(), send_udp_data(), and write_config_file().
| #define GET 4321 |
Flag for GET something , passing as a function parameter.
Definition at line 425 of file n_common.h.
| #define get_error | ( | ) |
pop up errors if any
Definition at line 331 of file n_common.h.
Referenced by main().
| #define iffalse if( FALSE == |
error checker type if( toto == FALSE )
Definition at line 312 of file n_common.h.
Referenced by main().
| #define ifnull if( ! |
error checker type if( !toto )
Definition at line 306 of file n_common.h.
Referenced by main().
| #define iftrue if( TRUE == |
error checker type if( toto == FALSE )
Definition at line 315 of file n_common.h.
Referenced by main().
| #define ifzero if( 0 == |
error checker type if( 0 != toto )
Definition at line 309 of file n_common.h.
Referenced by main().
| #define init_error_check | ( | ) |
init error checking in a function
Definition at line 302 of file n_common.h.
Referenced by main().
| #define init_lock | ( | __rwlock_mutex | ) |
Macro for initializing a rwlock.
Definition at line 350 of file n_common.h.
Referenced by n_cookiejar_new(), n_kafka_new(), netw_new_pool(), npcre_new(), and userlist_new().
| #define Malloc | ( | __ptr, | |
| __struct, | |||
| __size ) |
Malloc Handler to get errors and set to 0.
Definition at line 204 of file n_common.h.
Referenced by _a4_wrap(), _datagrid_ensure_colors(), _datagrid_ensure_sel(), _dropmenu_entries_grow(), _emit(), _form_decode_dup(), _ht_find_longest_prefix_trie(), _ht_new_node(), _ht_new_node_trie(), _items_grow(), _myers(), _n_git_diff_print_cb(), _n_html_parse_tag(), _n_html_strdup_upper(), _n_html_strndup(), _n_html_strndup_lower(), _n_log(), _new_widget(), _ngui_publish_primary_selection(), _serve(), _sort_windows_by_zorder(), _suggest_refresh(), _text_load(), _textarea_copy_to_clipboard(), _worker(), add_bmp_to_lib(), add_emitter(), add_int_to_msg(), add_nb_to_msg(), add_particle(), add_particle_at(), add_threaded_process(), allegro_init(), avro_decode_bytes_raw(), avro_decode_datum(), avro_encode_datum(), avro_schema_from_cjson(), build_syntaxview_window(), create_anim_library(), create_msg(), dispatch_to_pool(), dr_entity_create(), handle_request(), ht_put_ptr_ex(), init_game_env(), init_particle_system(), iso_map_new(), iso_map_set_segments(), join(), lexLoadMenuFromFile(), load_config_file(), load_midi(), load_sample(), load_ttf_font(), main(), main(), main(), make_msg_from_str(), make_str_from_msg(), mp_strndup(), n_clock_sync_new(), n_cookiejar_add_from_header(), n_cookiejar_new(), n_diff_lines(), n_diff_to_unified(), n_disk_cache_open(), n_file_copy_verified(), n_file_read_bounded(), n_file_streams_equal(), n_file_write_atomic(), n_git_init_ex(), n_git_log(), n_git_open(), n_git_set_remote_auth(), n_git_status(), n_gui_add_button(), n_gui_add_checkbox(), n_gui_add_combobox(), n_gui_add_custom(), n_gui_add_datagrid(), n_gui_add_dropmenu(), n_gui_add_hexview(), n_gui_add_image(), n_gui_add_label(), n_gui_add_listbox(), n_gui_add_markdownview(), n_gui_add_progressbar(), n_gui_add_radiolist(), n_gui_add_scrollbar(), n_gui_add_slider(), n_gui_add_splitpane(), n_gui_add_syntaxview(), n_gui_add_textarea(), n_gui_add_window(), n_gui_color_picker_new(), n_gui_datagrid_add_column(), n_gui_datagrid_add_row(), n_gui_datagrid_sort(), n_gui_hexview_set_data(), n_gui_kvtable_create(), n_gui_load_layout_json(), n_gui_load_theme_json(), n_gui_new_ctx(), n_gui_sectionlist_create(), n_gui_syntaxview_get_selected_text(), n_gui_syntaxview_set_text(), n_gui_tab_create(), n_gui_tree_create(), n_hex_decode(), n_html_extract_forms(), n_html_to_text(), n_http_build_multipart(), n_http_form_multipart_parse(), n_http_form_parse(), n_http_parse_multipart(), n_http_response_add_header(), n_http_response_new(), n_http_response_write(), n_http_server_new(), n_iso_camera_new(), n_kafka_dump_unprocessed(), n_kafka_new(), n_kafka_new_event(), n_kafka_new_event_from_char(), n_mock_server_start(), n_module_open(), n_proxy_cfg_parse(), n_random_hex_token(), n_router_add(), n_router_new(), n_scan_dir(), n_spawn_pipe_open(), n_sse_connect(), n_tiff_parse_ifd(), n_url_parse(), n_vigenere_cypher(), n_ws_connect(), n_ws_send(), netw_accept_from_ex(), netw_accept_pool_create(), netw_add_msg_ex(), netw_bind_udp(), netw_connect_ex_to(), netw_connect_nonblock(), netw_connect_udp(), netw_make_listening(), netw_new(), netw_new_pool(), netw_recv_func(), netw_send_func(), new_generic_list(), new_ht(), new_ht_trie(), new_list_node(), new_n_atlas(), new_n_fluid(), new_nstr(), new_stack(), new_thread_pool(), new_tree(), npcre_new(), npcre_replace(), open_safe_logging(), recv_php(), resize_nstr(), split(), str_replace(), str_to_int_ex(), str_to_int_nolog(), str_to_long_ex(), str_to_long_long_ex(), trajectory_new(), userlist_new(), and vasprintf().
| #define N_DAEMON_NO_CHDIR 64 |
daemonize flag: do not call chdir("/")
Definition at line 668 of file n_common.h.
Referenced by n_daemonize_ex().
| #define N_DAEMON_NO_CLOSE 2 |
daemonize flag: no descriptor close at all
Definition at line 658 of file n_common.h.
Referenced by n_daemonize_ex().
| #define N_DAEMON_NO_DOUBLE_FORK 8 |
daemonize flag: do not double fork
Definition at line 662 of file n_common.h.
Referenced by n_daemonize_ex().
| #define N_DAEMON_NO_SETSID 16 |
daemonize flag: do not call setsid
Definition at line 664 of file n_common.h.
Referenced by n_daemonize_ex().
| #define N_DAEMON_NO_SIGCHLD_HANDLER 256 |
daemonize flag: do not use internal zombie SIGCHLD handler
Definition at line 672 of file n_common.h.
Referenced by n_daemonize(), and n_daemonize_ex().
| #define N_DAEMON_NO_SIGCHLD_IGN 128 |
daemonize flag: do not ignore SIGCHLD
Definition at line 670 of file n_common.h.
Referenced by n_daemonize(), and n_daemonize_ex().
| #define N_DAEMON_NO_STD_REDIRECT 4 |
daemonize flag: just do not redirect stdin/out/err to /dev/null
Definition at line 660 of file n_common.h.
Referenced by n_daemonize_ex().
| #define N_DAEMON_NO_UMASK 32 |
daemonize flag: do not call umask( 0 )
Definition at line 666 of file n_common.h.
Referenced by n_daemonize_ex().
| #define next_even | ( | __val | ) |
next even helper
Definition at line 299 of file n_common.h.
Referenced by main().
| #define next_odd | ( | __val | ) |
next odd helper
Definition at line 296 of file n_common.h.
Referenced by main().
| #define PAUSED 1004 |
Value of the state of an application who is paused.
Definition at line 435 of file n_common.h.
| #define randomize | ( | ) |
Initialize the random sequence with time.
Definition at line 438 of file n_common.h.
| #define read_lock | ( | __rwlock_mutex | ) |
Macro for acquiring a read lock on a rwlock mutex.
Definition at line 368 of file n_common.h.
Referenced by n_cookiejar_build_header(), n_cookiejar_count(), n_kafka_dump_unprocessed(), n_kafka_get_status(), n_kafka_poll(), n_kafka_polling_thread(), n_kafka_start_polling_thread(), n_kafka_stop_polling_thread(), netw_pool_broadcast(), netw_pool_nbclients(), userlist_add_msg_to_ex(), and userlist_set_position_behavior().
| #define Realloc | ( | __ptr, | |
| __struct, | |||
| __size ) |
Realloc Handler to get errors.
Returns TRUE on success, FALSE on failure. On failure the original pointer is preserved (not set to NULL).
Definition at line 231 of file n_common.h.
Referenced by _ht_find_longest_prefix_trie(), ht_resize(), main(), trajectory_add_point(), userlist_del_user(), and userlist_set_position_behavior().
| #define Reallocz | ( | __ptr, | |
| __struct, | |||
| __old_size, | |||
| __size ) |
Realloc + zero new memory zone Handler to get errors.
Returns TRUE on success, FALSE on failure. On failure the original pointer is preserved (not set to NULL).
Definition at line 247 of file n_common.h.
Referenced by main(), nstrcat_ex(), resize_nstr(), and write_and_fit_ex().
| #define RUNNING 1001 |
Value of the state of an application who is running.
Definition at line 429 of file n_common.h.
| #define rw_lock_destroy | ( | __rwlock_mutex | ) |
Macro to destroy rwlock mutex.
Definition at line 409 of file n_common.h.
Referenced by n_cookiejar_free(), n_kafka_delete(), netw_destroy_pool(), and npcre_delete().
| #define RWLOCK_LOGLEVEL LOG_NULL |
flag to tell the API to disable DEBUG log on locks
Definition at line 346 of file n_common.h.
| #define SET 1234 |
Flag for SET something , passing as a function parameter.
Definition at line 423 of file n_common.h.
| #define STOPPED 1003 |
Value of the state of an application who is stopped.
Definition at line 433 of file n_common.h.
| #define STOPWANTED 1002 |
Value of the state of an application who want to stop his activity.
Definition at line 431 of file n_common.h.
| #define unlock | ( | __rwlock_mutex | ) |
Macro for releasing read/write lock a rwlock mutex.
Definition at line 396 of file n_common.h.
Referenced by n_cookiejar_add_from_header(), n_cookiejar_build_header(), n_cookiejar_clear(), n_cookiejar_count(), n_cookiejar_remove(), n_kafka_delivery_message_callback(), n_kafka_disable_event_consumption(), n_kafka_disable_event_production(), n_kafka_dump_unprocessed(), n_kafka_enable_event_consumption(), n_kafka_enable_event_production(), n_kafka_get_event(), n_kafka_get_status(), n_kafka_load_unprocessed(), n_kafka_poll(), n_kafka_polling_thread(), n_kafka_produce(), n_kafka_set_error_timeout(), n_kafka_set_sended_dir(), n_kafka_start_polling_thread(), n_kafka_stop_polling_thread(), netw_destroy_pool(), netw_pool_add(), netw_pool_broadcast(), netw_pool_nbclients(), netw_pool_remove(), npcre_clean_match(), npcre_delete(), npcre_match_capture(), userlist_add_msg_to_ex(), userlist_add_user(), userlist_del_user(), userlist_destroy(), userlist_send_waiting_msgs(), userlist_set_position_behavior(), userlist_user_add_waiting_msg(), and userlist_user_send_waiting_msgs().
| #define write_lock | ( | __rwlock_mutex | ) |
Macro for acquiring a write lock on a rwlock mutex.
Definition at line 382 of file n_common.h.
Referenced by n_cookiejar_add_from_header(), n_cookiejar_clear(), n_cookiejar_remove(), n_kafka_delivery_message_callback(), n_kafka_disable_event_consumption(), n_kafka_disable_event_production(), n_kafka_enable_event_consumption(), n_kafka_enable_event_production(), n_kafka_get_event(), n_kafka_load_unprocessed(), n_kafka_poll(), n_kafka_polling_thread(), n_kafka_produce(), n_kafka_set_error_timeout(), n_kafka_set_sended_dir(), n_kafka_start_polling_thread(), n_kafka_stop_polling_thread(), netw_destroy_pool(), netw_pool_add(), netw_pool_remove(), npcre_clean_match(), npcre_delete(), npcre_match_capture(), userlist_add_user(), userlist_del_user(), userlist_destroy(), userlist_send_waiting_msgs(), userlist_set_position_behavior(), userlist_user_add_waiting_msg(), and userlist_user_send_waiting_msgs().
| int file_exist | ( | const char * | filename | ) |
test file presence
test file presence
| filename | Path/name of the file |
Definition at line 105 of file n_common.c.
Referenced by main(), and main().
| int get_computer_name | ( | char * | computer_name, |
| size_t | len ) |
get the computer name into the given buffer
get the computer name into the given buffer
| computer_name | allocated buffer to hold the computer name |
| len | size of computer_name variable |
Definition at line 75 of file n_common.c.
References LOG_ERR, and n_log.
Referenced by main(), and n_kafka_load_config().
| char * get_prog_dir | ( | void | ) |
get running program directory
get running program directory
Definition at line 118 of file n_common.c.
Referenced by main().
| char * get_prog_name | ( | void | ) |
get running program name
get running program name
Definition at line 150 of file n_common.c.
Referenced by main().
| void log_environment | ( | int | loglevel | ) |
log environment variables at the given log level
log environment variables at the given log level
| loglevel | the loglevel used to log the environment |
Definition at line 821 of file n_common.c.
References n_log.
Referenced by main().
| void n_abort | ( | char const * | format, |
| ... ) |
htonl for 64 bits numbers
ntonl for 64 bits numbers
exit and print log to stderr
htonl for 64 bits numbers
| format | printf style format and args |
Definition at line 58 of file n_common.c.
Referenced by main(), and main().
| int n_daemonize | ( | void | ) |
daemonize the current process
daemonize the current process
Definition at line 873 of file n_common.c.
References N_DAEMON_NO_SIGCHLD_HANDLER, N_DAEMON_NO_SIGCHLD_IGN, and n_daemonize_ex().
Referenced by main().
| int n_daemonize_ex | ( | int | mode | ) |
daemonize the current process with the given mode flags
daemonize the current process with the given mode flags
| mode | flag made of a combination of N_DAEMON_NO_CLOSE, N_DAEMON_NO_STD_REDIRECT, N_DAEMON_NO_DOUBLE_FORK , N_DAEMON_NO_SETSID, N_DAEMON_NO_UMASK, N_DAEMON_NO_CHDIR, N_DAEMON_NO_SETSID, N_DAEMON_NO_SIGCHLD_IGN, N_DAEMON_NO_SIGCHLD_HANDLER or 0 for defaults |
Definition at line 882 of file n_common.c.
References LOG_ERR, LOG_NOTICE, mode, N_DAEMON_NO_CHDIR, N_DAEMON_NO_CLOSE, N_DAEMON_NO_DOUBLE_FORK, N_DAEMON_NO_SETSID, N_DAEMON_NO_SIGCHLD_HANDLER, N_DAEMON_NO_SIGCHLD_IGN, N_DAEMON_NO_STD_REDIRECT, N_DAEMON_NO_UMASK, n_log, and sigchld_handler_installer().
Referenced by n_daemonize().
| char * n_get_file_extension | ( | char | path[] | ) |
get the file extension from a path
get the file extension from a path
| path | the path + filename |
Definition at line 1069 of file n_common.c.
References __n_assert.
Referenced by main().
| void N_HIDE_STR | ( | char * | buf, |
| ... ) |
reconstruct hidden string from variadic char arguments
reconstruct hidden string from variadic char arguments
| buf | the variable which will receive the string. Must be large enough to hold all arguments. |
Definition at line 1048 of file n_common.c.
Referenced by main().
| int n_open_with_default | ( | const char * | path | ) |
Open a file or a URL with whatever the desktop opens it with.
xdg-open on Linux and the BSDs, open on macOS, ShellExecute on Windows. Detached, as n_spawn_detached().
| path | File path or URL. |
Definition at line 792 of file n_common.c.
References __n_assert, done, LOG_ERR, n_log, and n_spawn_detached().
| int n_popen | ( | char * | cmd, |
| size_t | read_buf_size, | ||
| void ** | nstr_output, | ||
| int * | ret ) |
shortcut for popen usage
shortcut for popen usage
| cmd | The command to launch |
| read_buf_size | popen read buf. Also serves as a minimum size for the dynamically allocated returned output if not already allocated |
| nstr_output | Pointer to a valid N_STR or NULL (see read_buf_size) |
| ret | Command output if any. Should be initialized to -1 and tested against to check if it's valid. |
Definition at line 185 of file n_common.c.
References __n_assert, free_nstr, LOG_ERR, n_log, new_nstr(), and nstrprintf_cat.
Referenced by addr2line(), main(), and n_get_current_dir_hd_serial().
| int n_spawn_detached | ( | const char * | program, |
| const char *const * | args ) |
Start a program and do not wait for it.
For handing a file to another application - an image editor, a viewer - that must outlive the caller's interest in it. No shell is involved: the arguments are passed as they are, so a file name with spaces, quotes or a semicolon in it is one argument and nothing else. On POSIX the program is found on the PATH and started through a double fork in a session of its own, so it leaves no zombie and a terminal closing does not take it with it; on Windows it is CreateProcess with each argument quoted.
| program | Program to run: a name on the PATH or a path. |
| args | Its arguments after the program itself, NULL terminated. May be NULL for none. |
Definition at line 293 of file n_common.c.
References __n_assert, line(), LOG_ERR, and n_log.
Referenced by main(), and n_open_with_default().
| int n_spawn_pipe_close | ( | N_SPAWN_PIPE ** | pipe, |
| int | stop, | ||
| int * | exit_code ) |
End a program's input, or end the program, and wait for it.
With stop at zero the input is closed, which is the end of the stream, and the program is waited for as long as it takes to finish with it. With stop set it is ended first - SIGTERM then SIGKILL two seconds later on POSIX, TerminateProcess on Windows - for a caller abandoning the work. Either way it is reaped, and *pipe is freed and set to NULL.
| pipe | Address of the running program. NULL or *NULL is a no-op that returns FALSE. |
| stop | Non-zero to end the program rather than let it finish. |
| exit_code | Receives its exit code, 127 when it could not be found or started on POSIX, -1 when it was ended by a signal or stopped. May be NULL. |
Definition at line 716 of file n_common.c.
References N_SPAWN_PIPE::child, Free, N_SPAWN_PIPE::input, LOG_ERR, LOG_NOTICE, n_log, N_SPAWN_PIPE::program, and stop().
Referenced by main().
| N_SPAWN_PIPE * n_spawn_pipe_open | ( | const char * | program, |
| const char *const * | args, | ||
| const char * | log_path ) |
Start a program whose standard input is fed by the caller.
For a tool that takes a stream rather than a file: an encoder fed raw frames, a compressor fed a buffer. No shell is involved, as with n_spawn_wait(). The program reads what n_spawn_pipe_write() sends and sees the end of its input at n_spawn_pipe_close(). Its standard output and error go to log_path when given, so what it said can be read after it failed, and are left as the caller's otherwise.
The write end is never inherited by another program the caller starts, which would otherwise hold the pipe open and keep this one waiting for an end of input that never comes.
| program | Program to run: a name on the PATH or a path. |
| args | Its arguments after the program itself, NULL terminated. May be NULL for none. |
| log_path | File that receives the program's standard output and error, created or truncated. NULL leaves them as they are. |
Definition at line 525 of file n_common.c.
References __n_assert, N_SPAWN_PIPE::child, Free, N_SPAWN_PIPE::input, line(), LOG_ERR, Malloc, n_log, and N_SPAWN_PIPE::program.
Referenced by main().
| int n_spawn_pipe_write | ( | N_SPAWN_PIPE * | pipe, |
| const void * | data, | ||
| size_t | len ) |
Write to a program's standard input, all of it.
Blocks while the program is not reading, which is how a fast producer is held to a slow consumer's pace. A program that has ended, or closed its input, makes this return FALSE rather than raise SIGPIPE: the signal is held back for the calling thread during the write and discarded.
| pipe | The running program. NULL fails. |
| data | What to write. May be NULL when len is 0. |
| len | How many bytes. |
Definition at line 655 of file n_common.c.
References __n_assert, N_SPAWN_PIPE::input, LOG_ERR, n_log, and N_SPAWN_PIPE::program.
Referenced by main().
| int n_spawn_wait | ( | const char * | program, |
| const char *const * | args, | ||
| int * | exit_code ) |
Run a program with arguments and wait for it to finish.
The waiting counterpart of n_spawn_detached(), for a tool whose result the caller needs before going on: a converter, a compressor. No shell is involved, so every argument arrives whole whatever it contains. On POSIX the program is found on the PATH, started with fork and execvp and reaped with waitpid; on Windows it is CreateProcess with each argument quoted and a wait on its handle. The caller's thread blocks for as long as the program runs: call it from a worker, not from an interface thread.
| program | Program to run: a name on the PATH or a path. |
| args | Its arguments after the program itself, NULL terminated. May be NULL for none. |
| exit_code | Receives the program's exit code when it ran to the end, 127 when it could not be found or started on POSIX, -1 when it was ended by a signal. May be NULL. |
Definition at line 370 of file n_common.c.
References n_spawn_wait_cancel().
Referenced by main().
| int n_spawn_wait_cancel | ( | const char * | program, |
| const char *const * | args, | ||
| int * | exit_code, | ||
| const volatile int * | cancel ) |
Run a program and wait for it, ending it early when asked.
n_spawn_wait() for a program that can run for minutes, a download say, whose caller must be able to stop it. While the program runs the flag is looked at every tenth of a second; once it is non-zero the program is ended - SIGTERM, then SIGKILL two seconds later on POSIX, TerminateProcess on Windows - and reaped, and the call returns FALSE. What the program had written by then is the caller's to remove.
| program | Program to run: a name on the PATH or a path. |
| args | Its arguments after the program itself, NULL terminated. May be NULL for none. |
| exit_code | As n_spawn_wait(); -1 when the program was stopped. May be NULL. |
| cancel | Flag another thread raises to stop the program. Read, never written. NULL waits as n_spawn_wait() does. |
Definition at line 374 of file n_common.c.
References __n_assert, line(), LOG_ERR, LOG_NOTICE, and n_log.
Referenced by main(), and n_spawn_wait().
| void sigchld_handler | ( | int | sig | ) |
reap zombie processes
reap zombie processes
| sig | signal type handle |
Definition at line 842 of file n_common.c.
References LOG_DEBUG, and n_log.
Referenced by sigchld_handler_installer().
| int sigchld_handler_installer | ( | void | ) |
install signal SIGCHLD handler
install signal SIGCHLD handler
Definition at line 856 of file n_common.c.
References LOG_ERR, n_log, and sigchld_handler().
Referenced by main(), and n_daemonize_ex().
| pid_t system_nb | ( | const char * | command, |
| int * | infp, | ||
| int * | outfp ) |
non-blocking system call
non-blocking system call
| command | to call |
| infp | stdin file descriptor holder or NULL |
| outfp | stdout file descriptor holder or NULL |
Definition at line 979 of file n_common.c.
References __n_assert, LOG_ERR, and n_log.
Referenced by main().