/*
* This file is part of the libCEC(R) library.
*
- * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited. All rights reserved.
+ * libCEC(R) is Copyright (C) 2011-2013 Pulse-Eight Limited. All rights reserved.
* libCEC(R) is an original work, containing original code.
*
* libCEC(R) is a trademark of Pulse-Eight Limited.
*/
-#include "../os.h"
-#include "../util/timeutils.h"
+#include "lib/platform/os.h"
+#include "lib/platform/util/timeutils.h"
#include <stdio.h>
#include <fcntl.h>
+#include <sys/ioctl.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
{
FD_ZERO(&port);
FD_SET(socket, &port);
- int returnv = select(socket + 1, NULL, &port, NULL, tv);
+ ssize_t returnv = (ssize_t)select(socket + 1, NULL, &port, NULL, tv);
if (returnv < 0)
{
*iError = errno;
FD_ZERO(&port);
FD_SET(socket, &port);
- int32_t returnv = select(socket + 1, &port, NULL, NULL, tv);
+ ssize_t returnv = (ssize_t)select(socket + 1, &port, NULL, NULL, tv);
if (returnv == -1)
{
return iBytesRead;
}
+
+ inline int SocketIoctl(socket_t socket, int *iError, int request, void* data)
+ {
+ if (socket == INVALID_SOCKET_VALUE)
+ {
+ *iError = EINVAL;
+ return -1;
+ }
+
+ int iReturn = ioctl(socket, request, data);
+ if (iReturn < 0)
+ *iError = errno;
+ return iReturn;
+ }
//@}
// TCP
{
if (iTimeoutMs > 0)
{
- int iPollResult = poll(&fds, 1, iTarget - iNow);
+ int iPollResult = poll(&fds, 1, (int)(iTarget - iNow));
if (iPollResult == 0)
{
*iError = ETIMEDOUT;
pfd.events = POLLOUT;
pfd.revents = 0;
- int iPollResult = poll(&pfd, 1, iTimeout);
+ int iPollResult = poll(&pfd, 1, (int)iTimeout);
if (iPollResult == 0)
*iError = ETIMEDOUT;
else if (iPollResult == -1)