From 2057491539259158e980c03a4a07740ce0dfbb13 Mon Sep 17 00:00:00 2001 From: shrinivasan ganapathy Date: Tue, 10 Oct 2017 11:32:11 -0700 Subject: LD_PRELOAD stub identified system calls - stub identifed unimplemented system call to return EOPNOTSUPP(95) Change-Id: I4f4a78717059f224bc695a0d32d4f0417dc46bd4 Signed-off-by: shrinivasan ganapathy --- vcl-ldpreload/src/libvcl-ldpreload/vcom.c | 60 ++++++++++++++++++++++ vcl-ldpreload/src/libvcl-ldpreload/vcom.h | 10 ++++ .../src/libvcl-ldpreload/vcom_glibc_socket.h | 25 +++++++++ vcl-ldpreload/src/libvcl-ldpreload/vcom_socket.c | 1 + 4 files changed, 96 insertions(+) diff --git a/vcl-ldpreload/src/libvcl-ldpreload/vcom.c b/vcl-ldpreload/src/libvcl-ldpreload/vcom.c index e148ce0..3160d1d 100644 --- a/vcl-ldpreload/src/libvcl-ldpreload/vcom.c +++ b/vcl-ldpreload/src/libvcl-ldpreload/vcom.c @@ -2899,6 +2899,66 @@ epoll_pwait (int __epfd, struct epoll_event *__events, return 0; } +/* Poll the file descriptors described by the NFDS structures starting at + FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for + an event to occur; if TIMEOUT is -1, block until an event occurs. + Returns the number of file descriptors with events, zero if timed out, + or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +int +vcom_poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) +{ + if (vcom_init () != 0) + { + return -1; + } + + return -EOPNOTSUPP; +} + +int +poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) +{ + int rv = 0; + + errno = EOPNOTSUPP; + rv = -1; + return rv; +} + +#ifdef __USE_GNU +/* Like poll, but before waiting the threads signal mask is replaced + with that specified in the fourth parameter. For better usability, + the timeout value is specified using a TIMESPEC object. + + This function is a cancellation point and therefore not marked with + __THROW. */ +int vcom_ppoll (struct pollfd *__fds, nfds_t __nfds, + const struct timespec *__timeout, + const __sigset_t *__ss) +{ + if (vcom_init () != 0) + { + return -1; + } + + return -EOPNOTSUPP; +} + +int ppoll (struct pollfd *__fds, nfds_t __nfds, + const struct timespec *__timeout, + const __sigset_t *__ss) +{ + int rv = 0; + + errno = EOPNOTSUPP; + rv = -1; + return rv; +} +#endif + void CONSTRUCTOR_ATTRIBUTE vcom_constructor (void); void DESTRUCTOR_ATTRIBUTE vcom_destructor (void); diff --git a/vcl-ldpreload/src/libvcl-ldpreload/vcom.h b/vcl-ldpreload/src/libvcl-ldpreload/vcom.h index 1706c0e..0cb68a3 100644 --- a/vcl-ldpreload/src/libvcl-ldpreload/vcom.h +++ b/vcl-ldpreload/src/libvcl-ldpreload/vcom.h @@ -175,6 +175,16 @@ vcom_epoll_pwait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout, const __sigset_t *__ss); +extern int +vcom_poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); + +#ifdef __USE_GNU +extern int +vcom_ppoll (struct pollfd *__fds, nfds_t __nfds, + const struct timespec *__timeout, + const __sigset_t *__ss); +#endif + #endif /* included_vcom_h */ diff --git a/vcl-ldpreload/src/libvcl-ldpreload/vcom_glibc_socket.h b/vcl-ldpreload/src/libvcl-ldpreload/vcom_glibc_socket.h index 026ba60..ecad24a 100644 --- a/vcl-ldpreload/src/libvcl-ldpreload/vcom_glibc_socket.h +++ b/vcl-ldpreload/src/libvcl-ldpreload/vcom_glibc_socket.h @@ -23,6 +23,8 @@ #include #include +#include + /* * * Generic glibc fd api @@ -318,6 +320,29 @@ epoll_pwait (int __epfd, struct epoll_event *__events, int __maxevents, int __timeout, const __sigset_t *__ss); +/* Poll the file descriptors described by the NFDS structures starting at + FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for + an event to occur; if TIMEOUT is -1, block until an event occurs. + Returns the number of file descriptors with events, zero if timed out, + or -1 for errors. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int poll (struct pollfd *__fds, nfds_t __nfds, int __timeout); + +#ifdef __USE_GNU +/* Like poll, but before waiting the threads signal mask is replaced + with that specified in the fourth parameter. For better usability, + the timeout value is specified using a TIMESPEC object. + + This function is a cancellation point and therefore not marked with + __THROW. */ +extern int ppoll (struct pollfd *__fds, nfds_t __nfds, + const struct timespec *__timeout, + const __sigset_t *__ss); +#endif + + #endif /* included_vcom_glibc_socket_h */ /* diff --git a/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket.c b/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket.c index 560cc7f..89c28fe 100644 --- a/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket.c +++ b/vcl-ldpreload/src/libvcl-ldpreload/vcom_socket.c @@ -1624,6 +1624,7 @@ vppcom_recvmsg (int __sid, struct msghdr *__message, int __flags) int rv = -1; /* rv = vppcom_session_read (__sid, (void *) __message->__buf, (int)__n); */ + rv = -EOPNOTSUPP; return rv; } -- cgit 1.2.3-korg