}
// return current process id
-static pid_t _getpid()
+pid_t _getpid()
{
if (gPid == -1)
gPid = getpid();
}
// return current thread id
-static pid_t _gettid()
+pid_t _gettid()
{
if(gTid == -1)
gTid = syscall(__NR_gettid); // syscall is very expensive
#include <sys/types.h>
#include <sys/stat.h>
-// getpid/gettid
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/syscall.h>
-
#include <sys/time.h>
#include <sys/socket.h>
BUF_PTR = pack_timestamp(BUF_PTR); /* timestamp */ \
BUF_PTR = pack_int32(BUF_PTR, 0); /* length */ \
BUF_PTR = pack_int32(BUF_PTR, api_id); /* API id */ \
- BUF_PTR = pack_int32(BUF_PTR, getpid()); /* PID */ \
- BUF_PTR = pack_int32(BUF_PTR, syscall(__NR_gettid)); /* call pc*/\
+ BUF_PTR = pack_int32(BUF_PTR, _getpid()); /* PID */ \
+ BUF_PTR = pack_int32(BUF_PTR, _gettid()); /* call pc*/\
BUF_PTR = pack_args(BUF_PTR, fmt, __VA_ARGS__); /* args */ \
RET_PTR = BUF_PTR; \
} while (0)
char** da_backtrace_symbols (void* const* array, int size);
char** cached_backtrace_symbols (void* const* array, int size);
+/* pid/tid values */
+pid_t _getpid();
+pid_t _gettid();
+extern void reset_pid_tid();
+
// profil turned on
int __profil(int mode);