diff --git a/src/c++wrap.cc b/src/c++wrap.cc index b412b8f7..6e777392 100644 --- a/src/c++wrap.cc +++ b/src/c++wrap.cc @@ -32,3 +32,12 @@ std::string strerror_r(int errnum) char buf[100]; return strerror_r(errnum, buf, sizeof buf); } + +std::pair pipe2(int flags) +{ + int fd[2]; + if(pipe2(fd, flags) == -1) + throw errno_error("pipe2"); + else + return std::pair(fd[0], fd[1]); +} diff --git a/src/c++wrap.hh b/src/c++wrap.hh index ae6cc96f..4de83aa7 100644 --- a/src/c++wrap.hh +++ b/src/c++wrap.hh @@ -24,10 +24,15 @@ #ifndef CPPWRAP_HH #define CPPWRAP_HH +#include + +#include #include #include +#include std::string strerror_r(int errnum); +std::pair pipe2(int flags); class errno_error: public std::runtime_error { typedef std::runtime_error Base;