summaryrefslogtreecommitdiff
path: root/os
diff options
context:
space:
mode:
authorJens Axboe <axboe@kernel.dk>2019-05-22 17:12:55 -0600
committerJens Axboe <axboe@kernel.dk>2019-05-22 17:12:55 -0600
commitde5ed0e4d398bc9d4576f9b2b82d7686989c27e1 (patch)
tree2308beb179774d659e27095db6eebad3f581a376 /os
parenta7760ecdb13394819b719f3f8181cc74c3d4affa (diff)
downloadfio-de5ed0e4d398bc9d4576f9b2b82d7686989c27e1.tar.gz
fio-de5ed0e4d398bc9d4576f9b2b82d7686989c27e1.tar.bz2
configure: add gettid() test
Apparently some newer glibcs now have it, decades after the fact. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'os')
-rw-r--r--os/os-dragonfly.h2
-rw-r--r--os/os-linux.h2
-rw-r--r--os/os-mac.h2
-rw-r--r--os/os-netbsd.h2
-rw-r--r--os/os-openbsd.h2
-rw-r--r--os/os-solaris.h2
-rw-r--r--os/os-windows.h2
-rw-r--r--os/os.h2
8 files changed, 16 insertions, 0 deletions
diff --git a/os/os-dragonfly.h b/os/os-dragonfly.h
index eb92521f..3c460ae2 100644
--- a/os/os-dragonfly.h
+++ b/os/os-dragonfly.h
@@ -202,10 +202,12 @@ static inline unsigned long long os_phys_mem(void)
return mem;
}
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return (int) lwp_gettid();
}
+#endif
static inline unsigned long long get_fs_free_size(const char *path)
{
diff --git a/os/os-linux.h b/os/os-linux.h
index ba58bf7d..36339ef3 100644
--- a/os/os-linux.h
+++ b/os/os-linux.h
@@ -124,10 +124,12 @@ static inline int ioprio_set(int which, int who, int ioprio_class, int ioprio)
return syscall(__NR_ioprio_set, which, who, ioprio);
}
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return syscall(__NR_gettid);
}
+#endif
#define SPLICE_DEF_SIZE (64*1024)
diff --git a/os/os-mac.h b/os/os-mac.h
index 0b9c8707..a073300c 100644
--- a/os/os-mac.h
+++ b/os/os-mac.h
@@ -90,10 +90,12 @@ static inline unsigned long long os_phys_mem(void)
return mem;
}
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return mach_thread_self();
}
+#endif
/*
* For some reason, there's no header definition for fdatasync(), even
diff --git a/os/os-netbsd.h b/os/os-netbsd.h
index c06261d4..88fb3ef1 100644
--- a/os/os-netbsd.h
+++ b/os/os-netbsd.h
@@ -65,10 +65,12 @@ static inline unsigned long long os_phys_mem(void)
return mem;
}
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return (int) _lwp_self();
}
+#endif
static inline unsigned long long get_fs_free_size(const char *path)
{
diff --git a/os/os-openbsd.h b/os/os-openbsd.h
index 70f58b49..43a649d4 100644
--- a/os/os-openbsd.h
+++ b/os/os-openbsd.h
@@ -65,10 +65,12 @@ static inline unsigned long long os_phys_mem(void)
return mem;
}
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return (int)(intptr_t) pthread_self();
}
+#endif
static inline unsigned long long get_fs_free_size(const char *path)
{
diff --git a/os/os-solaris.h b/os/os-solaris.h
index 1a411af6..f1966f44 100644
--- a/os/os-solaris.h
+++ b/os/os-solaris.h
@@ -164,10 +164,12 @@ static inline int fio_cpuset_exit(os_cpu_mask_t *mask)
return 0;
}
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return pthread_self();
}
+#endif
/*
* Should be enough, not aware of what (if any) restrictions Solaris has
diff --git a/os/os-windows.h b/os/os-windows.h
index dc958f5c..3e9f7341 100644
--- a/os/os-windows.h
+++ b/os/os-windows.h
@@ -162,10 +162,12 @@ static inline unsigned long long os_phys_mem(void)
return (unsigned long long) pages * (unsigned long long) pagesize;
}
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return GetCurrentThreadId();
}
+#endif
static inline int init_random_seeds(uint64_t *rand_seeds, int size)
{
diff --git a/os/os.h b/os/os.h
index 756ece4b..e4729680 100644
--- a/os/os.h
+++ b/os/os.h
@@ -373,11 +373,13 @@ static inline int CPU_COUNT(os_cpu_mask_t *mask)
#endif
#ifndef FIO_HAVE_GETTID
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return getpid();
}
#endif
+#endif
#ifndef FIO_HAVE_SHM_ATTACH_REMOVED
static inline int shm_attach_to_open_removed(void)