docs: Add supported versions and fix-backport policy
[lttng-tools.git] / src / common / thread.cpp
CommitLineData
cb8d0d24
MJ
1/*
2 * Copyright (C) 2020 Michael Jeanson <mjeanson@efficios.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1-only
5 *
6 */
7
28ab034a 8#include "thread.hpp"
cb8d0d24 9
c9e313bc 10#include <common/compat/pthread.hpp>
cb8d0d24 11
28ab034a 12#include <string.h>
cb8d0d24
MJ
13
14int lttng_thread_setname(const char *name)
15{
16 int ret;
17 char pthread_name[LTTNG_PTHREAD_NAMELEN];
18
19 /*
20 * Truncations are expected since pthread limits thread names to
21 * a generous 16 characters.
22 */
23 strncpy(pthread_name, name, sizeof(pthread_name));
24 pthread_name[sizeof(pthread_name) - 1] = '\0';
25
26 ret = lttng_pthread_setname_np(pthread_name);
27
28 return ret;
29}
This page took 0.052133 seconds and 4 git commands to generate.