[FIX] build with -Wunused-but-set-variable 80/21480/1
authorVitaliy Cherepanov <v.cherepanov@samsung.com>
Wed, 21 May 2014 10:01:18 +0000 (14:01 +0400)
committerVitaliy Cherepanov <v.cherepanov@samsung.com>
Wed, 21 May 2014 10:01:18 +0000 (14:01 +0400)
Change-Id: I9c68eda2a62391989c7d4ba31497720785381c0c
Signed-off-by: Vitaliy Cherepanov <v.cherepanov@samsung.com>
helper/libdaprobe.c
include/binproto.h
probe_thread/libdasync.c
probe_thread/libdathread.c

index bcf87d6..aca7217 100755 (executable)
@@ -465,7 +465,7 @@ void __attribute__((destructor)) _fini_probe()
  ************************************************************************/
 bool printLog(log_t *log, int msgType)
 {
-       int res;
+       ssize_t res, len;
        if(unlikely(gTraceInfo.socket.daemonSock == -1))
                return false;
 
@@ -474,17 +474,19 @@ bool printLog(log_t *log, int msgType)
 
        probeBlockStart();
        log->type = msgType;
+       len = sizeof(log->type) + sizeof(log->length) + log->length;
+
        real_pthread_mutex_lock(&(gTraceInfo.socket.sockMutex));
-       res = send(gTraceInfo.socket.daemonSock, log, sizeof(log->type) + sizeof(log->length) + log->length, 0);
+       res = send(gTraceInfo.socket.daemonSock, log, len, 0);
        real_pthread_mutex_unlock(&(gTraceInfo.socket.sockMutex));
        probeBlockEnd();
 
-       return true;
+       return (res == len);
 }
 
 bool printLogStr(const char* str, int msgType)
 {
-       int res;
+       ssize_t res, len;
        log_t log;
 
        if(unlikely(gTraceInfo.socket.daemonSock == -1))
@@ -503,13 +505,15 @@ bool printLogStr(const char* str, int msgType)
                log.length = 0;
        }
 
+       len = sizeof(log.type) + sizeof(log.length) + log.length;
+
        real_pthread_mutex_lock(&(gTraceInfo.socket.sockMutex));
-       res = send(gTraceInfo.socket.daemonSock, &log, sizeof(log.type) + sizeof(log.length) + log.length, MSG_DONTWAIT);
+       res = send(gTraceInfo.socket.daemonSock, &log, len, MSG_DONTWAIT);
        real_pthread_mutex_unlock(&(gTraceInfo.socket.sockMutex));
 
        probeBlockEnd();
 
-       return true;
+       return (res == len);
 }
 
 // get backtrace string
@@ -730,14 +734,13 @@ bool setProbePoint(probeInfo_t* iProbe)
 // return 1 if size is updated into global variable
 int update_heap_memory_size(bool isAdd, size_t size)
 {
-       long tmp;
        if(isAdd)
        {
-               tmp = __sync_add_and_fetch(&g_total_alloc_size, (long)size);
+               __sync_add_and_fetch(&g_total_alloc_size, (long)size);
        }
        else
        {
-               tmp = __sync_sub_and_fetch(&g_total_alloc_size, (long)size);
+               __sync_sub_and_fetch(&g_total_alloc_size, (long)size);
        }
 
        return 0;
index ddaf394..84df6bb 100644 (file)
@@ -359,7 +359,7 @@ static char __attribute__((used)) *pack_ret(char *to, char ret_type, ...)
 
 #define PACK_COMMON_END(ret_type, ret, errn, intern_call)                      \
        do {    /* PACK_COMMON_END */                                           \
-               BUF_PTR = pack_ret(BUF_PTR, ret_type, (uintptr_t)ret);          \
+               PACK_RETURN_END(ret_type, ret)                                  \
                BUF_PTR = pack_int64(BUF_PTR, (uint64_t)errn);                  \
                BUF_PTR = pack_int32(BUF_PTR, (uint32_t)intern_call);           \
                BUF_PTR = pack_int64(BUF_PTR, (uintptr_t)CALLER_ADDRESS);       \
index 7db0859..8b78fc1 100644 (file)
@@ -116,6 +116,7 @@ int pthread_mutex_lock(pthread_mutex_t *mutex) {
 
                postBlockEnd();
        }
+        errno = (newerrno != 0) ? newerrno : olderrno;
 
        return ret;
 }
@@ -160,6 +161,8 @@ int pthread_mutex_timedlock(pthread_mutex_t *mutex,
                postBlockEnd();
        }
 
+    errno = (newerrno != 0) ? newerrno : olderrno;
+
        return ret;
 }
 
@@ -450,6 +453,7 @@ int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) {
 
                postBlockEnd();
        }
+    errno = (newerrno != 0) ? newerrno : olderrno;
 
        return ret;
 }
@@ -499,6 +503,8 @@ int pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex,
                postBlockEnd();
        }
 
+    errno = (newerrno != 0) ? newerrno : olderrno;
+
        return ret;
 }
 
index c69c992..9bd0793 100644 (file)
@@ -205,6 +205,8 @@ int pthread_join(pthread_t thread, void **retval)
                postBlockEnd();
        }
 
+    errno = (newerrno != 0) ? newerrno : olderrno;
+
        return ret;
 }
 
@@ -230,7 +232,10 @@ void pthread_exit(void *retval)
 
        PRE_PROBEBLOCK_END();
 
+    errno = (newerrno != 0) ? newerrno : olderrno;
+
        pthread_exitp(retval);
+
 }
 
 int pthread_cancel(pthread_t thread)