fixes #800 accept4 not implemented on all systems
diff --git a/src/aio/usock_posix.inc b/src/aio/usock_posix.inc
index 2f8d1c3..c19f5db 100644
--- a/src/aio/usock_posix.inc
+++ b/src/aio/usock_posix.inc
@@ -329,6 +329,11 @@
     /*  Try to accept new connection in synchronous manner. */
 #if NN_HAVE_ACCEPT4
     s = accept4 (listener->s, NULL, NULL, SOCK_CLOEXEC);
+    if ((s < 0) && (errno == ENOTSUP)) {
+        /*  Apparently some old versions of Linux have a stub for this in libc,
+            without any of the underlying kernel support. */
+        s = accept (listener->s, NULL, NULL);
+    }
 #else
     s = accept (listener->s, NULL, NULL);
 #endif
diff --git a/src/utils/efd_pipe.inc b/src/utils/efd_pipe.inc
index eeb8891..408d77f 100644
--- a/src/utils/efd_pipe.inc
+++ b/src/utils/efd_pipe.inc
@@ -38,6 +38,10 @@
 
 #if defined NN_HAVE_PIPE2
     rc = pipe2 (p, O_NONBLOCK | O_CLOEXEC);
+    if ((rc == -1) &&  (errno == ENOTSUP)) {
+        /*  Deal with unimplemented system call/libc mismatch (Linux). */
+        rc = pipe (p);
+    }
 #else
     rc = pipe (p);
 #endif