All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: "Bruce Cran" <BCran@fusionio.com>,
	"Sébastien Bouchex Bellomié" <sbouchex@infovista.com>,
	"fio@vger.kernel.org" <fio@vger.kernel.org>
Subject: Re: ioengine=sync issue on Windows
Date: Wed, 12 Mar 2014 13:30:46 -0600	[thread overview]
Message-ID: <5320B5E6.7010902@kernel.dk> (raw)
In-Reply-To: <bd155da4787d49eb88221a9cc7f4612a@BLUPR04MB467.namprd04.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 234 bytes --]

On 03/12/2014 01:24 PM, Bruce Cran wrote:
> There's already code to use the environment variables TMP or TEMP, except it appends "tmp" to whatever it gets.
>

Yes, my point was to use it. Something like the attached.

-- 
Jens Axboe


[-- Attachment #2: fio-tmp.patch --]
[-- Type: text/x-patch, Size: 1625 bytes --]

diff --git a/os/os-windows.h b/os/os-windows.h
index 49f96068ff32..499e098f8b82 100644
--- a/os/os-windows.h
+++ b/os/os-windows.h
@@ -167,6 +167,8 @@ static inline void os_get_tmpdir(char *path, int len)
 	GetTempPath(len, path);
 }
 
+#define FIO_HAVE_OS_GET_TMPDIR
+
 static inline int gettid(void)
 {
 	return GetCurrentThreadId();
diff --git a/stat.c b/stat.c
index e43db8f9d075..df3bd93d32e5 100644
--- a/stat.c
+++ b/stat.c
@@ -13,6 +13,7 @@
 #include "json.h"
 #include "lib/getrusage.h"
 #include "idletime.h"
+#include "os/os.h"
 
 static struct fio_mutex *stat_mutex;
 
@@ -1480,7 +1481,7 @@ void show_running_run_stats(void)
 static int status_interval_init;
 static struct timeval status_time;
 
-#define FIO_STATUS_FILE		"/tmp/fio-dump-status"
+#define FIO_STATUS_FILE		"fio-dump-status"
 
 static int check_status_file(void)
 {
@@ -1491,10 +1492,22 @@ static int check_status_file(void)
 	temp_dir = getenv("TMPDIR");
 	if (temp_dir == NULL)
 		temp_dir = getenv("TEMP");
-	if (temp_dir == NULL)
+	if (temp_dir == NULL) {
+#ifdef FIO_HAVE_OS_GET_TMPDIR
+		temp_dir = NULL;
+		os_get_tmpdir(status_file_path, sizeof(status_file_path));
+#else
 		temp_dir = "/tmp";
+#endif
+	}
 
-	snprintf(fio_status_file_path, sizeof(fio_status_file_path), "%s/%s", temp_dir, FIO_STATUS_FILE);
+	if (temp_dir)
+		snprintf(fio_status_file_path, sizeof(fio_status_file_path), "%s/%s", temp_dir, FIO_STATUS_FILE);
+	else {
+		size_t len = strlen(fio_status_file_path);
+
+		snprintf(fio_status_file_path + len, sizeof(fio_status_file_path) - len, "%s", FIO_STATUS_FILE);
+	}
 
 	if (stat(fio_status_file_path, &sb))
 		return 0;

  reply	other threads:[~2014-03-12 19:30 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12 15:41 ioengine=sync issue on Windows Sébastien Bouchex Bellomié
2014-03-12 16:33 ` Jens Axboe
2014-03-12 17:48   ` Bruce Cran
2014-03-12 18:02   ` Bruce Cran
2014-03-12 19:11     ` Jens Axboe
2014-03-12 19:24       ` Bruce Cran
2014-03-12 19:30         ` Jens Axboe [this message]
2014-03-12 19:36           ` Bruce Cran
2014-03-12 19:38             ` Jens Axboe
2014-03-12 19:41               ` Jens Axboe
2014-03-12 19:44                 ` Bruce Cran
2014-04-02  3:11   ` Bruce Cran
2014-04-03 22:42     ` Bruce Cran
2014-04-04  1:57       ` Jens Axboe
2014-04-04  2:14         ` Bruce Cran
2014-04-04  2:17           ` Jens Axboe
2014-04-04  2:26             ` Bruce Cran
2014-04-04  2:35               ` Jens Axboe
2014-04-04  3:12                 ` Bruce Cran
2014-04-04  3:28                   ` Jens Axboe
2014-04-28 22:04                     ` Bruce Cran

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5320B5E6.7010902@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=BCran@fusionio.com \
    --cc=fio@vger.kernel.org \
    --cc=sbouchex@infovista.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.