Skip to content

Commit

Permalink
linux-user: Add missing termbits types and values definitions
Browse files Browse the repository at this point in the history
This patch introduces missing target types ('target_flag_t', 'target_cc_t',
'target_speed_t') in a few 'termibts.h' header files. Also, two missing
values ('TARGET_IUTF8' and 'TARGET_EXTPROC') were also added. These values
were also added in file 'syscall.c' in bitmask tables 'iflag_tbl[]' and
'lflag_tbl[]' which are used to convert values of 'struct termios' between
target and host.

Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200723210233.349690-3-Filip.Bozuta@syrmia.com>
[lv: keep TARGET_NCCS definition in xtensa/termbits.h]
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
  • Loading branch information
bozutaf authored and vivier committed Aug 27, 2020
1 parent fcb6fcf commit c218b4e
Show file tree
Hide file tree
Showing 10 changed files with 132 additions and 86 deletions.
1 change: 1 addition & 0 deletions linux-user/alpha/termbits.h
Expand Up @@ -159,6 +159,7 @@ struct target_termios {
#define TARGET_FLUSHO 0x00800000
#define TARGET_PENDIN 0x20000000
#define TARGET_IEXTEN 0x00000400
#define TARGET_EXTPROC 0x10000000

#define TARGET_FIOCLEX TARGET_IO('f', 1)
#define TARGET_FIONCLEX TARGET_IO('f', 2)
Expand Down
18 changes: 12 additions & 6 deletions linux-user/cris/termbits.h
Expand Up @@ -5,13 +5,17 @@

#define TARGET_NCCS 19

typedef unsigned char target_cc_t; /* cc_t */
typedef unsigned int target_speed_t; /* speed_t */
typedef unsigned int target_tcflag_t; /* tcflag_t */

struct target_termios {
unsigned int c_iflag; /* input mode flags */
unsigned int c_oflag; /* output mode flags */
unsigned int c_cflag; /* control mode flags */
unsigned int c_lflag; /* local mode flags */
unsigned char c_line; /* line discipline */
unsigned char c_cc[TARGET_NCCS]; /* control characters */
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
};

/* c_iflag bits */
Expand All @@ -29,6 +33,7 @@ struct target_termios {
#define TARGET_IXANY 0004000
#define TARGET_IXOFF 0010000
#define TARGET_IMAXBEL 0020000
#define TARGET_IUTF8 0040000

/* c_oflag bits */
#define TARGET_OPOST 0000001
Expand Down Expand Up @@ -118,6 +123,7 @@ struct target_termios {
#define TARGET_FLUSHO 0010000
#define TARGET_PENDIN 0040000
#define TARGET_IEXTEN 0100000
#define TARGET_EXTPROC 0200000

/* c_cc character offsets */
#define TARGET_VINTR 0
Expand Down
17 changes: 11 additions & 6 deletions linux-user/hppa/termbits.h
Expand Up @@ -5,13 +5,17 @@

#define TARGET_NCCS 19

typedef unsigned char target_cc_t; /* cc_t */
typedef unsigned int target_speed_t; /* speed_t */
typedef unsigned int target_tcflag_t; /* tcflag_t */

struct target_termios {
unsigned int c_iflag; /* input mode flags */
unsigned int c_oflag; /* output mode flags */
unsigned int c_cflag; /* control mode flags */
unsigned int c_lflag; /* local mode flags */
unsigned char c_line; /* line discipline */
unsigned char c_cc[TARGET_NCCS]; /* control characters */
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
};

/* c_iflag bits */
Expand Down Expand Up @@ -120,6 +124,7 @@ struct target_termios {
#define TARGET_FLUSHO 0010000
#define TARGET_PENDIN 0040000
#define TARGET_IEXTEN 0100000
#define TARGET_EXTPROC 0200000

/* c_cc character offsets */
#define TARGET_VINTR 0
Expand Down
17 changes: 11 additions & 6 deletions linux-user/mips/termbits.h
Expand Up @@ -5,13 +5,17 @@

#define TARGET_NCCS 23

typedef unsigned char target_cc_t; /* cc_t */
typedef unsigned int target_speed_t; /* speed_t */
typedef unsigned int target_tcflag_t; /* tcflag_t */

struct target_termios {
unsigned int c_iflag; /* input mode flags */
unsigned int c_oflag; /* output mode flags */
unsigned int c_cflag; /* control mode flags */
unsigned int c_lflag; /* local mode flags */
unsigned char c_line; /* line discipline */
unsigned char c_cc[TARGET_NCCS]; /* control characters */
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
};

/* c_iflag bits */
Expand Down Expand Up @@ -133,6 +137,7 @@ struct target_termios {
#define TARGET_PENDIN 0040000
#define TARGET_TOSTOP 0100000
#define TARGET_ITOSTOP TARGET_TOSTOP
#define TARGET_EXTPROC 0200000

/* c_cc character offsets */
#define TARGET_VINTR 0
Expand Down
21 changes: 13 additions & 8 deletions linux-user/ppc/termbits.h
Expand Up @@ -5,15 +5,19 @@

#define TARGET_NCCS 19

typedef unsigned char target_cc_t; /* cc_t */
typedef unsigned int target_speed_t; /* speed_t */
typedef unsigned int target_tcflag_t; /* tcflag_t */

struct target_termios {
unsigned int c_iflag; /* input mode flags */
unsigned int c_oflag; /* output mode flags */
unsigned int c_cflag; /* control mode flags */
unsigned int c_lflag; /* local mode flags */
unsigned char c_cc[TARGET_NCCS]; /* control characters */
unsigned char c_line; /* line discipline */
unsigned int c_ispeed; /* input speed */
unsigned int c_ospeed; /* output speed */
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
target_speed_t c_ispeed; /* input speed */
target_speed_t c_ospeed; /* output speed */
};

/* c_cc character offsets */
Expand Down Expand Up @@ -158,6 +162,7 @@ struct target_termios {
#define TARGET_FLUSHO 0x00800000
#define TARGET_PENDIN 0x20000000
#define TARGET_IEXTEN 0x00000400
#define TARGET_EXTPROC 0x10000000

/* ioctls */

Expand Down
19 changes: 13 additions & 6 deletions linux-user/sh4/termbits.h
Expand Up @@ -5,15 +5,20 @@

#define TARGET_NCCS 19

typedef unsigned char target_cc_t; /* cc_t */
typedef unsigned int target_speed_t; /* speed_t */
typedef unsigned int target_tcflag_t; /* tcflag_t */

struct target_termios {
unsigned int c_iflag; /* input mode flags */
unsigned int c_oflag; /* output mode flags */
unsigned int c_cflag; /* control mode flags */
unsigned int c_lflag; /* local mode flags */
unsigned char c_line; /* line discipline */
unsigned char c_cc[TARGET_NCCS]; /* control characters */
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
};


/* c_cc characters */
#define TARGET_VINTR 0
#define TARGET_VQUIT 1
Expand Down Expand Up @@ -150,6 +155,8 @@ struct target_termios {
#define TARGET_FLUSHO 0010000
#define TARGET_PENDIN 0040000
#define TARGET_IEXTEN 0100000
#define TARGET_EXTPROC 0200000


/* tcflow() and TCXONC use these */
#define TARGET_TCOOFF 0
Expand Down
18 changes: 12 additions & 6 deletions linux-user/sparc/termbits.h
Expand Up @@ -5,15 +5,20 @@

#define TARGET_NCCS 19

typedef unsigned char target_cc_t; /* cc_t */
typedef unsigned int target_speed_t; /* speed_t */
typedef unsigned int target_tcflag_t; /* tcflag_t */

struct target_termios {
unsigned int c_iflag; /* input mode flags */
unsigned int c_oflag; /* output mode flags */
unsigned int c_cflag; /* control mode flags */
unsigned int c_lflag; /* local mode flags */
unsigned char c_line; /* line discipline */
unsigned char c_cc[TARGET_NCCS]; /* control characters */
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
};


/* c_cc characters */
#define TARGET_VINTR 0
#define TARGET_VQUIT 1
Expand Down Expand Up @@ -170,6 +175,7 @@ struct target_termios {
#define TARGET_FLUSHO 0x00002000
#define TARGET_PENDIN 0x00004000
#define TARGET_IEXTEN 0x00008000
#define TARGET_EXTPROC 0x00010000

/* ioctls */

Expand Down
18 changes: 12 additions & 6 deletions linux-user/sparc64/termbits.h
Expand Up @@ -5,15 +5,20 @@

#define TARGET_NCCS 19

typedef unsigned char target_cc_t; /* cc_t */
typedef unsigned int target_speed_t; /* speed_t */
typedef unsigned int target_tcflag_t; /* tcflag_t */

struct target_termios {
unsigned int c_iflag; /* input mode flags */
unsigned int c_oflag; /* output mode flags */
unsigned int c_cflag; /* control mode flags */
unsigned int c_lflag; /* local mode flags */
unsigned char c_line; /* line discipline */
unsigned char c_cc[TARGET_NCCS]; /* control characters */
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
};


/* c_cc characters */
#define TARGET_VINTR 0
#define TARGET_VQUIT 1
Expand Down Expand Up @@ -170,6 +175,7 @@ struct target_termios {
#define TARGET_FLUSHO 0x00002000
#define TARGET_PENDIN 0x00004000
#define TARGET_IEXTEN 0x00008000
#define TARGET_EXTPROC 0x00010000

/* ioctls */

Expand Down
34 changes: 18 additions & 16 deletions linux-user/syscall.c
Expand Up @@ -5549,6 +5549,7 @@ static const bitmask_transtbl iflag_tbl[] = {
{ TARGET_IXANY, TARGET_IXANY, IXANY, IXANY },
{ TARGET_IXOFF, TARGET_IXOFF, IXOFF, IXOFF },
{ TARGET_IMAXBEL, TARGET_IMAXBEL, IMAXBEL, IMAXBEL },
{ TARGET_IUTF8, TARGET_IUTF8, IUTF8, IUTF8},
{ 0, 0, 0, 0 }
};

Expand Down Expand Up @@ -5616,22 +5617,23 @@ static const bitmask_transtbl cflag_tbl[] = {
};

static const bitmask_transtbl lflag_tbl[] = {
{ TARGET_ISIG, TARGET_ISIG, ISIG, ISIG },
{ TARGET_ICANON, TARGET_ICANON, ICANON, ICANON },
{ TARGET_XCASE, TARGET_XCASE, XCASE, XCASE },
{ TARGET_ECHO, TARGET_ECHO, ECHO, ECHO },
{ TARGET_ECHOE, TARGET_ECHOE, ECHOE, ECHOE },
{ TARGET_ECHOK, TARGET_ECHOK, ECHOK, ECHOK },
{ TARGET_ECHONL, TARGET_ECHONL, ECHONL, ECHONL },
{ TARGET_NOFLSH, TARGET_NOFLSH, NOFLSH, NOFLSH },
{ TARGET_TOSTOP, TARGET_TOSTOP, TOSTOP, TOSTOP },
{ TARGET_ECHOCTL, TARGET_ECHOCTL, ECHOCTL, ECHOCTL },
{ TARGET_ECHOPRT, TARGET_ECHOPRT, ECHOPRT, ECHOPRT },
{ TARGET_ECHOKE, TARGET_ECHOKE, ECHOKE, ECHOKE },
{ TARGET_FLUSHO, TARGET_FLUSHO, FLUSHO, FLUSHO },
{ TARGET_PENDIN, TARGET_PENDIN, PENDIN, PENDIN },
{ TARGET_IEXTEN, TARGET_IEXTEN, IEXTEN, IEXTEN },
{ 0, 0, 0, 0 }
{ TARGET_ISIG, TARGET_ISIG, ISIG, ISIG },
{ TARGET_ICANON, TARGET_ICANON, ICANON, ICANON },
{ TARGET_XCASE, TARGET_XCASE, XCASE, XCASE },
{ TARGET_ECHO, TARGET_ECHO, ECHO, ECHO },
{ TARGET_ECHOE, TARGET_ECHOE, ECHOE, ECHOE },
{ TARGET_ECHOK, TARGET_ECHOK, ECHOK, ECHOK },
{ TARGET_ECHONL, TARGET_ECHONL, ECHONL, ECHONL },
{ TARGET_NOFLSH, TARGET_NOFLSH, NOFLSH, NOFLSH },
{ TARGET_TOSTOP, TARGET_TOSTOP, TOSTOP, TOSTOP },
{ TARGET_ECHOCTL, TARGET_ECHOCTL, ECHOCTL, ECHOCTL },
{ TARGET_ECHOPRT, TARGET_ECHOPRT, ECHOPRT, ECHOPRT },
{ TARGET_ECHOKE, TARGET_ECHOKE, ECHOKE, ECHOKE },
{ TARGET_FLUSHO, TARGET_FLUSHO, FLUSHO, FLUSHO },
{ TARGET_PENDIN, TARGET_PENDIN, PENDIN, PENDIN },
{ TARGET_IEXTEN, TARGET_IEXTEN, IEXTEN, IEXTEN },
{ TARGET_EXTPROC, TARGET_EXTPROC, EXTPROC, EXTPROC},
{ 0, 0, 0, 0 }
};

static void target_to_host_termios (void *dst, const void *src)
Expand Down
55 changes: 29 additions & 26 deletions linux-user/xtensa/termbits.h
Expand Up @@ -15,40 +15,42 @@

#include <linux/posix_types.h>

typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;

#define TARGET_NCCS 19

typedef unsigned char target_cc_t; /* cc_t */
typedef unsigned int target_speed_t; /* speed_t */
typedef unsigned int target_tcflag_t; /* tcflag_t */

struct target_termios {
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_line; /* line discipline */
cc_t c_cc[TARGET_NCCS]; /* control characters */
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
};


struct target_termios2 {
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_line; /* line discipline */
cc_t c_cc[TARGET_NCCS]; /* control characters */
speed_t c_ispeed; /* input speed */
speed_t c_ospeed; /* output speed */
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
target_speed_t c_ispeed; /* input speed */
target_speed_t c_ospeed; /* output speed */
};

struct target_ktermios {
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_line; /* line discipline */
cc_t c_cc[TARGET_NCCS]; /* control characters */
speed_t c_ispeed; /* input speed */
speed_t c_ospeed; /* output speed */
target_tcflag_t c_iflag; /* input mode flags */
target_tcflag_t c_oflag; /* output mode flags */
target_tcflag_t c_cflag; /* control mode flags */
target_tcflag_t c_lflag; /* local mode flags */
target_cc_t c_line; /* line discipline */
target_cc_t c_cc[TARGET_NCCS]; /* control characters */
target_speed_t c_ispeed; /* input speed */
target_speed_t c_ospeed; /* output speed */
};

/* c_cc characters */
Expand Down Expand Up @@ -195,6 +197,7 @@ struct target_ktermios {
#define TARGET_FLUSHO 0010000
#define TARGET_PENDIN 0040000
#define TARGET_IEXTEN 0100000
#define TARGET_EXTPROC 0200000

/* tcflow() and TCXONC use these */

Expand Down

0 comments on commit c218b4e

Please sign in to comment.