Commit c8778a81 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Implement vlc_pipe()

parent 25adb445
......@@ -557,7 +557,7 @@ AC_CHECK_FUNCS(fdatasync,,
AC_FUNC_STRCOLL
dnl Check for non-standard system calls
AC_CHECK_FUNCS([accept4 dup3 eventfd vmsplice sched_getaffinity])
AC_CHECK_FUNCS([accept4 dup3 pipe2 eventfd vmsplice sched_getaffinity])
AH_BOTTOM([#include <vlc_fixups.h>])
......
......@@ -73,4 +73,5 @@ VLC_EXPORT( int, vlc_lstat, ( const char *filename, struct stat *buf ) );
VLC_EXPORT( int, vlc_mkstemp, ( char * ) );
VLC_EXPORT( int, vlc_dup, ( int ) );
VLC_EXPORT( int, vlc_pipe, ( int[2] ) );
#endif
......@@ -467,6 +467,7 @@ vlc_strcasestr
vlc_unlink
vlc_rename
vlc_dup
vlc_pipe
vlc_accept
utf8_vfprintf
var_AddCallback
......
......@@ -334,6 +334,26 @@ int vlc_dup (int oldfd)
return newfd;
}
/**
* Creates a pipe (see "man pipe" for further reference).
*/
int vlc_pipe (int fds[2])
{
#ifdef HAVE_PIPE2
if (pipe2 (fds, O_CLOEXEC) == 0)
return 0;
if (errno != ENOSYS)
return -1;
#endif
if (pipe (fds))
return -1;
fcntl (fds[0], F_SETFD, FD_CLOEXEC);
fcntl (fds[1], F_SETFD, FD_CLOEXEC);
return 0;
}
#include <vlc_network.h>
/**
......
......@@ -255,6 +255,11 @@ int vlc_dup (int oldfd)
#endif
}
int vlc_pipe (int fds[2])
{
return _pipe (fds, 32768, O_BINARY);
}
#include <vlc_network.h>
int vlc_socket (int pf, int type, int proto, bool nonblock)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment