@@ -1550,6 +1550,23 @@ if compile_prog "" "" ; then
pipe2=yes
fi
+# check if accept4 is there
+accept4=no
+cat > $TMPC << EOF
+#define _GNU_SOURCE
+#include <sys/socket.h>
+#include <stddef.h>
+
+int main(void)
+{
+ accept4(0, NULL, NULL, SOCK_CLOEXEC);
+ return 0;
+}
+EOF
+if compile_prog "" "" ; then
+ accept4=yes
+fi
+
# check if tee/splice is there. vmsplice was added same time.
splice=no
cat > $TMPC << EOF
@@ -2013,6 +2030,9 @@ fi
if test "$pipe2" = "yes" ; then
echo "CONFIG_PIPE2=y" >> $config_host_mak
fi
+if test "$accept4" = "yes" ; then
+ echo "CONFIG_ACCEPT4=y" >> $config_host_mak
+fi
if test "$splice" = "yes" ; then
echo "CONFIG_SPLICE=y" >> $config_host_mak
fi
@@ -260,7 +260,7 @@ int qemu_pipe(int pipefd[2])
{
int ret;
-#ifdef O_CLOEXEC
+#ifdef CONFIG_PIPE2
ret = pipe2(pipefd, O_CLOEXEC);
#else
ret = pipe(pipefd);
@@ -300,7 +300,7 @@ int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen)
{
int ret;
-#ifdef SOCK_CLOEXEC
+#ifdef CONFIG_ACCEPT4
ret = accept4(s, addr, addrlen, SOCK_CLOEXEC);
#else
ret = accept(s, addr, addrlen);