[PATCH rdma-core 3/4] Use set_fd_nonblock in instead of open coding F_SETFL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In all places.

Signed-off-by: Jason Gunthorpe <jgunthorpe@xxxxxxxxxxxxxxxxxxxx>
---
 ibacm/src/acm.c     | 2 +-
 librdmacm/rsocket.c | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/ibacm/src/acm.c b/ibacm/src/acm.c
index aba0deaa6de37f..08937345a0c112 100644
--- a/ibacm/src/acm.c
+++ b/ibacm/src/acm.c
@@ -2684,7 +2684,7 @@ static int acmc_init_sa_fds(void)
 		for (p = 0; p < dev->port_cnt; p++) {
 			sa.fds[i].fd = umad_get_fd(dev->port[p].mad_portid);
 			sa.fds[i].events = POLLIN;
-			ret = fcntl(sa.fds[i].fd, F_SETFL, O_NONBLOCK);
+			ret = set_fd_nonblock(sa.fds[i].fd, true);
 			if (ret)
 				acm_log(0, "WARNING - umad fd is blocking\n");
 
diff --git a/librdmacm/rsocket.c b/librdmacm/rsocket.c
index ca0b9bf2a21f7d..693d9eb5cb7e06 100644
--- a/librdmacm/rsocket.c
+++ b/librdmacm/rsocket.c
@@ -49,6 +49,7 @@
 #include <search.h>
 #include <byteswap.h>
 #include <util/compiler.h>
+#include <util/util.h>
 
 #include <rdma/rdma_cma.h>
 #include <rdma/rdma_verbs.h>
@@ -790,7 +791,7 @@ static int rs_create_cq(struct rsocket *rs, struct rdma_cm_id *cm_id)
 		goto err1;
 
 	if (rs->fd_flags & O_NONBLOCK) {
-		if (fcntl(cm_id->recv_cq_channel->fd, F_SETFL, O_NONBLOCK))
+		if (set_fd_nonblock(cm_id->recv_cq_channel->fd, true))
 			goto err2;
 	}
 
@@ -1253,7 +1254,7 @@ int raccept(int socket, struct sockaddr *addr, socklen_t *addrlen)
 	}
 
 	if (rs->fd_flags & O_NONBLOCK)
-		fcntl(new_rs->cm_id->channel->fd, F_SETFL, O_NONBLOCK);
+		set_fd_nonblock(new_rs->cm_id->channel->fd, true);
 
 	ret = rs_create_ep(new_rs);
 	if (ret)
@@ -1377,7 +1378,7 @@ connected:
 		break;
 	case rs_accepting:
 		if (!(rs->fd_flags & O_NONBLOCK))
-			fcntl(rs->cm_id->channel->fd, F_SETFL, 0);
+			set_fd_nonblock(rs->cm_id->channel->fd, true);
 
 		ret = ucma_complete(rs->cm_id);
 		if (ret)
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux