tests: ipcpipeline: provide pipe2() on systems that don't have it

https://bugzilla.gnome.org/show_bug.cgi?id=786763
This commit is contained in:
George Kiagiadakis 2017-08-31 14:57:34 +03:00
parent 14087c6c8d
commit 282b682cab
3 changed files with 25 additions and 1 deletions

View file

@ -171,7 +171,7 @@ dnl *** checks for structures ***
dnl *** checks for compiler characteristics ***
dnl *** checks for library functions ***
AC_CHECK_FUNCS([gmtime_r])
AC_CHECK_FUNCS([gmtime_r pipe2])
dnl *** checks for headers ***
AC_CHECK_HEADERS([sys/utsname.h])

View file

@ -195,6 +195,7 @@ check_functions = [
# check token HAVE_ORC
# check token HAVE_OSX
# check token HAVE_OSX_VIDEO
['HAVE_PIPE2', 'pipe2'],
# check token HAVE_PNG
# check token HAVE_PVR
# check token HAVE_QUICKTIME

View file

@ -22,6 +22,10 @@
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#define _GNU_SOURCE /* See feature_test_macros(7) */
#include <unistd.h>
#include <stdio.h>
@ -33,6 +37,25 @@
#include <gst/check/gstcheck.h>
#include <string.h>
#ifndef HAVE_PIPE2
static int
pipe2 (int pipedes[2], int flags)
{
int ret = pipe (pipedes);
if (ret < 0)
return ret;
if (flags != 0) {
ret = fcntl (pipedes[0], F_SETFL, flags);
if (ret < 0)
return ret;
ret = fcntl (pipedes[1], F_SETFL, flags);
if (ret < 0)
return ret;
}
return 0;
}
#endif
/* This enum contains flags that are used to configure the setup that
* test_base() will do internally */
typedef enum