[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 eca1f05..815c84c 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 87c12b9..ca06132 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 f20835a..c136dfc 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);