summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/event.c
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2015-03-10 12:12:01 +0530
committerVijay Bellur <vbellur@redhat.com>2015-03-10 19:20:52 -0700
commite64415ad9d97e2dfd74481b47c88a0f483b4374a (patch)
treead052e1ecdd8490ed738d23920f8d4263d34c87c /libglusterfs/src/event.c
parentf7d33653ebdeed737c101c64b53d638f2b40c886 (diff)
libglusterfs: Replace pipe2 with pipe.
pipe2() doesn't works on Linux kernel version < 2.6.27 and glibc < version 2.9. Hence replacing it with pipe(), so that the build will not fail on Centos5. Change-Id: If17aed0d51466cd7528cf8dde0edfa28b68139e5 BUG: 1200255 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/9844 Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'libglusterfs/src/event.c')
-rw-r--r--libglusterfs/src/event.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/libglusterfs/src/event.c b/libglusterfs/src/event.c
index b956d25595f..35564e46ea8 100644
--- a/libglusterfs/src/event.c
+++ b/libglusterfs/src/event.c
@@ -201,11 +201,26 @@ event_dispatch_destroy (struct event_pool *event_pool)
int ret = -1;
int fd[2] = {-1};
int idx = -1;
+ int flags = 0;
struct timespec sleep_till = {0, };
GF_VALIDATE_OR_GOTO ("event", event_pool, out);
- ret = pipe2 (fd, O_NONBLOCK);
+ ret = pipe (fd);
+ if (ret < 0)
+ goto out;
+
+ /* Make the read end of the pipe nonblocking */
+ flags = fcntl(fd[0], F_GETFL);
+ flags |= O_NONBLOCK;
+ ret = fcntl(fd[0], F_SETFL, flags);
+ if (ret < 0)
+ goto out;
+
+ /* Make the write end of the pipe nonblocking */
+ flags = fcntl(fd[1], F_GETFL);
+ flags |= O_NONBLOCK;
+ fcntl(fd[1], F_SETFL, flags);
if (ret < 0)
goto out;