Skip to content

Commit

Permalink
issue: 946914 Fix epoll_create() - libvma incompatibility with OS
Browse files Browse the repository at this point in the history
OS does not support creating epoll fd's using epoll_create() with zero size.
libvma should handle a non-positive size like OS does:
return -1 and set the errno to EINVAL.

Signed-off-by: Liran Oz <[email protected]>
  • Loading branch information
Liran Oz authored and OphirMunk committed Jan 9, 2017
1 parent df2fff3 commit e25566b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/vma/sock/sock-redirect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,12 @@ int epoll_create(int __size)

do_global_ctors();

if (__size <= 0 ) {
vlog_printf(VLOG_DEBUG, "%s: invalid size (size=%d) - must be a positive integer\n", __func__, __size);
errno = EINVAL;
return -1;
}

int epfd = orig_os_api.epoll_create(__size + 1); // +1 for the cq epfd
vlog_printf(VLOG_DEBUG, "ENTER: %s(size=%d) = %d\n",__func__, __size, epfd);

Expand Down

0 comments on commit e25566b

Please sign in to comment.