* Make a file descriptor non-blocking. * * @param fd * File descriptor to alter. * * @return * 0 on success, negative errno value otherwise and rte_errno is set. */
| 29 | * 0 on success, negative errno value otherwise and rte_errno is set. |
| 30 | */ |
| 31 | int |
| 32 | mlx4_fd_set_non_blocking(int fd) |
| 33 | { |
| 34 | int ret = fcntl(fd, F_GETFL); |
| 35 | |
| 36 | if (ret != -1 && !fcntl(fd, F_SETFL, ret | O_NONBLOCK)) |
| 37 | return 0; |
| 38 | MLX4_ASSERT(errno); |
| 39 | rte_errno = errno; |
| 40 | return -rte_errno; |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Internal helper to allocate memory once for several disparate objects. |
no test coverage detected