Skip to content

Commit

Permalink
iiod/interpreter: Remove unused functions
Browse files Browse the repository at this point in the history
Signed-off-by: Philip Molloy <[email protected]>
  • Loading branch information
pamolloy authored and dNechita committed Feb 11, 2025
1 parent d687ea3 commit a80a312
Showing 1 changed file with 0 additions and 80 deletions.
80 changes: 0 additions & 80 deletions iiod/interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,86 +116,6 @@ static ssize_t writefd_aio(struct parser_pdata *pdata, const void *dest,
}
#endif /* WITH_AIO */

static ssize_t readfd_io(struct parser_pdata *pdata, void *dest, size_t len)
{
ssize_t ret;
struct pollfd pfd[2];

pfd[0].fd = pdata->fd_in;
pfd[0].events = POLLIN | POLLRDHUP;
pfd[0].revents = 0;
pfd[1].fd = thread_pool_get_poll_fd(pdata->pool);
pfd[1].events = POLLIN;
pfd[1].revents = 0;

do {
poll_nointr(pfd, 2);

/* Got STOP event, or client closed the socket: treat it as EOF */
if (pfd[1].revents & POLLIN || pfd[0].revents & POLLRDHUP)
return 0;
if (pfd[0].revents & POLLERR)
return -EIO;
if (!(pfd[0].revents & POLLIN))
continue;

do {
if (pdata->fd_in_is_socket)
ret = recv(pdata->fd_in, dest, len, MSG_NOSIGNAL);
else
ret = read(pdata->fd_in, dest, len);
} while (ret == -1 && errno == EINTR);

if (ret != -1 || errno != EAGAIN)
break;
} while (true);

if (ret == -1)
return -errno;

return ret;
}

static ssize_t writefd_io(struct parser_pdata *pdata, const void *src, size_t len)
{
ssize_t ret;
struct pollfd pfd[2];

pfd[0].fd = pdata->fd_out;
pfd[0].events = POLLOUT;
pfd[0].revents = 0;
pfd[1].fd = thread_pool_get_poll_fd(pdata->pool);
pfd[1].events = POLLIN;
pfd[1].revents = 0;

do {
poll_nointr(pfd, 2);

/* Got STOP event, or client closed the socket: treat it as EOF */
if (pfd[1].revents & POLLIN || pfd[0].revents & POLLHUP)
return 0;
if (pfd[0].revents & POLLERR)
return -EIO;
if (!(pfd[0].revents & POLLOUT))
continue;

do {
if (pdata->fd_out_is_socket)
ret = send(pdata->fd_out, src, len, MSG_NOSIGNAL);
else
ret = write(pdata->fd_out, src, len);
} while (ret == -1 && errno == EINTR);

if (ret != -1 || errno != EAGAIN)
break;
} while (true);

if (ret == -1)
return -errno;

return ret;
}

void interpreter(struct iio_context *ctx, int fd_in, int fd_out,
bool is_socket, bool is_usb,
struct thread_pool *pool, const void *xml_zstd,
Expand Down

0 comments on commit a80a312

Please sign in to comment.