int iface_up(interface_defn *iface) { if (!iface->method->up(iface,check)) return -1; set_environ(iface, "start", "pre-up"); if (!execute_all(iface,doit,"pre-up")) return 0; if (!iface->method->up(iface,doit)) return 0; set_environ(iface, "start", "post-up"); if (!execute_all(iface,doit,"up")) return 0; return 1; }
int iface_down(interface_defn *iface) { if (!iface->method->down(iface,check)) return -1; set_environ(iface, "stop", "pre-down"); if (!execute_all(iface,doit,"down")) return 0; if (!iface->method->down(iface,doit)) return 0; set_environ(iface, "stop", "post-down"); if (!execute_all(iface,doit,"post-down")) return 0; return 1; }
void group_entry_execute(struct group_entry *entry, struct packet *packet) { VLOG_DBG_RL(LOG_MODULE, &rl, "Executing group %u.", entry->stats->group_id); /* NOTE: Packet is copied for all buckets now (even if there is only one). * This allows execution of the original packet onward. It is not clear * whether that is allowed or not according to the spec. though. */ switch (entry->desc->type) { case (OFPGT_ALL): { execute_all(entry, packet); break; } case (OFPGT_SELECT): { execute_select(entry, packet); break; } case (OFPGT_INDIRECT): { execute_indirect(entry, packet); break; } case (OFPGT_FF): { execute_ff(entry, packet); break; } default: { VLOG_WARN_RL(LOG_MODULE, &rl, "Trying to execute unknown group type (%u) in group (%u).", entry->desc->type, entry->stats->group_id); } } }
int main(int argc, char *argv[]) { if (argc != 2) err_exit("./functester /path/to/cmd/file\n"); const char *cmdfile = argv[1]; construct_all_cmds(cmdfile); execute_all(); return 0; }
pid_t execute_and_distrib(t_shell *sh, t_command *c) { pid_t child; pid_t child2; int pip[2][2]; int pip_sh[2][2]; do_pipes(pip, pip_sh); child = my_fork(); if (!child) { execute_all(sh, c, pip_sh, pip); handle_error_messages(sh); return (quit(sh, sh->last_status)); } else { prepa_exec(sh, c, pip_sh, pip); child2 = distrib_and_send(sh, c, pip[0][0], pip[1][0]); wait_exec(child2, pip); return (child); } }