Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162798342
D58224.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
5 KB
Referenced Files
None
Subscribers
None
D58224.diff
View Options
diff --git a/sys/compat/linux/linux_ioctl.h b/sys/compat/linux/linux_ioctl.h
--- a/sys/compat/linux/linux_ioctl.h
+++ b/sys/compat/linux/linux_ioctl.h
@@ -383,6 +383,9 @@
#define LINUX_TIOCSBRK 0x5427
#define LINUX_TIOCCBRK 0x5428
+#define LINUX_TCGETS2 0x542A
+#define LINUX_TCSETS2 0x542B
+
#define LINUX_TIOCGPTN 0x5430
#define LINUX_TIOCSPTLCK 0x5431
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c
--- a/sys/compat/linux/linux_ioctl.c
+++ b/sys/compat/linux/linux_ioctl.c
@@ -331,6 +331,17 @@
unsigned char c_cc[LINUX_NCCS];
};
+struct linux_termios2 {
+ unsigned int c_iflag;
+ unsigned int c_oflag;
+ unsigned int c_cflag;
+ unsigned int c_lflag;
+ unsigned char c_line;
+ unsigned char c_cc[LINUX_NCCS];
+ speed_t c_ispeed; /* input speed */
+ speed_t c_ospeed; /* output speed */
+};
+
struct linux_winsize {
unsigned short ws_row, ws_col;
unsigned short ws_xpixel, ws_ypixel;
@@ -508,6 +519,128 @@
lios->c_line = 0;
}
+static void
+bsd_to_linux_termios2(struct termios *bios, struct linux_termios2 *lios)
+{
+ int i;
+
+ lios->c_iflag = 0;
+ if (bios->c_iflag & IGNBRK)
+ lios->c_iflag |= LINUX_IGNBRK;
+ if (bios->c_iflag & BRKINT)
+ lios->c_iflag |= LINUX_BRKINT;
+ if (bios->c_iflag & IGNPAR)
+ lios->c_iflag |= LINUX_IGNPAR;
+ if (bios->c_iflag & PARMRK)
+ lios->c_iflag |= LINUX_PARMRK;
+ if (bios->c_iflag & INPCK)
+ lios->c_iflag |= LINUX_INPCK;
+ if (bios->c_iflag & ISTRIP)
+ lios->c_iflag |= LINUX_ISTRIP;
+ if (bios->c_iflag & INLCR)
+ lios->c_iflag |= LINUX_INLCR;
+ if (bios->c_iflag & IGNCR)
+ lios->c_iflag |= LINUX_IGNCR;
+ if (bios->c_iflag & ICRNL)
+ lios->c_iflag |= LINUX_ICRNL;
+ if (bios->c_iflag & IXON)
+ lios->c_iflag |= LINUX_IXON;
+ if (bios->c_iflag & IXANY)
+ lios->c_iflag |= LINUX_IXANY;
+ if (bios->c_iflag & IXOFF)
+ lios->c_iflag |= LINUX_IXOFF;
+ if (bios->c_iflag & IMAXBEL)
+ lios->c_iflag |= LINUX_IMAXBEL;
+ if (bios->c_iflag & IUTF8)
+ lios->c_iflag |= LINUX_IUTF8;
+
+ lios->c_oflag = 0;
+ if (bios->c_oflag & OPOST)
+ lios->c_oflag |= LINUX_OPOST;
+ if (bios->c_oflag & ONLCR)
+ lios->c_oflag |= LINUX_ONLCR;
+ if (bios->c_oflag & TAB3)
+ lios->c_oflag |= LINUX_XTABS;
+
+ lios->c_cflag = bsd_to_linux_speed(bios->c_ispeed, sptab);
+ lios->c_cflag |= (bios->c_cflag & CSIZE) >> 4;
+ if (bios->c_cflag & CSTOPB)
+ lios->c_cflag |= LINUX_CSTOPB;
+ if (bios->c_cflag & CREAD)
+ lios->c_cflag |= LINUX_CREAD;
+ if (bios->c_cflag & PARENB)
+ lios->c_cflag |= LINUX_PARENB;
+ if (bios->c_cflag & PARODD)
+ lios->c_cflag |= LINUX_PARODD;
+ if (bios->c_cflag & HUPCL)
+ lios->c_cflag |= LINUX_HUPCL;
+ if (bios->c_cflag & CLOCAL)
+ lios->c_cflag |= LINUX_CLOCAL;
+ if (bios->c_cflag & CRTSCTS)
+ lios->c_cflag |= LINUX_CRTSCTS;
+
+ lios->c_lflag = 0;
+ if (bios->c_lflag & ISIG)
+ lios->c_lflag |= LINUX_ISIG;
+ if (bios->c_lflag & ICANON)
+ lios->c_lflag |= LINUX_ICANON;
+ if (bios->c_lflag & ECHO)
+ lios->c_lflag |= LINUX_ECHO;
+ if (bios->c_lflag & ECHOE)
+ lios->c_lflag |= LINUX_ECHOE;
+ if (bios->c_lflag & ECHOK)
+ lios->c_lflag |= LINUX_ECHOK;
+ if (bios->c_lflag & ECHONL)
+ lios->c_lflag |= LINUX_ECHONL;
+ if (bios->c_lflag & NOFLSH)
+ lios->c_lflag |= LINUX_NOFLSH;
+ if (bios->c_lflag & TOSTOP)
+ lios->c_lflag |= LINUX_TOSTOP;
+ if (bios->c_lflag & ECHOCTL)
+ lios->c_lflag |= LINUX_ECHOCTL;
+ if (bios->c_lflag & ECHOPRT)
+ lios->c_lflag |= LINUX_ECHOPRT;
+ if (bios->c_lflag & ECHOKE)
+ lios->c_lflag |= LINUX_ECHOKE;
+ if (bios->c_lflag & FLUSHO)
+ lios->c_lflag |= LINUX_FLUSHO;
+ if (bios->c_lflag & PENDIN)
+ lios->c_lflag |= LINUX_PENDIN;
+ if (bios->c_lflag & IEXTEN)
+ lios->c_lflag |= LINUX_IEXTEN;
+
+ for (i=0; i<LINUX_NCCS; i++)
+ lios->c_cc[i] = LINUX_POSIX_VDISABLE;
+ lios->c_cc[LINUX_VINTR] = bios->c_cc[VINTR];
+ lios->c_cc[LINUX_VQUIT] = bios->c_cc[VQUIT];
+ lios->c_cc[LINUX_VERASE] = bios->c_cc[VERASE];
+ lios->c_cc[LINUX_VKILL] = bios->c_cc[VKILL];
+ lios->c_cc[LINUX_VEOF] = bios->c_cc[VEOF];
+ lios->c_cc[LINUX_VEOL] = bios->c_cc[VEOL];
+ lios->c_cc[LINUX_VMIN] = bios->c_cc[VMIN];
+ lios->c_cc[LINUX_VTIME] = bios->c_cc[VTIME];
+ lios->c_cc[LINUX_VEOL2] = bios->c_cc[VEOL2];
+ lios->c_cc[LINUX_VSUSP] = bios->c_cc[VSUSP];
+ lios->c_cc[LINUX_VSTART] = bios->c_cc[VSTART];
+ lios->c_cc[LINUX_VSTOP] = bios->c_cc[VSTOP];
+ lios->c_cc[LINUX_VREPRINT] = bios->c_cc[VREPRINT];
+ lios->c_cc[LINUX_VDISCARD] = bios->c_cc[VDISCARD];
+ lios->c_cc[LINUX_VWERASE] = bios->c_cc[VWERASE];
+ lios->c_cc[LINUX_VLNEXT] = bios->c_cc[VLNEXT];
+ if (linux_preserve_vstatus)
+ lios->c_cc[LINUX_VSTATUS] = bios->c_cc[VSTATUS];
+
+ for (i=0; i<LINUX_NCCS; i++) {
+ if (i != LINUX_VMIN && i != LINUX_VTIME &&
+ lios->c_cc[i] == _POSIX_VDISABLE)
+ lios->c_cc[i] = LINUX_POSIX_VDISABLE;
+ }
+ lios->c_line = 0;
+
+ lios->c_ispeed = bios->c_ispeed;
+ lios->c_ospeed = bios->c_ospeed;
+}
+
static void
linux_to_bsd_termios(struct linux_termios *lios, struct termios *bios)
{
@@ -664,6 +797,7 @@
{
struct termios bios;
struct linux_termios lios;
+ struct linux_termios2 lios2;
struct linux_termio lio;
struct file *fp;
int error;
@@ -682,6 +816,15 @@
error = copyout(&lios, (void *)args->arg, sizeof(lios));
break;
+ case LINUX_TCGETS2:
+ error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bios, td->td_ucred,
+ td);
+ if (error)
+ break;
+ bsd_to_linux_termios2(&bios, &lios2);
+ error = copyout(&lios2, (void *)args->arg, sizeof(lios2));
+ break;
+
case LINUX_TCSETS:
error = copyin((void *)args->arg, &lios, sizeof(lios));
if (error)
@@ -691,6 +834,17 @@
td));
break;
+ case LINUX_TCSETS2:
+ error = copyin((void *)args->arg, &lios2, sizeof(lios2));
+ if (error)
+ break;
+ linux_to_bsd_termios((struct linux_termios *)&lios2, &bios);
+ bios.c_ispeed = lios2.c_ispeed;
+ bios.c_ospeed = lios2.c_ospeed;
+ error = (fo_ioctl(fp, TIOCSETA, (caddr_t)&bios, td->td_ucred,
+ td));
+ break;
+
case LINUX_TCSETSW:
error = copyin((void *)args->arg, &lios, sizeof(lios));
if (error)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jul 18, 12:42 AM (3 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
35100245
Default Alt Text
D58224.diff (5 KB)
Attached To
Mode
D58224: Support for LINUX_TCGETS2 and LINUX_TCSETS2 ioctls
Attached
Detach File
Event Timeline
Log In to Comment