fixed bugs when open_limit return -1, we should use one default value for event_select.c and event_poll.c in fiber.

This commit is contained in:
zhengshuxin 2022-11-19 21:20:41 +08:00
parent 9cac39c265
commit fec4daee79
2 changed files with 5 additions and 5 deletions

View File

@ -259,9 +259,9 @@ EVENT *event_poll_create(int size)
// override size with system open limit setting
size = open_limit(0);
ep->size = size;
ep->pfds = (struct pollfd *) mem_calloc(size, sizeof(struct pollfd));
ep->files = (FILE_EVENT**) mem_calloc(size, sizeof(FILE_EVENT*));
ep->size = size > 0 ? size : 10240;
ep->pfds = (struct pollfd *) mem_calloc(ep->size, sizeof(struct pollfd));
ep->files = (FILE_EVENT**) mem_calloc(ep->size, sizeof(FILE_EVENT*));
ep->count = 0;
#ifdef DELAY_CALL

View File

@ -255,8 +255,8 @@ EVENT *event_select_create(int size)
size = open_limit(0);
es->maxfd = -1;
es->dirty = 0;
es->files = (FILE_EVENT**) mem_calloc(size, sizeof(FILE_EVENT*));
es->size = size;
es->size = size > 0 ? size : 10240;
es->files = (FILE_EVENT**) mem_calloc(es->size, sizeof(FILE_EVENT*));
#ifdef DELAY_CALL
es->r_ready = array_create(100);