author | Alan Coopersmith <Alan.Coopersmith@Oracle.COM> |
Mon, 31 Oct 2016 18:25:15 -0700 | |
changeset 7201 | bcc18175756d |
permissions | -rw-r--r-- |
7201
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
1 |
From 1d0cd85ec6ad9ae9886618816605261e8519b731 Mon Sep 17 00:00:00 2001 |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
2 |
From: Alan Coopersmith <[email protected]> |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
3 |
Date: Tue, 29 Dec 2015 18:50:08 -0800 |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
4 |
Subject: [PATCH 12/19] restart limit |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
5 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
6 |
Bug 15745160/SUNBT7096672 GDM should stop restarting the Xserver on the console |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
7 |
Original owner:yippi date:2011-11-07 type:bug bugster:7096672 |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
8 |
--- |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
9 |
daemon/gdm-display.c | 33 ++++++++++++++++++++------------- |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
10 |
1 file changed, 20 insertions(+), 13 deletions(-) |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
11 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
12 |
diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
13 |
index ab84ba4..ab7eba7 100644 |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
14 |
--- a/daemon/gdm-display.c |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
15 |
+++ b/daemon/gdm-display.c |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
16 |
@@ -68,7 +68,8 @@ struct GdmDisplayPrivate |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
17 |
char *x11_display_name; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
18 |
int status; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
19 |
time_t creation_time; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
20 |
- GTimer *server_timer; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
21 |
+ int num_failures; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
22 |
+ gint64 time_last_start; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
23 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
24 |
char *x11_cookie; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
25 |
gsize x11_cookie_size; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
26 |
@@ -613,6 +614,10 @@ gdm_display_manage (GdmDisplay *self) |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
27 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
28 |
g_debug ("GdmDisplay: Managing display: %s", self->priv->id); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
29 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
30 |
+ if (self->priv->time_last_start == 0) { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
31 |
+ self->priv->time_last_start = g_get_monotonic_time(); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
32 |
+ } |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
33 |
+ |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
34 |
/* If not explicitly prepared, do it now */ |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
35 |
if (self->priv->status == GDM_DISPLAY_UNMANAGED) { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
36 |
res = gdm_display_prepare (self); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
37 |
@@ -621,8 +626,6 @@ gdm_display_manage (GdmDisplay *self) |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
38 |
} |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
39 |
} |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
40 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
41 |
- g_timer_start (self->priv->server_timer); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
42 |
- |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
43 |
if (g_strcmp0 (self->priv->session_class, "greeter") == 0) { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
44 |
if (GDM_DISPLAY_GET_CLASS (self)->manage != NULL) { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
45 |
GDM_DISPLAY_GET_CLASS (self)->manage (self); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
46 |
@@ -658,8 +661,6 @@ gdm_display_unmanage (GdmDisplay *self) |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
47 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
48 |
g_debug ("GdmDisplay: unmanage display"); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
49 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
50 |
- g_timer_stop (self->priv->server_timer); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
51 |
- |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
52 |
if (self->priv->user_access_file != NULL) { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
53 |
gdm_display_access_file_close (self->priv->user_access_file); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
54 |
g_object_unref (self->priv->user_access_file); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
55 |
@@ -672,9 +673,18 @@ gdm_display_unmanage (GdmDisplay *self) |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
56 |
self->priv->access_file = NULL; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
57 |
} |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
58 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
59 |
- elapsed = g_timer_elapsed (self->priv->server_timer, NULL); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
60 |
- if (elapsed < 3) { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
61 |
- g_warning ("GdmDisplay: display lasted %lf seconds", elapsed); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
62 |
+ elapsed = (g_get_monotonic_time() - self->priv->time_last_start) / 1000000; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
63 |
+ g_debug ("GdmDisplay: Elapsed time since last start: %lf", elapsed); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
64 |
+ if (elapsed > 60) { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
65 |
+ self->priv->num_failures = 0; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
66 |
+ self->priv->time_last_start = g_get_monotonic_time(); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
67 |
+ } else { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
68 |
+ self->priv->num_failures++; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
69 |
+ g_debug ("GdmDisplay: Number of failures=%d", self->priv->num_failures); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
70 |
+ } |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
71 |
+ |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
72 |
+ if (self->priv->num_failures >= 5) { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
73 |
+ g_warning ("GdmDisplay: Display %s failed 5 times in %lf seconds, no longer managing display", self->priv->id, elapsed); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
74 |
_gdm_display_set_status (self, GDM_DISPLAY_FAILED); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
75 |
} else { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
76 |
_gdm_display_set_status (self, GDM_DISPLAY_UNMANAGED); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
77 |
@@ -1300,7 +1310,8 @@ gdm_display_init (GdmDisplay *self) |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
78 |
self->priv = GDM_DISPLAY_GET_PRIVATE (self); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
79 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
80 |
self->priv->creation_time = time (NULL); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
81 |
- self->priv->server_timer = g_timer_new (); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
82 |
+ self->priv->time_last_start = 0; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
83 |
+ self->priv->num_failures = 0; |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
84 |
} |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
85 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
86 |
static void |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
87 |
@@ -1336,10 +1347,6 @@ gdm_display_finalize (GObject *object) |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
88 |
g_object_unref (self->priv->user_access_file); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
89 |
} |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
90 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
91 |
- if (self->priv->server_timer != NULL) { |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
92 |
- g_timer_destroy (self->priv->server_timer); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
93 |
- } |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
94 |
- |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
95 |
G_OBJECT_CLASS (gdm_display_parent_class)->finalize (object); |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
96 |
} |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
97 |
|
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
98 |
-- |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
99 |
2.7.4 |
bcc18175756d
23245293 Move gdm to Userland and update to 3.18.2
Alan Coopersmith <Alan.Coopersmith@Oracle.COM>
parents:
diff
changeset
|
100 |