Lines Matching refs:fd
14 #define WP_TEST_ASSERT_VAL(fd, text, val) \ argument
17 wp_read(fd, &count, sizeof(long long)); \
25 static int wp_read(int fd, long long *count, int size) in wp_read() argument
27 int ret = read(fd, count, size); in wp_read()
54 int fd; in __event() local
58 fd = sys_perf_event_open(&attr, 0, -1, -1, in __event()
60 if (fd < 0) in __event()
63 return fd; in __event()
73 int fd; in test__wp_ro()
76 fd = __event(HW_BREAKPOINT_R, (void *)&data1, sizeof(data1)); in test__wp_ro()
77 if (fd < 0) in test__wp_ro()
81 WP_TEST_ASSERT_VAL(fd, "RO watchpoint", 1); in test__wp_ro()
84 WP_TEST_ASSERT_VAL(fd, "RO watchpoint", 1); in test__wp_ro()
86 close(fd); in test__wp_ro()
97 int fd; in test__wp_wo()
100 fd = __event(HW_BREAKPOINT_W, (void *)&data1, sizeof(data1)); in test__wp_wo()
101 if (fd < 0) in test__wp_wo()
105 WP_TEST_ASSERT_VAL(fd, "WO watchpoint", 0); in test__wp_wo()
108 WP_TEST_ASSERT_VAL(fd, "WO watchpoint", 1); in test__wp_wo()
110 close(fd); in test__wp_wo()
121 int fd; in test__wp_rw()
124 fd = __event(HW_BREAKPOINT_R | HW_BREAKPOINT_W, (void *)&data1, in test__wp_rw()
126 if (fd < 0) in test__wp_rw()
130 WP_TEST_ASSERT_VAL(fd, "RW watchpoint", 1); in test__wp_rw()
133 WP_TEST_ASSERT_VAL(fd, "RW watchpoint", 2); in test__wp_rw()
135 close(fd); in test__wp_rw()
146 int fd, ret; in test__wp_modify()
150 fd = __event(HW_BREAKPOINT_W, (void *)&data1, sizeof(data1)); in test__wp_modify()
151 if (fd < 0) in test__wp_modify()
155 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 1); in test__wp_modify()
161 ret = ioctl(fd, PERF_EVENT_IOC_MODIFY_ATTRIBUTES, &new_attr); in test__wp_modify()
164 close(fd); in test__wp_modify()
169 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 1); in test__wp_modify()
172 ioctl(fd, PERF_EVENT_IOC_ENABLE, 0); in test__wp_modify()
175 close(fd); in test__wp_modify()
180 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2); in test__wp_modify()
183 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2); in test__wp_modify()
185 close(fd); in test__wp_modify()