static void sbd_cmap_notify_fn( cmap_handle_t cmap_handle, cmap_track_handle_t cmap_track_handle, int32_t event, const char *key_name, struct cmap_notify_value new_val, struct cmap_notify_value old_val, void *user_data) { if (new_val.type == CMAP_VALUETYPE_UINT8) { switch (event) { case CMAP_TRACK_ADD: case CMAP_TRACK_MODIFY: two_node = *((uint8_t *) new_val.data); break; case CMAP_TRACK_DELETE: two_node = false; break; default: return; } sbd_cpg_membership_health_update(); notify_parent(); } }
void update(float delta) { x_axis->update(delta); y_axis->update(delta); if (speed_button) speed_button->update(delta); Vector2f new_pos = pos; float c_speed = speed; if (speed_button && speed_button->get_state() == BUTTON_PRESSED) { c_speed *= 5.0f; } new_pos.x += x_axis->get_pos() * c_speed * delta; new_pos.y += y_axis->get_pos() * c_speed * delta; // FIXME: shouldn't depend on Display new_pos.x = Math::clamp(0.0f, new_pos.x, static_cast<float>(Display::get_width())); new_pos.y = Math::clamp(0.0f, new_pos.y, static_cast<float>(Display::get_height())); if (new_pos != pos) { pos = new_pos; notify_parent(); } }
static gboolean mon_timer_notify(gpointer data) { static int counter = 0; int counter_max = timeout_watchdog / timeout_loop; if (timer_id_notify > 0) { g_source_remove(timer_id_notify); } if (cib_connected) { if (counter == counter_max) { free_xml(current_cib); current_cib = get_cib_copy(cib); mon_refresh_state(NULL); counter = 0; } else { cib->cmds->noop(cib, 0); notify_parent(); counter++; } } timer_id_notify = g_timeout_add(timeout_loop * 1000, mon_timer_notify, NULL); return FALSE; }
asmlink void do_exit(int code) { pushcli(); if (task_curr->id == 1) PANIC(">> exit task 1"); remove_from_runnable_list(task_curr); task_curr->state = Task::State_zombie; task_zombie_list.push_back(&task_curr->list_node); task_free(task_curr); task_curr->time_end = jiffies; task_curr->exit_code = code; // FIXME: ??? if (task_curr->exit_signal == 0) task_curr->exit_signal = SIGCHLD; notify_parent(task_curr); print_info(">> [%d] exit OK\n", task_curr->id); popif(); schedule(); PANIC("do_exit return"); }
void set_delta(const Vector2f& new_delta) { if (delta != new_delta) { delta = new_delta; notify_parent(); } }
static int victim_child(union pipe read_pipe, union pipe write_pipe) { FAIL_IF(wait_for_parent(read_pipe)); /* Setup our EBB handler, before the EBB event is created */ ebb_enable_pmc_counting(1); setup_ebb_handler(standard_ebb_callee); ebb_global_enable(); FAIL_IF(notify_parent(write_pipe)); while (ebb_state.stats.ebb_count < 20) { FAIL_IF(core_busy_loop()); } ebb_global_disable(); ebb_freeze_pmcs(); count_pmc(1, sample_period); dump_ebb_state(); FAIL_IF(ebb_state.stats.ebb_count == 0); return 0; }
void set_pos(const Vector2f& new_pos) { if (pos != new_pos) { pos = new_pos; notify_parent(); } }
asmlinkage void syscall_trace(void) { #ifdef DEBUG_PTRACE printk("%s [%d]: syscall_trace\n", current->comm, current->pid); #endif if (!test_thread_flag(TIF_SYSCALL_TRACE)) return; if (!(current->ptrace & PT_PTRACED)) return; current->exit_code = SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0); current->state = TASK_STOPPED; notify_parent(current, SIGCHLD); schedule(); /* * this isn't the same as continuing with a signal, but it will do * for normal use. strace only continues with a signal if the * stopping signal is not SIGTRAP. -brl */ #ifdef DEBUG_PTRACE printk("%s [%d]: syscall_trace exit= %x\n", current->comm, current->pid, current->exit_code); #endif if (current->exit_code) { send_sig (current->exit_code, current, 1); current->exit_code = 0; } }
static gboolean notify_timer_cb(gpointer data) { cl_log(LOG_DEBUG, "Refreshing %sstate", remote_node?"remote ":""); if(remote_node) { sbd_remote_check(NULL); return TRUE; } switch (get_cluster_type()) { case pcmk_cluster_classic_ais: send_cluster_text(crm_class_quorum, NULL, TRUE, NULL, crm_msg_ais); break; case pcmk_cluster_corosync: case pcmk_cluster_cman: /* TODO - Make a CPG call and only call notify_parent() when we get a reply */ notify_parent(); break; default: break; } return TRUE; }
static void run_child(size_t cpu) { struct child * self = &children[cpu]; self->pid = getpid(); self->sigusr1 = 0; self->sigusr2 = 0; self->sigterm = 0; inner_child = self; if (atexit(close_pipe)){ close_pipe(); exit(EXIT_FAILURE); } umask(0); /* Change directory to allow directory to be removed */ if (chdir("/") < 0) { perror("Unable to chdir to \"/\""); exit(EXIT_FAILURE); } setup_signals(); set_affinity(cpu); create_context(self); write_pmu(self); load_context(self); notify_parent(self, cpu); /* Redirect standard files to /dev/null */ freopen( "/dev/null", "r", stdin); freopen( "/dev/null", "w", stdout); freopen( "/dev/null", "w", stderr); for (;;) { sigset_t sigmask; sigfillset(&sigmask); sigdelset(&sigmask, SIGUSR1); sigdelset(&sigmask, SIGUSR2); sigdelset(&sigmask, SIGTERM); if (self->sigusr1) { perfmon_start_child(self->ctx_fd); self->sigusr1 = 0; } if (self->sigusr2) { perfmon_stop_child(self->ctx_fd); self->sigusr2 = 0; } sigsuspend(&sigmask); } }
virtual void set_state(ButtonState new_state) { if (new_state != state) { state = new_state; notify_parent(); } }
/*ARGSUSED*/ static void sigchld_handler(int sig) { int save_errno = errno; child_terminated = 1; signal(SIGCHLD, sigchld_handler); notify_parent(); errno = save_errno; }
void update(Control* p) { Pointer* pointer = dynamic_cast<Pointer*>(p); assert(pointer); Vector2f new_pos = pointer->get_pos(); if (new_pos != pos) { pos = new_pos; notify_parent(); } }
void ptrace_notify(int exit_code) { if (!(current->ptrace & PT_PTRACED)) BUG (); /* Let the debugger run. */ current->exit_code = exit_code; set_current_state(TASK_STOPPED); notify_parent(current, SIGCHLD); schedule(); }
/*ARGSUSED*/ static void sigchld_handler(int sig) { int save_errno = errno; child_terminated = 1; #ifndef _UNICOS mysignal(SIGCHLD, sigchld_handler); #endif notify_parent(); errno = save_errno; }
static void sbd_membership_destroy(gpointer user_data) { cl_log(LOG_WARNING, "Lost connection to %s", name_for_cluster_type(get_cluster_type())); set_servant_health(pcmk_health_unclean, LOG_ERR, "Cluster connection terminated"); notify_parent(); /* Attempt to reconnect, the watchdog will take the node down if the problem isn't transient */ sbd_membership_connect(); }
static void sbd_membership_connect(void) { bool connected = false; cl_log(LOG_INFO, "Attempting cluster connection"); cluster.destroy = sbd_membership_destroy; #if SUPPORT_PLUGIN cluster.cpg.cpg_deliver_fn = sbd_plugin_membership_dispatch; #endif #if SUPPORT_COROSYNC cluster.cpg.cpg_confchg_fn = sbd_cpg_membership_dispatch; #endif while(connected == false) { enum cluster_type_e stack = get_cluster_type(); if(get_cluster_type() == pcmk_cluster_unknown) { crm_debug("Attempting pacemaker remote connection"); /* Nothing is up, go looking for the pacemaker remote process */ if(find_pacemaker_remote() > 0) { connected = true; } } else { cl_log(LOG_INFO, "Attempting connection to %s", name_for_cluster_type(stack)); #if SUPPORT_COROSYNC && CHECK_TWO_NODE if (sbd_get_two_node()) { #endif if(crm_cluster_connect(&cluster)) { connected = true; } #if SUPPORT_COROSYNC && CHECK_TWO_NODE } #endif } if(connected == false) { cl_log(LOG_INFO, "Failed, retrying in %ds", reconnect_msec / 1000); sleep(reconnect_msec / 1000); } } set_servant_health(pcmk_health_transient, LOG_INFO, "Connected, waiting for initial membership"); notify_parent(); notify_timer_cb(NULL); }
void sbd_cpg_membership_dispatch(cpg_handle_t handle, const struct cpg_name *groupName, const struct cpg_address *member_list, size_t member_list_entries, const struct cpg_address *left_list, size_t left_list_entries, const struct cpg_address *joined_list, size_t joined_list_entries) { cpg_membership_entries = member_list_entries; sbd_cpg_membership_health_update(); notify_parent(); }
void param_set_t::end_edit( bool notify) { if( command_.get() && !is_command_empty()) undo::undo_stack_t::Instance().push_back( command_); else command_.reset(); if( notify) notify_parent(); ui::anim_editor_t::Instance().update(); }
virtual void set_state(float new_pos) { if (invert) new_pos = -new_pos; if (fabsf(new_pos) < dead_zone) new_pos = 0.0f; if (new_pos != pos) { pos = new_pos; notify_parent(); } }
void param_set_t::end_edit( bool notify) { if( command_.get() && !is_command_empty()) app().document().undo_stack().push_back( command_); else command_.reset(); if( notify) notify_parent(); app().ui()->update(); app().ui()->update_anim_editors(); }
static void sbd_plugin_membership_dispatch(cpg_handle_t handle, const struct cpg_name *groupName, uint32_t nodeid, uint32_t pid, void *msg, size_t msg_len) { if(msg_len > 0) { set_servant_health(pcmk_health_online, LOG_INFO, "Connected to %s", name_for_cluster_type(get_cluster_type())); } else { set_servant_health(pcmk_health_unclean, LOG_WARNING, "Broken %s message", name_for_cluster_type(get_cluster_type())); } notify_parent(); return; }
void evt_child_started( const so_5::event_data_t< msg_child_started > & ) { m_started_children += 1; if( m_started_children == m_max_children ) { if( m_level ) notify_parent(); else so_environment().deregister_coop( so_coop_name(), so_5::dereg_reason::normal ); } }
void sbd_cpg_membership_dispatch(cpg_handle_t handle, const struct cpg_name *groupName, const struct cpg_address *member_list, size_t member_list_entries, const struct cpg_address *left_list, size_t left_list_entries, const struct cpg_address *joined_list, size_t joined_list_entries) { if(member_list_entries > 0) { set_servant_health(pcmk_health_online, LOG_INFO, "Connected to %s", name_for_cluster_type(get_cluster_type())); } else { set_servant_health(pcmk_health_unclean, LOG_WARNING, "Empty %s membership", name_for_cluster_type(get_cluster_type())); } notify_parent(); }
static void syscall_ptrace(void) { current->exit_code = SIGTRAP; current->state = TASK_STOPPED; notify_parent(current, SIGCHLD); schedule(); /* * this isn't the same as continuing with a signal, but it will do * for normal use. strace only continues with a signal if the * stopping signal is not SIGTRAP. -brl */ if (current->exit_code) { send_sig(current->exit_code, current, 1); current->exit_code = 0; } }
virtual void update(Control* ctrl) { ButtonState new_state = BUTTON_RELEASED; for(std::vector<Button*>::iterator i = buttons.begin(); i != buttons.end(); ++i) { if ((*i)->get_state() == BUTTON_PRESSED) new_state = BUTTON_PRESSED; } if (new_state != state) { state = new_state; notify_parent(); } }
void so_evt_start() { if( m_level != m_max_deep ) { for( int i = 0; i != m_max_children; ++i ) create_and_register_agent( so_environment(), m_self_name, i, m_max_children, m_level + 1, m_max_deep ); } else notify_parent(); }
static void sbd_membership_destroy(gpointer user_data) { cl_log(LOG_WARNING, "Lost connection to %s", name_for_cluster_type(get_cluster_type())); if (get_cluster_type() != pcmk_cluster_unknown) { #if SUPPORT_COROSYNC && CHECK_TWO_NODE cmap_destroy(); #endif } set_servant_health(pcmk_health_unclean, LOG_ERR, "Cluster connection terminated"); notify_parent(); /* Attempt to reconnect, the watchdog will take the node down if the problem isn't transient */ sbd_membership_connect(); }
static void run_child(size_t cpu) { struct child * self = &children[cpu]; self->pid = getpid(); self->sigusr1 = 0; self->sigusr2 = 0; self->sigterm = 0; setup_signals(); set_affinity(cpu); create_context(self); write_pmu(self); load_context(self); notify_parent(self, cpu); for (;;) { sigset_t sigmask; sigfillset(&sigmask); sigdelset(&sigmask, SIGUSR1); sigdelset(&sigmask, SIGUSR2); sigdelset(&sigmask, SIGTERM); if (self->sigusr1) { printf("PFM_START on CPU%d\n", (int)cpu); fflush(stdout); perfmon_start_child(self->ctx_fd); self->sigusr1 = 0; } if (self->sigusr2) { printf("PFM_STOP on CPU%d\n", (int)cpu); fflush(stdout); perfmon_stop_child(self->ctx_fd); self->sigusr2 = 0; } sigsuspend(&sigmask); } }
/** * Update Actuator --> Send a message to the actuator turning it ON/OFF **/ void update_actuator(int msgid, group_st *devices, int index, int is_on, int sensor_data) { char message_to_parent[BUFFER_SIZE]; devices[index].is_on = is_on; if (is_on) { printf("%s threshold crossed. Turning ON\n", devices[index].actuator_name); sprintf(message_to_parent, "Sensor \"%s\" with value %d, turned ON %s", devices[index].sensor_name, sensor_data, devices[index].actuator_name); } else { printf("%s threshold crossed. Turning OFF\n", devices[index].actuator_name); sprintf(message_to_parent, "Sensor \"%s\" with value %d, turned OFF %s", devices[index].sensor_name, sensor_data, devices[index].actuator_name); } toggle_actuator(msgid, devices, index, is_on); notify_parent(msgid, message_to_parent); }