public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-x86 commit in x11-base/xorg-server/files: 1.3.0.0-fix-xkb-openoffice-hangs.patch
@ 2007-11-07  8:52 Donnie Berkholz (dberkholz)
  0 siblings, 0 replies; only message in thread
From: Donnie Berkholz (dberkholz) @ 2007-11-07  8:52 UTC (permalink / raw
  To: gentoo-commits

dberkholz    07/11/07 08:52:12

  Added:                1.3.0.0-fix-xkb-openoffice-hangs.patch
  Log:
  (#197104) Fix a 100% CPU hang on openoffice. (#196019) Don't create a redundant file with USE=xprint.
  (Portage version: 2.1.3.17)

Revision  Changes    Path
1.1                  x11-base/xorg-server/files/1.3.0.0-fix-xkb-openoffice-hangs.patch

file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/x11-base/xorg-server/files/1.3.0.0-fix-xkb-openoffice-hangs.patch?rev=1.1&view=markup
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/x11-base/xorg-server/files/1.3.0.0-fix-xkb-openoffice-hangs.patch?rev=1.1&content-type=text/plain

Index: 1.3.0.0-fix-xkb-openoffice-hangs.patch
===================================================================
https://bugs.gentoo.org/show_bug.cgi?id=197104

commit a5b8053606d6e786cdcf6734f271acc05f9cc588
Author: Adam Jackson <ajax@benzedrine.nwnk.net>
Date:   Tue Sep 11 11:37:06 2007 -0400

    Ignore - not just block - SIGALRM around Popen()/Pclose().

    Because our "popen" implementation uses stdio, and because nobody's stdio
    library is capable of surviving signals, we need to make absolutely sure
    that we hide the SIGALRM from the smart scheduler.  Otherwise, when you
    open a menu in openoffice, and it recompiles XKB to deal with the
    accelerators, and you popen xkbcomp because we suck, then the scheduler
    will tell you you're taking forever doing something stupid, and the
    wait() code will get confused, and input will hang and your CPU usage
    slams to 100%.  Down, not across.

diff --git a/os/utils.c b/os/utils.c
index 3bb7dbe..afcaae4 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -1720,6 +1720,8 @@ static struct pid {
     int pid;
 } *pidlist;
 
+static sighandler_t old_alarm = NULL; /* XXX horrible awful hack */
+
 pointer
 Popen(char *command, char *type)
 {
@@ -1741,11 +1743,15 @@ Popen(char *command, char *type)
 	return NULL;
     }
 
+    /* Ignore the smart scheduler while this is going on */
+    old_alarm = signal(SIGALRM, SIG_IGN);
+
     switch (pid = fork()) {
     case -1: 	/* error */
 	close(pdes[0]);
 	close(pdes[1]);
 	xfree(cur);
+	signal(SIGALRM, old_alarm);
 	return NULL;
     case 0:	/* child */
 	if (setgid(getgid()) == -1)
@@ -1921,6 +1927,8 @@ Pclose(pointer iop)
     /* allow EINTR again */
     OsReleaseSignals ();
     
+    signal(SIGALRM, old_alarm);
+
     return pid == -1 ? -1 : pstat;
 }
 



-- 
gentoo-commits@gentoo.org mailing list



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-11-07  8:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-07  8:52 [gentoo-commits] gentoo-x86 commit in x11-base/xorg-server/files: 1.3.0.0-fix-xkb-openoffice-hangs.patch Donnie Berkholz (dberkholz)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox