Gentoo Archives: gentoo-commits

From: "Donnie Berkholz (dberkholz)" <dberkholz@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in x11-base/xorg-server/files: 1.3.0.0-fix-xkb-openoffice-hangs.patch
Date: Wed, 07 Nov 2007 08:52:22
Message-Id: E1Ipgdw-0004sM-Vh@stork.gentoo.org
1 dberkholz 07/11/07 08:52:12
2
3 Added: 1.3.0.0-fix-xkb-openoffice-hangs.patch
4 Log:
5 (#197104) Fix a 100% CPU hang on openoffice. (#196019) Don't create a redundant file with USE=xprint.
6 (Portage version: 2.1.3.17)
7
8 Revision Changes Path
9 1.1 x11-base/xorg-server/files/1.3.0.0-fix-xkb-openoffice-hangs.patch
10
11 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
12 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
13
14 Index: 1.3.0.0-fix-xkb-openoffice-hangs.patch
15 ===================================================================
16 https://bugs.gentoo.org/show_bug.cgi?id=197104
17
18 commit a5b8053606d6e786cdcf6734f271acc05f9cc588
19 Author: Adam Jackson <ajax@×××××××××××××××.net>
20 Date: Tue Sep 11 11:37:06 2007 -0400
21
22 Ignore - not just block - SIGALRM around Popen()/Pclose().
23
24 Because our "popen" implementation uses stdio, and because nobody's stdio
25 library is capable of surviving signals, we need to make absolutely sure
26 that we hide the SIGALRM from the smart scheduler. Otherwise, when you
27 open a menu in openoffice, and it recompiles XKB to deal with the
28 accelerators, and you popen xkbcomp because we suck, then the scheduler
29 will tell you you're taking forever doing something stupid, and the
30 wait() code will get confused, and input will hang and your CPU usage
31 slams to 100%. Down, not across.
32
33 diff --git a/os/utils.c b/os/utils.c
34 index 3bb7dbe..afcaae4 100644
35 --- a/os/utils.c
36 +++ b/os/utils.c
37 @@ -1720,6 +1720,8 @@ static struct pid {
38 int pid;
39 } *pidlist;
40
41 +static sighandler_t old_alarm = NULL; /* XXX horrible awful hack */
42 +
43 pointer
44 Popen(char *command, char *type)
45 {
46 @@ -1741,11 +1743,15 @@ Popen(char *command, char *type)
47 return NULL;
48 }
49
50 + /* Ignore the smart scheduler while this is going on */
51 + old_alarm = signal(SIGALRM, SIG_IGN);
52 +
53 switch (pid = fork()) {
54 case -1: /* error */
55 close(pdes[0]);
56 close(pdes[1]);
57 xfree(cur);
58 + signal(SIGALRM, old_alarm);
59 return NULL;
60 case 0: /* child */
61 if (setgid(getgid()) == -1)
62 @@ -1921,6 +1927,8 @@ Pclose(pointer iop)
63 /* allow EINTR again */
64 OsReleaseSignals ();
65
66 + signal(SIGALRM, old_alarm);
67 +
68 return pid == -1 ? -1 : pstat;
69 }
70
71
72
73
74 --
75 gentoo-commits@g.o mailing list