Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/async/async_wait.c |
Switch to Source code | Preprocessed file |
Line | Source | Count | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | - | |||||||||||||||||||||||||
2 | - | |||||||||||||||||||||||||
3 | ASYNC_WAIT_CTX *ASYNC_WAIT_CTX_new(void) | - | ||||||||||||||||||||||||
4 | { | - | ||||||||||||||||||||||||
5 | return executed 5 times by 1 test: CRYPTO_zalloc(sizeof(ASYNC_WAIT_CTX), __FILE__, 17);return CRYPTO_zalloc(sizeof(ASYNC_WAIT_CTX), __FILE__, 17); Executed by:
executed 5 times by 1 test: return CRYPTO_zalloc(sizeof(ASYNC_WAIT_CTX), __FILE__, 17); Executed by:
| 5 | ||||||||||||||||||||||||
6 | } | - | ||||||||||||||||||||||||
7 | - | |||||||||||||||||||||||||
8 | void ASYNC_WAIT_CTX_free(ASYNC_WAIT_CTX *ctx) | - | ||||||||||||||||||||||||
9 | { | - | ||||||||||||||||||||||||
10 | struct fd_lookup_st *curr; | - | ||||||||||||||||||||||||
11 | struct fd_lookup_st *next; | - | ||||||||||||||||||||||||
12 | - | |||||||||||||||||||||||||
13 | if (ctx ==
| 5-8254 | ||||||||||||||||||||||||
14 | ((void *)0)
| 5-8254 | ||||||||||||||||||||||||
15 | ) | - | ||||||||||||||||||||||||
16 | return; executed 8254 times by 1 test: return; Executed by:
| 8254 | ||||||||||||||||||||||||
17 | - | |||||||||||||||||||||||||
18 | curr = ctx->fds; | - | ||||||||||||||||||||||||
19 | while (curr !=
| 0-5 | ||||||||||||||||||||||||
20 | ((void *)0)
| 0-5 | ||||||||||||||||||||||||
21 | ) { | - | ||||||||||||||||||||||||
22 | if (!curr->del
| 0 | ||||||||||||||||||||||||
23 | - | |||||||||||||||||||||||||
24 | if (curr->cleanup !=
| 0 | ||||||||||||||||||||||||
25 | ((void *)0)
| 0 | ||||||||||||||||||||||||
26 | ) | - | ||||||||||||||||||||||||
27 | curr->cleanup(ctx, curr->key, curr->fd, curr->custom_data); never executed: curr->cleanup(ctx, curr->key, curr->fd, curr->custom_data); | 0 | ||||||||||||||||||||||||
28 | } never executed: end of block | 0 | ||||||||||||||||||||||||
29 | - | |||||||||||||||||||||||||
30 | next = curr->next; | - | ||||||||||||||||||||||||
31 | CRYPTO_free(curr, __FILE__, 37); | - | ||||||||||||||||||||||||
32 | curr = next; | - | ||||||||||||||||||||||||
33 | } never executed: end of block | 0 | ||||||||||||||||||||||||
34 | - | |||||||||||||||||||||||||
35 | CRYPTO_free(ctx, __FILE__, 41); | - | ||||||||||||||||||||||||
36 | } executed 5 times by 1 test: end of block Executed by:
| 5 | ||||||||||||||||||||||||
37 | int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key, | - | ||||||||||||||||||||||||
38 | int fd, void *custom_data, | - | ||||||||||||||||||||||||
39 | void (*cleanup)(ASYNC_WAIT_CTX *, const void *, | - | ||||||||||||||||||||||||
40 | int, void *)) | - | ||||||||||||||||||||||||
41 | { | - | ||||||||||||||||||||||||
42 | struct fd_lookup_st *fdlookup; | - | ||||||||||||||||||||||||
43 | - | |||||||||||||||||||||||||
44 | if ((
| 0-2 | ||||||||||||||||||||||||
45 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
46 | ) { | - | ||||||||||||||||||||||||
47 | ERR_put_error(51,(106),((1|64)),__FILE__,51); | - | ||||||||||||||||||||||||
48 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
49 | } | - | ||||||||||||||||||||||||
50 | - | |||||||||||||||||||||||||
51 | fdlookup->key = key; | - | ||||||||||||||||||||||||
52 | fdlookup->fd = fd; | - | ||||||||||||||||||||||||
53 | fdlookup->custom_data = custom_data; | - | ||||||||||||||||||||||||
54 | fdlookup->cleanup = cleanup; | - | ||||||||||||||||||||||||
55 | fdlookup->add = 1; | - | ||||||||||||||||||||||||
56 | fdlookup->next = ctx->fds; | - | ||||||||||||||||||||||||
57 | ctx->fds = fdlookup; | - | ||||||||||||||||||||||||
58 | ctx->numadd++; | - | ||||||||||||||||||||||||
59 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||||||||
60 | } | - | ||||||||||||||||||||||||
61 | - | |||||||||||||||||||||||||
62 | int ASYNC_WAIT_CTX_get_fd(ASYNC_WAIT_CTX *ctx, const void *key, | - | ||||||||||||||||||||||||
63 | int *fd, void **custom_data) | - | ||||||||||||||||||||||||
64 | { | - | ||||||||||||||||||||||||
65 | struct fd_lookup_st *curr; | - | ||||||||||||||||||||||||
66 | - | |||||||||||||||||||||||||
67 | curr = ctx->fds; | - | ||||||||||||||||||||||||
68 | while (curr !=
| 0 | ||||||||||||||||||||||||
69 | ((void *)0)
| 0 | ||||||||||||||||||||||||
70 | ) { | - | ||||||||||||||||||||||||
71 | if (curr->del
| 0 | ||||||||||||||||||||||||
72 | - | |||||||||||||||||||||||||
73 | curr = curr->next; | - | ||||||||||||||||||||||||
74 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
75 | } | - | ||||||||||||||||||||||||
76 | if (curr->key == key
| 0 | ||||||||||||||||||||||||
77 | *fd = curr->fd; | - | ||||||||||||||||||||||||
78 | *custom_data = curr->custom_data; | - | ||||||||||||||||||||||||
79 | return never executed: 1;return 1; never executed: return 1; | 0 | ||||||||||||||||||||||||
80 | } | - | ||||||||||||||||||||||||
81 | curr = curr->next; | - | ||||||||||||||||||||||||
82 | } never executed: end of block | 0 | ||||||||||||||||||||||||
83 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
84 | } | - | ||||||||||||||||||||||||
85 | - | |||||||||||||||||||||||||
86 | int ASYNC_WAIT_CTX_get_all_fds(ASYNC_WAIT_CTX *ctx, int *fd, | - | ||||||||||||||||||||||||
87 | size_t *numfds) | - | ||||||||||||||||||||||||
88 | { | - | ||||||||||||||||||||||||
89 | struct fd_lookup_st *curr; | - | ||||||||||||||||||||||||
90 | - | |||||||||||||||||||||||||
91 | curr = ctx->fds; | - | ||||||||||||||||||||||||
92 | *numfds = 0; | - | ||||||||||||||||||||||||
93 | while (curr !=
| 3-5 | ||||||||||||||||||||||||
94 | ((void *)0)
| 3-5 | ||||||||||||||||||||||||
95 | ) { | - | ||||||||||||||||||||||||
96 | if (curr->del
| 1-2 | ||||||||||||||||||||||||
97 | - | |||||||||||||||||||||||||
98 | curr = curr->next; | - | ||||||||||||||||||||||||
99 | continue; executed 1 time by 1 test: continue; Executed by:
| 1 | ||||||||||||||||||||||||
100 | } | - | ||||||||||||||||||||||||
101 | if (fd !=
| 1 | ||||||||||||||||||||||||
102 | ((void *)0)
| 1 | ||||||||||||||||||||||||
103 | ) { | - | ||||||||||||||||||||||||
104 | *fd = curr->fd; | - | ||||||||||||||||||||||||
105 | fd++; | - | ||||||||||||||||||||||||
106 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
107 | (*numfds)++; | - | ||||||||||||||||||||||||
108 | curr = curr->next; | - | ||||||||||||||||||||||||
109 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
110 | return executed 5 times by 1 test: 1;return 1; Executed by:
executed 5 times by 1 test: return 1; Executed by:
| 5 | ||||||||||||||||||||||||
111 | } | - | ||||||||||||||||||||||||
112 | - | |||||||||||||||||||||||||
113 | int ASYNC_WAIT_CTX_get_changed_fds(ASYNC_WAIT_CTX *ctx, int *addfd, | - | ||||||||||||||||||||||||
114 | size_t *numaddfds, int *delfd, | - | ||||||||||||||||||||||||
115 | size_t *numdelfds) | - | ||||||||||||||||||||||||
116 | { | - | ||||||||||||||||||||||||
117 | struct fd_lookup_st *curr; | - | ||||||||||||||||||||||||
118 | - | |||||||||||||||||||||||||
119 | *numaddfds = ctx->numadd; | - | ||||||||||||||||||||||||
120 | *numdelfds = ctx->numdel; | - | ||||||||||||||||||||||||
121 | if (addfd ==
| 1-5 | ||||||||||||||||||||||||
122 | ((void *)0)
| 1-5 | ||||||||||||||||||||||||
123 | && delfd ==
| 1-4 | ||||||||||||||||||||||||
124 | ((void *)0)
| 1-4 | ||||||||||||||||||||||||
125 | ) | - | ||||||||||||||||||||||||
126 | return executed 4 times by 1 test: 1;return 1; Executed by:
executed 4 times by 1 test: return 1; Executed by:
| 4 | ||||||||||||||||||||||||
127 | - | |||||||||||||||||||||||||
128 | curr = ctx->fds; | - | ||||||||||||||||||||||||
129 | - | |||||||||||||||||||||||||
130 | while (curr !=
| 2 | ||||||||||||||||||||||||
131 | ((void *)0)
| 2 | ||||||||||||||||||||||||
132 | ) { | - | ||||||||||||||||||||||||
133 | - | |||||||||||||||||||||||||
134 | if (curr->del
| 0-1 | ||||||||||||||||||||||||
135 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||
136 | )
| 0-1 | ||||||||||||||||||||||||
137 | *delfd = curr->fd; | - | ||||||||||||||||||||||||
138 | delfd++; | - | ||||||||||||||||||||||||
139 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
140 | if (curr->add
| 0-1 | ||||||||||||||||||||||||
141 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||
142 | )
| 0-1 | ||||||||||||||||||||||||
143 | *addfd = curr->fd; | - | ||||||||||||||||||||||||
144 | addfd++; | - | ||||||||||||||||||||||||
145 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
146 | curr = curr->next; | - | ||||||||||||||||||||||||
147 | } executed 2 times by 1 test: end of block Executed by:
| 2 | ||||||||||||||||||||||||
148 | - | |||||||||||||||||||||||||
149 | return executed 2 times by 1 test: 1;return 1; Executed by:
executed 2 times by 1 test: return 1; Executed by:
| 2 | ||||||||||||||||||||||||
150 | } | - | ||||||||||||||||||||||||
151 | - | |||||||||||||||||||||||||
152 | int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key) | - | ||||||||||||||||||||||||
153 | { | - | ||||||||||||||||||||||||
154 | struct fd_lookup_st *curr, *prev; | - | ||||||||||||||||||||||||
155 | - | |||||||||||||||||||||||||
156 | curr = ctx->fds; | - | ||||||||||||||||||||||||
157 | prev = | - | ||||||||||||||||||||||||
158 | ((void *)0) | - | ||||||||||||||||||||||||
159 | ; | - | ||||||||||||||||||||||||
160 | while (curr !=
| 0-2 | ||||||||||||||||||||||||
161 | ((void *)0)
| 0-2 | ||||||||||||||||||||||||
162 | ) { | - | ||||||||||||||||||||||||
163 | if (curr->del == 1
| 0-2 | ||||||||||||||||||||||||
164 | - | |||||||||||||||||||||||||
165 | prev = curr; | - | ||||||||||||||||||||||||
166 | curr = curr->next; | - | ||||||||||||||||||||||||
167 | continue; never executed: continue; | 0 | ||||||||||||||||||||||||
168 | } | - | ||||||||||||||||||||||||
169 | if (curr->key == key
| 0-2 | ||||||||||||||||||||||||
170 | - | |||||||||||||||||||||||||
171 | if (curr->add == 1
| 1 | ||||||||||||||||||||||||
172 | if (ctx->fds == curr
| 0-1 | ||||||||||||||||||||||||
173 | ctx->fds = curr->next; | - | ||||||||||||||||||||||||
174 | } executed 1 time by 1 test: else {end of block Executed by:
| 1 | ||||||||||||||||||||||||
175 | prev->next = curr->next; | - | ||||||||||||||||||||||||
176 | } never executed: end of block | 0 | ||||||||||||||||||||||||
177 | - | |||||||||||||||||||||||||
178 | - | |||||||||||||||||||||||||
179 | - | |||||||||||||||||||||||||
180 | - | |||||||||||||||||||||||||
181 | CRYPTO_free(curr, __FILE__, 165); | - | ||||||||||||||||||||||||
182 | ctx->numadd--; | - | ||||||||||||||||||||||||
183 | return executed 1 time by 1 test: 1;return 1; Executed by:
executed 1 time by 1 test: return 1; Executed by:
| 1 | ||||||||||||||||||||||||
184 | } | - | ||||||||||||||||||||||||
185 | - | |||||||||||||||||||||||||
186 | - | |||||||||||||||||||||||||
187 | - | |||||||||||||||||||||||||
188 | - | |||||||||||||||||||||||||
189 | - | |||||||||||||||||||||||||
190 | - | |||||||||||||||||||||||||
191 | curr->del = 1; | - | ||||||||||||||||||||||||
192 | ctx->numdel++; | - | ||||||||||||||||||||||||
193 | return executed 1 time by 1 test: 1;return 1; Executed by:
executed 1 time by 1 test: return 1; Executed by:
| 1 | ||||||||||||||||||||||||
194 | } | - | ||||||||||||||||||||||||
195 | prev = curr; | - | ||||||||||||||||||||||||
196 | curr = curr->next; | - | ||||||||||||||||||||||||
197 | } never executed: end of block | 0 | ||||||||||||||||||||||||
198 | return never executed: 0;return 0; never executed: return 0; | 0 | ||||||||||||||||||||||||
199 | } | - | ||||||||||||||||||||||||
200 | - | |||||||||||||||||||||||||
201 | void async_wait_ctx_reset_counts(ASYNC_WAIT_CTX *ctx) | - | ||||||||||||||||||||||||
202 | { | - | ||||||||||||||||||||||||
203 | struct fd_lookup_st *curr, *prev = | - | ||||||||||||||||||||||||
204 | ((void *)0) | - | ||||||||||||||||||||||||
205 | ; | - | ||||||||||||||||||||||||
206 | - | |||||||||||||||||||||||||
207 | ctx->numadd = 0; | - | ||||||||||||||||||||||||
208 | ctx->numdel = 0; | - | ||||||||||||||||||||||||
209 | - | |||||||||||||||||||||||||
210 | curr = ctx->fds; | - | ||||||||||||||||||||||||
211 | - | |||||||||||||||||||||||||
212 | while (curr !=
| 2-9 | ||||||||||||||||||||||||
213 | ((void *)0)
| 2-9 | ||||||||||||||||||||||||
214 | ) { | - | ||||||||||||||||||||||||
215 | if (curr->del
| 1 | ||||||||||||||||||||||||
216 | if (prev ==
| 0-1 | ||||||||||||||||||||||||
217 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||
218 | ) | - | ||||||||||||||||||||||||
219 | ctx->fds = curr->next; executed 1 time by 1 test: ctx->fds = curr->next; Executed by:
| 1 | ||||||||||||||||||||||||
220 | else | - | ||||||||||||||||||||||||
221 | prev->next = curr->next; never executed: prev->next = curr->next; | 0 | ||||||||||||||||||||||||
222 | CRYPTO_free(curr, __FILE__, 200); | - | ||||||||||||||||||||||||
223 | if (prev ==
| 0-1 | ||||||||||||||||||||||||
224 | ((void *)0)
| 0-1 | ||||||||||||||||||||||||
225 | ) | - | ||||||||||||||||||||||||
226 | curr = ctx->fds; executed 1 time by 1 test: curr = ctx->fds; Executed by:
| 1 | ||||||||||||||||||||||||
227 | else | - | ||||||||||||||||||||||||
228 | curr = prev->next; never executed: curr = prev->next; | 0 | ||||||||||||||||||||||||
229 | continue; executed 1 time by 1 test: continue; Executed by:
| 1 | ||||||||||||||||||||||||
230 | } | - | ||||||||||||||||||||||||
231 | if (curr->add
| 0-1 | ||||||||||||||||||||||||
232 | curr->add = 0; | - | ||||||||||||||||||||||||
233 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
234 | prev = curr; | - | ||||||||||||||||||||||||
235 | curr = curr->next; | - | ||||||||||||||||||||||||
236 | } executed 1 time by 1 test: end of block Executed by:
| 1 | ||||||||||||||||||||||||
237 | } executed 9 times by 1 test: end of block Executed by:
| 9 | ||||||||||||||||||||||||
Switch to Source code | Preprocessed file |