@@ -50,8 +50,17 @@
 | 
				
			|||||||
#ifdef __linux__
 | 
					#ifdef __linux__
 | 
				
			||||||
#include <sys/syscall.h> //Use gettid() syscall under linux to get thread id
 | 
					#include <sys/syscall.h> //Use gettid() syscall under linux to get thread id
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#elif defined(__FreeBSD__)
 | 
					#elif defined(_AIX)
 | 
				
			||||||
#include <sys/thr.h> //Use thr_self() syscall under FreeBSD to get thread id
 | 
					#include <pthread.h>     // for pthread_getthreadid_np
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#elif defined(__DragonFly__) || defined(__FreeBSD__)
 | 
				
			||||||
 | 
					#include <pthread_np.h>  // for pthread_getthreadid_np
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#elif defined(__NetBSD__)
 | 
				
			||||||
 | 
					#include <lwp.h>         // for _lwp_self
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#elif defined(__sun)
 | 
				
			||||||
 | 
					#include <thread.h>      // for thr_self
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // unix
 | 
					#endif // unix
 | 
				
			||||||
@@ -221,7 +230,7 @@ SPDLOG_INLINE size_t filesize(FILE *f)
 | 
				
			|||||||
#else // unix
 | 
					#else // unix
 | 
				
			||||||
    int fd = fileno(f);
 | 
					    int fd = fileno(f);
 | 
				
			||||||
// 64 bits(but not in osx or cygwin, where fstat64 is deprecated)
 | 
					// 64 bits(but not in osx or cygwin, where fstat64 is deprecated)
 | 
				
			||||||
#if !defined(__FreeBSD__) && !defined(__APPLE__) && (defined(__x86_64__) || defined(__ppc64__)) && !defined(__CYGWIN__)
 | 
					#if (defined(__linux__) || defined(__sun) || defined(_AIX)) && (defined(__LP64__) || defined(_LP64))
 | 
				
			||||||
    struct stat64 st;
 | 
					    struct stat64 st;
 | 
				
			||||||
    if (::fstat64(fd, &st) == 0)
 | 
					    if (::fstat64(fd, &st) == 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
@@ -316,10 +325,14 @@ SPDLOG_INLINE size_t _thread_id() SPDLOG_NOEXCEPT
 | 
				
			|||||||
#define SYS_gettid __NR_gettid
 | 
					#define SYS_gettid __NR_gettid
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
    return static_cast<size_t>(syscall(SYS_gettid));
 | 
					    return static_cast<size_t>(syscall(SYS_gettid));
 | 
				
			||||||
#elif defined(__FreeBSD__)
 | 
					#elif defined(_AIX) || defined(__DragonFly__) || defined(__FreeBSD__)
 | 
				
			||||||
    long tid;
 | 
					    return static_cast<size_t>(pthread_getthreadid_np());
 | 
				
			||||||
    thr_self(&tid);
 | 
					#elif defined(__NetBSD__)
 | 
				
			||||||
    return static_cast<size_t>(tid);
 | 
					    return static_cast<size_t>(_lwp_self());
 | 
				
			||||||
 | 
					#elif defined(__OpenBSD__)
 | 
				
			||||||
 | 
					    return static_cast<size_t>(getthrid());
 | 
				
			||||||
 | 
					#elif defined(__sun)
 | 
				
			||||||
 | 
					    return static_cast<size_t>(thr_self());
 | 
				
			||||||
#elif __APPLE__
 | 
					#elif __APPLE__
 | 
				
			||||||
    uint64_t tid;
 | 
					    uint64_t tid;
 | 
				
			||||||
    pthread_threadid_np(nullptr, &tid);
 | 
					    pthread_threadid_np(nullptr, &tid);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user