Skip to content

Commit

Permalink
Test interleaved/overlapping SIGPROF/SIGALRM delivery
Browse files Browse the repository at this point in the history
  • Loading branch information
rocallahan committed Nov 7, 2023
1 parent d5d126a commit 1475ac4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,7 @@ set(BASIC_TESTS
sigprocmask_in_syscallbuf_sighandler
sigprocmask_rr_sigs
sigprocmask_syscallbuf
sigprof
sigpwr
sigqueueinfo
x86/sigreturn
Expand Down
26 changes: 26 additions & 0 deletions src/test/sigprof.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* -*- Mode: C; tab-width: 8; c-basic-offset: 2; indent-tabs-mode: nil; -*- */

#include "util.h"

static volatile int count;

static void handler(__attribute__((unused)) int sig) { ++count; }

int main(void) {
struct itimerval itv = {
{ 0, 1000 },
{ 0, 1000 },
};

test_assert(0 == signal(SIGPROF, handler));
test_assert(0 == signal(SIGALRM, handler));

setitimer(ITIMER_REAL, &itv, NULL);
setitimer(ITIMER_PROF, &itv, NULL);

while (count < 2000) {
}

atomic_puts("EXIT-SUCCESS");
return 0;
}

0 comments on commit 1475ac4

Please sign in to comment.