Fix: compat: 'LTTNG_UST_ABI_PROCNAME_LEN' is undeclared
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Tue, 29 Mar 2022 20:31:44 +0000 (16:31 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 6 Apr 2022 15:39:13 +0000 (11:39 -0400)
Observed issue
==============

On old systems, the `lttng_pthread_setname_np` function fallsback to
using the compat prctl version. In that context,
`LTTNG_UST_ABI_PROCNAME_LEN` is indeed not declared.

Solution
========

Use `LTTNG_PTHREAD_NAMELEN`. This mimics what is done in other versions
of `lttng_pthread_setname_np`.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I73956cacd7b1e9400881b17b1cd89db2530d3a00

src/common/compat/pthread.hpp

index 209cd275e330444236e432a63d0938f0fa813c4c..7883cd1ba303c5ecbcb88c5e842af6a3d7e0a61f 100644 (file)
@@ -60,7 +60,7 @@ static inline
 int lttng_pthread_setname_np(const char *name)
 {
        /* Replicate pthread_setname_np's behavior. */
-       if (strnlen(name, LTTNG_UST_ABI_PROCNAME_LEN) >= LTTNG_UST_ABI_PROCNAME_LEN) {
+       if (strnlen(name, LTTNG_PTHREAD_NAMELEN) >= LTTNG_PTHREAD_NAMELEN) {
                return ERANGE;
        }
        return prctl(PR_SET_NAME, name, 0, 0, 0);
This page took 0.02794 seconds and 5 git commands to generate.