mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-21 09:10:10 +00:00
Instead of calling case() with majors all over the places lets introduce own enum for tty types and use it instead. Because we're using not @major numbers now but taking @minors into account as well, this brings more strict check of which kind of terminals we can dump now thus it's potentially should fix the cases when we're trying to c/r terminals which we don't understand yet (in particular /dev/console [5:1]). Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org> Acked-by: Tycho Andersen <tycho.andersen@canonical.com> Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
60 lines
1.2 KiB
C
60 lines
1.2 KiB
C
#ifndef __CR_TTY_H__
|
|
#define __CR_TTY_H__
|
|
|
|
#include <linux/major.h>
|
|
|
|
#include "files.h"
|
|
|
|
/* Kernel's limit */
|
|
#define TERMIOS_NCC 19
|
|
|
|
enum {
|
|
TTY_TYPE_UNKNOWN = 0,
|
|
TTY_TYPE_PTM = 1,
|
|
TTY_TYPE_PTS = 2,
|
|
|
|
TTY_TYPE_MAX
|
|
};
|
|
|
|
#define PTMX_PATH "/dev/ptmx"
|
|
#ifndef PTMX_MINOR
|
|
# define PTMX_MINOR 2
|
|
#endif
|
|
#define PTS_FMT "/dev/pts/%d"
|
|
|
|
extern const struct fdtype_ops tty_dump_ops;
|
|
|
|
static inline int tty_type(int major, int minor)
|
|
{
|
|
switch (major) {
|
|
case TTYAUX_MAJOR:
|
|
if (minor == 0 || minor == 2)
|
|
return TTY_TYPE_PTM;
|
|
break;
|
|
case UNIX98_PTY_MASTER_MAJOR ... (UNIX98_PTY_MASTER_MAJOR + UNIX98_PTY_MAJOR_COUNT - 1):
|
|
return TTY_TYPE_PTM;
|
|
case UNIX98_PTY_SLAVE_MAJOR:
|
|
return TTY_TYPE_PTS;
|
|
}
|
|
return TTY_TYPE_UNKNOWN;
|
|
}
|
|
|
|
static inline int is_tty(int major, int minor)
|
|
{
|
|
return tty_type(major, minor) != TTY_TYPE_UNKNOWN;
|
|
}
|
|
|
|
extern int dump_verify_tty_sids(void);
|
|
extern struct collect_image_info tty_info_cinfo;
|
|
extern struct collect_image_info tty_cinfo;
|
|
extern int prepare_shared_tty(void);
|
|
extern int tty_setup_slavery(void);
|
|
|
|
extern int tty_verify_active_pairs(void);
|
|
|
|
extern int tty_prep_fds(void);
|
|
extern void tty_fini_fds(void);
|
|
|
|
#define OPT_SHELL_JOB "shell-job"
|
|
|
|
#endif /* __CR_TTY_H__ */
|