Hi Minh,

Thanks. I will include it and push.

Best Regards,
ThuanTr

-----Original Message-----
From: Minh Hon Chau <minh.c...@dektech.com.au> 
Sent: Sunday, August 9, 2020 9:15 AM
To: Thuan Tran <thuan.t...@dektech.com.au>; Thang Duc Nguyen 
<thang.d.ngu...@dektech.com.au>
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] nid: fix opensafd fail to start under gcov enabled 
[#3209]

Hi Thuan,

ack from me.

Just find another compilation issue with gcc 9.2.1

make[2]: Entering directory '/home/minhchau/dek/osaftest/opensaf-code'
   CXX      src/base/lib_libopensaf_core_la-logtrace.lo
src/base/logtrace.cc:61:14: error: 'pid_t gettid()' was declared 
'extern' and later 'static' [-fpermissive]
    61 | static pid_t gettid() { return syscall(SYS_gettid); }

Can we add the below patch within this commit? Otherwise I can raise 
another ticket.

diff --git a/src/base/logtrace.cc b/src/base/logtrace.cc
index 9822879ab..31c9294e2 100644
--- a/src/base/logtrace.cc
+++ b/src/base/logtrace.cc
@@ -58,7 +58,7 @@ std::once_flag init_flag;
  thread_local LogTraceBuffer gl_thread_buffer{gl_local_thread_trace,
    global::thread_trace_buffer_size};

-static pid_t gettid() { return syscall(SYS_gettid); }
+static pid_t get_tid() { return syscall(SYS_gettid); }

  /**
   * USR2 signal handler to enable/disable trace (toggle)
@@ -83,7 +83,7 @@ void trace_output(const char *file, unsigned line, 
unsigned priority,
    assert(priority <= LOG_DEBUG && category < CAT_MAX);

    if (strncmp(file, "src/", 4) == 0) file += 4;
-  snprintf(preamble, sizeof(preamble), "%d:%s:%u %s %s", gettid(), 
file, line,
+  snprintf(preamble, sizeof(preamble), "%d:%s:%u %s %s", get_tid(), 
file, line,
             global::prefix_name[priority + category], format);
    // legacy trace
    if (is_logtrace_enabled(category)) {
@@ -110,7 +110,7 @@ void log_output(const char *file, unsigned line, 
unsigned priority,
    assert(priority <= LOG_DEBUG && category < CAT_MAX);

    if (strncmp(file, "src/", 4) == 0) file += 4;
-  snprintf(preamble, sizeof(preamble), "%d:%s:%u %s %s", gettid(), 
file, line,
+  snprintf(preamble, sizeof(preamble), "%d:%s:%u %s %s", get_tid(), 
file, line,
             global::prefix_name[priority + category], format);
    LogTraceClient::Log(gl_remote_osaflog,
        static_cast<base::LogMessage::Severity>(priority), preamble, ap);

Thanks

Minh

On 4/8/20 6:00 pm, thuan.tran wrote:
> - Fix amfd/sgproc.cc cause compile failed when configure enable gcov.
> - Waiting svc_monitor_thread ready in create_svc_monitor_thread to avoid
> lost svc_mon_thr_fd value which later cause opensafd fail to start.
> ---
>   src/amf/amfd/sgproc.cc |  3 +--
>   src/nid/nodeinit.cc    | 19 +++++++++----------
>   2 files changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/src/amf/amfd/sgproc.cc b/src/amf/amfd/sgproc.cc
> index 78ccb31f9..405e2c45d 100644
> --- a/src/amf/amfd/sgproc.cc
> +++ b/src/amf/amfd/sgproc.cc
> @@ -2624,9 +2624,8 @@ static uint32_t shutdown_contained_sus(AVD_CL_CB *cb, 
> AVD_SU *container_su,
>     }
>   
>   done:
> -  return rc;
> -
>     TRACE_LEAVE();
> +  return rc;
>   }
>   
>   
> /*****************************************************************************
> diff --git a/src/nid/nodeinit.cc b/src/nid/nodeinit.cc
> index d5b4eb20a..548c7fb46 100644
> --- a/src/nid/nodeinit.cc
> +++ b/src/nid/nodeinit.cc
> @@ -1612,6 +1612,15 @@ uint32_t create_svc_monitor_thread(void) {
>       return NCSCC_RC_FAILURE;
>     }
>   
> +  // Waiting until svc_monitor_thread is up and in ready state.
> +  unsigned no_repeat = 0;
> +  while (svc_monitor_thread_ready == false && no_repeat < 100) {
> +    osaf_nanosleep(&kHundredMilliseconds);
> +    no_repeat++;
> +  }
> +  osafassert(svc_monitor_thread_ready);
> +  LOG_NO("svc_monitor_thread is up and in ready state");
> +
>     TRACE_LEAVE();
>     return NCSCC_RC_SUCCESS;
>   }
> @@ -1662,16 +1671,6 @@ int main(int argc, char *argv[]) {
>       exit(EXIT_FAILURE);
>     }
>   
> -  // Waiting until svc_monitor_thread is up and in ready state.
> -  unsigned no_repeat = 0;
> -  while (svc_monitor_thread_ready == false && no_repeat < 100) {
> -    osaf_nanosleep(&kHundredMilliseconds);
> -    no_repeat++;
> -  }
> -
> -  osafassert(svc_monitor_thread_ready);
> -  LOG_NO("svc_monitor_thread is up and in ready state");
> -
>     if (parse_nodeinit_conf(sbuf) != NCSCC_RC_SUCCESS) {
>       LOG_ER("Failed to parse file %s. Exiting", sbuf);
>       exit(EXIT_FAILURE);

_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to