+#if HAVE_ACCEPT4
+# undef accept4
+ /* Try the system call first, if it exists. (We may be running with a glibc
+ that has the function but with an older kernel that lacks it.) */
+ {
+ /* Cache the information whether the system call really exists. */
+ static int have_accept4_really; /* 0 = unknown, 1 = yes, -1 = no */
+ if (have_accept4_really >= 0)
+ {
+ int result = accept4 (sockfd, addr, addrlen, flags);
+ if (!(result < 0 && errno == ENOSYS))
+ {
+ have_accept4_really = 1;
+ return result;
+ }
+ have_accept4_really = -1;
+ }
+ }
+#endif
+