diff --git a/src/common.h b/src/common.h index aff25e67ca..71a5e199b4 100644 --- a/src/common.h +++ b/src/common.h @@ -153,6 +153,8 @@ typedef struct session { ev_signal usr1_signal; /// Signal handler for SIGINT ev_signal int_signal; + /// Signal handler for SIGXCPU + ev_signal xcpu_signal; // === Backend related === /// backend data diff --git a/src/picom.c b/src/picom.c index 2651db3444..7fff4ab10f 100644 --- a/src/picom.c +++ b/src/picom.c @@ -1952,6 +1952,12 @@ static void exit_enable(EV_P attr_unused, ev_signal *w, int revents attr_unused) quit(ps); } +static void +handle_xcpu_signal(EV_P attr_unused, ev_signal *w attr_unused, int revents attr_unused) { + log_info("Received XCPU signal, aborting..."); + abort(); +} + static void config_file_change_cb(void *_ps) { auto ps = (struct session *)_ps; reset_enable(ps->loop, NULL, 0); @@ -2486,8 +2492,10 @@ static session_t *session_init(int argc, char **argv, Display *dpy, // Set up SIGUSR1 signal handler to reset program ev_signal_init(&ps->usr1_signal, reset_enable, SIGUSR1); ev_signal_init(&ps->int_signal, exit_enable, SIGINT); + ev_signal_init(&ps->xcpu_signal, handle_xcpu_signal, SIGXCPU); ev_signal_start(ps->loop, &ps->usr1_signal); ev_signal_start(ps->loop, &ps->int_signal); + ev_signal_start(ps->loop, &ps->xcpu_signal); // xcb can read multiple events from the socket when a request with reply is // made. diff --git a/src/rtkit.c b/src/rtkit.c index ecb89a252e..779ebae771 100644 --- a/src/rtkit.c +++ b/src/rtkit.c @@ -191,7 +191,9 @@ bool rtkit_make_realtime(long thread, int priority) { } new_rlim = old_rlim; new_rlim.rlim_cur = min3(new_rlim.rlim_max, (rlim_t)rttime_usec_max, 100000); // 100ms - new_rlim.rlim_max = new_rlim.rlim_cur; + new_rlim.rlim_max = (rlim_t)rttime_usec_max; + log_info("Setting RLIMIT_RTTIME to: hard: %lld, soft: %lld", + (long long)new_rlim.rlim_max, (long long)new_rlim.rlim_cur); if (setrlimit(RLIMIT_RTTIME, &new_rlim) != 0) { log_debug("Couldn't set RLIMIT_RTTIME."); return false;