From: Vitaliy Cherepanov Date: Thu, 10 Jul 2014 11:11:05 +0000 (+0400) Subject: [IMPROVE] get pid/tid for message probe generate X-Git-Tag: Tizen_SDK_2.3~57 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F19%2F24319%2F1;p=platform%2Fcore%2Fsystem%2Fswap-probe.git [IMPROVE] get pid/tid for message probe generate Change-Id: Id177ad619e8fe1b394096f31c2f416fd2428c9e7 Signed-off-by: Vitaliy Cherepanov --- diff --git a/helper/libdaprobe.c b/helper/libdaprobe.c index eca1f05..815c84c 100755 --- a/helper/libdaprobe.c +++ b/helper/libdaprobe.c @@ -194,7 +194,7 @@ void reset_pid_tid() } // return current process id -static pid_t _getpid() +pid_t _getpid() { if (gPid == -1) gPid = getpid(); @@ -202,7 +202,7 @@ static pid_t _getpid() } // return current thread id -static pid_t _gettid() +pid_t _gettid() { if(gTid == -1) gTid = syscall(__NR_gettid); // syscall is very expensive diff --git a/include/binproto.h b/include/binproto.h index 87c12b9..ca06132 100644 --- a/include/binproto.h +++ b/include/binproto.h @@ -42,11 +42,6 @@ #include #include -// getpid/gettid -#include -#include -#include - #include #include @@ -351,8 +346,8 @@ static char __attribute__((used)) *pack_ret(char *to, char ret_type, ...) 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) diff --git a/include/dahelper.h b/include/dahelper.h index f20835a..c136dfc 100755 --- a/include/dahelper.h +++ b/include/dahelper.h @@ -206,6 +206,11 @@ int get_map_address(void* symbol, void** map_start, void** map_end); 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);