rpms/kvm/F-9 kvm-65-pty-rawmode.patch,NONE,1.1 kvm.spec,1.55,1.56
Daniel P. Berrange (berrange)
fedora-extras-commits at redhat.com
Fri May 23 14:48:37 UTC 2008
Author: berrange
Update of /cvs/pkgs/rpms/kvm/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26023
Modified Files:
kvm.spec
Added Files:
kvm-65-pty-rawmode.patch
Log Message:
Fix PTY term to be in raw mode
kvm-65-pty-rawmode.patch:
--- NEW FILE kvm-65-pty-rawmode.patch ---
diff -rup kvm-65.orig/qemu/vl.c kvm-65.new/qemu/vl.c
--- kvm-65.orig/qemu/vl.c 2008-04-04 17:22:20.000000000 -0400
+++ kvm-65.new/qemu/vl.c 2008-05-23 10:41:13.000000000 -0400
@@ -2300,28 +2300,78 @@ static CharDriverState *qemu_chr_open_st
return chr;
}
+#ifdef __sun__
+/* Once Solaris has openpty(), this is going to be removed. */
+int openpty(int *amaster, int *aslave, char *name,
+ struct termios *termp, struct winsize *winp)
+{
+ const char *slave;
+ int mfd = -1, sfd = -1;
+
+ *amaster = *aslave = -1;
+
+ mfd = open("/dev/ptmx", O_RDWR | O_NOCTTY);
+ if (mfd < 0)
+ goto err;
+
+ if (grantpt(mfd) == -1 || unlockpt(mfd) == -1)
+ goto err;
+
+ if ((slave = ptsname(mfd)) == NULL)
+ goto err;
+
+ if ((sfd = open(slave, O_RDONLY | O_NOCTTY)) == -1)
+ goto err;
+
+ if (ioctl(sfd, I_PUSH, "ptem") == -1 ||
+ (termp != NULL && tcgetattr(sfd, termp) < 0))
+ goto err;
+
+ if (amaster)
+ *amaster = mfd;
+ if (aslave)
+ *aslave = sfd;
+ if (winp)
+ ioctl(sfd, TIOCSWINSZ, winp);
+
+ return 0;
+
+err:
+ if (sfd != -1)
+ close(sfd);
+ close(mfd);
+ return -1;
+}
+
+void cfmakeraw (struct termios *termios_p)
+{
+ termios_p->c_iflag &=
+ ~(IGNBRK|BRKINT|PARMRK|ISTRIP|INLCR|IGNCR|ICRNL|IXON);
+ termios_p->c_oflag &= ~OPOST;
+ termios_p->c_lflag &= ~(ECHO|ECHONL|ICANON|ISIG|IEXTEN);
+ termios_p->c_cflag &= ~(CSIZE|PARENB);
+ termios_p->c_cflag |= CS8;
+
+ termios_p->c_cc[VMIN] = 0;
+ termios_p->c_cc[VTIME] = 0;
+}
+#endif
+
#if defined(__linux__) || defined(__sun__)
static CharDriverState *qemu_chr_open_pty(void)
{
struct termios tty;
- char slave_name[1024];
int master_fd, slave_fd;
-#if defined(__linux__)
- /* Not satisfying */
- if (openpty(&master_fd, &slave_fd, slave_name, NULL, NULL) < 0) {
+ if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) < 0) {
return NULL;
}
-#endif
- /* Disabling local echo and line-buffered output */
- tcgetattr (master_fd, &tty);
- tty.c_lflag &= ~(ECHO|ICANON|ISIG);
- tty.c_cc[VMIN] = 1;
- tty.c_cc[VTIME] = 0;
- tcsetattr (master_fd, TCSAFLUSH, &tty);
+ /* Set raw attributes on the pty. */
+ cfmakeraw(&tty);
+ tcsetattr(slave_fd, TCSAFLUSH, &tty);
- fprintf(stderr, "char device redirected to %s\n", slave_name);
+ fprintf(stderr, "char device redirected to %s\n", ptsname(master_fd));
return qemu_chr_open_fd(master_fd, master_fd);
}
Index: kvm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kvm/F-9/kvm.spec,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -r1.55 -r1.56
--- kvm.spec 20 May 2008 14:38:33 -0000 1.55
+++ kvm.spec 23 May 2008 14:47:56 -0000 1.56
@@ -1,7 +1,7 @@
Summary: Kernel-based Virtual Machine
Name: kvm
Version: 65
-Release: 4%{?dist}
+Release: 5%{?dist}
License: GPLv2+ and LGPLv2+
Group: Development/Tools
URL: http://%{name}.sf.net
@@ -13,6 +13,7 @@
Patch3: %{name}-62-e1000-default.patch
Patch4: %{name}-65-kernel-virtio-boot.patch
Patch5: %{name}-65-cirrus.patch
+Patch6: %{name}-65-pty-rawmode.patch
# patches from upstream qemu
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: SDL-devel
@@ -47,6 +48,7 @@
#patch3 -p1
%patch4 -p1
%patch5 -p1
+%patch6 -p1
%build
# we need to install the data bits in a different path
@@ -101,6 +103,9 @@
%{_sysconfdir}/sysconfig/modules/%{name}.modules
%changelog
+* Fri May 23 2008 Daniel P. Berrange <berrange at redhat.com> - 65-5.fc9
+- Put PTY in rawmode
+
* Tue May 20 2008 Mark McLoughlin <markmc at redhat.com> - 65-4.fc9
- Re-enable patch to fix -kernel with virtio/extboot drives (#444578)
More information about the fedora-extras-commits
mailing list