os/os-linux: add pthread CPU affinity helper

Signed-off-by: Jens Axboe <axboe@kernel.dk>
diff --git a/os/os-linux.h b/os/os-linux.h
index 5562b0d..ea8d792 100644
--- a/os/os-linux.h
+++ b/os/os-linux.h
@@ -74,6 +74,9 @@
 	sched_getaffinity((pid), (ptr))
 #endif
 
+#define fio_get_thread_affinity(mask)	\
+	pthread_getaffinity_np(pthread_self(), sizeof(mask), &(mask))
+
 #define fio_cpu_clear(mask, cpu)	(void) CPU_CLR((cpu), (mask))
 #define fio_cpu_set(mask, cpu)		(void) CPU_SET((cpu), (mask))
 #define fio_cpu_isset(mask, cpu)	(CPU_ISSET((cpu), (mask)) != 0)