MCPcopy Create free account
hub / github.com/F-Stack/f-stack / ff_sys_epoll_wait

Function ff_sys_epoll_wait

adapter/syscall/ff_socket_ops.c:298–336  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

296}
297
298static int
299ff_sys_epoll_wait(struct ff_epoll_wait_args *args)
300{
301 int ret;
302
303 DEBUG_LOG("to run ff_epoll_wait, epfd:%d, maxevents:%d, timeout:%d\n",
304 args->epfd, args->maxevents, args->timeout);
305 ret = ff_epoll_wait(args->epfd, args->events,
306 args->maxevents, args->timeout);
307
308#ifdef FF_PRELOAD_POLLING_MODE
309 /*
310 * If an event is generated or error occurs, user app epoll_wait return imme.
311 */
312 if (ret != 0) {
313 sem_flag = 1;
314 } else {
315 if (args->timeout < 0) {
316 /* -1 : Block user app until an event or error occurs. */
317 sem_flag = 0;
318 } else {
319 sem_flag = 1;
320 }
321 }
322#else
323 /*
324 * If timeout is 0, and no event triggered,
325 * no post sem, and next loop will continue to call ff_sys_epoll_wait,
326 * until some event triggered
327 */
328 if (args->timeout == 0 && ret == 0 && args->maxevents != 0) {
329 sem_flag = 0;
330 } else {
331 sem_flag = 1;
332 }
333#endif
334
335 return ret;
336}
337
338static int
339ff_sys_kqueue(struct ff_kqueue_args *args)

Callers 1

ff_so_handlerFunction · 0.85

Calls 1

ff_epoll_waitFunction · 0.85

Tested by

no test coverage detected