Gentoo Archives: gentoo-commits

From: "Roy Marples (uberlord)" <uberlord@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-auth/consolekit/files: consolekit-0.2.3-freebsd.patch
Date: Wed, 31 Oct 2007 21:32:36
Message-Id: E1InLAq-0002Di-Pp@stork.gentoo.org
1 uberlord 07/10/31 21:32:28
2
3 Added: consolekit-0.2.3-freebsd.patch
4 Log:
5 Add a workaround for a FreeBSD kernel bug so consolekit stops when in use.
6 (Portage version: 2.1.3.16)
7
8 Revision Changes Path
9 1.1 sys-auth/consolekit/files/consolekit-0.2.3-freebsd.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-auth/consolekit/files/consolekit-0.2.3-freebsd.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-auth/consolekit/files/consolekit-0.2.3-freebsd.patch?rev=1.1&content-type=text/plain
13
14 Index: consolekit-0.2.3-freebsd.patch
15 ===================================================================
16 diff --git a/src/ck-sysdeps-unix.c b/src/ck-sysdeps-unix.c
17 index 0001b6b..bcdfb21 100644
18 --- a/src/ck-sysdeps-unix.c
19 +++ b/src/ck-sysdeps-unix.c
20 @@ -267,7 +267,13 @@ ck_wait_for_active_console_num (int console_fd,
21 g_debug ("Interrupted waiting for native console %d activation: %s",
22 num,
23 errmsg);
24 +#if !defined(__FreeBSD__)
25 + /* We don't want to retry on FreeBSD since getting
26 + * EINTR means we are terminating, and we don't want
27 + * to keep restarting our active VT check.
28 + */
29 goto again;
30 +#endif
31 } else {
32 g_warning ("Error waiting for native console %d activation: %s",
33 num,
34 diff --git a/src/main.c b/src/main.c
35 index 11b6f2e..af2998b 100644
36 --- a/src/main.c
37 +++ b/src/main.c
38 @@ -245,6 +245,27 @@ setup_debug_log_signals (void)
39 }
40
41 static void
42 +terminate (int sig __unused)
43 +{
44 + return;
45 +}
46 +
47 +static void
48 +setup_termination_signals (void)
49 +{
50 + struct sigaction sa;
51 +
52 + sa.sa_handler = terminate;
53 + sigemptyset (&sa.sa_mask);
54 + sa.sa_flags = 0;
55 +
56 + sigaction (SIGTERM, &sa, NULL);
57 + sigaction (SIGQUIT, &sa, NULL);
58 + sigaction (SIGINT, &sa, NULL);
59 + sigaction (SIGHUP, &sa, NULL);
60 +}
61 +
62 +static void
63 setup_debug_log (gboolean debug)
64 {
65 ck_log_init ();
66 @@ -300,6 +321,8 @@ main (int argc,
67
68 setup_debug_log (debug);
69
70 + setup_termination_signals ();
71 +
72 connection = get_system_bus ();
73 if (connection == NULL) {
74 goto out;
75 diff --git a/src/test-vt-monitor.c b/src/test-vt-monitor.c
76 index c445865..e31b24e 100644
77 --- a/src/test-vt-monitor.c
78 +++ b/src/test-vt-monitor.c
79 @@ -30,6 +30,7 @@
80 #include <fcntl.h>
81 #include <pwd.h>
82 #include <string.h>
83 +#include <signal.h>
84 #include <errno.h>
85
86 #include <locale.h>
87 @@ -47,6 +48,12 @@ activated_cb (CkVtMonitor *monitor,
88 g_message ("VT %u activated", num);
89 }
90
91 +static void
92 +terminate (int sig __unused)
93 +{
94 + return;
95 +}
96 +
97 int
98 main (int argc, char **argv)
99 {
100 @@ -55,12 +62,22 @@ main (int argc, char **argv)
101 GError *error;
102 guint num;
103 gboolean res;
104 + struct sigaction sa;
105
106 if (! g_thread_supported ()) {
107 g_thread_init (NULL);
108 }
109 g_type_init ();
110
111 + sa.sa_handler = terminate;
112 + sigemptyset (&sa.sa_mask);
113 + sa.sa_flags = 0;
114 +
115 + sigaction (SIGINT, &sa, NULL);
116 + sigaction (SIGTERM, &sa, NULL);
117 + sigaction (SIGQUIT, &sa, NULL);
118 + sigaction (SIGHUP, &sa, NULL);
119 +
120 if (! ck_is_root_user ()) {
121 g_warning ("Must be run as root");
122 exit (1);
123
124
125
126 --
127 gentoo-commits@g.o mailing list