/** * Escape objects and go to the light or dark * @global _mode_light_ it must be set */ void go_light_touch() { int bmp; start_process(go_light()); _go_light_touch_running_ = 1; while(_go_light_touch_running_) { /* Obstacle touched, I stop the run and I am escaping */ bmp = bumper_detection(); if(bmp != 0 && bmp != BMP_BACK) { stop_process(_go_light_running_); wait_process(_go_light_running_); escape(bmp); /* Run after the correction*/ start_process(go_light()); } } stop_process(_go_light_running_); wait_process(_go_light_running_); _go_light_touch_running_ = -1; }
/** * Running to 20cm of ligth * but escape obstacle with bumpers */ void go_light_stop_touch() { int bmp; _mode_light_ = GO_LIGHT; _motor_initial_speed_ = 100; light_environnement(); start_process(go_light_stop(20)); while(_go_light_touch_running_) { bmp = bumper_detection(); if(bmp != 0 && (bmp != BMP_BACK)) { stop_process(_go_light_stop_running_); wait_process(_go_light_stop_running_); escape(bmp); start_process(go_light_stop(20)); } } stop_process(_go_light_stop_running_); wait_process(_go_light_stop_running_); _go_light_touch_running_ = -1; }
/** * Avoid objects and go to the light or dark * @global _mode_light_ it must be set */ void go_light_detection() { int ir; start_process(go_light()); _go_light_detection_running_ = 1; while(_go_light_detection_running_) { /* Obstacle detected, I stop the run and I am escaping remotely */ if((ir = ir_detect()) != OBSTACLE_NONE) { stop_process(_go_light_running_); wait_process(_go_light_running_); escape(ir); /* Run after the correction*/ start_process(go_light()); } } stop_process(_go_light_running_); wait_process(_go_light_running_); _go_light_detection_running_ = -1; }
void stop_milkfish(void) { if (stop_process("rtpproxy", "rtpproxy") || stop_process("openser", "openser")) { eval("milkfish_services", "stop"); } }
void stop_dhcpfwd(void) { #ifdef HAVE_DHCPFORWARD stop_process("dhcpfwd", "dhcp forwarder"); #endif #ifdef HAVE_DHCPRELAY stop_process("dhcrelay", "dhcp relay"); #endif }
void stop_pptpd(void) { stop_process("pptpd", "pptp server"); stop_process("bcrelay", "pptp broadcast relay"); unlink("/tmp/pptp_connected"); if (nvram_default_match("sys_enable_jffs2", "1", "0")) system("/bin/cp /tmp/pptp_peer.db /jffs/etc/"); #ifdef HAVE_PPTP_ACCEL eval("rmmod","pptp"); #endif return; }
void stop_l2tp(void) { route_del(nvram_safe_get("wan_ifname"), 0, nvram_safe_get("l2tp_server_ip"), NULL, NULL); unlink("/tmp/ppp/link"); stop_process("pppd", "ppp daemon"); stop_process("xl2tpd", "L2TP daemon"); stop_process("listen", "connectivity listener"); cprintf("done\n"); return; }
void stop_pptp(void) { route_del(nvram_safe_get("wan_ifname"), 0, nvram_safe_get("pptp_server_ip"), NULL, NULL); unlink("/tmp/ppp/link"); stop_process("pppd", "PPP daemon"); stop_process("pptp", "PPTP daemon"); stop_process("listen", "activity daemon"); cprintf("done\n"); return; }
void stop_freeradius(void) { cprintf("done\n"); stop_process("radiusd", "FreeRadius daemon"); return; }
void stop_ttraff(void) { stop_process("ttraff", "traffic counter daemon"); cprintf("done\n"); return; }
void stop_all_processes() { for (auto it = child_processes_.begin(); it < child_processes_.end(); ++it) { stop_process(it); } }
void SimpleCpcClient::cmd_stop(char *arg) { Properties p; Vector<Process> proc_list; list_processes(proc_list, p); bool stopped = false; for(size_t i = 0; i < proc_list.size(); i++) { if(strcmp(proc_list[i].m_name.c_str(), arg) == 0) { stopped = true; Properties reply; stop_process(proc_list[i].m_id, reply); Uint32 status; reply.get("status", &status); if(status != 0) { BaseString msg; reply.get("errormessage", msg); ndbout << "Stop failed: " << msg << endl; } } } if(!stopped) ndbout << "No such process" << endl; }
void stop_openvpnserver(void) { #if defined(HAVE_TMK) || defined(HAVE_BKM) char *gpiovpn = nvram_get("gpiovpn"); if (gpiovpn != NULL) { set_gpio(atoi(gpiovpn), 0); } #endif if (stop_process("openvpnserver", "OpenVPN daemon (Server)")) { eval("stopservice", "wshaper"); eval("startservice", "wshaper"); //remove ebtables rules on shutdown system("/usr/sbin/ebtables -t nat -D POSTROUTING -o tap2 --pkttype-type multicast -j DROP"); system("/usr/sbin/ebtables -t nat -D POSTROUTING -o tap2 -p ipv4 --ip-proto udp --ip-sport 67:68 --ip-dport 67:68 -j DROP"); system("/usr/sbin/ebtables -t nat -D PREROUTING -i tap2 -p ipv4 --ip-proto udp --ip-sport 67:68 --ip-dport 67:68 -j DROP"); unlink("/tmp/openvpn/ccd/DEFAULT"); unlink("/tmp/openvpn/dh.pem"); unlink("/tmp/openvpn/ca.crt"); unlink("/tmp/openvpn/cert.pem"); unlink("/tmp/openvpn/ca.crl"); unlink("/tmp/openvpn/key.pem"); unlink("/tmp/openvpn/ta.key"); unlink("/tmp/openvpn/cert.p12"); unlink("/tmp/openvpn/static.key"); unlink("/tmp/openvpn/openvpn.conf"); unlink("/tmp/openvpn/route-up.sh"); unlink("/tmp/openvpn/route-down.sh"); } return; }
void nm_dhcp_client_stop_existing (const char *pid_file, const char *binary_name) { char *pid_contents = NULL, *proc_contents = NULL, *proc_path = NULL; long int tmp; /* Check for an existing instance and stop it */ if (!g_file_get_contents (pid_file, &pid_contents, NULL, NULL)) return; errno = 0; tmp = strtol (pid_contents, NULL, 10); if ((errno == 0) && (tmp > 1)) { const char *exe; /* Ensure the process is a DHCP client */ proc_path = g_strdup_printf ("/proc/%ld/cmdline", tmp); if (g_file_get_contents (proc_path, &proc_contents, NULL, NULL)) { exe = strrchr (proc_contents, '/'); if (exe) exe++; else exe = proc_contents; if (!strcmp (exe, binary_name)) stop_process ((GPid) tmp, NULL); } } remove (pid_file); g_free (proc_path); g_free (pid_contents); g_free (proc_contents); }
void stop_radio_timer(void) { stop_process("radio_timer", "radio timer daemon"); cprintf("done\n"); return; }
void stop_processes(void* owner) { for (auto it = child_processes_.begin(); it < child_processes_.end(); ++it) { if (it->owner == owner) stop_process(it); } }
void stop_radvd(void) { stop_process("radvd", "RADV daemon"); unlink("/var/run/radvd.pid"); cprintf("done\n"); return; }
void stop_ftpsrv(void) { unlink("/tmp/proftpd/etc/passwd"); unlink("/tmp/proftpd/etc/proftpd.conf"); unlink("/tmp/proftpd/etc/proftpd.scoreboard"); stop_process("proftpd", "FTP Server"); }
void stop_chilli(void) { if (stop_process("chilli", "chilli daemon")) { unlink("/tmp/chilli/chilli.conf"); unlink("/tmp/chilli/hotss.conf"); } cprintf("done\n"); return; }
void stop_chilli(void) { if (stop_process("chilli", "chilli daemon")) { unlink("/tmp/chilli/chilli.conf"); unlink("/tmp/chilli/hotss.conf"); unlink("/tmp/chilli/ip-up.sh"); unlink("/tmp/chilli/ip-down.sh"); system("rm -rf /var/run/chilli1"); } cprintf("done\n"); return; }
void stop_pppoe(void) { unlink("/tmp/ppp/link"); stop_process("pppd", "pppoe process"); if (nvram_match("wan_vdsl", "1")) { eval("ifconfig", nvram_safe_get("wan_iface"), "down"); eval("vconfig", "rem", nvram_safe_get("wan_iface")); } cprintf("done\n"); return; }
void start_lltd(void) { int ret; if (nvram_match("lltd_enabled", "0")) { stop_lltd(); return; } /* * Make sure its not running first */ stop_process("lld2d", "Stop LLTD Daemon"); ret = eval("lld2d", nvram_safe_get("lan_ifname")); dd_syslog(LOG_INFO, "lld2d : LLTD Daemon successfully started\n"); return; }
void stop_dns_clear_resolv(void) { FILE *fp_w; stop_process("dnsmasq", "dnsmasq daemon"); /* * Save DNS to resolv.conf */ if (!(fp_w = fopen(RESOLV_FILE, "w"))) { perror(RESOLV_FILE); return; } fprintf(fp_w, " "); fclose(fp_w); cprintf("done\n"); return; }
static void real_stop (NMDHCPClient *self) { NMDHCPClientPrivate *priv; g_return_if_fail (self != NULL); g_return_if_fail (NM_IS_DHCP_CLIENT (self)); priv = NM_DHCP_CLIENT_GET_PRIVATE (self); g_return_if_fail (priv->pid > 0); /* Clean up the watch handler since we're explicitly killing the daemon */ watch_cleanup (self); stop_process (priv->pid, priv->iface); priv->info_only = FALSE; }
int handle_leader(t_player *player, char **map, t_target *target) { int ret; ret = 0; if (count_followers(map, player->team) >= 1 && !(ret = determ_target(target, player, map, 1))) { stop_process(player, map); manage_ressources(UNLOCK); return 1; } if (ret > 0) { lead_team(target, count_followers(map, player->team)); hunt(player, target, map); } return 0; }
void stop_openvpn(void) { if (stop_process("openvpn", "OpenVPN daemon (Client)")) { if (nvram_match("wshaper_enable", "1")) { stop_wshaper(); start_wshaper(); } //remove ebtables rules on shutdown system("/usr/sbin/ebtables -t nat -D POSTROUTING -o tap1 --pkttype-type multicast -j DROP"); unlink("/tmp/openvpncl/ca.crt"); unlink("/tmp/openvpncl/client.crt"); unlink("/tmp/openvpncl/client.key"); unlink("/tmp/openvpncl/ta.key"); unlink("/tmp/openvpncl/cert.p12"); unlink("/tmp/openvpncl/static.key"); unlink("/tmp/openvpncl/openvpncl.conf"); unlink("/tmp/openvpncl/route-up.sh"); unlink("/tmp/openvpncl/route-down.sh"); } }
static bool do_reset_proc(atrt_config& config, SqlResultSet& command, AtrtClient& atrtdb){ uint process_id= command.columnAsInt("process_id"); g_logger.info("Reset process: %d", process_id); // Get the process if (process_id > config.m_processes.size()){ g_logger.critical("Invalid process id %d", process_id); return false; } atrt_process& proc= *config.m_processes[process_id]; g_logger.info("stopping process..."); if (!stop_process(proc)) return false; if (proc.m_save.m_saved) { ndbout << "before: " << proc << endl; proc.m_proc= proc.m_save.m_proc; proc.m_save.m_saved= false; proc.m_proc.m_id= -1; ndbout << "after: " << proc << endl; } else { ndbout << "process has not changed" << endl; } g_logger.info("starting process..."); if (!start_process(proc)) return false; return true; }
void stop_lltd(void) { stop_process("lld2d", "Stop LLTD Daemon"); return; }
void stop_apserv(void) { stop_process("ap_serv", "buffalo discovery daemon"); return; }
void event_loop(const int *quit) { /* TODO: refactor this function event_loop(). */ LOG_FUNC_ENTER; const wchar_t *const prev_input_buf = curr_input_buf; const size_t *const prev_input_buf_pos = curr_input_buf_pos; wchar_t input_buf[128]; size_t input_buf_pos; int last_result = 0; int wait_for_enter = 0; int timeout = cfg.timeout_len; input_buf[0] = L'\0'; input_buf_pos = 0; curr_input_buf = &input_buf[0]; curr_input_buf_pos = &input_buf_pos; while(!*quit) { wint_t c; size_t counter; int got_input; if(!ensure_term_is_ready()) { wait_for_enter = 0; continue; } lwin.user_selection = 1; rwin.user_selection = 1; modes_pre(); /* Waits for timeout then skips if no keypress. Short-circuit if we're not * waiting for the next key after timeout. */ do { modes_periodic(); check_background_jobs(); got_input = get_char_async_loop(status_bar, &c, timeout) != ERR; if(!got_input && input_buf_pos == 0) { timeout = cfg.timeout_len; continue; } break; } while(1); /* Ensure that current working directory is set correctly (some pieces of * code rely on this). */ (void)vifm_chdir(flist_get_dir(curr_view)); if(got_input) { if(wait_for_enter) { wait_for_enter = 0; curr_stats.save_msg = 0; clean_status_bar(); if(c == L'\x0d') { continue; } } if(c == L'\x1a') /* Ctrl-Z */ { def_prog_mode(); endwin(); stop_process(); continue; } if(input_buf_pos < ARRAY_LEN(input_buf) - 2) { input_buf[input_buf_pos++] = c; input_buf[input_buf_pos] = L'\0'; } else { /* Recover from input buffer overflow by resetting its contents. */ reset_input_buf(input_buf, &input_buf_pos); clear_input_bar(); continue; } } counter = get_key_counter(); if(!got_input && last_result == KEYS_WAIT_SHORT) { last_result = execute_keys_timed_out(input_buf); counter = get_key_counter() - counter; assert(counter <= input_buf_pos); if(counter > 0) { memmove(input_buf, input_buf + counter, (wcslen(input_buf) - counter + 1)*sizeof(wchar_t)); } } else { if(got_input) { curr_stats.save_msg = 0; } last_result = execute_keys(input_buf); counter = get_key_counter() - counter; assert(counter <= input_buf_pos); if(counter > 0) { input_buf_pos -= counter; memmove(input_buf, input_buf + counter, (wcslen(input_buf) - counter + 1)*sizeof(wchar_t)); } if(last_result == KEYS_WAIT || last_result == KEYS_WAIT_SHORT) { if(got_input) { modupd_input_bar(input_buf); } if(last_result == KEYS_WAIT_SHORT && wcscmp(input_buf, L"\033") == 0) { timeout = 1; } if(counter > 0) { clear_input_bar(); } if(!curr_stats.save_msg && curr_view->selected_files && !vle_mode_is(CMDLINE_MODE)) { print_selected_msg(); } continue; } } timeout = cfg.timeout_len; process_scheduled_updates(); reset_input_buf(input_buf, &input_buf_pos); clear_input_bar(); if(is_status_bar_multiline()) { wait_for_enter = 1; update_all_windows(); continue; } /* Ensure that current working directory is set correctly (some pieces of * code rely on this). PWD could be changed during command execution, but * it should be correct for modes_post() in case of preview modes. */ (void)vifm_chdir(flist_get_dir(curr_view)); modes_post(); } curr_input_buf = prev_input_buf; curr_input_buf_pos = prev_input_buf_pos; }