Move Windows port to MinGW
- Add calls to WSAStartup in the network code as required by
Winsock.
- Add Windows-specific init_random_state function which uses the
Crypto API.
- Move Windows port to MinGW and update build system to create a
64-bit binary by default.
- Install text files as .rtf so they won't open in Notepad by default
(Wordpad understands Unix line endings; Notepad doesn't).
- Simplify WiX installer code.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/os/os.h b/os/os.h
index c10cb12..8d2a6ae 100644
--- a/os/os.h
+++ b/os/os.h
@@ -3,6 +3,7 @@
#include <sys/types.h>
#include <sys/socket.h>
+#include <fcntl.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
@@ -34,7 +35,7 @@
#include "os-aix.h"
#elif defined(__hpux)
#include "os-hpux.h"
-#elif defined(__CYGWIN__)
+#elif defined(WIN32)
#include "os-windows.h"
#else
#error "unsupported os"
@@ -267,6 +268,32 @@
}
#endif
+#ifdef FIO_USE_GENERIC_INIT_RANDOM_STATE
+extern void td_fill_rand_seeds(struct thread_data *td);
+/*
+ * Initialize the various random states we need (random io, block size ranges,
+ * read/write mix, etc).
+ */
+static inline int init_random_state(struct thread_data *td, unsigned long *rand_seeds, int size)
+{
+ int fd;
+
+ fd = open("/dev/urandom", O_RDONLY);
+ if (fd == -1) {
+ return 1;
+ }
+
+ if (read(fd, rand_seeds, size) < size) {
+ close(fd);
+ return 1;
+ }
+
+ close(fd);
+ td_fill_rand_seeds(td);
+ return 0;
+}
+#endif
+
#ifndef FIO_HAVE_FS_STAT
static inline unsigned long long get_fs_size(const char *path)
{