rpms/kvm/F-8 kvm-60-pty-rawmode.patch,NONE,1.1 kvm.spec,1.32,1.33

Daniel P. Berrange (berrange) fedora-extras-commits at redhat.com
Fri May 23 14:50:06 UTC 2008


Author: berrange

Update of /cvs/pkgs/rpms/kvm/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26210

Modified Files:
	kvm.spec 
Added Files:
	kvm-60-pty-rawmode.patch 
Log Message:
Fix PTY term to be in raw mode

kvm-60-pty-rawmode.patch:

--- NEW FILE kvm-60-pty-rawmode.patch ---
diff -rup kvm-60.orig/qemu/vl.c kvm-60.new/qemu/vl.c
--- kvm-60.orig/qemu/vl.c	2008-01-20 07:35:04.000000000 -0500
+++ kvm-60.new/qemu/vl.c	2008-05-23 10:43:29.000000000 -0400
@@ -2226,28 +2226,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-8/kvm.spec,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- kvm.spec	16 May 2008 16:18:04 -0000	1.32
+++ kvm.spec	23 May 2008 14:49:23 -0000	1.33
@@ -1,7 +1,7 @@
 Summary: Kernel-based Virtual Machine
 Name: kvm
 Version: 60
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: GPLv2+ and LGPLv2+
 Group: Development/Tools
 URL: http://%{name}.sf.net
@@ -10,6 +10,7 @@
 Patch1: %{name}-bootmenu.patch
 Patch2: %{name}-%{version}-block-rw-range-check.patch
 Patch3: %{name}-cirrus.patch
+Patch4: %{name}-60-pty-rawmode.patch
 # patches from upstream qemu
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: SDL-devel
@@ -41,6 +42,7 @@
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 %build
 # we need to install the data bits in a different path
@@ -95,6 +97,9 @@
 %{_sysconfdir}/sysconfig/modules/%{name}.modules
 
 %changelog
+* Fri May 23 2008 Daniel P. Berrange <berrange at redhat.com> - 60-5.fc8
+- Put PTY in rawmode
+
 * Fri May 16 2008 Glauber Costa <gcosta at redhat.com> - 60-4.fc8
 - Fix problem with cirrus device that was breaking vnc connections (rhbz #446830)
 




More information about the fedora-extras-commits mailing list