@@ -99,7 +99,7 @@ static void sig_handler(int signum __maybe_unused,
}
}
-static int __xp_event(bool is_bp, void *addr, int setup_signal, int signal)
+static int __event(bool is_x, void *addr, int signal)
{
struct perf_event_attr pe;
int fd;
@@ -109,7 +109,7 @@ static int __xp_event(bool is_bp, void *addr, int setup_signal, int signal)
pe.size = sizeof(struct perf_event_attr);
pe.config = 0;
- pe.bp_type = is_bp ? HW_BREAKPOINT_X : HW_BREAKPOINT_W;
+ pe.bp_type = is_x ? HW_BREAKPOINT_X : HW_BREAKPOINT_W;
pe.bp_addr = (unsigned long) addr;
pe.bp_len = sizeof(long);
@@ -128,25 +128,23 @@ static int __xp_event(bool is_bp, void *addr, int setup_signal, int signal)
return TEST_FAIL;
}
- if (setup_signal) {
- fcntl(fd, F_SETFL, O_RDWR|O_NONBLOCK|O_ASYNC);
- fcntl(fd, F_SETSIG, signal);
- fcntl(fd, F_SETOWN, getpid());
- }
+ fcntl(fd, F_SETFL, O_RDWR|O_NONBLOCK|O_ASYNC);
+ fcntl(fd, F_SETSIG, signal);
+ fcntl(fd, F_SETOWN, getpid());
ioctl(fd, PERF_EVENT_IOC_RESET, 0);
return fd;
}
-static int bp_event(void *addr, int setup_signal)
+static int bp_event(void *addr, int signal)
{
- return __xp_event(true, addr, setup_signal, SIGIO);
+ return __event(true, addr, signal);
}
-static int wp_event(void *addr, int setup_signal)
+static int wp_event(void *addr, int signal)
{
- return __xp_event(false, addr, setup_signal, SIGIO);
+ return __event(false, addr, signal);
}
static long long bp_count(int fd)
@@ -229,9 +227,9 @@ int test__bp_signal(int subtest __maybe_unused)
*
*/
- fd1 = bp_event(__test_function, 1);
- fd2 = __xp_event(true, sig_handler, 1, SIGUSR1);
- fd3 = wp_event((void *)&the_var, 1);
+ fd1 = bp_event(__test_function, SIGIO);
+ fd2 = bp_event(sig_handler, SIGUSR1);
+ fd3 = wp_event((void *)&the_var, SIGIO);
ioctl(fd1, PERF_EVENT_IOC_ENABLE, 0);
ioctl(fd2, PERF_EVENT_IOC_ENABLE, 0);