.. | .. |
---|
12 | 12 | |
---|
13 | 13 | for (fd = 0; fd < fda->nr; ++fd) { |
---|
14 | 14 | fda->entries[fd].fd = fda->nr - fd; |
---|
| 15 | + fda->entries[fd].events = revents; |
---|
15 | 16 | fda->entries[fd].revents = revents; |
---|
16 | 17 | } |
---|
17 | 18 | } |
---|
.. | .. |
---|
29 | 30 | |
---|
30 | 31 | int test__fdarray__filter(struct test *test __maybe_unused, int subtest __maybe_unused) |
---|
31 | 32 | { |
---|
32 | | - int nr_fds, expected_fd[2], fd, err = TEST_FAIL; |
---|
| 33 | + int nr_fds, err = TEST_FAIL; |
---|
33 | 34 | struct fdarray *fda = fdarray__new(5, 5); |
---|
34 | 35 | |
---|
35 | 36 | if (fda == NULL) { |
---|
.. | .. |
---|
55 | 56 | |
---|
56 | 57 | fdarray__init_revents(fda, POLLHUP); |
---|
57 | 58 | fda->entries[2].revents = POLLIN; |
---|
58 | | - expected_fd[0] = fda->entries[2].fd; |
---|
59 | 59 | |
---|
60 | 60 | pr_debug("\nfiltering all but fda->entries[2]:"); |
---|
61 | 61 | fdarray__fprintf_prefix(fda, "before", stderr); |
---|
.. | .. |
---|
66 | 66 | goto out_delete; |
---|
67 | 67 | } |
---|
68 | 68 | |
---|
69 | | - if (fda->entries[0].fd != expected_fd[0]) { |
---|
70 | | - pr_debug("\nfda->entries[0].fd=%d != %d\n", |
---|
71 | | - fda->entries[0].fd, expected_fd[0]); |
---|
72 | | - goto out_delete; |
---|
73 | | - } |
---|
74 | | - |
---|
75 | 69 | fdarray__init_revents(fda, POLLHUP); |
---|
76 | 70 | fda->entries[0].revents = POLLIN; |
---|
77 | | - expected_fd[0] = fda->entries[0].fd; |
---|
78 | 71 | fda->entries[3].revents = POLLIN; |
---|
79 | | - expected_fd[1] = fda->entries[3].fd; |
---|
80 | 72 | |
---|
81 | 73 | pr_debug("\nfiltering all but (fda->entries[0], fda->entries[3]):"); |
---|
82 | 74 | fdarray__fprintf_prefix(fda, "before", stderr); |
---|
.. | .. |
---|
86 | 78 | pr_debug("\nfdarray__filter()=%d != 2, should have left just two events", |
---|
87 | 79 | nr_fds); |
---|
88 | 80 | goto out_delete; |
---|
89 | | - } |
---|
90 | | - |
---|
91 | | - for (fd = 0; fd < 2; ++fd) { |
---|
92 | | - if (fda->entries[fd].fd != expected_fd[fd]) { |
---|
93 | | - pr_debug("\nfda->entries[%d].fd=%d != %d\n", fd, |
---|
94 | | - fda->entries[fd].fd, expected_fd[fd]); |
---|
95 | | - goto out_delete; |
---|
96 | | - } |
---|
97 | 81 | } |
---|
98 | 82 | |
---|
99 | 83 | pr_debug("\n"); |
---|
.. | .. |
---|
128 | 112 | } |
---|
129 | 113 | |
---|
130 | 114 | #define FDA_ADD(_idx, _fd, _revents, _nr) \ |
---|
131 | | - if (fdarray__add(fda, _fd, _revents) < 0) { \ |
---|
| 115 | + if (fdarray__add(fda, _fd, _revents, fdarray_flag__default) < 0) { \ |
---|
132 | 116 | pr_debug("\n%d: fdarray__add(fda, %d, %d) failed!", \ |
---|
133 | 117 | __LINE__,_fd, _revents); \ |
---|
134 | 118 | goto out_delete; \ |
---|