- fix a very longstanding and irritating issue where opening two gnome-terminal
windows/tabs would make gnome-pty-helper hungry for cpu time. so hungry that it would try to eat all cpu time. from chpe@gnome.org bugzilla: #562385
This commit is contained in:
parent
2a9c1d59bd
commit
e9f7d829b6
@ -1,11 +1,11 @@
|
||||
# $OpenBSD: Makefile,v 1.37 2008/11/10 09:02:30 landry Exp $
|
||||
# $OpenBSD: Makefile,v 1.38 2008/11/27 18:22:53 jasper Exp $
|
||||
|
||||
COMMENT-main= terminal emulation library
|
||||
COMMENT-python= python bindings for vte
|
||||
|
||||
GNOME_PROJECT= vte
|
||||
GNOME_VERSION= 0.17.4
|
||||
PKGNAME-main= ${DISTNAME}
|
||||
PKGNAME-main= ${DISTNAME}p0
|
||||
PKGNAME-python= py-${DISTNAME}
|
||||
CATEGORIES= devel
|
||||
SHARED_LIBS+= vte 12.0 # .12.3
|
||||
|
@ -1,12 +1,101 @@
|
||||
$OpenBSD: patch-gnome-pty-helper_gnome-pty-helper_c,v 1.2 2007/04/24 22:02:19 martynas Exp $
|
||||
--- gnome-pty-helper/gnome-pty-helper.c.orig Fri Mar 23 16:14:44 2007
|
||||
+++ gnome-pty-helper/gnome-pty-helper.c Fri Mar 23 16:15:42 2007
|
||||
@@ -101,7 +101,7 @@ static int CONTROLLEN;
|
||||
static int
|
||||
init_msg_pass (void)
|
||||
{
|
||||
- CONTROLLEN = (CMSG_DATA (cmptr) - (unsigned char *)cmptr) + sizeof(int);
|
||||
+ CONTROLLEN = (CMSG_DATA (cmptr) - (unsigned char *)cmptr) + sizeof(long);
|
||||
cmptr = malloc (CONTROLLEN);
|
||||
$OpenBSD: patch-gnome-pty-helper_gnome-pty-helper_c,v 1.3 2008/11/27 18:22:53 jasper Exp $
|
||||
|
||||
Patch to fix 64-bit issues where gnome-pty-helper would eat up 100% CPU usage.
|
||||
From chpe@gnome.org Bugzilla: #562385
|
||||
|
||||
--- gnome-pty-helper/gnome-pty-helper.c.orig Thu Jun 26 19:49:45 2008
|
||||
+++ gnome-pty-helper/gnome-pty-helper.c Thu Nov 27 13:21:41 2008
|
||||
@@ -95,27 +95,25 @@ static pty_info *pty_list;
|
||||
#endif
|
||||
#endif /* CMSG_DATA */
|
||||
|
||||
if (cmptr)
|
||||
-static struct cmsghdr *cmptr;
|
||||
-static int CONTROLLEN;
|
||||
+/* Solaris doesn't define these */
|
||||
+#ifndef CMSG_ALIGN
|
||||
+#define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) & (size_t) ~(sizeof (size_t) - 1))
|
||||
+#endif
|
||||
+#ifndef CMSG_SPACE
|
||||
+#define CMSG_SPACE(len) (CMSG_ALIGN (len) + CMSG_ALIGN (sizeof (struct cmsghdr)))
|
||||
+#endif
|
||||
+#ifndef CMSG_LEN
|
||||
+#define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len))
|
||||
+#endif
|
||||
|
||||
static int
|
||||
-init_msg_pass (void)
|
||||
-{
|
||||
- CONTROLLEN = (CMSG_DATA (cmptr) - (unsigned char *)cmptr) + sizeof(int);
|
||||
- cmptr = malloc (CONTROLLEN);
|
||||
-
|
||||
- if (cmptr)
|
||||
- return 0;
|
||||
-
|
||||
- return -1;
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
pass_fd (int client_fd, int fd)
|
||||
{
|
||||
struct iovec iov[1];
|
||||
struct msghdr msg;
|
||||
char buf [1];
|
||||
+ char cmsgbuf[CMSG_SPACE(sizeof(int))];
|
||||
+ struct cmsghdr *cmptr;
|
||||
|
||||
iov [0].iov_base = buf;
|
||||
iov [0].iov_len = 1;
|
||||
@@ -124,12 +122,13 @@ pass_fd (int client_fd, int fd)
|
||||
msg.msg_iovlen = 1;
|
||||
msg.msg_name = NULL;
|
||||
msg.msg_namelen = 0;
|
||||
- msg.msg_control = (caddr_t) cmptr;
|
||||
- msg.msg_controllen = CONTROLLEN;
|
||||
-
|
||||
+ msg.msg_control = (caddr_t) cmsgbuf;
|
||||
+ msg.msg_controllen = sizeof(cmsgbuf);
|
||||
+
|
||||
+ cmptr = CMSG_FIRSTHDR(&msg);
|
||||
cmptr->cmsg_level = SOL_SOCKET;
|
||||
cmptr->cmsg_type = SCM_RIGHTS;
|
||||
- cmptr->cmsg_len = CONTROLLEN;
|
||||
+ cmptr->cmsg_len = CMSG_LEN(sizeof(int));
|
||||
*(int *)CMSG_DATA (cmptr) = fd;
|
||||
|
||||
if (sendmsg (client_fd, &msg, 0) != 1)
|
||||
@@ -154,12 +153,6 @@ pass_fd (int client_fd, int fd)
|
||||
#include <sys/uio.h>
|
||||
|
||||
static int
|
||||
-init_msg_pass ()
|
||||
-{
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-static int
|
||||
pass_fd (int client_fd, int fd)
|
||||
{
|
||||
struct iovec iov[1];
|
||||
@@ -185,12 +178,6 @@ pass_fd (int client_fd, int fd)
|
||||
#else
|
||||
#include <stropts.h>
|
||||
#ifdef I_SENDFD
|
||||
-static int
|
||||
-init_msg_pass ()
|
||||
-{
|
||||
- /* nothing */
|
||||
- return 0;
|
||||
-}
|
||||
|
||||
int
|
||||
pass_fd (int client_fd, int fd)
|
||||
@@ -707,9 +694,6 @@ main (int argc, char *argv [])
|
||||
/* Make sure we clean up utmp/wtmp even under vncserver */
|
||||
signal (SIGHUP, exit_handler);
|
||||
signal (SIGTERM, exit_handler);
|
||||
-
|
||||
- if (init_msg_pass () == -1)
|
||||
- exit (1);
|
||||
|
||||
while (!done) {
|
||||
res = n_read (STDIN_FILENO, &op, sizeof (op));
|
||||
|
Loading…
Reference in New Issue
Block a user