Add configure script
[fio.git] / os / windows / posix.c
index 29ed2c57172735b6bf73abed670d543a772badc5..8b451478dec79e142397572c2cd6943142255a33 100755 (executable)
@@ -234,10 +234,10 @@ void syslog(int priority, const char *message, ... /* argument */)
        va_start(v, message);
        len = _vscprintf(message, v);
        output = malloc(len + sizeof(char));
-       vsprintf_s(output, len + sizeof(char), message, v);
+       vsprintf(output, message, v);
        WriteFile(log_file, output, len, &bytes_written, NULL);
        va_end(v);
-    free(output);
+       free(output);
 }
 
 int kill(pid_t pid, int sig)
@@ -377,7 +377,7 @@ char *basename(char *path)
 
 int posix_fallocate(int fd, off_t offset, off_t len)
 {
-       const int BUFFER_SIZE = 64 * 1024 * 1024;
+       const int BUFFER_SIZE = 256 * 1024;
        int rc = 0;
        char *buf;
        unsigned int write_len;
@@ -411,6 +411,9 @@ int posix_fallocate(int fd, off_t offset, off_t len)
                        break;
                }
 
+               /* Don't allow Windows to cache the write: flush it to disk */
+               _commit(fd);
+
                bytes_remaining -= bytes_written;
        }
 
@@ -532,6 +535,11 @@ int getrusage(int who, struct rusage *r_usage)
        return 0;
 }
 
+int posix_fadvise(int fd, off_t offset, off_t len, int advice)
+{
+       return 0;
+}
+
 int posix_madvise(void *addr, size_t len, int advice)
 {
        log_err("%s is not implemented\n", __func__);
@@ -628,11 +636,11 @@ int poll(struct pollfd fds[], nfds_t nfds, int timeout)
        int i;
        int rc;
 
-       if (timeout != -1)
+       if (timeout != -1) {
                to = &tv;
-
-       to->tv_sec = timeout / 1000;
-       to->tv_usec = (timeout % 1000) * 1000;
+               to->tv_sec = timeout / 1000;
+               to->tv_usec = (timeout % 1000) * 1000;
+       }
 
        FD_ZERO(&readfds);
        FD_ZERO(&writefds);
@@ -811,6 +819,7 @@ const char* inet_ntop(int af, const void *restrict src,
                errno = ENOSPC;
 
        WSACleanup();
+
        return ret;
 }