Apparently some newer glibcs now have it, decades after the
fact.
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fi
print_config "MADV_HUGEPAGE" "$thp"
fi
print_config "MADV_HUGEPAGE" "$thp"
+##########################################
+# check for gettid()
+gettid="no"
+cat > $TMPC << EOF
+#include <unistd.h>
+int main(int argc, char **argv)
+{
+ return gettid();
+}
+EOF
+if compile_prog "" "" "gettid"; then
+ gettid="yes"
+fi
+print_config "gettid" "$gettid"
+
#############################################################################
if test "$wordsize" = "64" ; then
#############################################################################
if test "$wordsize" = "64" ; then
if test "$__kernel_rwf_t" = "yes"; then
output_sym "CONFIG_HAVE_KERNEL_RWF_T"
fi
if test "$__kernel_rwf_t" = "yes"; then
output_sym "CONFIG_HAVE_KERNEL_RWF_T"
fi
+if test "$gettid" = "yes"; then
+ output_sym "CONFIG_HAVE_GETTID"
+fi
if test "$fallthrough" = "yes"; then
CFLAGS="$CFLAGS -Wimplicit-fallthrough"
fi
if test "$fallthrough" = "yes"; then
CFLAGS="$CFLAGS -Wimplicit-fallthrough"
fi
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return (int) lwp_gettid();
}
static inline int gettid(void)
{
return (int) lwp_gettid();
}
static inline unsigned long long get_fs_free_size(const char *path)
{
static inline unsigned long long get_fs_free_size(const char *path)
{
return syscall(__NR_ioprio_set, which, who, ioprio);
}
return syscall(__NR_ioprio_set, which, who, ioprio);
}
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return syscall(__NR_gettid);
}
static inline int gettid(void)
{
return syscall(__NR_gettid);
}
#define SPLICE_DEF_SIZE (64*1024)
#define SPLICE_DEF_SIZE (64*1024)
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return mach_thread_self();
}
static inline int gettid(void)
{
return mach_thread_self();
}
/*
* For some reason, there's no header definition for fdatasync(), even
/*
* For some reason, there's no header definition for fdatasync(), even
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return (int) _lwp_self();
}
static inline int gettid(void)
{
return (int) _lwp_self();
}
static inline unsigned long long get_fs_free_size(const char *path)
{
static inline unsigned long long get_fs_free_size(const char *path)
{
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return (int)(intptr_t) pthread_self();
}
static inline int gettid(void)
{
return (int)(intptr_t) pthread_self();
}
static inline unsigned long long get_fs_free_size(const char *path)
{
static inline unsigned long long get_fs_free_size(const char *path)
{
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return pthread_self();
}
static inline int gettid(void)
{
return pthread_self();
}
/*
* Should be enough, not aware of what (if any) restrictions Solaris has
/*
* Should be enough, not aware of what (if any) restrictions Solaris has
return (unsigned long long) pages * (unsigned long long) pagesize;
}
return (unsigned long long) pages * (unsigned long long) pagesize;
}
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return GetCurrentThreadId();
}
static inline int gettid(void)
{
return GetCurrentThreadId();
}
static inline int init_random_seeds(uint64_t *rand_seeds, int size)
{
static inline int init_random_seeds(uint64_t *rand_seeds, int size)
{
#endif
#ifndef FIO_HAVE_GETTID
#endif
#ifndef FIO_HAVE_GETTID
+#ifndef CONFIG_HAVE_GETTID
static inline int gettid(void)
{
return getpid();
}
#endif
static inline int gettid(void)
{
return getpid();
}
#endif
#ifndef FIO_HAVE_SHM_ATTACH_REMOVED
static inline int shm_attach_to_open_removed(void)
#ifndef FIO_HAVE_SHM_ATTACH_REMOVED
static inline int shm_attach_to_open_removed(void)