- Add 0001-let-it-become-a-real-daemon.patch to make plymouth
a real daemon, fixes bnc#889757 and probably others. Patch by Werner. OBS-URL: https://build.opensuse.org/package/show/Base:System/plymouth?expand=0&rev=155
This commit is contained in:
parent
1ffbd1c496
commit
6ce78afa6b
164
0001-let-it-become-a-real-daemon.patch
Normal file
164
0001-let-it-become-a-real-daemon.patch
Normal file
@ -0,0 +1,164 @@
|
||||
Related to bnc#892526 -- let plymouthd become a real daemon that
|
||||
is it should use its own session with the help of the system call
|
||||
setsid(2). Also avoid an EBUSY on ioctl TIOCCONS if a former
|
||||
plymouthd had failed. And a crash or termination may restore not
|
||||
only the current virtual console but also any serial console as
|
||||
well restore the system console.
|
||||
|
||||
---
|
||||
plymouth-0.9.0/src/libply-splash-core/ply-device-manager.c | 9 ++
|
||||
plymouth-0.9.0/src/libply-splash-core/ply-device-manager.h | 1
|
||||
plymouth-0.9.0/src/libply/ply-terminal-session.c | 7 ++
|
||||
plymouth-0.9.0/src/libply/ply-utils.c | 2
|
||||
plymouth-0.9.0/src/main.c | 42 +++++++------
|
||||
5 files changed, 43 insertions(+), 18 deletions(-)
|
||||
|
||||
--- plymouth-0.9.0/src/libply-splash-core/ply-device-manager.c
|
||||
+++ plymouth-0.9.0/src/libply-splash-core/ply-device-manager.c 2014-09-10 12:16:10.694235361 +0000
|
||||
@@ -947,3 +947,12 @@ ply_device_manager_deactivate_keyboards
|
||||
node = next_node;
|
||||
}
|
||||
}
|
||||
+
|
||||
+void
|
||||
+ply_close_all_terminals (ply_device_manager_t *manager)
|
||||
+{
|
||||
+ ply_hashtable_foreach (manager->terminals,
|
||||
+ (ply_hashtable_foreach_func_t *)
|
||||
+ ply_terminal_close,
|
||||
+ manager);
|
||||
+}
|
||||
--- plymouth-0.9.0/src/libply-splash-core/ply-device-manager.h
|
||||
+++ plymouth-0.9.0/src/libply-splash-core/ply-device-manager.h 2014-09-10 12:16:24.826735672 +0000
|
||||
@@ -50,6 +50,7 @@ void ply_device_manager_deactivate_keybo
|
||||
void ply_device_manager_activate_renderers (ply_device_manager_t *manager);
|
||||
void ply_device_manager_deactivate_renderers (ply_device_manager_t *manager);
|
||||
ply_terminal_t *ply_device_manager_get_default_terminal (ply_device_manager_t *manager);
|
||||
+void ply_close_all_terminals (ply_device_manager_t *manager);
|
||||
|
||||
#endif
|
||||
|
||||
--- plymouth-0.9.0/src/libply/ply-utils.c
|
||||
+++ plymouth-0.9.0/src/libply/ply-utils.c 2014-09-10 08:53:01.886236228 +0000
|
||||
@@ -843,6 +843,8 @@ ply_detach_daemon (ply_daemon_handle_t *
|
||||
close (sender_fd);
|
||||
free (handle);
|
||||
|
||||
+ setsid();
|
||||
+
|
||||
return true;
|
||||
}
|
||||
|
||||
--- plymouth-0.9.0/src/libply/ply-terminal-session.c
|
||||
+++ plymouth-0.9.0/src/libply/ply-terminal-session.c 2014-09-10 11:18:04.118735227 +0000
|
||||
@@ -187,6 +187,13 @@ ply_terminal_session_redirect_console (p
|
||||
|
||||
assert (terminal_name != NULL);
|
||||
|
||||
+ fd = open ("/dev/console", O_RDWR | O_NOCTTY);
|
||||
+ if (fd >= 0)
|
||||
+ {
|
||||
+ ioctl (fd, TIOCCONS); /* Undo any current map if any */
|
||||
+ close (fd);
|
||||
+ }
|
||||
+
|
||||
fd = open (terminal_name, O_RDWR | O_NOCTTY);
|
||||
|
||||
if (fd < 0)
|
||||
--- plymouth-0.9.0/src/main.c
|
||||
+++ plymouth-0.9.0/src/main.c 2014-09-10 13:02:23.242235200 +0000
|
||||
@@ -1042,6 +1042,7 @@ on_seat_added (state_t *state,
|
||||
|
||||
}
|
||||
|
||||
+static ply_device_manager_t *manager;
|
||||
static void
|
||||
load_devices (state_t *state,
|
||||
ply_device_manager_flags_t flags)
|
||||
@@ -1049,6 +1050,8 @@ load_devices (state_t
|
||||
state->device_manager = ply_device_manager_new (state->default_tty, flags);
|
||||
state->local_console_terminal = ply_device_manager_get_default_terminal (state->device_manager);
|
||||
|
||||
+ manager = state->device_manager;
|
||||
+
|
||||
ply_device_manager_watch_seats (state->device_manager,
|
||||
(ply_seat_added_handler_t)
|
||||
on_seat_added,
|
||||
@@ -1077,6 +1080,7 @@ quit_splash (state_t *state)
|
||||
ply_trace ("Not retaining splash, so deallocating VT");
|
||||
ply_terminal_deactivate_vt (state->local_console_terminal);
|
||||
ply_terminal_close (state->local_console_terminal);
|
||||
+ ply_close_all_terminals (state->device_manager);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2075,25 +2079,22 @@ dump_debug_buffer_to_file (void)
|
||||
#include <termios.h>
|
||||
#include <unistd.h>
|
||||
static void
|
||||
-on_crash (int signum)
|
||||
+dosigaction (int signum)
|
||||
{
|
||||
- struct termios term_attributes;
|
||||
int fd;
|
||||
|
||||
- fd = open ("/dev/tty1", O_RDWR | O_NOCTTY);
|
||||
- if (fd < 0) fd = open ("/dev/hvc0", O_RDWR | O_NOCTTY);
|
||||
-
|
||||
- ioctl (fd, KDSETMODE, KD_TEXT);
|
||||
-
|
||||
- tcgetattr (fd, &term_attributes);
|
||||
-
|
||||
- term_attributes.c_iflag |= BRKINT | IGNPAR | ICRNL | IXON;
|
||||
- term_attributes.c_oflag |= OPOST;
|
||||
- term_attributes.c_lflag |= ECHO | ICANON | ISIG | IEXTEN;
|
||||
-
|
||||
- tcsetattr (fd, TCSAFLUSH, &term_attributes);
|
||||
+ if (manager)
|
||||
+ {
|
||||
+ ply_device_manager_deactivate_keyboards (manager);
|
||||
+ ply_close_all_terminals (manager);
|
||||
+ }
|
||||
|
||||
- close (fd);
|
||||
+ fd = open ("/dev/console", O_RDWR | O_NOCTTY);
|
||||
+ if (fd >= 0)
|
||||
+ {
|
||||
+ ioctl (fd, TIOCCONS); /* Undo any current map if any */
|
||||
+ close (fd);
|
||||
+ }
|
||||
|
||||
if (debug_buffer != NULL)
|
||||
{
|
||||
@@ -2108,7 +2109,6 @@ on_crash (int signum)
|
||||
pid_file = NULL;
|
||||
}
|
||||
|
||||
- signal (signum, SIG_DFL);
|
||||
raise(signum);
|
||||
}
|
||||
|
||||
@@ -2145,6 +2145,7 @@ main (int argc,
|
||||
char *kernel_command_line = NULL;
|
||||
char *tty = NULL;
|
||||
ply_device_manager_flags_t device_manager_flags = PLY_DEVICE_MANAGER_FLAGS_NONE;
|
||||
+ struct sigaction sa;
|
||||
|
||||
state.start_time = ply_get_timestamp ();
|
||||
state.command_parser = ply_command_parser_new ("plymouthd", "Splash server");
|
||||
@@ -2256,8 +2257,13 @@ main (int argc,
|
||||
if (debug)
|
||||
debug_buffer = ply_buffer_new ();
|
||||
|
||||
- signal (SIGABRT, on_crash);
|
||||
- signal (SIGSEGV, on_crash);
|
||||
+ sigemptyset(&sa.sa_mask);
|
||||
+ sa.sa_flags = SA_RESETHAND;
|
||||
+ sa.sa_handler = dosigaction;
|
||||
+ sigaction (SIGHUP, &sa, NULL);
|
||||
+ sigaction (SIGTERM, &sa, NULL);
|
||||
+ sigaction (SIGABRT, &sa, NULL);
|
||||
+ sigaction (SIGSEGV, &sa, NULL);
|
||||
|
||||
/* before do anything we need to make sure we have a working
|
||||
* environment.
|
@ -1,15 +1,32 @@
|
||||
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
|
||||
index a5aa59d..0be2117 100644
|
||||
--- a/src/libply-splash-core/ply-device-manager.c
|
||||
+++ b/src/libply-splash-core/ply-device-manager.c
|
||||
@@ -125,6 +125,10 @@ fb_device_has_drm_device (ply_device_manager_t *manager,
|
||||
const char *id_path;
|
||||
bool has_drm_device = false;
|
||||
|
||||
+ const char *card_name = udev_device_get_sysattr_value (fb_device, "name");
|
||||
+ if (card_name && strcmp ("cirrusdrmfb", card_name) == 0)
|
||||
+ return false;
|
||||
+
|
||||
/* We want to see if the framebuffer is associated with a DRM-capable
|
||||
* graphics card, if it is, we'll use the DRM device */
|
||||
card_matches = udev_enumerate_new (manager->udev_context);
|
||||
Index: plymouth-0.9.0/src/libply-splash-core/ply-device-manager.c
|
||||
===================================================================
|
||||
--- plymouth-0.9.0.orig/src/libply-splash-core/ply-device-manager.c
|
||||
+++ plymouth-0.9.0/src/libply-splash-core/ply-device-manager.c
|
||||
@@ -123,6 +123,9 @@ fb_device_has_drm_device (ply_device_man
|
||||
const char *id_path;
|
||||
bool has_drm_device = false;
|
||||
|
||||
+ const char *card_name = udev_device_get_sysattr_value (fb_device, "name");
|
||||
+ ply_trace("First method gives us: %s", card_name);
|
||||
+
|
||||
/* We want to see if the framebuffer is associated with a DRM-capable
|
||||
* graphics card, if it is, we'll use the DRM device */
|
||||
card_matches = udev_enumerate_new (manager->udev_context);
|
||||
@@ -149,8 +152,15 @@ fb_device_has_drm_device (ply_device_man
|
||||
card_path = udev_list_entry_get_name (card_entry);
|
||||
card_device = udev_device_new_from_syspath (manager->udev_context, card_path);
|
||||
card_node = udev_device_get_devnode (card_device);
|
||||
- if (card_node != NULL)
|
||||
- has_drm_device = true;
|
||||
+ if (card_node != NULL) {
|
||||
+ /* don't consider drm driver for cirrus usable */
|
||||
+ const char *card_name = udev_device_get_sysattr_value (card_device, "name");
|
||||
+ ply_trace("Second method gives us: %s", card_name);
|
||||
+ if (card_name && strcmp ("cirrusdrmfb", card_name) == 0)
|
||||
+ has_drm_device = false;
|
||||
+ else
|
||||
+ has_drm_device = true;
|
||||
+ }
|
||||
else
|
||||
ply_trace ("no card node!");
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Sep 12 12:50:06 UTC 2014 - idonmez@suse.com
|
||||
|
||||
- Add 0001-let-it-become-a-real-daemon.patch to make plymouth
|
||||
a real daemon, fixes bnc#889757 and probably others.
|
||||
Patch by Werner.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 4 10:34:25 UTC 2014 - idonmez@suse.com
|
||||
|
||||
|
@ -61,6 +61,7 @@ Patch26: plymouth-ignore-cirrusdrm.patch
|
||||
# PATCH-FIX-UPSTREAM 0001-text-step-bar-use-correct-utf-8-multibyte-sequence-f.patch bnc#886148 fcrozat@suse.com -- fix UTF-8 code for square
|
||||
Patch27: 0001-text-step-bar-use-correct-utf-8-multibyte-sequence-f.patch
|
||||
Patch28: plymouth-boot-vga-framebuffer.patch
|
||||
Patch29: 0001-let-it-become-a-real-daemon.patch
|
||||
|
||||
BuildRequires: automake
|
||||
BuildRequires: docbook-xsl-stylesheets
|
||||
@ -358,6 +359,7 @@ plugin.
|
||||
%patch26 -p1
|
||||
%patch27 -p1
|
||||
%patch28 -p1
|
||||
%patch29 -p1
|
||||
|
||||
# replace builddate with patch0date
|
||||
sed -i "s/__DATE__/\"$(stat -c %y %{_sourcedir}/%{name}.changes)\"/" src/main.c
|
||||
|
Loading…
Reference in New Issue
Block a user