}
/*
- * lxc_cmd_terminal_winch: To process as if a SIGWINCH were received
+ * lxc_cmd_terminal_winch: noop
*
* @name : name of container to connect to
* @lxcpath : the lxcpath in which the container is running
*/
int lxc_cmd_terminal_winch(const char *name, const char *lxcpath)
{
- int ret, stopped;
- struct lxc_cmd_rr cmd = {
- .req = { .cmd = LXC_CMD_TERMINAL_WINCH },
- };
-
- ret = lxc_cmd(name, &cmd, &stopped, lxcpath, NULL);
- if (ret < 0)
- return ret;
-
return 0;
}
static int lxc_cmd_terminal_winch_callback(int fd, struct lxc_cmd_req *req,
struct lxc_handler *handler)
{
- struct lxc_cmd_rsp rsp = { .data = 0 };
-
- lxc_terminal_sigwinch(SIGWINCH);
-
- return lxc_cmd_rsp_send(fd, &rsp);
+ /* should never be called */
+ return -1;
}
/*
lxc_log_define(terminal, lxc);
-static struct lxc_list lxc_ttys;
-
-typedef void (*sighandler_t)(int);
-
-__attribute__((constructor)) void lxc_terminal_init_global(void)
-{
- lxc_list_init(&lxc_ttys);
-}
-
void lxc_terminal_winsz(int srcfd, int dstfd)
{
int ret;
static void lxc_terminal_winch(struct lxc_terminal_state *ts)
{
lxc_terminal_winsz(ts->stdinfd, ts->masterfd);
-
- if (ts->winch_proxy)
- lxc_cmd_terminal_winch(ts->winch_proxy, ts->winch_proxy_lxcpath);
-}
-
-void lxc_terminal_sigwinch(int sig)
-{
- struct lxc_list *it;
- struct lxc_terminal_state *ts;
-
- lxc_list_for_each(it, &lxc_ttys) {
- ts = it->elem;
- lxc_terminal_winch(ts);
- }
}
int lxc_terminal_signalfd_cb(int fd, uint32_t events, void *cbdata,
if (!istty) {
INFO("fd %d does not refer to a tty device", srcfd);
} else {
- /* Add tty to list to be scanned at SIGWINCH time. */
- lxc_list_add_elem(&ts->node, ts);
- lxc_list_add_tail(&lxc_ttys, &ts->node);
ret = sigaddset(&mask, SIGWINCH);
if (ret < 0)
SYSNOTICE("Failed to add SIGWINCH to signal set");
ts->sigfd = -1;
}
- if (istty)
- lxc_list_del(&ts->node);
-
return ts;
}
SYSWARN("Failed to restore signal mask");
}
- if (isatty(ts->stdinfd))
- lxc_list_del(&ts->node);
-
free(ts);
}
goto close_fds;
}
ts->escape = escape;
- ts->winch_proxy = c->name;
- ts->winch_proxy_lxcpath = c->config_path;
ts->stdoutfd = stdoutfd;
istty = isatty(stdinfd);
if (istty) {
lxc_terminal_winsz(stdinfd, masterfd);
- lxc_cmd_terminal_winch(ts->winch_proxy, ts->winch_proxy_lxcpath);
+ lxc_terminal_winsz(ts->stdinfd, ts->masterfd);
} else {
INFO("File descriptor %d does not refer to a terminal", stdinfd);
}
*/
int saw_escape;
- /* Name of the container to forward the SIGWINCH event to. */
- const char *winch_proxy;
-
- /* Path of the container to forward the SIGWINCH event to. */
- const char *winch_proxy_lxcpath;
-
/* File descriptor that accepts signals. If set to -1 no signal handler
* could be installed. This also means that the sigset_t oldmask member
* is meaningless.