Lines Matching defs:method

28  * method.c - method execution functions
30 * This file contains the routines needed to run a method: a fork(2)-exec(2)
44 * from offline to online (i.e., the start method), we'll transfer inherited
87 * Mapping from restart_on method-type to contract events. Must correspond to
169 * Determine if the method for the given instance is transient,
343 * Activate a contract template for the type method of inst. type,
445 exec_method(const restarter_inst_t *inst, int type, const char *method,
453 cmd = uu_msprintf("exec %s", method);
459 log_instance(inst, B_FALSE, "Executing %s method (\"%s\").",
460 method_names[type], method);
469 "svc.startd could not set context for method: ");
628 "for %s method of %s: %s.\n", mname,
640 * Execute the type method of instp. If it requires a fork(), wait for it
642 * *exit_code to 0 if the method succeeds & -1 if it fails. If the
647 * EINVAL - A correct method or method context couldn't be retrieved.
651 * ECANCELED - inst was deleted from the repository before method was run
658 char *method;
701 "Using editing version to run method %s.\n",
720 if ((method = libscf_get_method(h, type, inst, snap, &restart_on,
724 "%s: instance has no method property group '%s'.\n",
727 log_instance(inst, B_TRUE, "No '%s' method "
736 "%s: instance has no '%s/exec' method property.\n",
765 "contract %ld. Stop method not run.",
771 if (restarter_is_null_method(method)) {
772 log_framework(LOG_DEBUG, "%s: null method succeeds\n",
775 log_instance(inst, B_TRUE, "Executing %s method (null).",
783 sig = restarter_is_kill_method(method);
790 "as stop method for transient service.");
799 log_instance(inst, B_TRUE, "Executing %s method (:kill).",
810 log_framework(LOG_DEBUG, "%s: forking to run method %s\n",
811 inst->ri_i.i_fmri, method);
814 inst->ri_m_inst, snap, mname, method, &mcp);
833 * Validate safety of method contexts, to save children work.
836 log_framework(LOG_DEBUG, "%s: method contexts limited "
840 * For wait-style svc, sanity check that method exists to prevent an
848 * We need to handle start method strings that have arguments,
849 * such as '/lib/svc/method/console-login %i'.
851 if ((pend = strchr(method, ' ')) != NULL)
854 if (*method == '/' && stat64(method, &sbuf) == -1 &&
856 log_instance(inst, B_TRUE, "Missing start method (%s), "
857 "changing state to maintenance.", method);
885 exec_method(inst, type, method, mcp, need_session);
895 "%s: Couldn't fork to execute method %s: %s\n",
896 inst->ri_i.i_fmri, method, strerror(forkerr));
913 * Similarly for the start method PID.
947 /* Unlock the instance while waiting for the method. */
972 "%s method for %s exited with status %d.\n", mname,
977 "Couldn't waitpid() for %s method of %s (%s).\n",
994 * If method didn't exit itself (it was killed by an
1004 inst->ri_i.i_fmri, method, buf);
1010 inst->ri_i.i_fmri, method,
1024 inst->ri_i.i_fmri, method, WEXITSTATUS(ret_status));
1079 (restarter_is_kill_method(method) < 0))
1086 free(method);
1091 * The method thread executes a service method to effect a state transition.
1098 * each, the method must be fetched from the repository & executed. fork()ed
1099 * methods must be waited on, except for the start method of wait services
1101 * the method succeeded (returned 0), then for start methods its contract
1103 * methods, it should be abandoned. If the method fails, then depending on
1104 * the failure, either the method should be reexecuted or the service should
1131 log_framework(LOG_DEBUG, "method_thread() running %s method for %s.\n",
1177 * When a stop method succeeds, remove the primary contract of