Lines Matching refs:fd
16 #define WP_TEST_ASSERT_VAL(fd, text, val) \ argument
19 wp_read(fd, &count, sizeof(long long)); \
27 static int wp_read(int fd, long long *count, int size) in wp_read() argument
29 int ret = read(fd, count, size); in wp_read()
56 int fd; in __event() local
60 fd = sys_perf_event_open(&attr, 0, -1, -1, in __event()
62 if (fd < 0) { in __event()
63 fd = -errno; in __event()
67 return fd; in __event()
77 int fd; in test__wp_ro()
80 fd = __event(HW_BREAKPOINT_R, (void *)&data1, sizeof(data1)); in test__wp_ro()
81 if (fd < 0) in test__wp_ro()
82 return fd == -ENODEV ? TEST_SKIP : -1; in test__wp_ro()
85 WP_TEST_ASSERT_VAL(fd, "RO watchpoint", 1); in test__wp_ro()
88 WP_TEST_ASSERT_VAL(fd, "RO watchpoint", 1); in test__wp_ro()
90 close(fd); in test__wp_ro()
101 int fd; in test__wp_wo()
104 fd = __event(HW_BREAKPOINT_W, (void *)&data1, sizeof(data1)); in test__wp_wo()
105 if (fd < 0) in test__wp_wo()
106 return fd == -ENODEV ? TEST_SKIP : -1; in test__wp_wo()
109 WP_TEST_ASSERT_VAL(fd, "WO watchpoint", 0); in test__wp_wo()
112 WP_TEST_ASSERT_VAL(fd, "WO watchpoint", 1); in test__wp_wo()
114 close(fd); in test__wp_wo()
125 int fd; in test__wp_rw()
128 fd = __event(HW_BREAKPOINT_R | HW_BREAKPOINT_W, (void *)&data1, in test__wp_rw()
130 if (fd < 0) in test__wp_rw()
131 return fd == -ENODEV ? TEST_SKIP : -1; in test__wp_rw()
134 WP_TEST_ASSERT_VAL(fd, "RW watchpoint", 1); in test__wp_rw()
137 WP_TEST_ASSERT_VAL(fd, "RW watchpoint", 2); in test__wp_rw()
139 close(fd); in test__wp_rw()
149 int fd, ret; in test__wp_modify()
153 fd = __event(HW_BREAKPOINT_W, (void *)&data1, sizeof(data1)); in test__wp_modify()
154 if (fd < 0) in test__wp_modify()
155 return fd == -ENODEV ? TEST_SKIP : -1; in test__wp_modify()
158 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 1); in test__wp_modify()
164 ret = ioctl(fd, PERF_EVENT_IOC_MODIFY_ATTRIBUTES, &new_attr); in test__wp_modify()
172 close(fd); in test__wp_modify()
177 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 1); in test__wp_modify()
180 ioctl(fd, PERF_EVENT_IOC_ENABLE, 0); in test__wp_modify()
183 close(fd); in test__wp_modify()
188 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2); in test__wp_modify()
191 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2); in test__wp_modify()
193 close(fd); in test__wp_modify()