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>
This commit is contained in:
Poornima G 2015-03-10 12:12:01 +05:30 committed by Vijay Bellur
parent f7d33653eb
commit e64415ad9d

View File

@ -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;