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()
65 return fd; in __event()
75 int fd; in test__wp_ro()
78 fd = __event(HW_BREAKPOINT_R, (void *)&data1, sizeof(data1)); in test__wp_ro()
79 if (fd < 0) in test__wp_ro()
83 WP_TEST_ASSERT_VAL(fd, "RO watchpoint", 1); in test__wp_ro()
86 WP_TEST_ASSERT_VAL(fd, "RO watchpoint", 1); in test__wp_ro()
88 close(fd); in test__wp_ro()
99 int fd; in test__wp_wo()
102 fd = __event(HW_BREAKPOINT_W, (void *)&data1, sizeof(data1)); in test__wp_wo()
103 if (fd < 0) in test__wp_wo()
107 WP_TEST_ASSERT_VAL(fd, "WO watchpoint", 0); in test__wp_wo()
110 WP_TEST_ASSERT_VAL(fd, "WO watchpoint", 1); in test__wp_wo()
112 close(fd); in test__wp_wo()
123 int fd; in test__wp_rw()
126 fd = __event(HW_BREAKPOINT_R | HW_BREAKPOINT_W, (void *)&data1, in test__wp_rw()
128 if (fd < 0) in test__wp_rw()
132 WP_TEST_ASSERT_VAL(fd, "RW watchpoint", 1); in test__wp_rw()
135 WP_TEST_ASSERT_VAL(fd, "RW watchpoint", 2); in test__wp_rw()
137 close(fd); in test__wp_rw()
147 int fd, ret; in test__wp_modify()
151 fd = __event(HW_BREAKPOINT_W, (void *)&data1, sizeof(data1)); in test__wp_modify()
152 if (fd < 0) in test__wp_modify()
156 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 1); in test__wp_modify()
162 ret = ioctl(fd, PERF_EVENT_IOC_MODIFY_ATTRIBUTES, &new_attr); in test__wp_modify()
170 close(fd); in test__wp_modify()
175 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 1); in test__wp_modify()
178 ioctl(fd, PERF_EVENT_IOC_ENABLE, 0); in test__wp_modify()
181 close(fd); in test__wp_modify()
186 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2); in test__wp_modify()
189 WP_TEST_ASSERT_VAL(fd, "Modify watchpoint", 2); in test__wp_modify()
191 close(fd); in test__wp_modify()