* don't block for min events == 0
*/
if (!min)
- fio_set_fd_nonblocking(bf->fd, "binject");
+ bd->fd_flags[i] = fio_set_fd_nonblocking(bf->fd, "binject");
+ else
+ bd->fd_flags[i] = -1;
bd->pfds[i].fd = bf->fd;
bd->pfds[i].events = POLLIN;
for_each_file(td, f, i) {
bf = (struct binject_file *) (uintptr_t) f->engine_data;
+ if (bd->fd_flags[i] == -1)
+ continue;
+
if (fcntl(bf->fd, F_SETFL, bd->fd_flags[i]) < 0)
log_err("fio: binject failed to restore fcntl flags: %s\n", strerror(errno));
}
* don't block for min events == 0
*/
if (!min)
- fio_set_fd_nonblocking(f->fd, "sg");
+ sd->fd_flags[i] = fio_set_fd_nonblocking(f->fd, "sg");
+ else
+ sd->fd_flags[i] = -1;
sd->pfds[i].fd = f->fd;
sd->pfds[i].events = POLLIN;
if (!min) {
for_each_file(td, f, i) {
+ if (sd->fd_flags[i] == -1)
+ continue;
+
if (fcntl(f->fd, F_SETFL, sd->fd_flags[i]) < 0)
log_err("fio: sg failed to restore fcntl flags: %s\n", strerror(errno));
}
extern int ioengine_load(struct thread_data *);
extern int parse_dryrun(void);
extern int fio_running_or_pending_io_threads(void);
-extern void fio_set_fd_nonblocking(int, const char *);
+extern int fio_set_fd_nonblocking(int, const char *);
extern uintptr_t page_mask;
extern uintptr_t page_size;
return 0;
}
-void fio_set_fd_nonblocking(int fd, const char *who)
+int fio_set_fd_nonblocking(int fd, const char *who)
{
int flags;
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)
+ int new_flags = flags | O_NONBLOCK;
+
+ new_flags = fcntl(fd, F_SETFL, new_flags);
+ if (new_flags < 0)
log_err("fio: %s failed to get file flags: %s\n", who, strerror(errno));
}
+
+ return flags;
}
static int endian_check(void)