* 02110-1301 USA
*/
-#include <string.h>
-#include <signal.h>
-#include <errno.h>
#include <glib.h>
#include <gio/gio.h>
#include <glib-unix.h>
static gboolean
_on_sigterm_cb (gpointer data)
{
- DBG ("SIGTERM");
+ DBG ("SIGTERM/SIGINT");
TlmManager *manager = TLM_MANAGER(data);
static void
_setup_unix_signal_handlers (TlmManager *manager)
{
- if (signal (SIGINT, SIG_IGN) == SIG_ERR)
- WARN ("failed ignore SIGINT: %s", strerror(errno));
-
g_unix_signal_add (SIGTERM, _on_sigterm_cb, (gpointer) manager);
+ g_unix_signal_add (SIGINT, _on_sigterm_cb, (gpointer) manager);
g_unix_signal_add (SIGHUP, _on_sighup_cb, (gpointer) manager);
}
#include <signal.h>
#include <string.h>
#include <stdio.h>
-#include <errno.h>
#include <glib-unix.h>
#include <glib.h>
#include <gio/gio.h>
#include "tlm-session-daemon.h"
static TlmSessionDaemon *_daemon = NULL;
-static guint _sig_source_id[2];
+static guint _sig_source_id[3];
static void
_on_daemon_closed (gpointer data, GObject *server)
GSource *source = NULL;
GMainContext *ctx = g_main_loop_get_context (main_loop);
- if (signal (SIGINT, SIG_IGN) == SIG_ERR)
- WARN ("failed to ignore SIGINT: %s", strerror(errno));
-
source = g_unix_signal_source_new (SIGTERM);
g_source_set_callback (source,
_handle_quit_signal,
NULL);
_sig_source_id[0] = g_source_attach (source, ctx);
- source = g_unix_signal_source_new (SIGHUP);
+ source = g_unix_signal_source_new (SIGINT);
g_source_set_callback (source,
_handle_quit_signal,
main_loop,
NULL);
_sig_source_id[1] = g_source_attach (source, ctx);
+ source = g_unix_signal_source_new (SIGHUP);
+ g_source_set_callback (source,
+ _handle_quit_signal,
+ main_loop,
+ NULL);
+ _sig_source_id[2] = g_source_attach (source, ctx);
+
if (prctl(PR_SET_PDEATHSIG, SIGHUP))
WARN ("failed to set parent death signal");
}
#include <grp.h>
#include <stdio.h>
#include <signal.h>
-#include <errno.h>
#include <termios.h>
#include <libintl.h>
#include <sys/types.h>
#include <ctype.h>
#include <sys/socket.h>
#include <netdb.h>
+#include <linux/kd.h>
#include <glib.h>
#include <glib/gstdio.h>
#define TLM_SESSION_PRIV(obj) \
G_TYPE_INSTANCE_GET_PRIVATE ((obj), TLM_TYPE_SESSION, TlmSessionPrivate)
+#ifndef KDSKBMUTE
+#define KDSKBMUTE 0x4B51
+#endif
+
enum {
PROP_0,
PROP_CONFIG,
if (ioctl (tty_fd, TIOCSPGRP, &tty_pgid)) {
WARN ("ioctl(TIOCSPGRP) failed: %s", strerror(errno));
}
+
+ /* TODO: unset the mode on session cleanup */
+ if (ioctl(tty_fd, KDSKBMUTE, 1) &&
+ ioctl(tty_fd, KDSKBMODE, K_OFF)) {
+ WARN ("ioctl(KDSKBMODE) failed: %s", strerror(errno));
+ }
+
/*if (tcsetpgrp (tty_fd, getpgrp ()))
WARN ("tcsetpgrp() failed: %s", strerror(errno));*/
/* ==================================
* this is child process here onwards
* ================================== */
-
gint open_max;
gint fd;
args[1] = g_strdup ("--user");
}
- if (signal (SIGINT, SIG_DFL) == SIG_ERR)
- WARN ("failed reset SIGINT: %s", strerror(errno));
-
DBG ("executing: ");
args_iter = args;
while (args_iter && *args_iter) {
GVariant *venv = NULL;
gchar **penv = env;
- g_return_val_if_fail (env != NULL, NULL);
-
builder = g_variant_builder_new (((const GVariantType *) "a{ss}"));
- while (*penv) {
+ while (penv && *penv) {
gchar *key = *penv++;
gchar *value = *penv++;
if (!key || !value) {