mirror of
https://github.com/Llewellynvdm/conky.git
synced 2024-11-15 17:47:09 +00:00
C++ wrapper of pipe2(2)
This commit is contained in:
parent
536f719c65
commit
bcfc90accb
@ -32,3 +32,12 @@ std::string strerror_r(int errnum)
|
||||
char buf[100];
|
||||
return strerror_r(errnum, buf, sizeof buf);
|
||||
}
|
||||
|
||||
std::pair<int, int> pipe2(int flags)
|
||||
{
|
||||
int fd[2];
|
||||
if(pipe2(fd, flags) == -1)
|
||||
throw errno_error("pipe2");
|
||||
else
|
||||
return std::pair<int, int>(fd[0], fd[1]);
|
||||
}
|
||||
|
@ -24,10 +24,15 @@
|
||||
#ifndef CPPWRAP_HH
|
||||
#define CPPWRAP_HH
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cerrno>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
std::string strerror_r(int errnum);
|
||||
std::pair<int, int> pipe2(int flags);
|
||||
|
||||
class errno_error: public std::runtime_error {
|
||||
typedef std::runtime_error Base;
|
||||
|
Loading…
Reference in New Issue
Block a user