[IMPROVE] get pid/tid for message probe generate 19/24319/1
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Thu, 10 Jul 2014 11:11:05 +0000 (15:11 +0400)
committerVitaliy Cherepanov <v.cherepanov@samsung.com>
Thu, 10 Jul 2014 11:11:05 +0000 (15:11 +0400)
Change-Id: Id177ad619e8fe1b394096f31c2f416fd2428c9e7
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
helper/libdaprobe.c
include/binproto.h
include/dahelper.h

index eca1f05c8df5be28ec17e6228d065c9f5e891806..815c84c81fae5cb202d1895e6e350818c8068409 100755 (executable)
@@ -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
index 87c12b9a6a9c53f7a9988694b5e42a23ac23116f..ca06132a4f5940472a1a3d3499128e91916422fb 100644 (file)
 #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>
@@ -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)
index f20835a23fa9c8f8d6519bdd6122d68e01912cdf..c136dfc1e9b5e9ed98c9a17d735806d441829194 100755 (executable)
@@ -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);