qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/1] util/oslib: Returns real thread identifier on FreeBSD an


From: Thomas Huth
Subject: Re: [PATCH 1/1] util/oslib: Returns real thread identifier on FreeBSD and NetBSD
Date: Tue, 26 May 2020 07:40:00 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

On 23/05/2020 09.23, David CARLIER wrote:
> Hi this is my first contribution hope it s useful . Regards.

 Hi!

Thanks for your contribution. Some hints for getting your patch included:

- Please make sure to CC: the corresponding maintainers, otherwise your
patch might get lost in the high traffic of the mailing list. See the
MAINTAINERS file for more information.

- For simple patches like this one, it might also be helpful to CC:
address@hidden so that the patch could get picked up via the
trivial queue

> From ca7fcd85e0453f7173ce73732905463bc259ee32 Mon Sep 17 00:00:00 2001
> From: David Carlier <address@hidden>
> Date: Sat, 23 May 2020 08:17:51 +0100
> Subject: [PATCH] util/oslib: returns real thread identifier on FreeBSD and
>  NetBSD

The body of the mail should only contain a proper patch description, not
these head lines anymore, so that the patch can directly applied via
"git am". Please also add a proper description, e.g. saying what's the
effect of your patch. Is it just a cosmetic thing? Does it fix a real
bug that you've hit?

> Signed-off-by: David Carlier <address@hidden>
> ---
>  util/oslib-posix.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 062236a1ab..4d28dfd8f5 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -48,11 +48,13 @@
>  #ifdef __FreeBSD__
>  #include <sys/sysctl.h>
>  #include <sys/user.h>
> +#include <sys/thr.h>
>  #include <libutil.h>
>  #endif
> 
>  #ifdef __NetBSD__
>  #include <sys/sysctl.h>
> +#include <lwp.h>
>  #endif
> 
>  #include "qemu/mmap-alloc.h"
> @@ -84,6 +86,13 @@ int qemu_get_thread_id(void)
>  {
>  #if defined(__linux__)
>      return syscall(SYS_gettid);
> +#elif defined(__FreeBSD__)
> +    // thread id is up to INT_MAX

QEMU coding style only used /* ... */ comments, see the CODING_STYLE.rst
file.

> +    long tid;
> +    thr_self(&tid);
> +    return (int)tid;
> +#elif defined(__NetBSD__)
> +    return _lwp_self();
>  #else
>      return getpid();
>  #endif
> 

 HTH,
  Thomas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]