Fix compile gettid on older Linux (#11184)

Summary:
Seen only in post-PR CI job benchmark-linux. Some context: https://stackoverflow.com/questions/30680550/c-gettid-was-not-declared-in-this-scope

Pull Request resolved: https://github.com/facebook/rocksdb/pull/11184

Test Plan: watch CI

Reviewed By: cbi42

Differential Revision: D43013891

Pulled By: pdillinger

fbshipit-source-id: 48b3b7231080a0f803fdc36d13946d5524770302
This commit is contained in:
Peter Dillinger 2023-02-03 16:49:54 -08:00 committed by Facebook GitHub Bot
parent cf756ed916
commit 27cf09172c
1 changed files with 7 additions and 3 deletions

View File

@ -31,14 +31,18 @@ void* SaveStack(int* /*num_frames*/, int /*first_frames_to_skip*/) {
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#if defined(OS_FREEBSD) #ifdef OS_FREEBSD
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif #endif // OS_FREEBSD
#ifdef OS_LINUX #ifdef OS_LINUX
#include <sys/prctl.h> #include <sys/prctl.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#endif #if __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 30)
#include <sys/syscall.h>
#define gettid() syscall(SYS_gettid)
#endif // GLIBC version
#endif // OS_LINUX
#include "port/lang.h" #include "port/lang.h"