X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvcl%2Fvcom.c;h=b215771e70cc2107022be0ca6c1aff9e99480bac;hb=e695cb4dbdb6f9424ac5a567799e67f791fad328;hp=be1e4c5b47addf7e729bd5b996b04d3279965d58;hpb=6c36f53ff0419d27f3e5720a42e0b43d5e7157f0;p=vpp.git diff --git a/src/vcl/vcom.c b/src/vcl/vcom.c index be1e4c5b47a..b215771e70c 100644 --- a/src/vcl/vcom.c +++ b/src/vcl/vcom.c @@ -2792,54 +2792,19 @@ epoll_ctl (int __epfd, int __op, int __fd, struct epoll_event *__event) int rv; pid_t pid = getpid (); - if (is_vcom_epfd (__epfd)) - { - /* TBD: currently limiting epoll to support only vcom fds */ - if (is_vcom_socket_fd (__fd)) - { - rv = vcom_epoll_ctl (__epfd, __op, __fd, __event); - if (VCOM_DEBUG > 0) - fprintf (stderr, - "[%d] epoll_ctl: " - "'%04d'='%04d', '%04d', '%04d'\n", - pid, rv, __epfd, __op, __fd); - if (rv != 0) - { - errno = -rv; - return -1; - } - return 0; - } - else - { - /* - * TBD: currently epoll does not support kernel fds - * or epoll fds */ - errno = EBADF; - return -1; - } - } - else + rv = vcom_epoll_ctl (__epfd, __op, __fd, __event); + if (VCOM_DEBUG > 0) + fprintf (stderr, + "[%d] epoll_ctl: " + "'%04d'='%04d', '%04d', '%04d'\n", pid, rv, __epfd, __op, __fd); + if (rv != 0) { - /* epfd is not an epoll file descriptor */ - errno = EINVAL; + errno = -rv; return -1; } return 0; } -int -vcom_epoll_wait (int __epfd, struct epoll_event *__events, - int __maxevents, int __timeout) -{ - if (vcom_init () != 0) - { - return -1; - } - - return vcom_epoll_pwait (__epfd, __events, __maxevents, __timeout, NULL); -} - int epoll_wait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout) @@ -2849,49 +2814,29 @@ epoll_wait (int __epfd, struct epoll_event *__events, if (__maxevents <= 0 || __maxevents > EP_MAX_EVENTS) { + fprintf (stderr, "[%d] ERROR: epoll_wait() invalid maxevents %d\n", + pid, __maxevents); errno = EINVAL; return -1; } - if (is_vcom_epfd (__epfd)) - { - rv = vcom_epoll_wait (__epfd, __events, __maxevents, __timeout); - if (VCOM_DEBUG > 0) - fprintf (stderr, - "[%d] epoll_wait: " - "'%04d'='%04d', '%p', " - "'%04d', '%04d'\n", - pid, rv, __epfd, __events, __maxevents, __timeout); - if (rv < 0) - { - errno = -rv; - return -1; - } - return rv; - } - else + rv = + vcom_socket_epoll_pwait (__epfd, __events, __maxevents, __timeout, NULL); + if (VCOM_DEBUG > 0) + fprintf (stderr, + "[%d] epoll_wait: " + "'%04d'='%04d', '%p', " + "'%04d', '%04d'\n", + pid, rv, __epfd, __events, __maxevents, __timeout); + if (rv < 0) { - errno = EINVAL; + errno = -rv; return -1; } - return 0; + return rv; } -int -vcom_epoll_pwait (int __epfd, struct epoll_event *__events, - int __maxevents, int __timeout, const __sigset_t * __ss) -{ - if (vcom_init () != 0) - { - return -1; - } - - /* implementation */ - return vcom_socket_epoll_pwait (__epfd, __events, - __maxevents, __timeout, __ss); -} - int epoll_pwait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout, const __sigset_t * __ss) @@ -2907,7 +2852,9 @@ epoll_pwait (int __epfd, struct epoll_event *__events, if (is_vcom_epfd (__epfd)) { - rv = vcom_epoll_pwait (__epfd, __events, __maxevents, __timeout, __ss); + rv = + vcom_socket_epoll_pwait (__epfd, __events, __maxevents, __timeout, + __ss); if (VCOM_DEBUG > 0) fprintf (stderr, "[%d] epoll_pwait: "