From e64415ad9d97e2dfd74481b47c88a0f483b4374a Mon Sep 17 00:00:00 2001 From: Poornima G Date: Tue, 10 Mar 2015 12:12:01 +0530 Subject: 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 Reviewed-on: http://review.gluster.org/9844 Reviewed-by: Raghavendra Talur Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi --- libglusterfs/src/event.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'libglusterfs/src/event.c') 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; -- cgit