diff options
Diffstat (limited to 'meta-oe/recipes-graphics/slim/slim/0008-restart-Xserver-if-killed.patch')
-rw-r--r-- | meta-oe/recipes-graphics/slim/slim/0008-restart-Xserver-if-killed.patch | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/meta-oe/recipes-graphics/slim/slim/0008-restart-Xserver-if-killed.patch b/meta-oe/recipes-graphics/slim/slim/0008-restart-Xserver-if-killed.patch deleted file mode 100644 index 0c5cfb742..000000000 --- a/meta-oe/recipes-graphics/slim/slim/0008-restart-Xserver-if-killed.patch +++ /dev/null | |||
@@ -1,161 +0,0 @@ | |||
1 | From ee77a3d154443d2823ecbf2141daa1b5924f629f Mon Sep 17 00:00:00 2001 | ||
2 | From: iwamatsu <iwamatsu@7c53e7cc-98ea-0310-8f1f-a0b24da60408> | ||
3 | Date: Fri, 17 Jun 2011 20:38:34 +0000 | ||
4 | Subject: [PATCH 8/8] restart Xserver if killed | ||
5 | |||
6 | Patch from http://developer.berlios.de/patch/?func=detailpatch&patch_id=2378&group_id=2663. | ||
7 | |||
8 | Signed-off-by: Nobuhiro Iwamatsu <iwamatsu@nigauri.org> | ||
9 | |||
10 | git-svn-id: svn://svn.berlios.de/slim/trunk@182 7c53e7cc-98ea-0310-8f1f-a0b24da60408 | ||
11 | --- | ||
12 | app.cpp | 36 +++++++++--------------------------- | ||
13 | app.h | 2 +- | ||
14 | 2 files changed, 10 insertions(+), 28 deletions(-) | ||
15 | |||
16 | diff --git a/app.cpp b/app.cpp | ||
17 | index 44ab099..358a98f 100644 | ||
18 | --- a/app.cpp | ||
19 | +++ b/app.cpp | ||
20 | @@ -104,6 +104,11 @@ int conv(int num_msg, const struct pam_message **msg, | ||
21 | |||
22 | extern App* LoginApp; | ||
23 | |||
24 | +int xioerror(Display *disp) { | ||
25 | + LoginApp->RestartServer(); | ||
26 | + return 0; | ||
27 | +} | ||
28 | + | ||
29 | void CatchSignal(int sig) { | ||
30 | cerr << APPNAME << ": unexpected signal " << sig << endl; | ||
31 | |||
32 | @@ -114,19 +119,6 @@ void CatchSignal(int sig) { | ||
33 | exit(ERR_EXIT); | ||
34 | } | ||
35 | |||
36 | - | ||
37 | -void AlarmSignal(int sig) { | ||
38 | - int pid = LoginApp->GetServerPID(); | ||
39 | - if(waitpid(pid, NULL, WNOHANG) == pid) { | ||
40 | - LoginApp->StopServer(); | ||
41 | - LoginApp->RemoveLock(); | ||
42 | - exit(OK_EXIT); | ||
43 | - } | ||
44 | - signal(sig, AlarmSignal); | ||
45 | - alarm(2); | ||
46 | -} | ||
47 | - | ||
48 | - | ||
49 | void User1Signal(int sig) { | ||
50 | signal(sig, User1Signal); | ||
51 | } | ||
52 | @@ -275,7 +267,6 @@ void App::Run() { | ||
53 | signal(SIGHUP, CatchSignal); | ||
54 | signal(SIGPIPE, CatchSignal); | ||
55 | signal(SIGUSR1, User1Signal); | ||
56 | - signal(SIGALRM, AlarmSignal); | ||
57 | |||
58 | #ifndef XNEST_DEBUG | ||
59 | if (!force_nodaemon && cfg->getOption("daemon") == "yes") { | ||
60 | @@ -297,7 +288,6 @@ void App::Run() { | ||
61 | |||
62 | CreateServerAuth(); | ||
63 | StartServer(); | ||
64 | - alarm(2); | ||
65 | #endif | ||
66 | |||
67 | } | ||
68 | @@ -613,6 +603,8 @@ void App::Login() { | ||
69 | int status; | ||
70 | while (wpid != pid) { | ||
71 | wpid = wait(&status); | ||
72 | + if (wpid == ServerPID) | ||
73 | + xioerror(Dpy); // Server died, simulate IO error | ||
74 | } | ||
75 | if (WIFEXITED(status) && WEXITSTATUS(status)) { | ||
76 | LoginPanel->Message("Failed to execute login command"); | ||
77 | @@ -658,9 +650,6 @@ void App::Login() { | ||
78 | |||
79 | |||
80 | void App::Reboot() { | ||
81 | - // Stop alarm clock | ||
82 | - alarm(0); | ||
83 | - | ||
84 | #ifdef USE_PAM | ||
85 | try{ | ||
86 | pam.end(); | ||
87 | @@ -683,9 +672,6 @@ void App::Reboot() { | ||
88 | |||
89 | |||
90 | void App::Halt() { | ||
91 | - // Stop alarm clock | ||
92 | - alarm(0); | ||
93 | - | ||
94 | #ifdef USE_PAM | ||
95 | try{ | ||
96 | pam.end(); | ||
97 | @@ -771,6 +757,7 @@ void App::RestartServer() { | ||
98 | |||
99 | StopServer(); | ||
100 | RemoveLock(); | ||
101 | + while (waitpid(-1, NULL, WNOHANG) > 0); // Collects all dead childrens | ||
102 | Run(); | ||
103 | } | ||
104 | |||
105 | @@ -841,6 +828,7 @@ int App::WaitForServer() { | ||
106 | |||
107 | for(cycles = 0; cycles < ncycles; cycles++) { | ||
108 | if((Dpy = XOpenDisplay(DisplayName))) { | ||
109 | + XSetIOErrorHandler(xioerror); | ||
110 | return 1; | ||
111 | } else { | ||
112 | if(!ServerTimeout(1, (char *) "X server to begin accepting connections")) | ||
113 | @@ -925,9 +913,6 @@ int App::StartServer() { | ||
114 | ServerPID = -1; | ||
115 | break; | ||
116 | } | ||
117 | - alarm(15); | ||
118 | - pause(); | ||
119 | - alarm(0); | ||
120 | |||
121 | // Wait for server to start up | ||
122 | if(WaitForServer() == 0) { | ||
123 | @@ -962,15 +947,12 @@ int IgnoreXIO(Display *d) { | ||
124 | |||
125 | |||
126 | void App::StopServer() { | ||
127 | - // Stop alars clock and ignore signals | ||
128 | - alarm(0); | ||
129 | signal(SIGQUIT, SIG_IGN); | ||
130 | signal(SIGINT, SIG_IGN); | ||
131 | signal(SIGHUP, SIG_IGN); | ||
132 | signal(SIGPIPE, SIG_IGN); | ||
133 | signal(SIGTERM, SIG_DFL); | ||
134 | signal(SIGKILL, SIG_DFL); | ||
135 | - signal(SIGALRM, SIG_DFL); | ||
136 | |||
137 | // Catch X error | ||
138 | XSetIOErrorHandler(IgnoreXIO); | ||
139 | diff --git a/app.h b/app.h | ||
140 | index dd7c281..2db1038 100644 | ||
141 | --- a/app.h | ||
142 | +++ b/app.h | ||
143 | @@ -34,6 +34,7 @@ public: | ||
144 | ~App(); | ||
145 | void Run(); | ||
146 | int GetServerPID(); | ||
147 | + void RestartServer(); | ||
148 | void StopServer(); | ||
149 | |||
150 | bool serverStarted; | ||
151 | @@ -49,7 +50,6 @@ private: | ||
152 | void Console(); | ||
153 | void Exit(); | ||
154 | void KillAllClients(Bool top); | ||
155 | - void RestartServer(); | ||
156 | void ReadConfig(); | ||
157 | void OpenLog(); | ||
158 | void CloseLog(); | ||
159 | -- | ||
160 | 1.6.6.1 | ||
161 | |||