mirror of
git://github.com/lxc/lxc
synced 2025-09-01 11:08:26 +00:00
start: non-functional changes
This renames the socketpair() variable "ttysock" to "data_sock" since we will use it to send arbitrary data around, not just ttys anymore. Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
@@ -3071,7 +3071,7 @@ static int lxc_send_ttys_to_parent(struct lxc_handler *handler)
|
|||||||
struct lxc_pty_info *pty_info;
|
struct lxc_pty_info *pty_info;
|
||||||
struct lxc_conf *conf = handler->conf;
|
struct lxc_conf *conf = handler->conf;
|
||||||
const struct lxc_tty_info *tty_info = &conf->tty_info;
|
const struct lxc_tty_info *tty_info = &conf->tty_info;
|
||||||
int sock = handler->ttysock[0];
|
int sock = handler->data_sock[0];
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
size_t num_ttyfds = (2 * conf->tty);
|
size_t num_ttyfds = (2 * conf->tty);
|
||||||
|
|
||||||
@@ -3095,8 +3095,8 @@ static int lxc_send_ttys_to_parent(struct lxc_handler *handler)
|
|||||||
else
|
else
|
||||||
TRACE("sent %d ttys to parent", conf->tty);
|
TRACE("sent %d ttys to parent", conf->tty);
|
||||||
|
|
||||||
close(handler->ttysock[0]);
|
close(handler->data_sock[0]);
|
||||||
close(handler->ttysock[1]);
|
close(handler->data_sock[1]);
|
||||||
|
|
||||||
for (i = 0; i < num_ttyfds; i++)
|
for (i = 0; i < num_ttyfds; i++)
|
||||||
close(ttyfds[i]);
|
close(ttyfds[i]);
|
||||||
|
@@ -535,7 +535,7 @@ struct lxc_handler *lxc_init_handler(const char *name, struct lxc_conf *conf,
|
|||||||
|
|
||||||
memset(handler, 0, sizeof(*handler));
|
memset(handler, 0, sizeof(*handler));
|
||||||
|
|
||||||
handler->ttysock[0] = handler->ttysock[1] = -1;
|
handler->data_sock[0] = handler->data_sock[1] = -1;
|
||||||
handler->conf = conf;
|
handler->conf = conf;
|
||||||
handler->lxcpath = lxcpath;
|
handler->lxcpath = lxcpath;
|
||||||
handler->pinfd = -1;
|
handler->pinfd = -1;
|
||||||
@@ -759,9 +759,9 @@ void lxc_fini(const char *name, struct lxc_handler *handler)
|
|||||||
free(cur);
|
free(cur);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler->ttysock[0] != -1) {
|
if (handler->data_sock[0] != -1) {
|
||||||
close(handler->ttysock[0]);
|
close(handler->data_sock[0]);
|
||||||
close(handler->ttysock[1]);
|
close(handler->data_sock[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handler->conf->ephemeral == 1 && handler->conf->reboot != 1)
|
if (handler->conf->ephemeral == 1 && handler->conf->reboot != 1)
|
||||||
@@ -1128,7 +1128,7 @@ static int lxc_recv_ttys_from_child(struct lxc_handler *handler)
|
|||||||
int *ttyfds;
|
int *ttyfds;
|
||||||
struct lxc_pty_info *pty_info;
|
struct lxc_pty_info *pty_info;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int sock = handler->ttysock[1];
|
int sock = handler->data_sock[1];
|
||||||
struct lxc_conf *conf = handler->conf;
|
struct lxc_conf *conf = handler->conf;
|
||||||
struct lxc_tty_info *tty_info = &conf->tty_info;
|
struct lxc_tty_info *tty_info = &conf->tty_info;
|
||||||
size_t num_ttyfds = (2 * conf->tty);
|
size_t num_ttyfds = (2 * conf->tty);
|
||||||
@@ -1201,7 +1201,7 @@ void resolve_clone_flags(struct lxc_handler *handler)
|
|||||||
*/
|
*/
|
||||||
static int lxc_spawn(struct lxc_handler *handler)
|
static int lxc_spawn(struct lxc_handler *handler)
|
||||||
{
|
{
|
||||||
int i, flags, nveths;
|
int i, flags, nveths, ret;
|
||||||
const char *name = handler->name;
|
const char *name = handler->name;
|
||||||
bool wants_to_map_ids;
|
bool wants_to_map_ids;
|
||||||
int netpipepair[2], saved_ns_fd[LXC_NS_MAX];
|
int netpipepair[2], saved_ns_fd[LXC_NS_MAX];
|
||||||
@@ -1220,7 +1220,8 @@ static int lxc_spawn(struct lxc_handler *handler)
|
|||||||
if (lxc_sync_init(handler))
|
if (lxc_sync_init(handler))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, handler->ttysock) < 0) {
|
ret = socketpair(AF_UNIX, SOCK_DGRAM, 0, handler->data_sock);
|
||||||
|
if (ret < 0) {
|
||||||
lxc_sync_fini(handler);
|
lxc_sync_fini(handler);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -49,8 +49,10 @@ struct lxc_handler {
|
|||||||
const char *lxcpath;
|
const char *lxcpath;
|
||||||
void *cgroup_data;
|
void *cgroup_data;
|
||||||
|
|
||||||
/* socketpair for child->parent tty fd passing */
|
/* Abstract unix domain SOCK_DGRAM socketpair to pass arbitrary data
|
||||||
int ttysock[2];
|
* between child and parent.
|
||||||
|
*/
|
||||||
|
int data_sock[2];
|
||||||
|
|
||||||
/* indicates whether should we close std{in,out,err} on start */
|
/* indicates whether should we close std{in,out,err} on start */
|
||||||
bool backgrounded;
|
bool backgrounded;
|
||||||
|
Reference in New Issue
Block a user