Exemplo n.º 1
0
static gboolean
signal_cb (int      signo,
           gpointer data)
{
        int ret;
        CsmManager *manager;

        g_debug ("Got callback for signal %d", signo);

        ret = TRUE;

        switch (signo) {
        case SIGFPE:
        case SIGPIPE:
                /* let the fatal signals interrupt us */
                g_debug ("Caught signal %d, shutting down abnormally.", signo);
                ret = FALSE;
                break;
        case SIGINT:
        case SIGTERM:
                manager = (CsmManager *)data;
                csm_manager_logout (manager, CSM_MANAGER_LOGOUT_MODE_FORCE, NULL);

                /* let the fatal signals interrupt us */
                g_debug ("Caught signal %d, shutting down normally.", signo);
                ret = TRUE;
                break;
        case SIGHUP:
                g_debug ("Got HUP signal");
                ret = TRUE;
                break;
        case SIGUSR1:
                g_debug ("Got USR1 signal");
                ret = TRUE;
                mdm_log_toggle_debug ();
                break;
        default:
                g_debug ("Caught unhandled signal %d", signo);
                ret = TRUE;

                break;
        }

        return ret;
}
static gboolean
signal_cb (int      signo,
           gpointer data)
{
    int ret;

    g_debug ("Got callback for signal %d", signo);

    ret = TRUE;

    switch (signo) {
    case SIGSEGV:
    case SIGBUS:
    case SIGILL:
    case SIGABRT:
        g_debug ("Caught signal %d.", signo);

        ret = FALSE;
        break;

    case SIGFPE:
    case SIGPIPE:
        /* let the fatal signals interrupt us */
        g_debug ("Caught signal %d, shutting down abnormally.", signo);
        ret = FALSE;

        break;

    case SIGINT:
    case SIGTERM:
        /* let the fatal signals interrupt us */
        g_debug ("Caught signal %d, shutting down normally.", signo);
        ret = FALSE;

        break;

    case SIGHUP:
        g_debug ("Got HUP signal");
        /* FIXME:
         * Reread config stuff like system config files, VPN service files, etc
         */
        ret = TRUE;

        break;

    case SIGUSR1:
        g_debug ("Got USR1 signal");
        /* we get this from xorg - can't use for anything else */
        ret = TRUE;

        break;

    case SIGUSR2:
        g_debug ("Got USR2 signal");
        ret = TRUE;

        mdm_log_toggle_debug ();

        break;

    default:
        g_debug ("Caught unhandled signal %d", signo);
        ret = TRUE;

        break;
    }

    return ret;
}