From b35d179d7be2ab0cb4a9c698b86d78928089fc39 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 22 Aug 2011 15:35:10 -0400 Subject: [PATCH] Rename sessiond comm lib into ust comm Signed-off-by: Mathieu Desnoyers --- Makefile.am | 2 +- configure.ac | 2 +- include/Makefile.am | 2 +- ...lttng-sessiond-comm.h => lttng-ust-comm.h} | 93 +++++-------------- include/ust/lttng-ust-abi.h | 28 +++--- liblttng-sessiond-comm/Makefile.am | 6 -- liblttng-ust-comm/Makefile.am | 5 + .../lttng-ust-comm.c | 2 +- libust/Makefile.am | 2 +- libust/lttng-ust-abi.c | 9 +- libust/lttng-ust-comm.c | 8 +- 11 files changed, 53 insertions(+), 106 deletions(-) rename include/{lttng-sessiond-comm.h => lttng-ust-comm.h} (79%) delete mode 100644 liblttng-sessiond-comm/Makefile.am create mode 100644 liblttng-ust-comm/Makefile.am rename liblttng-sessiond-comm/lttng-sessiond-comm.c => liblttng-ust-comm/lttng-ust-comm.c (99%) diff --git a/Makefile.am b/Makefile.am index b163bf8..4f5ae8c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ ACLOCAL_AMFLAGS = -I config # libust and '.' (that contains the linker script). However, '.' # must be installed after libust so it can overwrite libust.so with # the linker script. -SUBDIRS = snprintf liblttng-sessiond-comm libringbuffer libust include doc tests +SUBDIRS = snprintf liblttng-ust-comm libringbuffer libust include doc tests #temporarily disabled # . libustinstr-malloc libustfork diff --git a/configure.ac b/configure.ac index 9926d73..ce24a1a 100644 --- a/configure.ac +++ b/configure.ac @@ -141,7 +141,7 @@ AC_CONFIG_FILES([ doc/man/Makefile doc/info/Makefile include/Makefile - liblttng-sessiond-comm/Makefile + liblttng-ust-comm/Makefile libringbuffer/Makefile libust/Makefile tests/Makefile diff --git a/include/Makefile.am b/include/Makefile.am index 3361b4e..a754d04 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -16,7 +16,7 @@ nobase_include_HEADERS = \ # note: usterr-signal-safe.h, core.h and share.h need namespace cleanup. noinst_HEADERS = \ - lttng-sessiond-comm.h \ + lttng-ust-comm.h \ usterr.h \ ust_snprintf.h \ ust/compat.h \ diff --git a/include/lttng-sessiond-comm.h b/include/lttng-ust-comm.h similarity index 79% rename from include/lttng-sessiond-comm.h rename to include/lttng-ust-comm.h index 71a1dd6..6914cc2 100644 --- a/include/lttng-sessiond-comm.h +++ b/include/lttng-ust-comm.h @@ -1,5 +1,5 @@ -#ifndef _LTTNG_SESSIOND_COMM_H -#define _LTTNG_SESSIOND_COMM_H +#ifndef _LTTNG_UST_COMM_H +#define _LTTNG_UST_COMM_H /* * Copyright (C) 2011 - David Goulet @@ -28,6 +28,7 @@ #include #include +#include #define LTTNG_RUNDIR "/var/run/lttng" @@ -40,42 +41,39 @@ /* Queue size of listen(2) */ #define MAX_LISTEN 10 -#define LTTNG_UST_COMM_VERSION_MAJOR 0 -#define LTTNG_UST_COMM_VERSION_MINOR 1 - /* Get the error code index from 0 since * LTTCOMM_OK start at 1000 */ #define LTTCOMM_ERR_INDEX(code) (code - LTTCOMM_OK) enum lttcomm_ust_command { - LTTNG_UST_CREATE_SESSION, - LTTNG_UST_RELEASE_SESSION, - LTTNG_UST_VERSION, - LTTNG_UST_LIST_TRACEPOINTS, - LTTNG_UST_WAIT_QUIESCENT, - LTTNG_UST_CALIBRATE, + UST_CREATE_SESSION, + UST_RELEASE_SESSION, + UST_VERSION, + UST_LIST_TRACEPOINTS, + UST_WAIT_QUIESCENT, + UST_CALIBRATE, /* Apply on session handle */ - LTTNG_UST_METADATA, /* release with LTTNG_UST_RELEASE_CHANNEL */ - LTTNG_UST_CHANNEL, - LTTNG_UST_RELEASE_CHANNEL, - LTTNG_UST_SESSION_START, - LTTNG_UST_SESSION_STOP, + UST_METADATA, /* release with UST_RELEASE_CHANNEL */ + UST_CHANNEL, + UST_RELEASE_CHANNEL, + UST_SESSION_START, + UST_SESSION_STOP, /* Apply on channel handle */ - LTTNG_UST_STREAM, - LTTNG_UST_RELEASE_STREAM, - LTTNG_UST_EVENT, - LTTNG_UST_RELEASE_EVENT, + UST_STREAM, + UST_RELEASE_STREAM, + UST_EVENT, + UST_RELEASE_EVENT, /* Apply on event and channel handle */ - LTTNG_UST_CONTEXT, - LTTNG_UST_RELEASE_CONTEXT, + UST_CONTEXT, + UST_RELEASE_CONTEXT, /* Apply on event, channel and session handle */ - LTTNG_UST_ENABLE, - LTTNG_UST_DISABLE, + UST_ENABLE, + UST_DISABLE, }; /* @@ -138,51 +136,6 @@ enum lttcomm_return_code { LTTCOMM_NR, /* Last element */ }; -#define LTTNG_SYM_NAME_LEN 128 - -enum lttng_ust_instrumentation { - LTTNG_UST_TRACEPOINT = 0, - LTTNG_UST_PROBE = 1, - LTTNG_UST_FUNCTION = 2, -}; - -enum lttng_ust_output { - LTTNG_UST_MMAP = 0, -}; - -struct lttng_ust_tracer_version { - uint32_t version; - uint32_t patchlevel; - uint32_t sublevel; -}; - -struct lttng_ust_channel { - int overwrite; /* 1: overwrite, 0: discard */ - uint64_t subbuf_size; /* in bytes */ - uint64_t num_subbuf; - unsigned int switch_timer_interval; /* usecs */ - unsigned int read_timer_interval; /* usecs */ - enum lttng_ust_output output; /* output mode */ -}; - -struct lttng_ust_event { - char name[LTTNG_SYM_NAME_LEN]; /* event name */ - enum lttng_ust_instrumentation instrumentation; - /* Per instrumentation type configuration */ - union { - } u; -}; - -enum lttng_ust_context_type { - LTTNG_KERNEL_CONTEXT_VTID = 0, -}; - -struct lttng_ust_context { - enum lttng_ust_context_type ctx; - union { - } u; -}; - /* * Data structure for the commands sent from sessiond to UST. */ @@ -221,4 +174,4 @@ extern ssize_t lttcomm_recv_unix_sock(int sock, void *buf, size_t len); extern ssize_t lttcomm_send_unix_sock(int sock, void *buf, size_t len); extern const char *lttcomm_get_readable_code(enum lttcomm_return_code code); -#endif /* _LTTNG_SESSIOND_COMM_H */ +#endif /* _LTTNG_UST_COMM_H */ diff --git a/include/ust/lttng-ust-abi.h b/include/ust/lttng-ust-abi.h index f8ba13e..16c49d1 100644 --- a/include/ust/lttng-ust-abi.h +++ b/include/ust/lttng-ust-abi.h @@ -15,20 +15,24 @@ #define LTTNG_UST_SYM_NAME_LEN 128 +#define LTTNG_UST_COMM_VERSION_MAJOR 0 +#define LTTNG_UST_COMM_VERSION_MINOR 1 + enum lttng_ust_instrumentation { LTTNG_UST_TRACEPOINT = 0, + LTTNG_UST_PROBE = 1, + LTTNG_UST_FUNCTION = 2, }; -/* - * LTTng consumer mode - */ enum lttng_ust_output { - LTTNG_UST_MMAP = 0, + LTTNG_UST_MMAP = 0, }; -/* - * LTTng DebugFS ABI structures. - */ +struct lttng_ust_tracer_version { + uint32_t version; + uint32_t patchlevel; + uint32_t sublevel; +}; struct lttng_ust_channel { int overwrite; /* 1: overwrite, 0: discard */ @@ -36,7 +40,7 @@ struct lttng_ust_channel { uint64_t num_subbuf; unsigned int switch_timer_interval; /* usecs */ unsigned int read_timer_interval; /* usecs */ - enum lttng_ust_output output; /* mmap */ + enum lttng_ust_output output; /* output mode */ }; struct lttng_ust_event { @@ -47,12 +51,6 @@ struct lttng_ust_event { } u; }; -struct lttng_ust_tracer_version { - uint32_t version; - uint32_t patchlevel; - uint32_t sublevel; -}; - enum lttng_ust_context_type { LTTNG_UST_CONTEXT_VTID = 0, }; @@ -95,4 +93,6 @@ struct lttng_ust_context { #define LTTNG_UST_ENABLE _UST_CMD(0x80) #define LTTNG_UST_DISABLE _UST_CMD(0x81) +void lttng_ust_abi_exit(void); + #endif /* _LTTNG_UST_ABI_H */ diff --git a/liblttng-sessiond-comm/Makefile.am b/liblttng-sessiond-comm/Makefile.am deleted file mode 100644 index 5ddd39c..0000000 --- a/liblttng-sessiond-comm/Makefile.am +++ /dev/null @@ -1,6 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir)/include - -noinst_LTLIBRARIES = liblttng-sessiond-comm.la - -liblttng_sessiond_comm_la_SOURCES = lttng-sessiond-comm.c \ - lttng-sessiond-comm.h diff --git a/liblttng-ust-comm/Makefile.am b/liblttng-ust-comm/Makefile.am new file mode 100644 index 0000000..2ae997c --- /dev/null +++ b/liblttng-ust-comm/Makefile.am @@ -0,0 +1,5 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include + +noinst_LTLIBRARIES = liblttng-ust-comm.la + +liblttng_ust_comm_la_SOURCES = lttng-ust-comm.c diff --git a/liblttng-sessiond-comm/lttng-sessiond-comm.c b/liblttng-ust-comm/lttng-ust-comm.c similarity index 99% rename from liblttng-sessiond-comm/lttng-sessiond-comm.c rename to liblttng-ust-comm/lttng-ust-comm.c index 53e7462..214f6e4 100644 --- a/liblttng-sessiond-comm/lttng-sessiond-comm.c +++ b/liblttng-ust-comm/lttng-ust-comm.c @@ -28,7 +28,7 @@ #include #include -#include +#include /* * Human readable error message. diff --git a/libust/Makefile.am b/libust/Makefile.am index d72d469..0a6834a 100644 --- a/libust/Makefile.am +++ b/libust/Makefile.am @@ -29,6 +29,6 @@ libust_la_LIBADD = \ -luuid \ $(top_builddir)/snprintf/libustsnprintf.la \ $(top_builddir)/libringbuffer/libringbuffer.la \ - $(top_builddir)/liblttng-sessiond-comm/liblttng-sessiond-comm.la + $(top_builddir)/liblttng-ust-comm/liblttng-ust-comm.la libust_la_CFLAGS = -DUST_COMPONENT="libust" -fno-strict-aliasing diff --git a/libust/lttng-ust-abi.c b/libust/lttng-ust-abi.c index 13b94c4..fee3d07 100644 --- a/libust/lttng-ust-abi.c +++ b/libust/lttng-ust-abi.c @@ -704,14 +704,7 @@ static const struct objd_ops lttng_event_ops = { .cmd = lttng_event_cmd, }; -void __attribute__((constructor)) lttng_ust_abi_init(void) -{ - init_usterr(); - /* TODO: initialize socket */ -} - -static -void __attribute__((destructor)) lttng_ust_abi_exit(void) +void lttng_ust_abi_exit(void) { /* TODO: teardown socket */ objd_table_destroy(); diff --git a/libust/lttng-ust-comm.c b/libust/lttng-ust-comm.c index e73d324..c9cb777 100644 --- a/libust/lttng-ust-comm.c +++ b/libust/lttng-ust-comm.c @@ -23,7 +23,8 @@ #include #include #include -#include +#include +#include #include #include @@ -79,13 +80,13 @@ int handle_message(int sock, struct lttcomm_ust_msg *lum) int ret; switch (lum->cmd_type) { - case LTTNG_UST_CREATE_SESSION: + case UST_CREATE_SESSION: { struct lttcomm_ust_reply lur; DBG("Handling create session message"); memset(&lur, 0, sizeof(lur)); - lur.cmd_type = LTTNG_UST_CREATE_SESSION; + lur.cmd_type = UST_CREATE_SESSION; /* ... */ ret = 0; @@ -224,4 +225,5 @@ void __attribute__((destructor)) lttng_ust_comm_exit(void) if (ret) { ERR("Error cancelling local ust listener thread"); } + lttng_ust_abi_exit(); } -- 2.34.1