From: Jonathan Rajotte Date: Tue, 29 Sep 2020 15:46:24 +0000 (-0400) Subject: Introduce lttng_domain_type_str utility X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=c0374092ddafb9d5ea860665caf123bb17603226;p=lttng-tools.git Introduce lttng_domain_type_str utility Change-Id: I1d2c7be968da6658e93407cdba26a6042177badd Signed-off-by: Jonathan Rajotte Signed-off-by: Jérémie Galarneau --- diff --git a/include/Makefile.am b/include/Makefile.am index 658a56753..5a3b5b5f3 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -172,6 +172,7 @@ noinst_HEADERS = \ lttng/endpoint-internal.h \ lttng/notification/channel-internal.h \ lttng/channel-internal.h \ + lttng/domain-internal.h \ lttng/event-internal.h \ lttng/rotate-internal.h \ lttng/ref-internal.h \ diff --git a/include/lttng/domain-internal.h b/include/lttng/domain-internal.h new file mode 100644 index 000000000..877fa2892 --- /dev/null +++ b/include/lttng/domain-internal.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2020 Simon Marchi + * + * SPDX-License-Identifier: LGPL-2.1-only + * + */ + +#ifndef LTTNG_DOMAIN_INTERNAL_H +#define LTTNG_DOMAIN_INTERNAL_H + +#include "lttng/domain.h" +#include "common/macros.h" + +#ifdef __cplusplus +extern "C" { +#endif + +LTTNG_HIDDEN +const char *lttng_domain_type_str(enum lttng_domain_type domain_type); + +#ifdef __cplusplus +} +#endif + +#endif /* LTTNG_DOMAIN_INTERNAL_H */ diff --git a/src/common/Makefile.am b/src/common/Makefile.am index f6918b54c..0376e59d2 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -42,6 +42,7 @@ libcommon_la_SOURCES = \ credentials.c credentials.h \ daemonize.c daemonize.h \ defaults.c \ + domain.c \ dynamic-array.c dynamic-array.h \ dynamic-buffer.c dynamic-buffer.h \ endpoint.c \ diff --git a/src/common/domain.c b/src/common/domain.c new file mode 100644 index 000000000..277fc802a --- /dev/null +++ b/src/common/domain.c @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2020 Simon Marchi + * + * SPDX-License-Identifier: LGPL-2.1-only + * + */ + +#include "lttng/domain-internal.h" +#include "common/macros.h" + +LTTNG_HIDDEN +const char *lttng_domain_type_str(enum lttng_domain_type domain_type) +{ + switch (domain_type) { + case LTTNG_DOMAIN_NONE: + return "none"; + case LTTNG_DOMAIN_KERNEL: + return "kernel"; + case LTTNG_DOMAIN_UST: + return "ust"; + case LTTNG_DOMAIN_JUL: + return "jul"; + case LTTNG_DOMAIN_LOG4J: + return "log4j"; + case LTTNG_DOMAIN_PYTHON: + return "python"; + default: + return "???"; + } +}