From ffb51df395d5e0427ef00a6cff1f93a63eaa65e5 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 26 Oct 2009 15:42:27 +0100 Subject: add bits of infrastructure needed for xmlprc code. This does not affect existing code in any way. Signed-off-by: Denys Vlasenko --- lib/Utils/xfuncs.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/Utils/xfuncs.cpp') diff --git a/lib/Utils/xfuncs.cpp b/lib/Utils/xfuncs.cpp index d256c19..9c8b0f1 100644 --- a/lib/Utils/xfuncs.cpp +++ b/lib/Utils/xfuncs.cpp @@ -5,6 +5,22 @@ */ #include "abrtlib.h" +/* Turn on nonblocking I/O on a fd */ +int ndelay_on(int fd) +{ + return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL) | O_NONBLOCK); +} + +int ndelay_off(int fd) +{ + return fcntl(fd, F_SETFL, fcntl(fd,F_GETFL) & ~O_NONBLOCK); +} + +int close_on_exec_on(int fd) +{ + return fcntl(fd, F_SETFD, FD_CLOEXEC); +} + // Die if we can't allocate size bytes of memory. void* xmalloc(size_t size) { -- cgit