[vlc-devel] commit: Linux: use accept4 if available (glibc 2.10) ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sun Nov 8 12:03:14 CET 2009
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Nov 8 13:02:43 2009 +0200| [3585accf1f4c128f46a9b86da9742c3260a7221a] | committer: Rémi Denis-Courmont
Linux: use accept4 if available (glibc 2.10)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3585accf1f4c128f46a9b86da9742c3260a7221a
---
configure.ac | 2 +-
src/network/httpd.c | 4 ++++
src/network/tcp.c | 7 +++++++
3 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/configure.ac b/configure.ac
index 40b46c7..4232168 100644
--- a/configure.ac
+++ b/configure.ac
@@ -583,7 +583,7 @@ AC_CHECK_FUNCS(fdatasync,,
])
dnl Check for non-standard system calls
-AC_CHECK_FUNCS([vmsplice eventfd fstatfs])
+AC_CHECK_FUNCS([vmsplice eventfd fstatfs accept4])
AH_BOTTOM([#include <vlc_fixups.h>])
diff --git a/src/network/httpd.c b/src/network/httpd.c
index c016661..9103194 100644
--- a/src/network/httpd.c
+++ b/src/network/httpd.c
@@ -2517,6 +2517,10 @@ static void* httpd_HostThread( void *data )
continue;
/* */
+#ifdef HAVE_ACCEPT4
+ fd = accept4 (fd, NULL, NULL, SOCK_CLOEXEC);
+ if (fd == -1 && errno == ENOSYS)
+#endif
fd = accept (fd, NULL, NULL);
if (fd == -1)
continue;
diff --git a/src/network/tcp.c b/src/network/tcp.c
index 4297a20..0347010 100644
--- a/src/network/tcp.c
+++ b/src/network/tcp.c
@@ -255,8 +255,15 @@ next_ai: /* failure */
int net_AcceptSingle (vlc_object_t *obj, int lfd)
{
int fd;
+
do
+ {
+#ifdef HAVE_ACCEPT4
+ fd = accept4 (lfd, NULL, NULL, SOCK_CLOEXEC);
+ if (fd == -1 && errno == ENOSYS)
+#endif
fd = accept (lfd, NULL, NULL);
+ }
while (fd == -1 && errno == EINTR);
if (fd == -1)
More information about the vlc-devel
mailing list