Lines Matching refs:fda

7 static void fdarray__init_revents(struct fdarray *fda, short revents)  in fdarray__init_revents()  argument
11 fda->nr = fda->nr_alloc; in fdarray__init_revents()
13 for (fd = 0; fd < fda->nr; ++fd) { in fdarray__init_revents()
14 fda->entries[fd].fd = fda->nr - fd; in fdarray__init_revents()
15 fda->entries[fd].events = revents; in fdarray__init_revents()
16 fda->entries[fd].revents = revents; in fdarray__init_revents()
20 static int fdarray__fprintf_prefix(struct fdarray *fda, const char *prefix, FILE *fp) in fdarray__fprintf_prefix() argument
28 return printed + fdarray__fprintf(fda, fp); in fdarray__fprintf_prefix()
34 struct fdarray *fda = fdarray__new(5, 5); in test__fdarray__filter() local
36 if (fda == NULL) { in test__fdarray__filter()
41 fdarray__init_revents(fda, POLLIN); in test__fdarray__filter()
42 nr_fds = fdarray__filter(fda, POLLHUP, NULL, NULL); in test__fdarray__filter()
43 if (nr_fds != fda->nr_alloc) { in test__fdarray__filter()
45 nr_fds, fda->nr_alloc); in test__fdarray__filter()
49 fdarray__init_revents(fda, POLLHUP); in test__fdarray__filter()
50 nr_fds = fdarray__filter(fda, POLLHUP, NULL, NULL); in test__fdarray__filter()
53 nr_fds, fda->nr_alloc); in test__fdarray__filter()
57 fdarray__init_revents(fda, POLLHUP); in test__fdarray__filter()
58 fda->entries[2].revents = POLLIN; in test__fdarray__filter()
61 fdarray__fprintf_prefix(fda, "before", stderr); in test__fdarray__filter()
62 nr_fds = fdarray__filter(fda, POLLHUP, NULL, NULL); in test__fdarray__filter()
63 fdarray__fprintf_prefix(fda, " after", stderr); in test__fdarray__filter()
69 fdarray__init_revents(fda, POLLHUP); in test__fdarray__filter()
70 fda->entries[0].revents = POLLIN; in test__fdarray__filter()
71 fda->entries[3].revents = POLLIN; in test__fdarray__filter()
74 fdarray__fprintf_prefix(fda, "before", stderr); in test__fdarray__filter()
75 nr_fds = fdarray__filter(fda, POLLHUP, NULL, NULL); in test__fdarray__filter()
76 fdarray__fprintf_prefix(fda, " after", stderr); in test__fdarray__filter()
87 fdarray__delete(fda); in test__fdarray__filter()
95 struct fdarray *fda = fdarray__new(2, 2); in test__fdarray__add() local
97 if (fda == NULL) { in test__fdarray__add()
103 if (fda->entries[_idx].fd != _fd) { \ in test__fdarray__add()
105 __LINE__, _idx, fda->entries[1].fd, _fd); \ in test__fdarray__add()
108 if (fda->entries[_idx].events != (_revents)) { \ in test__fdarray__add()
110 __LINE__, _idx, fda->entries[_idx].fd, _revents); \ in test__fdarray__add()
115 if (fdarray__add(fda, _fd, _revents, fdarray_flag__default) < 0) { \ in test__fdarray__add()
120 if (fda->nr != _nr) { \ in test__fdarray__add()
122 __LINE__,_fd, _revents, fda->nr, _nr); \ in test__fdarray__add()
130 fdarray__fprintf_prefix(fda, "before growing array", stderr); in test__fdarray__add()
134 if (fda->entries == NULL) { in test__fdarray__add()
139 fdarray__fprintf_prefix(fda, "after 3rd add", stderr); in test__fdarray__add()
143 fdarray__fprintf_prefix(fda, "after 4th add", stderr); in test__fdarray__add()
157 fdarray__delete(fda); in test__fdarray__add()