rexit(EXIT_FAILURE);
}
-static int lxc_attach_pty(struct lxc_conf *conf, struct lxc_console *pty)
+static int lxc_attach_pty(struct lxc_conf *conf, struct lxc_pty *pty)
{
int ret;
return -1;
}
-static int lxc_attach_pty_mainloop_init(struct lxc_console *pty,
+static int lxc_attach_pty_mainloop_init(struct lxc_pty *pty,
struct lxc_epoll_descr *descr)
{
int ret;
return 0;
}
-static inline void lxc_attach_pty_close_master(struct lxc_console *pty)
+static inline void lxc_attach_pty_close_master(struct lxc_pty *pty)
{
if (pty->master < 0)
return;
pty->master = -EBADF;
}
-static inline void lxc_attach_pty_close_slave(struct lxc_console *pty)
+static inline void lxc_attach_pty_close_slave(struct lxc_pty *pty)
{
if (pty->slave < 0)
return;
pty->slave = -EBADF;
}
-static inline void lxc_attach_pty_close_peer(struct lxc_console *pty)
+static inline void lxc_attach_pty_close_peer(struct lxc_pty *pty)
{
if (pty->peer < 0)
return;
pty->peer = -EBADF;
}
-static inline void lxc_attach_pty_close_log(struct lxc_console *pty)
+static inline void lxc_attach_pty_close_log(struct lxc_pty *pty)
{
if (pty->log_fd < 0)
return;
signed long personality;
pid_t attached_pid, init_pid, pid;
struct lxc_proc_context_info *init_ctx;
- struct lxc_console pty;
+ struct lxc_pty pty;
struct lxc_conf *conf;
struct attach_clone_payload payload = {0};
free(ts);
}
-static int lxc_console_truncate_log_file(struct lxc_console *console)
+static int lxc_console_truncate_log_file(struct lxc_pty *console)
{
/* be very certain things are kosher */
if (!console->log_path || console->log_fd < 0)
return lxc_unpriv(ftruncate(console->log_fd, 0));
}
-static int lxc_console_rotate_log_file(struct lxc_console *console)
+static int lxc_console_rotate_log_file(struct lxc_pty *console)
{
int ret;
size_t len;
return lxc_console_create_log_file(console);
}
-static int lxc_console_write_log_file(struct lxc_console *console, char *buf,
+static int lxc_console_write_log_file(struct lxc_pty *console, char *buf,
int bytes_read)
{
int ret;
int lxc_console_cb_con(int fd, uint32_t events, void *data,
struct lxc_epoll_descr *descr)
{
- struct lxc_console *console = (struct lxc_console *)data;
+ struct lxc_pty *console = data;
char buf[LXC_CONSOLE_BUFFER_SIZE];
int r, w, w_log, w_rbuf;
return 0;
}
-static int lxc_console_mainloop_add_peer(struct lxc_console *console)
+static int lxc_console_mainloop_add_peer(struct lxc_pty *console)
{
int ret;
}
int lxc_console_mainloop_add(struct lxc_epoll_descr *descr,
- struct lxc_console *console)
+ struct lxc_pty *console)
{
int ret;
return 0;
}
-static void lxc_console_peer_proxy_free(struct lxc_console *console)
+static void lxc_console_peer_proxy_free(struct lxc_pty *console)
{
if (console->tty_state) {
lxc_console_signal_fini(console->tty_state);
console->peer = -1;
}
-static int lxc_console_peer_proxy_alloc(struct lxc_console *console, int sockfd)
+static int lxc_console_peer_proxy_alloc(struct lxc_pty *console, int sockfd)
{
struct termios oldtermio;
struct lxc_tty_state *ts;
{
int masterfd = -1, ttynum;
struct lxc_tty_info *tty_info = &conf->tty_info;
- struct lxc_console *console = &conf->console;
+ struct lxc_pty *console = &conf->console;
if (*ttyreq == 0) {
if (lxc_console_peer_proxy_alloc(console, sockfd) < 0)
{
int i;
struct lxc_tty_info *tty_info = &conf->tty_info;
- struct lxc_console *console = &conf->console;
+ struct lxc_pty *console = &conf->console;
for (i = 0; i < tty_info->nbtty; i++) {
if (tty_info->pty_info[i].busy == fd)
}
}
-static int lxc_console_peer_default(struct lxc_console *console)
+static int lxc_console_peer_default(struct lxc_pty *console)
{
struct lxc_tty_state *ts;
const char *path = console->path;
return ret;
}
-int lxc_console_write_ringbuffer(struct lxc_console *console)
+int lxc_console_write_ringbuffer(struct lxc_pty *console)
{
char *r_addr;
ssize_t ret;
return 0;
}
-void lxc_console_delete(struct lxc_console *console)
+void lxc_console_delete(struct lxc_pty *console)
{
int ret;
* register a handler for the console's masterfd when we create the mainloop
* the console handler needs to see an allocated ringbuffer.
*/
-static int lxc_console_create_ringbuf(struct lxc_console *console)
+static int lxc_console_create_ringbuf(struct lxc_pty *console)
{
int ret;
struct lxc_ringbuf *buf = &console->ringbuf;
* This is the console log file. Please note that the console log file is
* (implementation wise not content wise) independent of the console ringbuffer.
*/
-int lxc_console_create_log_file(struct lxc_console *console)
+int lxc_console_create_log_file(struct lxc_pty *console)
{
if (!console->log_path)
return 0;
return 0;
}
-int lxc_pty_create(struct lxc_console *console)
+int lxc_pty_create(struct lxc_pty *console)
{
int ret, saved_errno;
int lxc_console_create(struct lxc_conf *conf)
{
int ret;
- struct lxc_console *console = &conf->console;
+ struct lxc_pty *console = &conf->console;
if (console->path && !strcmp(console->path, "none")) {
INFO("No console was requested");
pty->busy = -1;
}
-void lxc_pty_init(struct lxc_console *pty)
+void lxc_pty_init(struct lxc_pty *pty)
{
memset(pty, 0, sizeof(*pty));
pty->slave = -EBADF;
lxc_pty_info_init(&pty->peerpty);
}
-void lxc_pty_conf_free(struct lxc_console *console)
+void lxc_pty_conf_free(struct lxc_pty *console)
{
free(console->log_path);
free(console->path);
lxc_ringbuf_release(&console->ringbuf);
}
-int lxc_pty_map_ids(struct lxc_conf *c, struct lxc_console *pty)
+int lxc_pty_map_ids(struct lxc_conf *c, struct lxc_pty *pty)
{
int ret;
* automatically chowned to the uid/gid of the unprivileged user. For this
* ttys_shift_ids() can be called.)
*/
-extern int lxc_pty_create(struct lxc_console *console);
+extern int lxc_pty_create(struct lxc_pty *console);
/**
* lxc_console_create: Create a new pty.
* /dev/tty)
* Registered handlers in a mainloop are not automatically deleted.
*/
-extern void lxc_console_delete(struct lxc_console *);
+extern void lxc_console_delete(struct lxc_pty *);
/*
* lxc_console_free: mark the console or a tty as unallocated, free any
/*
* Register pty event handlers in an open mainloop
*/
-extern int lxc_console_mainloop_add(struct lxc_epoll_descr *, struct lxc_console *);
+extern int lxc_console_mainloop_add(struct lxc_epoll_descr *, struct lxc_pty *);
/*
* Handle SIGWINCH events on the allocated ptys.
*/
extern void lxc_console_signal_fini(struct lxc_tty_state *ts);
-extern int lxc_console_create_log_file(struct lxc_console *console);
+extern int lxc_console_write_ringbuffer(struct lxc_pty *console);
+extern int lxc_console_create_log_file(struct lxc_pty *console);
extern int lxc_console_cb_con(int fd, uint32_t events, void *data,
struct lxc_epoll_descr *descr);
extern int lxc_make_controlling_pty(int fd);
extern int lxc_login_pty(int fd);
-extern void lxc_pty_conf_free(struct lxc_console *console);
+extern void lxc_pty_conf_free(struct lxc_pty *console);
extern void lxc_pty_info_init(struct lxc_pty_info *pty);
-extern void lxc_pty_init(struct lxc_console *pty);
-extern int lxc_pty_map_ids(struct lxc_conf *c, struct lxc_console *pty);
+extern void lxc_pty_init(struct lxc_pty *pty);
+extern int lxc_pty_map_ids(struct lxc_conf *c, struct lxc_pty *pty);
#endif