void start_services () { init_services (); bzero (&user_list_head, sizeof (struct socket_list)); bzero (rooms, sizeof (rooms)); int i; for (i = 0; i < MAXROOM; i++) rooms[i].index = i; printf ("running services...\n"); struct epoll_event events[MAXEVENTS]; int nfds; while (1) { nfds = epoll_wait (epoll_fd, events, MAXEVENTS, -1); if (nfds == -1) { perror ("epoll_wait"); continue; } for (i = 0; i < nfds; ++i) { if (events[i].data.fd == listen_socket) on_accept (); else on_receive (events[i].data.fd); } } }
DJISDKNode::DJISDKNode(ros::NodeHandle& nh, ros::NodeHandle& nh_private) { init_publishers(nh); init_services(nh); init_actions(nh); init_parameters_and_activate(nh_private); }
/* Daemon init sequence */ static void start_check(void) { /* Initialize sub-system */ ipvs_start(); init_checkers_queue(); #ifdef _WITH_VRRP_ init_interface_queue(); kernel_netlink_init(); #endif #ifdef _WITH_SNMP_ if (!reload && snmp) check_snmp_agent_init(); #endif /* Parse configuration file */ global_data = alloc_global_data(); check_data = alloc_check_data(); init_data(conf_file, check_init_keywords); if (!check_data) { stop_check(); return; } /* Post initializations */ log_message(LOG_INFO, "Configuration is using : %lu Bytes", mem_allocated); /* SSL load static data & initialize common ctx context */ if (!init_ssl_ctx()) { stop_check(); return; } /* Processing differential configuration parsing */ if (reload) { clear_diff_services(); copy_srv_states(); } /* Initialize IPVS topology */ if (!init_services()) { stop_check(); return; } /* Dump configuration */ if (debug & 4) { dump_global_data(global_data); dump_check_data(check_data); } #ifdef _WITH_VRRP_ /* Initialize linkbeat */ init_interface_linkbeat(); #endif /* Register checkers thread */ register_checkers_thread(); }
int main(int argc, char **argv) { #if ! defined(_WIN32) __log_error = (void (*)(void *, const char *,...)) log_server; /*set c-icap library log function */ #else __vlog_error = vlog_server; /*set c-icap library log function */ #endif mem_init(); init_internal_lookup_tables(); ci_acl_init(); init_http_auth(); if (init_body_system() != CI_OK) { ci_debug_printf(1, "Can not initialize body system\n"); exit(-1); } ci_txt_template_init(); ci_txt_template_set_dir(DATADIR"templates"); commands_init(); if (!(CI_CONF.MAGIC_DB = ci_magic_db_load(CI_CONF.magics_file))) { ci_debug_printf(1, "Can not load magic file %s!!!\n", CI_CONF.magics_file); } init_conf_tables(); request_stats_init(); init_modules(); init_services(); config(argc, argv); compute_my_hostname(); ci_debug_printf(2, "My hostname is:%s\n", MY_HOSTNAME); if (!log_open()) { ci_debug_printf(1, "Can not init loggers. Exiting.....\n"); exit(-1); } #if ! defined(_WIN32) if (is_icap_running(CI_CONF.PIDFILE)) { ci_debug_printf(1, "c-icap server already running!\n"); exit(-1); } if (DAEMON_MODE) run_as_daemon(); if (!set_running_permissions(CI_CONF.RUN_USER, CI_CONF.RUN_GROUP)) exit(-1); store_pid(CI_CONF.PIDFILE); #endif if (!init_server(CI_CONF.ADDRESS, CI_CONF.PORT, &(CI_CONF.PROTOCOL_FAMILY))) return -1; post_init_modules(); post_init_services(); start_server(); clear_pid(CI_CONF.PIDFILE); return 0; }
/** * @brief Initialize Bluetooth Low Energy and start advertising */ void ble_init() { nrf_gpio_cfg_output(PIN_LED_ADVERTISING); nrf_gpio_cfg_output(PIN_LED_CONNECTED); nrf_gpio_cfg_output(PIN_LED_DATA); APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false); init_softdevice(); init_ble_stack(); init_gap(); init_services(); init_characteristics(); init_advertising(); init_connection_parameters(); init_security_parameters(); start_advertising(); }
/* Daemon init sequence */ static void start_check(void) { /* Initialize sub-system */ if (ipvs_start() != IPVS_SUCCESS) { stop_check(KEEPALIVED_EXIT_FATAL); return; } init_checkers_queue(); #ifdef _WITH_VRRP_ init_interface_queue(); kernel_netlink_init(); #endif /* Parse configuration file */ global_data = alloc_global_data(); check_data = alloc_check_data(); if (!check_data) stop_check(KEEPALIVED_EXIT_FATAL); init_data(conf_file, check_init_keywords); init_global_data(global_data); /* Post initializations */ #ifdef _MEM_CHECK_ log_message(LOG_INFO, "Configuration is using : %zu Bytes", mem_allocated); #endif /* Remove any entries left over from previous invocation */ if (!reload && global_data->lvs_flush) ipvs_flush_cmd(); #ifdef _WITH_SNMP_CHECKER_ if (!reload && global_data->enable_snmp_checker) check_snmp_agent_init(global_data->snmp_socket); #endif /* SSL load static data & initialize common ctx context */ if (!init_ssl_ctx()) stop_check(KEEPALIVED_EXIT_FATAL); /* fill 'vsg' members of the virtual_server_t structure. * We must do that after parsing config, because * vs and vsg declarations may appear in any order */ link_vsg_to_vs(); /* Set the process priority and non swappable if configured */ if (global_data->checker_process_priority) set_process_priority(global_data->checker_process_priority); if (global_data->checker_no_swap) set_process_dont_swap(4096); /* guess a stack size to reserve */ /* Processing differential configuration parsing */ if (reload) clear_diff_services(); /* Initialize IPVS topology */ if (!init_services()) stop_check(KEEPALIVED_EXIT_FATAL); /* Dump configuration */ if (__test_bit(DUMP_CONF_BIT, &debug)) { dump_global_data(global_data); dump_check_data(check_data); } #ifdef _WITH_VRRP_ /* Initialize linkbeat */ init_interface_linkbeat(); #endif /* Register checkers thread */ register_checkers_thread(); }
/* Daemon init sequence */ static void start_check(void) { /* Initialize sub-system */ if (ipvs_start() != IPVS_SUCCESS) { stop_check(); return; } init_checkers_queue(); #ifdef _WITH_VRRP_ init_interface_queue(); kernel_netlink_init(); #endif #ifdef _WITH_SNMP_ if (!reload && snmp) check_snmp_agent_init(snmp_socket); #endif /* Parse configuration file */ global_data = alloc_global_data(); check_data = alloc_check_data(); init_data(conf_file, check_init_keywords); if (!check_data) { stop_check(); return; } init_global_data(global_data); /* Post initializations */ #ifdef _DEBUG_ log_message(LOG_INFO, "Configuration is using : %lu Bytes", mem_allocated); #endif /* SSL load static data & initialize common ctx context */ if (!init_ssl_ctx()) { stop_check(); return; } /* fill 'vsg' members of the virtual_server_t structure. * We must do that after parsing config, because * vs and vsg declarations may appear in any order */ link_vsg_to_vs(); /* Processing differential configuration parsing */ if (reload) clear_diff_services(); /* Initialize IPVS topology */ if (!init_services()) { stop_check(); return; } /* Dump configuration */ if (__test_bit(DUMP_CONF_BIT, &debug)) { dump_global_data(global_data); dump_check_data(check_data); } #ifdef _WITH_VRRP_ /* Initialize linkbeat */ init_interface_linkbeat(); #endif /* Register checkers thread */ register_checkers_thread(); }