Lines Matching full:fd
16 #define WP_TEST_ASSERT_VAL(fd, text, val) \ argument
19 wp_read(fd, &count, sizeof(long long)); \
32 static int wp_read(int fd, long long *count, int size) in wp_read() argument
34 int ret = read(fd, count, size); in wp_read()
61 int fd; in __event() local
65 fd = sys_perf_event_open(&attr, 0, -1, -1, in __event()
67 if (fd < 0) { in __event()
68 fd = -errno; in __event()
72 return fd; in __event()
82 int fd; in test__wp_ro()
85 fd = __event(HW_BREAKPOINT_R, (void *)&data1, sizeof(data1)); in test__wp_ro()
86 if (fd < 0) in test__wp_ro()
87 return fd == -ENODEV ? TEST_SKIP : -1; in test__wp_ro()
90 WP_TEST_ASSERT_VAL(fd, "RO watchpoint", 1); in test__wp_ro()
93 WP_TEST_ASSERT_VAL(fd, "RO watchpoint", 1); in test__wp_ro()
95 close(fd); in test__wp_ro()
106 int fd; in test__wp_wo()
109 fd = __event(HW_BREAKPOINT_W, (void *)&data1, sizeof(data1)); in test__wp_wo()
110 if (fd < 0) in test__wp_wo()
111 return fd == -ENODEV ? TEST_SKIP : -1; in test__wp_wo()
114 WP_TEST_ASSERT_VAL(fd, "WO watchpoint", 0); in test__wp_wo()
117 WP_TEST_ASSERT_VAL(fd, "WO watchpoint", 1); in test__wp_wo()
119 close(fd); in test__wp_wo()
130 int fd; in test__wp_rw()
133 fd = __event(HW_BREAKPOINT_R | HW_BREAKPOINT_W, (void *)&data1, in test__wp_rw()
135 if (fd < 0) in test__wp_rw()
136 return fd == -ENODEV ? TEST_SKIP : -1; in test__wp_rw()
139 WP_TEST_ASSERT_VAL(fd, "RW watchpoint", 1); in test__wp_rw()
142 WP_TEST_ASSERT_VAL(fd, "RW watchpoint", 2); in test__wp_rw()
144 close(fd); in test__wp_rw()
154 int fd, ret; in test__wp_modify()
158 fd = __event(HW_BREAKPOINT_W, (void *)&data1, sizeof(data1)); in test__wp_modify()
159 if (fd < 0) in test__wp_modify()
160 return fd == -ENODEV ? TEST_SKIP : -1; in test__wp_modify()
163 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 1); in test__wp_modify()
169 ret = ioctl(fd, PERF_EVENT_IOC_MODIFY_ATTRIBUTES, &new_attr); in test__wp_modify()
177 close(fd); in test__wp_modify()
182 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 1); in test__wp_modify()
185 ioctl(fd, PERF_EVENT_IOC_ENABLE, 0); in test__wp_modify()
188 close(fd); in test__wp_modify()
193 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2); in test__wp_modify()
196 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2); in test__wp_modify()
198 close(fd); in test__wp_modify()