Hi Hans N,

It seems in some flavors of linux `gettid`  is available, so dose it be 
under #ifndef ?

-AVM

On 3/13/2017 5:46 PM, Hans Nordeback wrote:
>   src/base/logtrace.c |  7 ++++++-
>   1 files changed, 6 insertions(+), 1 deletions(-)
>
>
> Even though not being LSB it would be good to use thread id instead of 
> process id in trace.
>
> diff --git a/src/base/logtrace.c b/src/base/logtrace.c
> --- a/src/base/logtrace.c
> +++ b/src/base/logtrace.c
> @@ -48,6 +48,11 @@ static const char *ident;
>   static const char *pathname;
>   static int logmask;
>   
> +static pid_t gettid(void)
> +{
> +     return syscall(SYS_gettid);
> +}
> +
>   /**
>    * USR2 signal handler to enable/disable trace (toggle)
>    * @param sig
> @@ -100,7 +105,7 @@ void output_(const char *file, unsigned
>       i = snprintf(preamble, sizeof(preamble), "%s.%06ld %s ", log_string, 
> tv.tv_usec, ident);
>   
>       snprintf(&preamble[i], sizeof(preamble) - i, "[%d:%s:%04u] %s %s",
> -             getpid(), file, line, prefix_name[priority + category], format);
> +             gettid(), file, line, prefix_name[priority + category], format);
>       i = vsnprintf(log_string, sizeof(log_string), preamble, ap);
>   
>       /* Check if the logtrace user had passed message length >= logtrace 
> array limit of 1023.
>
> ------------------------------------------------------------------------------
> Announcing the Oxford Dictionaries API! The API offers world-renowned
> dictionary content that is easy and intuitive to access. Sign up for an
> account today to start using our lexical data to power your apps and
> projects. Get started today and enter our developer competition.
> http://sdm.link/oxford
> _______________________________________________
> Opensaf-devel mailing list
> Opensaf-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/opensaf-devel


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to