break;
else if (errno == EAGAIN || errno == EINTR)
continue;
+ else
+ break;
} while (!exit_backend);
if (!len)
break;
else if (errno == EAGAIN || errno == EINTR)
continue;
+ else
+ break;
} while (!exit_backend);
if (!len)
cmd = malloc(sizeof(*cmd));
- fio_init_net_cmd(&cmd->cmd, opcode, NULL, 0, (uint64_t) cmd);
+ fio_init_net_cmd(&cmd->cmd, opcode, NULL, 0, (uintptr_t) cmd);
fio_net_cmd_crc(&cmd->cmd);
INIT_FLIST_HEAD(&cmd->list);
probe.os = FIO_OS;
probe.arch = FIO_ARCH;
+ probe.bpp = sizeof(void *);
+
return fio_net_send_cmd(server_fd, FIO_NET_CMD_PROBE, &probe, sizeof(probe), cmd->tag);
}
size_t size;
int i;
- size = sizeof(*je) + thread_number * sizeof(char);
+ if (!thread_number)
+ return 0;
+
+ size = sizeof(*je) + thread_number * sizeof(char) + 1;
je = malloc(size);
memset(je, 0, size);
return ret;
}
-static void sig_int(int sig)
+void fio_server_got_signal(int signal)
{
- fio_terminate_threads(TERMINATE_ALL);
- exit_backend = 1;
-}
-
-static void server_signal_handler(void)
-{
- struct sigaction act;
-
- memset(&act, 0, sizeof(act));
- act.sa_handler = sig_int;
- act.sa_flags = SA_RESTART;
- sigaction(SIGINT, &act, NULL);
-
- memset(&act, 0, sizeof(act));
- act.sa_handler = sig_int;
- act.sa_flags = SA_RESTART;
- sigaction(SIGTERM, &act, NULL);
+ if (signal == SIGPIPE)
+ server_fd = -1;
+ else {
+ log_info("\nfio: terminating on signal %d\n", signal);
+ exit_backend = 1;
+ }
}
static int check_existing_pidfile(const char *pidfile)
pid_t pid;
int ret;
- server_signal_handler();
-
if (!pidfile)
return fio_server();