Commit 282b682c authored by George Kiagiadakis's avatar George Kiagiadakis

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

https://bugzilla.gnome.org/show_bug.cgi?id=786763
parent 14087c6c
......@@ -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])
......
......@@ -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
......
......@@ -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
......
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