Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Stefan Agner
weston
Commits
3651bd54
Commit
3651bd54
authored
Aug 11, 2011
by
Kristian Høgsberg
Browse files
xserver: Shut down if X server is crashing too fast
parent
3cf11723
Changes
1
Show whitespace changes
Inline
Side-by-side
compositor/xserver-launcher.c
View file @
3651bd54
...
...
@@ -549,13 +549,28 @@ wlsc_xserver_handle_event(int listen_fd, uint32_t mask, void *data)
return
1
;
}
static
void
wlsc_xserver_shutdown
(
struct
wlsc_xserver
*
wxs
)
{
char
path
[
256
];
snprintf
(
path
,
sizeof
path
,
"/tmp/.X%d-lock"
,
wxs
->
display
);
unlink
(
path
);
snprintf
(
path
,
sizeof
path
,
"/tmp/.X11-unix/X%d"
,
wxs
->
display
);
unlink
(
path
);
close
(
wxs
->
abstract_fd
);
wl_event_source_remove
(
wxs
->
abstract_source
);
close
(
wxs
->
unix_fd
);
wl_event_source_remove
(
wxs
->
unix_source
);
wxs
->
loop
=
NULL
;
}
static
void
wlsc_xserver_cleanup
(
struct
wlsc_process
*
process
,
int
status
)
{
struct
wlsc_xserver
*
mxs
=
container_of
(
process
,
struct
wlsc_xserver
,
process
);
fprintf
(
stderr
,
"xserver exited, code %d
\n
"
,
status
);
mxs
->
process
.
pid
=
0
;
mxs
->
abstract_source
=
...
...
@@ -568,8 +583,17 @@ wlsc_xserver_cleanup(struct wlsc_process *process, int status)
WL_EVENT_READABLE
,
wlsc_xserver_handle_event
,
mxs
);
if
(
mxs
->
wm
)
{
fprintf
(
stderr
,
"xserver exited, code %d
\n
"
,
status
);
wlsc_wm_destroy
(
mxs
->
wm
);
mxs
->
wm
=
NULL
;
}
else
{
/* If the X server crashes before it binds to the
* xserver interface, shut down and don't try
* again. */
fprintf
(
stderr
,
"xserver crashing too fast: %d
\n
"
,
status
);
wlsc_xserver_shutdown
(
mxs
);
}
}
static
void
...
...
@@ -790,15 +814,9 @@ void
wlsc_xserver_destroy
(
struct
wlsc_compositor
*
compositor
)
{
struct
wlsc_xserver
*
wxs
=
compositor
->
wxs
;
char
path
[
256
];
snprintf
(
path
,
sizeof
path
,
"/tmp/.X%d-lock"
,
wxs
->
display
);
unlink
(
path
);
snprintf
(
path
,
sizeof
path
,
"/tmp/.X11-unix/X%d"
,
wxs
->
display
);
unlink
(
path
);
close
(
wxs
->
abstract_fd
);
wl_event_source_remove
(
wxs
->
abstract_source
);
close
(
wxs
->
unix_fd
);
wl_event_source_remove
(
wxs
->
unix_source
);
if
(
wxs
->
loop
)
wlsc_xserver_shutdown
(
wxs
);
free
(
wxs
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment