Searched refs:state (Results 1 - 20 of 20) sorted by relevance

/lxc/src/lxc/
H A Dstate.c52 const char *lxc_state2str(lxc_state_t state) argument
54 if (state < STOPPED || state > MAX_STATE - 1)
56 return strstate[state];
59 lxc_state_t lxc_str2state(const char *state) argument
65 if (!strcmp(strstate[i], state))
68 ERROR("invalid state '%s'", state);
76 lxc_state_t state = freezer_state(name, lxcpath); local
77 if (state !
86 int state; local
112 int state, ret; local
[all...]
H A Dstate.h34 extern lxc_state_t lxc_str2state(const char *state);
35 extern const char *lxc_state2str(lxc_state_t state);
H A Dfreezer.c35 #include "state.h"
45 if (lxc_cgroup_get("freezer.state", v, 100, name, lxcpath) < 0)
56 const char *state = freeze ? "FROZEN" : "THAWED"; local
58 if (lxc_cgroup_set("freezer.state", state, name, lxcpath) < 0) {
63 if (lxc_cgroup_get("freezer.state", v, 100, name, lxcpath) < 0) {
64 ERROR("Failed to get new freezer state for %s:%s", lxcpath, name);
69 if (strncmp(v, state, strlen(state)) == 0) {
H A Dstart.h31 #include "state.h"
48 lxc_state_t state; member in struct:lxc_handler
67 extern int lxc_set_state(const char *name, struct lxc_handler *handler, lxc_state_t state);
H A Dmonitor.h48 extern void lxc_monitor_send_state(const char *name, lxc_state_t state,
62 * Blocking read for the next container state change
64 * @msg : the variable which will be filled with the state
71 * Blocking read for the next container state change with timeout
73 * @msg : the variable which will be filled with the state
74 * @timeout : the timeout in seconds to wait for a state change
81 * Blocking read from multiple monitors for the next container state
85 * @msg : the variable which will be filled with the state
86 * @timeout : the timeout in seconds to wait for a state change
H A Dlxccontainer.h131 * \brief Determine state of container.
135 * \return Static upper-case string representing state of container.
139 const char *(*state)(struct lxc_container *c); member in struct:lxc_container
229 * \param state Value for the daemonize bit (0 or 1).
233 bool (*want_daemonize)(struct lxc_container *c, bool state);
240 * \param state Value for the close_all_fds bit (0 or 1).
244 bool (*want_close_all_fds)(struct lxc_container *c, bool state);
258 * \brief Wait for container to reach a particular state.
261 * \param state State to wait for.
264 * \return \c true if state reache
[all...]
H A Dmonitor.c49 #include "state.h"
130 void lxc_monitor_send_state(const char *name, lxc_state_t state, argument
133 struct lxc_msg msg = {.type = lxc_msg_state, .value = state};
H A Dstart.c330 int lxc_set_state(const char *name, struct lxc_handler *handler, lxc_state_t state) argument
332 handler->state = state;
333 lxc_monitor_send_state(name, state, handler->lxcpath);
420 /* Begin by setting the state to STARTING. */
422 ERROR("Failed to set state for container \"%s\" to \"%s\".", name, lxc_state2str(STARTING));
502 /* The STOPPING state is there for future cleanup code which can take
1273 ERROR("Failed to set state for container \"%s\" to \"%s\".", name,
H A Dlxccontainer.c60 #include "state.h"
569 static bool do_lxcapi_want_daemonize(struct lxc_container *c, bool state) argument
577 c->daemonize = state;
584 static bool do_lxcapi_want_close_all_fds(struct lxc_container *c, bool state) argument
592 c->lxc_conf->close_all_fds = state;
599 static bool do_lxcapi_wait(struct lxc_container *c, const char *state, int timeout) argument
606 ret = lxc_wait(c->name, state, timeout, c->config_path);
4158 c->state = lxcapi_state;
H A Dcommands.c469 WARN("Container \"%s\" has stopped before sending its state.", name);
559 * lxc_cmd_get_state: Get current state of the container
564 * Returns the state on success, < 0 on failure
581 WARN("Container \"%s\" has stopped before sending its state.", name);
585 DEBUG("Container \"%s\" is in \"%s\" state.", name,
593 struct lxc_cmd_rsp rsp = { .data = INT_TO_PTR(handler->state) };
/lxc/src/python-lxc/examples/
H A Dapi_test.py43 # A few basic checks of the current state
50 assert(container.state == "STOPPED")
85 # A few basic checks of the current state
92 # A few basic checks of the current state
101 # A few basic checks of the current state
104 assert(container.state == "RUNNING")
129 # A few basic checks of the current state
149 # A few basic checks of the current state
152 assert(container.state == "FROZEN")
159 # A few basic checks of the current state
[all...]
/lxc/src/lxc/tools/
H A Dlxc_info.c43 static bool state; variable
64 case 's': state = true; filter_count += 1; break;
75 {"state", no_argument, 0, 's'},
96 -s, --state shows the state of the container\n\
326 if (!state && !pid && !ips && !stats && keys <= 0) {
327 state = pid = ips = stats = true;
331 if (state) {
332 print_info_msg_str("State:", c->state(c));
H A Dlxc_ls.c64 char *state; member in struct:ls
290 free(m->state);
403 const char *state_tmp = c->state(c);
456 l->state = strdup(state_tmp);
457 if (!l->state)
841 printf("%-*s ", lht->state_length, m->state ? m->state : "-");
899 printf("%-*s ", lht->state_length, m->state ? m->state : "-");
1081 if (ls_send_str(wpipefd, n->state) <
[all...]
/lxc/src/tests/
H A Dcontainertests.c29 #include "lxc/state.h"
166 s = c->state(c);
171 fprintf(stderr, "%d: %s thinks it is in state %s\n", __LINE__, c->name, s);
191 s = c->state(c);
193 fprintf(stderr, "%d: %s is in state %s, not in STOPPED.\n", __LINE__, c->name, s ? s : "undefined");
213 fprintf(stderr, "got state %d %s\n", i, sstr[i]);
225 fprintf(stderr, "%d: failed waiting for state RUNNING\n", __LINE__);
230 s = c->state(c);
232 fprintf(stderr, "%d: %s is in state %s, not in RUNNING.\n", __LINE__, c->name, s ? s : "undefined");
H A Dstartone.c145 s = c->state(c);
147 fprintf(stderr, "%d: %s is in state %s, not in STOPPED.\n", __LINE__, c->name, s ? s : "undefined");
174 s = c->state(c);
176 fprintf(stderr, "%d: %s is in state %s, not in RUNNING.\n", __LINE__, c->name, s ? s : "undefined");
193 b = c->set_cgroup_item(c, "freezer.state", buf);
195 fprintf(stderr, "%d: not able to set freezer.state.\n", __LINE__);
200 len = c->get_cgroup_item(c, "freezer.state", buf, 200);
202 fprintf(stderr, "%d: not able to get freezer.state (len %d buf %s)\n", __LINE__, len, buf);
206 c->set_cgroup_item(c, "freezer.state", "THAWED");
H A Dlxc-test-unpriv207 run_cmd lxc-cgroup -n c1 freezer.state
212 run_cmd lxc-cgroup -n c1 freezer.state
/lxc/src/python-lxc/lxc/
H A D__init__.py409 def wait(self, state, timeout=-1):
411 Wait for the container to reach a given state or timeout.
414 if isinstance(state, str):
415 state = state.upper()
417 return _lxc.Container.wait(self, state, timeout)
/lxc/src/lua-lxc/
H A Dlxc.lua126 function container:wait(state, timeout)
127 return self.core:wait(state, timeout)
142 function container:state()
143 return self.core:state()
H A Dcore.c146 /* container state */
193 const char *state = luaL_checkstring(L, 2); local
196 lua_pushboolean(L, !!c->wait(c, state, timeout));
242 lua_pushstring(L, c->state(c));
503 {"state", container_state},
/lxc/src/python-lxc/
H A Dlxc.c548 rv = self->container->state(self->container);
1537 static char *kwlist[] = {"state", "timeout", NULL};
1538 char *state = NULL; local
1542 &state, &timeout))
1545 if (self->container->wait(self->container, state, timeout)) {
1578 {"state",
1580 "Container state",
1817 "wait(state, timeout = -1) -> boolean\n"
1819 "Wait for the container to reach a given state or timeout."

Completed in 1253 milliseconds