X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=libfio.c;h=5ed8c6073603d4edb0b381fb356694cce600e04b;hp=3fde492c91af727f6d96abf39c308d3ca4b657c7;hb=4a851614cfdbebddeb78de04ac89a39d26f25459;hpb=c5c65506c564862c25c41e588d65bb4bfcf49d62 diff --git a/libfio.c b/libfio.c index 3fde492c..5ed8c607 100644 --- a/libfio.c +++ b/libfio.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "fio.h" #include "smalloc.h" @@ -233,6 +234,21 @@ int fio_running_or_pending_io_threads(void) return 0; } +void fio_set_fd_nonblocking(int fd, const char *who) +{ + int flags; + + flags = fcntl(fd, F_GETFL); + if (flags < 0) + log_err("fio: %s failed to get file flags: %s\n", who, strerror(errno)); + else { + flags |= O_NONBLOCK; + flags = fcntl(fd, F_SETFL, flags); + if (flags < 0) + log_err("fio: %s failed to get file flags: %s\n", who, strerror(errno)); + } +} + static int endian_check(void) { union {