• Home
  • Raw
  • Download

Lines Matching refs:sop

97 static int select_resize(struct selectop *sop, int fdsz);
98 static void select_free_selectop(struct selectop *sop);
103 struct selectop *sop; in select_init() local
105 if (!(sop = mm_calloc(1, sizeof(struct selectop)))) in select_init()
108 if (select_resize(sop, SELECT_ALLOC_SIZE(32 + 1))) { in select_init()
109 select_free_selectop(sop); in select_init()
115 return (sop); in select_init()
120 check_selectop(struct selectop *sop) in check_selectop() argument
125 #define check_selectop(sop) do { (void) sop; } while (0) argument
132 struct selectop *sop = base->evbase; in select_dispatch() local
134 check_selectop(sop); in select_dispatch()
135 if (sop->resize_out_sets) { in select_dispatch()
137 size_t sz = sop->event_fdsz; in select_dispatch()
138 if (!(readset_out = mm_realloc(sop->event_readset_out, sz))) in select_dispatch()
140 sop->event_readset_out = readset_out; in select_dispatch()
141 if (!(writeset_out = mm_realloc(sop->event_writeset_out, sz))) { in select_dispatch()
148 sop->event_writeset_out = writeset_out; in select_dispatch()
149 sop->resize_out_sets = 0; in select_dispatch()
152 memcpy(sop->event_readset_out, sop->event_readset_in, in select_dispatch()
153 sop->event_fdsz); in select_dispatch()
154 memcpy(sop->event_writeset_out, sop->event_writeset_in, in select_dispatch()
155 sop->event_fdsz); in select_dispatch()
157 nfds = sop->event_fds+1; in select_dispatch()
161 res = select(nfds, sop->event_readset_out, in select_dispatch()
162 sop->event_writeset_out, NULL, tv); in select_dispatch()
166 check_selectop(sop); in select_dispatch()
179 check_selectop(sop); in select_dispatch()
185 if (FD_ISSET(i, sop->event_readset_out)) in select_dispatch()
187 if (FD_ISSET(i, sop->event_writeset_out)) in select_dispatch()
195 check_selectop(sop); in select_dispatch()
201 select_resize(struct selectop *sop, int fdsz) in select_resize() argument
206 if (sop->event_readset_in) in select_resize()
207 check_selectop(sop); in select_resize()
209 if ((readset_in = mm_realloc(sop->event_readset_in, fdsz)) == NULL) in select_resize()
211 sop->event_readset_in = readset_in; in select_resize()
212 if ((writeset_in = mm_realloc(sop->event_writeset_in, fdsz)) == NULL) { in select_resize()
221 sop->event_writeset_in = writeset_in; in select_resize()
222 sop->resize_out_sets = 1; in select_resize()
224 memset((char *)sop->event_readset_in + sop->event_fdsz, 0, in select_resize()
225 fdsz - sop->event_fdsz); in select_resize()
226 memset((char *)sop->event_writeset_in + sop->event_fdsz, 0, in select_resize()
227 fdsz - sop->event_fdsz); in select_resize()
229 sop->event_fdsz = fdsz; in select_resize()
230 check_selectop(sop); in select_resize()
243 struct selectop *sop = base->evbase; in select_add() local
247 check_selectop(sop); in select_add()
252 if (sop->event_fds < fd) { in select_add()
253 int fdsz = sop->event_fdsz; in select_add()
264 if (fdsz != sop->event_fdsz) { in select_add()
265 if (select_resize(sop, fdsz)) { in select_add()
266 check_selectop(sop); in select_add()
271 sop->event_fds = fd; in select_add()
275 FD_SET(fd, sop->event_readset_in); in select_add()
277 FD_SET(fd, sop->event_writeset_in); in select_add()
278 check_selectop(sop); in select_add()
290 struct selectop *sop = base->evbase; in select_del() local
294 check_selectop(sop); in select_del()
296 if (sop->event_fds < fd) { in select_del()
297 check_selectop(sop); in select_del()
302 FD_CLR(fd, sop->event_readset_in); in select_del()
305 FD_CLR(fd, sop->event_writeset_in); in select_del()
307 check_selectop(sop); in select_del()
312 select_free_selectop(struct selectop *sop) in select_free_selectop() argument
314 if (sop->event_readset_in) in select_free_selectop()
315 mm_free(sop->event_readset_in); in select_free_selectop()
316 if (sop->event_writeset_in) in select_free_selectop()
317 mm_free(sop->event_writeset_in); in select_free_selectop()
318 if (sop->event_readset_out) in select_free_selectop()
319 mm_free(sop->event_readset_out); in select_free_selectop()
320 if (sop->event_writeset_out) in select_free_selectop()
321 mm_free(sop->event_writeset_out); in select_free_selectop()
323 memset(sop, 0, sizeof(struct selectop)); in select_free_selectop()
324 mm_free(sop); in select_free_selectop()