Skip to content

Commit

Permalink
trying to catch rttime kills
Browse files Browse the repository at this point in the history
  • Loading branch information
yshui committed Feb 27, 2024
1 parent 2be58f1 commit bc77266
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/picom.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 3 additions & 1 deletion src/rtkit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit bc77266

Please sign in to comment.