--- libpisock/linuxusb.c	2006-10-12 16:21:22.000000000 +0200
+++ libpisock/linuxusb.c	2016-12-20 14:17:56.216661746 +0100
@@ -27,6 +27,7 @@
 #include <stdio.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/socket.h>
 
 #include "pi-debug.h"
 #include "pi-source.h"
@@ -48,8 +48,8 @@
 
 static int u_open(pi_socket_t *ps, struct pi_sockaddr *addr, size_t addrlen);
 static int u_close(pi_socket_t *ps);
-static int u_write(pi_socket_t *ps, unsigned char *buf, size_t len, int flags);
-static int u_read(pi_socket_t *ps, pi_buffer_t *buf, size_t len, int flags);
+static ssize_t u_write(pi_socket_t *ps, PI_CONST unsigned char *buf, size_t len, int flags);
+static ssize_t u_read(pi_socket_t *ps, pi_buffer_t *buf, size_t len, int flags);
 static int u_poll(pi_socket_t *ps, int timeout);
 static int u_flush(pi_socket_t *ps, int flags);
 
@@ -188,7 +188,7 @@
  * Returns:     Nothing
  *
  ***********************************************************************/
-static int
-u_write(pi_socket_t *ps, unsigned char *buf, size_t len, int flags)
+static ssize_t
+u_write(pi_socket_t *ps, PI_CONST unsigned char *buf, size_t len, int flags)
 {
 	int 	total,
@@ -243,7 +243,7 @@
  * Returns:     number of bytes read
  *
  ***********************************************************************/
-static int
+static ssize_t
 u_read_buf (pi_socket_t *ps, pi_buffer_t *buf, size_t len, int flags) 
 {
 	struct 	pi_usb_data *data = (struct pi_usb_data *)ps->device->data;
@@ -281,7 +281,7 @@
  * Returns:     number of bytes read or negative otherwise
  *
  ***********************************************************************/
-static int
+static ssize_t
 u_read(pi_socket_t *ps, pi_buffer_t *buf, size_t len, int flags)
 {
 	ssize_t rbuf = 0,
