No <sys/limits.h> on Ubuntu.
Use %zd for ssize_t to handle ssize_t.
diff --git a/getevent.c b/getevent.c
index 256720d..16e3ec5 100644
--- a/getevent.c
+++ b/getevent.c
@@ -6,10 +6,15 @@
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/inotify.h>
+#ifndef NO_ANDROID_HEADERS
 #include <sys/limits.h>
+#else
+#include <limits.h>
+#endif
 #include <sys/poll.h>
 #include <linux/input.h> // this does not compile
 #include <errno.h>
+#include <unistd.h>
 
 static struct pollfd *ufds;
 static char **device_names;
@@ -42,7 +47,7 @@
             bits_size = res + 16;
             bits = realloc(bits, bits_size * 2);
             if(bits == NULL) {
-                fprintf(stderr, "failed to allocate buffer of size %d\n", bits_size);
+                fprintf(stderr, "failed to allocate buffer of size %zd\n", bits_size);
                 return 1;
             }
         }