baresip/re

pthread_getname_np() too few arguments to function call, expected 2, have 1

DenisPolygalov opened this issue · 2 comments

Hi,
this:

(void)pthread_setname_np(th.name);

contradicts documentation for both Linux:

https://man7.org/linux/man-pages/man3/pthread_setname_np.3.html

and FreeBSD. Note that the signature in FreeBSD version is this one:
int pthread_setname_np(pthread_t thread, const char *name);
I guess this is similar to what happened here:

mitsuba-renderer/mitsuba#39

I don't see any simple fix from my side, so hope you may consider to change this somehow...
Regards,
Denis.

This should fix the problem:

9d1b8d2

Thank you for the quick response, but it seems like there is a small issue with the fix.
This line:

(void)pthread_setname_np(th.thr, th.name);

gives me warning:
incompatible pointer types passing 'thrd_t *' (aka 'struct pthread **') to parameter of type 'pthread_t' (aka 'struct pthread *'); dereference with * [-Wincompatible-pointer-types]

I changed
(void)pthread_setname_np(th.thr, th.name);
to
(void)pthread_setname_np(*th.thr, th.name);
but I am not sure this solution is correct. The baresip compiles and runs though...
Could you please check and include into the next libre release if this is correct?
Regards,
Denis.