Merge remote-tracking branch 'warped-rudi/cubox-stable' into development. Closes #50
[deb_libcec.git] / src / lib / platform / posix / os-socket.h
index 06df1e45888af8b5ba26037755808501fd571032..739c6a71823d76ee002f306fb11888325775010e 100644 (file)
@@ -36,6 +36,7 @@
 #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>
@@ -172,6 +173,20 @@ namespace PLATFORM
 
     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