#define uninitialized_var(x) x = x
+#ifndef __weak
#define __weak __attribute__((weak))
+#endif
#endif
ret = gettimeofday(&tv, NULL);
- ts->ts_sec = tv.tv_sec;
- ts->ts_nsec = tv.tv_usec * 1000;
+ ts->tv_sec = tv.tv_sec;
+ ts->tv_nsec = tv.tv_usec * 1000;
return ret;
}
#ifndef FIO_HELPERS_H
#define FIO_HELPERS_H
+#include "compiler/compiler.h"
+
struct in_addr;
extern int __weak posix_memalign(void **ptr, size_t align, size_t size);
#include "mutex.h"
#include "arch/arch.h"
#include "os/os.h"
+#include "helpers.h"
void fio_mutex_remove(struct fio_mutex *mutex)
{
void fio_keywords_init(void)
{
- unsigned long mb_memory;
+ unsigned long long mb_memory;
char buf[128];
long l;
sprintf(buf, "%lu", page_size);
fio_keywords[0].replace = strdup(buf);
- l = sysconf(_SC_PHYS_PAGES);
- mb_memory = l * (page_size / 1024UL);
- sprintf(buf, "%lu", mb_memory);
+ mb_memory = os_phys_mem() / page_size;
+ sprintf(buf, "%llu", mb_memory);
fio_keywords[1].replace = strdup(buf);
l = sysconf(_SC_NPROCESSORS_ONLN);
#ifdef FIO_USE_GENERIC_BDEV_SIZE
static inline int blockdev_size(int fd, unsigned long long *bytes)
{
- off_t end = lseek(fd, 0, SEEK_END);
+ off_t end;
+ *bytes = 0;
+
+ end = lseek(fd, 0, SEEK_END);
if (end < 0)
return errno;