From 9dc7b7ff797a5cbb1e9ffd59e053a04562f306c4 Mon Sep 17 00:00:00 2001 From: Nils Carlson Date: Wed, 5 Jan 2011 13:53:43 +0100 Subject: [PATCH] Rename libustd to libustconsumer and ustd to ust-consumerd This is a fargoing but necessary renaming of some ust components. The point of the renaming is to allow for a new daemon, ustd, which will be able to keep track of tracing sessions and connect applications with consumers. Also, the current names were non-sensical. This patch is a step on the way towards creating a session daemon that can connect trace producers and consumers in a nice way. Signed-off-by: Nils Carlson --- .gitignore | 2 +- Makefile.am | 2 +- README | 10 ++- TODO | 2 +- configure.ac | 4 +- doc/Makefile.am | 2 +- doc/info/ust.texi | 10 +-- doc/man/Makefile.am | 4 +- doc/man/{ustd.1 => ust-consumerd.1} | 10 +-- doc/man/{ustd.1.md => ust-consumerd.1.md} | 8 +- doc/man/ustctl.1 | 4 +- doc/man/ustctl.1.md | 4 +- doc/man/usttrace.1 | 2 +- doc/man/usttrace.1.md | 2 +- include/Makefile.am | 2 +- include/ust/{ustd.h => ustconsumer.h} | 76 +++++++++---------- libust/tracectl.c | 14 ++-- libustcmd/ustcmd.c | 2 +- libustconsumer/Makefile.am | 16 ++++ .../libustconsumer.c | 50 ++++++------ {libustd => libustconsumer}/lowlevel.c | 4 +- {libustd => libustconsumer}/lowlevel.h | 4 +- libustd/Makefile.am | 17 ----- tests/manual_mode_tracing.sh | 10 +-- tests/runtests | 2 +- ...rind_ustd.sh => valgrind_ust-consumerd.sh} | 16 ++-- ust-consumerd/Makefile.am | 14 ++++ ust-consumerd/README | 3 + ustd/ustd.c => ust-consumerd/ust-consumerd.c | 52 ++++++------- ustd/Makefile.am | 14 ---- ustd/README | 3 - usttrace | 46 +++++------ 32 files changed, 207 insertions(+), 204 deletions(-) rename doc/man/{ustd.1 => ust-consumerd.1} (73%) rename doc/man/{ustd.1.md => ust-consumerd.1.md} (76%) rename include/ust/{ustd.h => ustconsumer.h} (75%) create mode 100644 libustconsumer/Makefile.am rename libustd/libustd.c => libustconsumer/libustconsumer.c (93%) rename {libustd => libustconsumer}/lowlevel.c (97%) rename {libustd => libustconsumer}/lowlevel.h (89%) delete mode 100644 libustd/Makefile.am rename tests/{valgrind_ustd.sh => valgrind_ust-consumerd.sh} (73%) create mode 100644 ust-consumerd/Makefile.am create mode 100644 ust-consumerd/README rename ustd/ustd.c => ust-consumerd/ust-consumerd.c (86%) delete mode 100644 ustd/Makefile.am delete mode 100644 ustd/README diff --git a/.gitignore b/.gitignore index 020c2f4..9935f11 100644 --- a/.gitignore +++ b/.gitignore @@ -23,4 +23,4 @@ stamp-h1 libtool ustctl/ustctl -ustd/ustd +ust-consumerd/ust-consumerd diff --git a/Makefile.am b/Makefile.am index 5132d59..249bf02 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 libustcomm libustcmd libust . tests libustinstr-malloc libustd ustd ustctl libustfork include doc +SUBDIRS = snprintf libustcomm libustcmd libust . tests libustinstr-malloc libustconsumer ust-consumerd ustctl libustfork include doc EXTRA_DIST = libust.ldscript.in libust-initializer.c libust-initializer.h dist_bin_SCRIPTS = usttrace diff --git a/README b/README index 8eaf618..a381c95 100644 --- a/README +++ b/README @@ -61,7 +61,7 @@ PACKAGE CONTENTS: - include The public header files that will be installed on the system. - - ustd + - ust-consumerd The daemon that collects trace data and writes it to the disk. - doc @@ -83,8 +83,12 @@ PACKAGE CONTENTS: A library to control tracing in other processes. Used by ustctl. - libustcomm - A static library shared between libust, ustd and libustcmd, that provides - functions that allow these components to communicate together. + A static library shared between libust, ust-consumerd and libustcmd, that + provides functions that allow these components to communicate together. + + - libustconsumer + A library to create ust consumers by registering callbacks, used by + ust-consumerd. - snprintf An asynchronous signal-safe version of snprintf. diff --git a/TODO b/TODO index 46d5b64..0d07589 100644 --- a/TODO +++ b/TODO @@ -19,7 +19,7 @@ - save_registers: save them only when the marker is active (complicated because we need to know their value at the address that is put in struct marker) - make streaming work, including periodical flush - make a system (signal-based?) that allow the listener thread to not be started initially -- ustd should work as a pool of threads +- ust-consumerd should work as a pool of threads - support more than one marker with the same channel and name on the same line? - make a mode where the listener thread can poll buffers to check if they are ready to be collected This is to guarantee there will never be a system call in the tracing path. Currently there is a system diff --git a/configure.ac b/configure.ac index 189ab12..b6cf946 100644 --- a/configure.ac +++ b/configure.ac @@ -129,8 +129,8 @@ AC_CONFIG_FILES([ tests/ustcmd_function_tests/Makefile libustinstr-malloc/Makefile libustfork/Makefile - libustd/Makefile - ustd/Makefile + libustconsumer/Makefile + ust-consumerd/Makefile ustctl/Makefile libustcomm/Makefile libustcmd/Makefile diff --git a/doc/Makefile.am b/doc/Makefile.am index 37a55ac..463203c 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1 +1 @@ -SUBDIRS = man info \ No newline at end of file +SUBDIRS = man info diff --git a/doc/info/ust.texi b/doc/info/ust.texi index e0565f3..a0ccdf1 100644 --- a/doc/info/ust.texi +++ b/doc/info/ust.texi @@ -92,7 +92,7 @@ Components licensed as GPL v2: @itemize @bullet @item ustctl @item libustcmd -@item ustd +@item ust-consumerd @end itemize @node Supported platforms @@ -112,7 +112,7 @@ The following packages are required: @item ust -This contains the tracing library, the ustd daemon, trace control tools +This contains the tracing library, the ust-consumerd daemon, trace control tools and other helper tools. Repository: @url{http://git.dorsal.polymtl.ca} @@ -385,11 +385,11 @@ First the daemon must be started. # Make sure the directory for the communication sockets exists. $ mkdir /tmp/ustsocks -# Make sure the directory where ustd will write the trace exists. +# Make sure the directory where ust-consumerd will write the trace exists. $ mkdir /tmp/trace # Start the daemon -$ ustd +$ ust-consumerd # We assume the program we want to trace is already running and that # it has pid 1234. @@ -543,7 +543,7 @@ the application (or library) being linked to libust. Libust is initialized by a constructor, which by definition runs before the @code{main()} function of the application starts. This constructor creates a thread called the @emph{listener thread}. The listener thread initializes a -named socket and waits for connections for ustd or ustctl. +named socket and waits for connections for ust-consumerd or ustctl. Libust-specific code may: @itemize @bullet diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index 7e18b8e..5adbba4 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am @@ -1,2 +1,2 @@ -EXTRA_DIST = ustctl.1 ustd.1 usttrace.1 -man_MANS = ustctl.1 ustd.1 usttrace.1 +EXTRA_DIST = ustctl.1 ust-consumerd.1 usttrace.1 +man_MANS = ustctl.1 ust-consumerd.1 usttrace.1 diff --git a/doc/man/ustd.1 b/doc/man/ust-consumerd.1 similarity index 73% rename from doc/man/ustd.1 rename to doc/man/ust-consumerd.1 index f423978..c6ce6a4 100644 --- a/doc/man/ustd.1 +++ b/doc/man/ust-consumerd.1 @@ -1,16 +1,16 @@ .\" generated with Ronn/v0.5 .\" http://github.com/rtomayko/ronn/ . -.TH "USTD" "1" "May 2010" "" "" +.TH "UST-CONSUMERD" "1" "May 2010" "" "" . .SH "NAME" -\fBustd\fR \-\- a daemon that collects trace data and writes it to the disk +\fBust-consumerd\fR \-\- a daemon that collects trace data and writes it to the disk . .SH "SYNOPSIS" -\fBustd\fR [\fIoptions\fR] +\fBust-consumerd\fR [\fIoptions\fR] . .SH "DESCRIPTION" -\fBustd\fR is a program that collects trace data and writes it to the disk. +\fBust-consumerd\fR is a program that collects trace data and writes it to the disk. . .SH "OPTIONS" These programs follow the usual GNU command line syntax, with long options @@ -44,7 +44,7 @@ Show version of program. ustctl(1), usttrace(1) . .SH "AUTHOR" -\fBustd\fR was written by Pierre\-Marc Fournier. +\fBust-consumerd\fR was written by Pierre\-Marc Fournier. . .P This manual page was written by Jon Bernard , for diff --git a/doc/man/ustd.1.md b/doc/man/ust-consumerd.1.md similarity index 76% rename from doc/man/ustd.1.md rename to doc/man/ust-consumerd.1.md index 296d1c4..1b93f47 100644 --- a/doc/man/ustd.1.md +++ b/doc/man/ust-consumerd.1.md @@ -1,13 +1,13 @@ -ustd(1) -- a daemon that collects trace data and writes it to the disk +ust-consumerd(1) -- a daemon that collects trace data and writes it to the disk ====================================================================== ## SYNOPSIS -`ustd` [] +`ust-consumerd` [] ## DESCRIPTION -`ustd` is a program that collects trace data and writes it to the disk. +`ust-consumerd` is a program that collects trace data and writes it to the disk. ## OPTIONS @@ -38,7 +38,7 @@ ustctl(1), usttrace(1) ## AUTHOR -`ustd` was written by Pierre-Marc Fournier. +`ust-consumerd` was written by Pierre-Marc Fournier. This manual page was written by Jon Bernard <jbernard@debian.org>, for the Debian project (and may be used by others). diff --git a/doc/man/ustctl.1 b/doc/man/ustctl.1 index 4f171c6..b0f97d9 100644 --- a/doc/man/ustctl.1 +++ b/doc/man/ustctl.1 @@ -114,7 +114,7 @@ have flushed to the disk the full contents of the buffer yet. .P Finally, when \fB\-\-destroy\-trace\fR is used, the trace buffers are unallocated. However, the memory may not be effectively freed until the daemon finishes to -collect them. When the trace is being collected by \fBustd\fR, this command +collect them. When the trace is being collected by \fBust-consumerd\fR, this command guarantees its full contents is flushed to the disk. . .SH "STRUCTURE OF A TRACE" @@ -139,7 +139,7 @@ for a given channel may be chosen with \fB\-\-set\-subbuf\-size\fR while the sub count is set with \fB\-\-set\-subbuf\-num\fR. . .SH "SEE ALSO" -usttrace(1), ustd(1) +usttrace(1), ust-consumerd(1) . .SH "AUTHOR" \fBustctl\fR was written by Pierre\-Marc Fournier. diff --git a/doc/man/ustctl.1.md b/doc/man/ustctl.1.md index 208e1dd..c8ad1f1 100644 --- a/doc/man/ustctl.1.md +++ b/doc/man/ustctl.1.md @@ -92,7 +92,7 @@ have flushed to the disk the full contents of the buffer yet. Finally, when `--destroy-trace` is used, the trace buffers are unallocated. However, the memory may not be effectively freed until the daemon finishes to -collect them. When the trace is being collected by `ustd`, this command +collect them. When the trace is being collected by `ust-consumerd`, this command guarantees its full contents is flushed to the disk. ## STRUCTURE OF A TRACE @@ -118,7 +118,7 @@ count is set with `--set-subbuf-num`. ## SEE ALSO -usttrace(1), ustd(1) +usttrace(1), ust-consumerd(1) ## AUTHOR diff --git a/doc/man/usttrace.1 b/doc/man/usttrace.1 index e789e45..a56cfc4 100644 --- a/doc/man/usttrace.1 +++ b/doc/man/usttrace.1 @@ -91,7 +91,7 @@ Specify the number of subbuffers. Print the location of the last trace saved in the usttrace output directory. . .SH "SEE ALSO" -ustctl(1), ustd(1) +ustctl(1), ust-consumerd(1) . .SH "AUTHOR" \fBusttrace\fR was written by Pierre\-Marc Fournier. diff --git a/doc/man/usttrace.1.md b/doc/man/usttrace.1.md index 34acb36..75cff9a 100644 --- a/doc/man/usttrace.1.md +++ b/doc/man/usttrace.1.md @@ -64,7 +64,7 @@ starting with two dashes(`-'). A summary of options is included below. ## SEE ALSO -ustctl(1), ustd(1) +ustctl(1), ust-consumerd(1) ## AUTHOR diff --git a/include/Makefile.am b/include/Makefile.am index 0ace775..400e8b1 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -18,6 +18,6 @@ nobase_include_HEADERS = \ ust/kcompat/types.h \ ust/kcompat/stringify.h \ ust/ustcmd.h \ - ust/ustd.h + ust/ustconsumer.h noinst_HEADERS = share.h usterr.h ust_snprintf.h diff --git a/include/ust/ustd.h b/include/ust/ustconsumer.h similarity index 75% rename from include/ust/ustd.h rename to include/ust/ustconsumer.h index 6336e69..e07b75e 100644 --- a/include/ust/ustd.h +++ b/include/ust/ustconsumer.h @@ -1,5 +1,5 @@ /* - * libustd header file + * libustconsumer header file * * Copyright 2005-2010 - * Mathieu Desnoyers @@ -23,15 +23,15 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef USTD_H -#define USTD_H +#ifndef _USTCONSUMER_H +#define _USTCONSUMER_H #include #include #include #include -#define USTD_DEFAULT_TRACE_PATH "/tmp/usttrace" +#define USTCONSUMER_DEFAULT_TRACE_PATH "/tmp/usttrace" struct ustcomm_sock; @@ -68,15 +68,15 @@ struct buffer_info { void *user_data; }; -struct libustd_callbacks; +struct ustconsumer_callbacks; /** - * struct libustd_instance - Contains the data associated with a trace instance. + * struct ustconsumer_instance - Contains the data associated with a trace instance. * The lib user can read but MUST NOT change any attributes but callbacks. * @callbacks: Contains the necessary callbacks for a tracing session. */ -struct libustd_instance { - struct libustd_callbacks *callbacks; +struct ustconsumer_instance { + struct ustconsumer_callbacks *callbacks; int quit_program; int is_init; struct cds_list_head connections; @@ -88,11 +88,11 @@ struct libustd_instance { }; /** -* struct libustd_callbacks - Contains the necessary callbacks for a tracing +* struct ustconsumer_callbacks - Contains the necessary callbacks for a tracing * session. The user can set the unnecessary functions to NULL if he does not * need them. */ -struct libustd_callbacks { +struct ustconsumer_callbacks { /** * on_open_buffer - Is called after a buffer is attached to process memory * @@ -104,7 +104,7 @@ struct libustd_callbacks { * * It has to be thread safe, because it is called by many threads. */ - int (*on_open_buffer)(struct libustd_callbacks *data, + int (*on_open_buffer)(struct ustconsumer_callbacks *data, struct buffer_info *buf); /** @@ -118,7 +118,7 @@ struct libustd_callbacks { * * It has to be thread safe, because it is called by many threads. */ - int (*on_close_buffer)(struct libustd_callbacks *data, + int (*on_close_buffer)(struct ustconsumer_callbacks *data, struct buffer_info *buf); /** @@ -132,7 +132,7 @@ struct libustd_callbacks { * * It has to be thread safe, because it is called by many threads. */ - int (*on_read_subbuffer)(struct libustd_callbacks *data, + int (*on_read_subbuffer)(struct ustconsumer_callbacks *data, struct buffer_info *buf); /** @@ -149,7 +149,7 @@ struct libustd_callbacks { * * It has to be thread safe, because it is called by many threads. */ - int (*on_read_partial_subbuffer)(struct libustd_callbacks *data, + int (*on_read_partial_subbuffer)(struct ustconsumer_callbacks *data, struct buffer_info *buf, long subbuf_index, unsigned long valid_length); @@ -166,7 +166,7 @@ struct libustd_callbacks { * * It has to be thread safe, because it is called by many threads. */ - int (*on_put_error)(struct libustd_callbacks *data, + int (*on_put_error)(struct ustconsumer_callbacks *data, struct buffer_info *buf); /** @@ -179,7 +179,7 @@ struct libustd_callbacks { * * It has to be thread safe, because it is called by many threads. */ - int (*on_new_thread)(struct libustd_callbacks *data); + int (*on_new_thread)(struct ustconsumer_callbacks *data); /** * on_close_thread - Is called just before a thread is destroyed @@ -191,7 +191,7 @@ struct libustd_callbacks { * * It has to be thread safe, because it is called by many threads. */ - int (*on_close_thread)(struct libustd_callbacks *data); + int (*on_close_thread)(struct ustconsumer_callbacks *data); /** * on_trace_end - Is called at the very end of the tracing session. At @@ -205,9 +205,9 @@ struct libustd_callbacks { * * After this callback is called, no other callback will be called * again and the tracing instance will be deleted automatically by - * libustd. After this call, the user must not use the libustd instance. + * libustconsumer. After this call, the user must not use the libustconsumer instance. */ - int (*on_trace_end)(struct libustd_instance *instance); + int (*on_trace_end)(struct ustconsumer_instance *instance); /** * The library's data. @@ -216,7 +216,7 @@ struct libustd_callbacks { }; /** - * libustd_new_instance - Is called to create a new tracing session. + * ustconsumer_new_instance - Is called to create a new tracing session. * * @callbacks: Pointer to a callbacks structure that contain the user * callbacks and data. @@ -224,48 +224,48 @@ struct libustd_callbacks { * * Returns the instance if the function succeeds else NULL. */ -struct libustd_instance * -libustd_new_instance( - struct libustd_callbacks *callbacks, char *sock_path); +struct ustconsumer_instance * +ustconsumer_new_instance( + struct ustconsumer_callbacks *callbacks, char *sock_path); /** - * libustd_delete_instance - Is called to free a libustd_instance struct + * ustconsumer_delete_instance - Is called to free a ustconsumer_instance struct * * @instance: The tracing session instance that needs to be freed. * * This function should only be called if the instance has not been started, - * as it will automatically be called at the end of libustd_start_instance. + * as it will automatically be called at the end of ustconsumer_start_instance. */ -void libustd_delete_instance(struct libustd_instance *instance); +void ustconsumer_delete_instance(struct ustconsumer_instance *instance); /** - * libustd_init_instance - Is called to initiliaze a new tracing session + * ustconsumer_init_instance - Is called to initiliaze a new tracing session * * @instance: The tracing session instance that needs to be started. * * Returns 0 if the function succeeds. * - * This function must be called between libustd_new_instance and - * libustd_start_instance. It sets up the communication between the library + * This function must be called between ustconsumer_new_instance and + * ustconsumer_start_instance. It sets up the communication between the library * and the tracing application. */ -int libustd_init_instance(struct libustd_instance *instance); +int ustconsumer_init_instance(struct ustconsumer_instance *instance); /** - * libustd_start_instance - Is called to start a new tracing session. + * ustconsumer_start_instance - Is called to start a new tracing session. * * @instance: The tracing session instance that needs to be started. * * Returns 0 if the function succeeds. * * This is a blocking function. The caller will be blocked on it until the - * tracing session is stopped by the user using libustd_stop_instance or until + * tracing session is stopped by the user using ustconsumer_stop_instance or until * the traced application terminates */ -int libustd_start_instance(struct libustd_instance *instance); +int ustconsumer_start_instance(struct ustconsumer_instance *instance); /** - * libustd_stop_instance - Is called to stop a tracing session. + * ustconsumer_stop_instance - Is called to stop a tracing session. * * @instance: The tracing session instance that needs to be stoped. * @send_msg: If true, a message will be sent to the listening thread through @@ -276,12 +276,12 @@ int libustd_start_instance(struct libustd_instance *instance); * * Returns 0 if the function succeeds. * - * This function returns immediately, it only tells libustd to stop the + * This function returns immediately, it only tells libustconsumer to stop the * instance. The on_trace_end callback will be called when the tracing session - * will really be stopped. The instance is deleted automatically by libustd + * will really be stopped. The instance is deleted automatically by libustconsumer * after on_trace_end is called. */ -int libustd_stop_instance(struct libustd_instance *instance, int send_msg); +int ustconsumer_stop_instance(struct ustconsumer_instance *instance, int send_msg); -#endif /* USTD_H */ +#endif /* _USTCONSUMER_H */ diff --git a/libust/tracectl.c b/libust/tracectl.c index a7da945..b783c76 100644 --- a/libust/tracectl.c +++ b/libust/tracectl.c @@ -122,10 +122,10 @@ static void print_trace_events(FILE *fp) unlock_trace_events(); } -static int connect_ustd(void) +static int connect_ustconsumer(void) { int result, fd; - char default_daemon_path[] = SOCK_DIR "/ustd"; + char default_daemon_path[] = SOCK_DIR "/ustconsumer"; char *explicit_daemon_path, *daemon_path; explicit_daemon_path = getenv("UST_DAEMON_SOCKET"); @@ -139,7 +139,7 @@ static int connect_ustd(void) result = ustcomm_connect_path(daemon_path, &fd); if (result < 0) { - WARN("connect_ustd failed, daemon_path: %s", + WARN("connect_ustconsumer failed, daemon_path: %s", daemon_path); return result; } @@ -194,12 +194,12 @@ static void inform_consumer_daemon(const char *trace_name) struct ust_trace *trace; const char *ch_name; - sock = connect_ustd(); + sock = connect_ustconsumer(); if (sock < 0) { return; } - DBG("Connected to ustd"); + DBG("Connected to ustconsumer"); ltt_lock_traces(); @@ -1007,7 +1007,7 @@ static void process_client_cmd(struct ustcomm_header *recv_header, if (!sock_path_env) { result = ustcomm_pack_single_field(reply_header, sock_msg, - SOCK_DIR "/ustd"); + SOCK_DIR "/ustconsumer"); } else { result = ustcomm_pack_single_field(reply_header, @@ -1496,7 +1496,7 @@ static void stop_listener(void) } /* This destructor keeps the process alive for a few seconds in order - * to leave time to ustd to connect to its buffers. This is necessary + * to leave time for ustconsumer to connect to its buffers. This is necessary * for programs whose execution is very short. It is also useful in all * programs when tracing is started close to the end of the program * execution. diff --git a/libustcmd/ustcmd.c b/libustcmd/ustcmd.c index 2c16e75..62c117f 100644 --- a/libustcmd/ustcmd.c +++ b/libustcmd/ustcmd.c @@ -104,7 +104,7 @@ pid_t *ustcmd_get_online_pids(void) } if (dirent->d_type != DT_DIR && - !!strcmp(dirent->d_name, "ustd")) { + !!strcmp(dirent->d_name, "ust-consumer")) { sscanf(dirent->d_name, "%u", (unsigned int *) &ret[i]); /* FIXME: Here we previously called pid_is_online, which diff --git a/libustconsumer/Makefile.am b/libustconsumer/Makefile.am new file mode 100644 index 0000000..1f87479 --- /dev/null +++ b/libustconsumer/Makefile.am @@ -0,0 +1,16 @@ +AM_CPPFLAGS = -I$(top_srcdir)/libust -I$(top_srcdir)/libustcomm \ + -I$(top_srcdir)/include +AM_CFLAGS = -fno-strict-aliasing + +lib_LTLIBRARIES = libustconsumer.la + +libustconsumer_la_SOURCES = libustconsumer.c lowlevel.c lowlevel.h + +libustconsumer_la_LDFLAGS = -no-undefined -version-info 0:0:0 + +libustconsumer_la_LIBADD = \ + -lpthread \ + $(top_builddir)/snprintf/libustsnprintf.la \ + $(top_builddir)/libustcomm/libustcomm.la + +libustconsumer_la_CFLAGS = -fno-strict-aliasing diff --git a/libustd/libustd.c b/libustconsumer/libustconsumer.c similarity index 93% rename from libustd/libustd.c rename to libustconsumer/libustconsumer.c index 0dc6940..6cb3dbf 100644 --- a/libustd/libustd.c +++ b/libustconsumer/libustconsumer.c @@ -32,7 +32,7 @@ #include #include -#include +#include #include "lowlevel.h" #include "usterr.h" #include "ustcomm.h" @@ -140,7 +140,7 @@ static int put_subbuffer(struct buffer_info *buf) void decrement_active_buffers(void *arg) { - struct libustd_instance *instance = arg; + struct ustconsumer_instance *instance = arg; pthread_mutex_lock(&instance->mutex); instance->active_buffers--; pthread_mutex_unlock(&instance->mutex); @@ -284,7 +284,7 @@ static int notify_buffer_mapped(int sock, struct buffer_info *buf) } -struct buffer_info *connect_buffer(struct libustd_instance *instance, pid_t pid, +struct buffer_info *connect_buffer(struct ustconsumer_instance *instance, pid_t pid, const char *trace, const char *channel, int channel_cpu) { @@ -417,7 +417,7 @@ free_buf: return NULL; } -static void destroy_buffer(struct libustd_callbacks *callbacks, +static void destroy_buffer(struct ustconsumer_callbacks *callbacks, struct buffer_info *buf) { int result; @@ -443,7 +443,7 @@ static void destroy_buffer(struct libustd_callbacks *callbacks, free(buf); } -int consumer_loop(struct libustd_instance *instance, struct buffer_info *buf) +int consumer_loop(struct ustconsumer_instance *instance, struct buffer_info *buf) { int result, read_result; char read_buf; @@ -520,7 +520,7 @@ struct consumer_thread_args { const char *trace; const char *channel; int channel_cpu; - struct libustd_instance *instance; + struct ustconsumer_instance *instance; }; void *consumer_thread(void *arg) @@ -576,7 +576,7 @@ void *consumer_thread(void *arg) return NULL; } -int start_consuming_buffer(struct libustd_instance *instance, pid_t pid, +int start_consuming_buffer(struct ustconsumer_instance *instance, pid_t pid, const char *trace, const char *channel, int channel_cpu) { @@ -616,7 +616,7 @@ int start_consuming_buffer(struct libustd_instance *instance, pid_t pid, return 0; } static void process_client_cmd(int sock, struct ustcomm_header *req_header, - char *recvbuf, struct libustd_instance *instance) + char *recvbuf, struct ustconsumer_instance *instance) { int result; struct ustcomm_header _res_header; @@ -665,7 +665,7 @@ static void process_client_cmd(int sock, struct ustcomm_header *req_header, #define MAX_EVENTS 10 -int libustd_start_instance(struct libustd_instance *instance) +int ustconsumer_start_instance(struct ustconsumer_instance *instance) { struct ustcomm_header recv_hdr; char recv_buf[USTCOMM_BUFFER_SIZE]; @@ -675,7 +675,7 @@ int libustd_start_instance(struct libustd_instance *instance) int result, epoll_fd, accept_fd, nfds, i, addr_size, timeout; if(!instance->is_init) { - ERR("libustd instance not initialized"); + ERR("libustconsumer instance not initialized"); return 1; } epoll_fd = instance->epoll_fd; @@ -688,7 +688,7 @@ int libustd_start_instance(struct libustd_instance *instance) if (nfds == -1 && errno == EINTR) { /* Caught signal */ } else if (nfds == -1) { - PERROR("libustd_start_instance: epoll_wait failed"); + PERROR("ustconsumer_start_instance: epoll_wait failed"); continue; } @@ -700,7 +700,7 @@ int libustd_start_instance(struct libustd_instance *instance) &addr, (socklen_t *)&addr_size); if (accept_fd == -1) { - PERROR("libustd_start_instance: " + PERROR("ustconsumer_start_instance: " "accept failed"); continue; } @@ -734,13 +734,13 @@ int libustd_start_instance(struct libustd_instance *instance) if(instance->callbacks->on_trace_end) instance->callbacks->on_trace_end(instance); - libustd_delete_instance(instance); + ustconsumer_delete_instance(instance); return 0; } /* FIXME: threads and connections !? */ -void libustd_delete_instance(struct libustd_instance *instance) +void ustconsumer_delete_instance(struct ustconsumer_instance *instance) { if (instance->is_init) { ustcomm_del_named_sock(instance->listen_sock, 0); @@ -755,7 +755,7 @@ void libustd_delete_instance(struct libustd_instance *instance) /* FIXME: Do something about the fixed path length, maybe get rid * of the whole concept and use a pipe? */ -int libustd_stop_instance(struct libustd_instance *instance, int send_msg) +int ustconsumer_stop_instance(struct ustconsumer_instance *instance, int send_msg) { int result; int fd; @@ -796,12 +796,12 @@ int libustd_stop_instance(struct libustd_instance *instance, int send_msg) return 0; } -struct libustd_instance -*libustd_new_instance(struct libustd_callbacks *callbacks, +struct ustconsumer_instance +*ustconsumer_new_instance(struct ustconsumer_callbacks *callbacks, char *sock_path) { - struct libustd_instance *instance = - zmalloc(sizeof(struct libustd_instance)); + struct ustconsumer_instance *instance = + zmalloc(sizeof(struct ustconsumer_instance)); if(!instance) { return NULL; } @@ -821,13 +821,13 @@ struct libustd_instance return instance; } -static int init_ustd_socket(struct libustd_instance *instance) +static int init_ustconsumer_socket(struct ustconsumer_instance *instance) { char *name; if (instance->sock_path) { if (asprintf(&name, "%s", instance->sock_path) < 0) { - ERR("ustcomm_init_ustd : asprintf failed (sock_path %s)", + ERR("ustcomm_init_ustconsumer : asprintf failed (sock_path %s)", instance->sock_path); return -1; } @@ -841,8 +841,8 @@ static int init_ustd_socket(struct libustd_instance *instance) return -1; } - if (asprintf(&name, "%s/%s", SOCK_DIR, "ustd") < 0) { - ERR("ustcomm_init_ustd : asprintf failed (%s/ustd)", + if (asprintf(&name, "%s/%s", SOCK_DIR, "ustconsumer") < 0) { + ERR("ustcomm_init_ustconsumer : asprintf failed (%s/ustconsumer)", SOCK_DIR); return -1; } @@ -877,10 +877,10 @@ free_name: return -1; } -int libustd_init_instance(struct libustd_instance *instance) +int ustconsumer_init_instance(struct ustconsumer_instance *instance) { int result; - result = init_ustd_socket(instance); + result = init_ustconsumer_socket(instance); if(result == -1) { ERR("failed to initialize socket"); return 1; diff --git a/libustd/lowlevel.c b/libustconsumer/lowlevel.c similarity index 97% rename from libustd/lowlevel.c rename to libustconsumer/lowlevel.c index a8abf92..7eb124b 100644 --- a/libustd/lowlevel.c +++ b/libustconsumer/lowlevel.c @@ -19,7 +19,7 @@ #include #include -#include "ust/ustd.h" +#include "ust/ustconsumer.h" #include "buffers.h" #include "tracer.h" #include "usterr.h" @@ -62,7 +62,7 @@ size_t subbuffer_data_size(void *subbuf) } -void finish_consuming_dead_subbuffer(struct libustd_callbacks *callbacks, struct buffer_info *buf) +void finish_consuming_dead_subbuffer(struct ustconsumer_callbacks *callbacks, struct buffer_info *buf) { struct ust_buffer *ustbuf = buf->bufstruct_mem; diff --git a/libustd/lowlevel.h b/libustconsumer/lowlevel.h similarity index 89% rename from libustd/lowlevel.h rename to libustconsumer/lowlevel.h index a1d8da5..6ae6476 100644 --- a/libustd/lowlevel.h +++ b/libustconsumer/lowlevel.h @@ -26,9 +26,9 @@ #ifndef LOWLEVEL_H #define LOWLEVEL_H -#include +#include "ust/ustconsumer.h" -void finish_consuming_dead_subbuffer(struct libustd_callbacks *callbacks, struct buffer_info *buf); +void finish_consuming_dead_subbuffer(struct ustconsumer_callbacks *callbacks, struct buffer_info *buf); size_t subbuffer_data_size(void *subbuf); #endif /* LOWLEVEL_H */ diff --git a/libustd/Makefile.am b/libustd/Makefile.am deleted file mode 100644 index 1b9a961..0000000 --- a/libustd/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir)/libust -I$(top_srcdir)/libustcomm \ - -I$(top_srcdir)/include -AM_CFLAGS = -fno-strict-aliasing - -lib_LTLIBRARIES = libustd.la - -libustd_la_SOURCES = libustd.c lowlevel.c lowlevel.h - -libustd_la_LDFLAGS = -no-undefined -version-info 0:0:0 - -libustd_la_LIBADD = \ - -lpthread \ - $(top_builddir)/snprintf/libustsnprintf.la \ - $(top_builddir)/libustcomm/libustcomm.la - -libustd_la_CFLAGS = -fno-strict-aliasing - diff --git a/tests/manual_mode_tracing.sh b/tests/manual_mode_tracing.sh index 3f203b1..09f0764 100755 --- a/tests/manual_mode_tracing.sh +++ b/tests/manual_mode_tracing.sh @@ -34,11 +34,11 @@ TRACE_DIR="/tmp/ust-testsuite-manual-trace" rm -rf "$TRACE_DIR" mkdir "$TRACE_DIR" -pidfilepath="/tmp/ust-testsuite-$USER-$(date +%Y%m%d%H%M%S%N)-ustd-pid" +pidfilepath="/tmp/ust-testsuite-$USER-$(date +%Y%m%d%H%M%S%N)-ust-consumerd-pid" mkfifo -m 0600 "$pidfilepath" -ustd --pidfile "$pidfilepath" -o "$TRACE_DIR" >/dev/null 2>&1 & -USTD_PID="$(<$pidfilepath)" +ust-consumerd --pidfile "$pidfilepath" -o "$TRACE_DIR" >/dev/null 2>&1 & +UST_CONSUMERD_PID="$(<$pidfilepath)" LD_PRELOAD=/usr/local/lib/libust.so.0.0.0:/usr/local/lib/libustinstr-malloc.so find -L / >/dev/null 2>&1 & PID=$! @@ -54,7 +54,7 @@ sleep 0.5 okx ustctl --stop-trace $PID okx ustctl --destroy-trace $PID kill $PID -kill -SIGTERM $USTD_PID -wait $USTD_PID +kill -SIGTERM $UST_CONSUMERD_PID +wait $UST_CONSUMERD_PID trace_matches -N "ust.malloc" "^ust.malloc:" "$TRACE_DIR" diff --git a/tests/runtests b/tests/runtests index 9560c46..afc1e21 100755 --- a/tests/runtests +++ b/tests/runtests @@ -37,7 +37,7 @@ simple_harness_run test-libustinstr-malloc/test-libustinstr-malloc.sh simple_harness_run ./manual_mode_tracing.sh -simple_harness_run ./valgrind_ustd.sh +simple_harness_run ./valgrind_ust-consumerd.sh simple_harness_run dlopen/dlopen.sh diff --git a/tests/valgrind_ustd.sh b/tests/valgrind_ust-consumerd.sh similarity index 73% rename from tests/valgrind_ustd.sh rename to tests/valgrind_ust-consumerd.sh index 541d8ca..53b1208 100755 --- a/tests/valgrind_ustd.sh +++ b/tests/valgrind_ust-consumerd.sh @@ -22,32 +22,32 @@ TESTDIR=$(dirname $0) source $TESTDIR/test_functions.sh source $TESTDIR/tap.sh -starttest "ustd valgrind check" +starttest "ust-consumerd valgrind check" plan_tests 2 -TRACE_DIR="/tmp/ust-testsuite-ustdvalgrind-trace" +TRACE_DIR="/tmp/ust-testsuite-ust-consumerdvalgrind-trace" rm -rf "$TRACE_DIR" mkdir "$TRACE_DIR" -pidfilepath="/tmp/ust-testsuite-$USER-$(date +%Y%m%d%H%M%S%N)-ustd-pid" +pidfilepath="/tmp/ust-testsuite-$USER-$(date +%Y%m%d%H%M%S%N)-ust-consumerd-pid" mkfifo -m 0600 "$pidfilepath" VALG_OUT=/tmp/ust-testsuite-valg.txt -valgrind --suppressions=$TESTDIR/valgrind_suppress.txt -q ustd --pidfile "$pidfilepath" -o "$TRACE_DIR" >/dev/null 2>"$VALG_OUT" & +valgrind --suppressions=$TESTDIR/valgrind_suppress.txt -q ust-consumerd --pidfile "$pidfilepath" -o "$TRACE_DIR" >/dev/null 2>"$VALG_OUT" & VALG_PID=$! -USTD_PID="$(<$pidfilepath)" +UST_CONSUMERD_PID="$(<$pidfilepath)" okx usttrace -s $TESTDIR/basic/.libs/basic -kill -SIGTERM $USTD_PID +kill -SIGTERM $UST_CONSUMERD_PID wait $! echo "Valgrind output is in $VALG_OUT" if [ -z "$(<$VALG_OUT)" ]; then - pass "Valgrind found no errors in ustd" + pass "Valgrind found no errors in ust-consumerd" else - fail "Valgrind found errors in ustd:" + fail "Valgrind found errors in ust-consumerd:" cat $VALG_OUT | while read; do diag $REPLY done diff --git a/ust-consumerd/Makefile.am b/ust-consumerd/Makefile.am new file mode 100644 index 0000000..01e3b82 --- /dev/null +++ b/ust-consumerd/Makefile.am @@ -0,0 +1,14 @@ +AM_CPPFLAGS = -I$(top_srcdir)/libust -I$(top_srcdir)/libustcomm \ + -I$(top_srcdir)/include -I$(top_srcdir)/libustconsumer +AM_CFLAGS = -fno-strict-aliasing + +bin_PROGRAMS = ust-consumerd + +ust_consumerd_SOURCES = ust-consumerd.c + +ust_consumerd_LDADD = \ + $(top_builddir)/snprintf/libustsnprintf.la \ + $(top_builddir)/libustcomm/libustcomm.la \ + $(top_builddir)/libustconsumer/libustconsumer.la + +ust_consumerd_CFLAGS = -DUST_COMPONENT=ust-consumerd -fno-strict-aliasing diff --git a/ust-consumerd/README b/ust-consumerd/README new file mode 100644 index 0000000..6df4015 --- /dev/null +++ b/ust-consumerd/README @@ -0,0 +1,3 @@ +This is ust-consumerd, the UST consumer daemon. + +This daemon is used to collect the traces for the traced programs and write them to disk. diff --git a/ustd/ustd.c b/ust-consumerd/ust-consumerd.c similarity index 86% rename from ustd/ustd.c rename to ust-consumerd/ust-consumerd.c index e75fd9d..fae4efa 100644 --- a/ustd/ustd.c +++ b/ust-consumerd/ust-consumerd.c @@ -32,7 +32,7 @@ #include #include -#include "ust/ustd.h" +#include "ust/ustconsumer.h" #include "usterr.h" char *sock_path=NULL; @@ -40,7 +40,7 @@ char *trace_path=NULL; int daemon_mode = 0; char *pidfile = NULL; -struct libustd_instance *instance; +struct ustconsumer_instance *instance; struct buffer_info_local { /* output file */ @@ -128,12 +128,12 @@ int write_current_subbuffer(struct buffer_info *buf) return 0; } -int on_read_subbuffer(struct libustd_callbacks *data, struct buffer_info *buf) +int on_read_subbuffer(struct ustconsumer_callbacks *data, struct buffer_info *buf) { return write_current_subbuffer(buf); } -int on_read_partial_subbuffer(struct libustd_callbacks *data, struct buffer_info *buf, +int on_read_partial_subbuffer(struct ustconsumer_callbacks *data, struct buffer_info *buf, long subbuf_index, unsigned long valid_length) { struct buffer_info_local *buf_local = buf->user_data; @@ -161,7 +161,7 @@ int on_read_partial_subbuffer(struct libustd_callbacks *data, struct buffer_info } -int on_open_buffer(struct libustd_callbacks *data, struct buffer_info *buf) +int on_open_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf) { char *tmp; int result; @@ -182,13 +182,13 @@ int on_open_buffer(struct libustd_callbacks *data, struct buffer_info *buf) * of the risk of typo when using trace path override. We don't * want to risk creating plenty of useless directories in that case. */ - result = create_dir_if_needed(USTD_DEFAULT_TRACE_PATH); + result = create_dir_if_needed(USTCONSUMER_DEFAULT_TRACE_PATH); if(result == -1) { - ERR("could not create directory %s", USTD_DEFAULT_TRACE_PATH); + ERR("could not create directory %s", USTCONSUMER_DEFAULT_TRACE_PATH); return 1; } - trace_path = USTD_DEFAULT_TRACE_PATH; + trace_path = USTCONSUMER_DEFAULT_TRACE_PATH; } if (asprintf(&tmp, "%s/%u_%lld", trace_path, buf->pid, buf->pidunique) < 0) { @@ -221,7 +221,7 @@ int on_open_buffer(struct libustd_callbacks *data, struct buffer_info *buf) return 0; } -int on_close_buffer(struct libustd_callbacks *data, struct buffer_info *buf) +int on_close_buffer(struct ustconsumer_callbacks *data, struct buffer_info *buf) { struct buffer_info_local *buf_local = buf->user_data; int result = close(buf_local->file_fd); @@ -232,15 +232,15 @@ int on_close_buffer(struct libustd_callbacks *data, struct buffer_info *buf) return 0; } -int on_put_error(struct libustd_callbacks *data, struct buffer_info *buf) +int on_put_error(struct ustconsumer_callbacks *data, struct buffer_info *buf) { unwrite_last_subbuffer(buf); } -struct libustd_callbacks *new_callbacks() +struct ustconsumer_callbacks *new_callbacks() { - struct libustd_callbacks *callbacks = - zmalloc(sizeof(struct libustd_callbacks)); + struct ustconsumer_callbacks *callbacks = + zmalloc(sizeof(struct ustconsumer_callbacks)); if(!callbacks) return NULL; @@ -278,7 +278,7 @@ int is_directory(const char *dir) void usage(void) { - fprintf(stderr, "Usage:\nustd OPTIONS\n\nOptions:\n" + fprintf(stderr, "Usage:\nust-consumerd OPTIONS\n\nOptions:\n" "\t-h\t\tDisplay this usage.\n" "\t-o DIR\t\tSpecify the directory where to output the traces.\n" "\t-s PATH\t\tSpecify the path to use for the daemon socket.\n" @@ -345,16 +345,16 @@ int parse_args(int argc, char **argv) void sigterm_handler(int sig) { - libustd_stop_instance(instance, 0); + ustconsumer_stop_instance(instance, 0); } -int start_ustd(int fd) +int start_ustconsumer(int fd) { int result; sigset_t sigset; struct sigaction sa; - struct libustd_callbacks *callbacks = new_callbacks(); + struct ustconsumer_callbacks *callbacks = new_callbacks(); if(!callbacks) { PERROR("new_callbacks"); return 1; @@ -379,15 +379,15 @@ int start_ustd(int fd) return 1; } - instance = libustd_new_instance(callbacks, sock_path); + instance = ustconsumer_new_instance(callbacks, sock_path); if(!instance) { - ERR("failed to create libustd instance"); + ERR("failed to create ustconsumer instance"); return 1; } - result = libustd_init_instance(instance); + result = ustconsumer_init_instance(instance); if(result) { - ERR("failed to initialize libustd instance"); + ERR("failed to initialize ustconsumer instance"); return 1; } @@ -435,14 +435,14 @@ int start_ustd(int fd) } } - libustd_start_instance(instance); + ustconsumer_start_instance(instance); free(callbacks); return 0; } -int start_ustd_daemon() +int start_ustconsumer_daemon() { int result; int fd[2]; @@ -456,7 +456,7 @@ int start_ustd_daemon() return -1; } else if(result == 0) { - return start_ustd(fd[1]); + return start_ustconsumer(fd[1]); } else { char buf; @@ -495,10 +495,10 @@ int main(int argc, char **argv) } if(daemon_mode) { - result = start_ustd_daemon(); + result = start_ustconsumer_daemon(); } else { - result = start_ustd(-1); + result = start_ustconsumer(-1); } return result; diff --git a/ustd/Makefile.am b/ustd/Makefile.am deleted file mode 100644 index 991c717..0000000 --- a/ustd/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir)/libust -I$(top_srcdir)/libustcomm \ - -I$(top_srcdir)/include -I$(top_srcdir)/libustd -AM_CFLAGS = -fno-strict-aliasing - -bin_PROGRAMS = ustd - -ustd_SOURCES = ustd.c - -ustd_LDADD = \ - $(top_builddir)/snprintf/libustsnprintf.la \ - $(top_builddir)/libustcomm/libustcomm.la \ - $(top_builddir)/libustd/libustd.la - -ustd_CFLAGS = -DUST_COMPONENT=ustd -fno-strict-aliasing diff --git a/ustd/README b/ustd/README deleted file mode 100644 index 8fcd218..0000000 --- a/ustd/README +++ /dev/null @@ -1,3 +0,0 @@ -This is ustd, the UST daemon. - -This daemon is used to collect the traces for the traced programs. diff --git a/usttrace b/usttrace index 94404dd..5d6729e 100755 --- a/usttrace +++ b/usttrace @@ -9,14 +9,14 @@ function error() { function sighandler() { echo "Caught Ctrl-C" - if [ -z "$USTDPID" ]; then - USTDPID="$(<$pidfilepath)" + if [ -z "$UST_CONSUMERDPID" ]; then + UST_CONSUMERDPID="$(<$pidfilepath)" fi # Tell the daemon to die - kill -SIGTERM "$USTDPID" + kill -SIGTERM "$UST_CONSUMERDPID" - echo "Waiting for ustd to shutdown..." - wait "$USTDPID" + echo "Waiting for ust-consumerd to shutdown..." + wait "$UST_CONSUMERDPID" rm "$pidfilepath" @@ -24,17 +24,17 @@ function sighandler() { } USTTRACE_DIR="$(dirname $0)" -if [ -x "${USTTRACE_DIR}/ustd/ustd" ] ; then +if [ -x "${USTTRACE_DIR}/ust-consumerd/ust-consumerd" ] ; then # Use the not installed libraries instead - USTD="${USTTRACE_DIR}/ustd/ustd" + UST_CONSUMERD="${USTTRACE_DIR}/ust-consumerd/ust-consumerd" LIBINTERFORK_PATH="${USTTRACE_DIR}/libustfork/.libs/libustfork.so" LIBMALLOCWRAP_PATH="${USTTRACE_DIR}/libustinstr-malloc/.libs/libustinstr-malloc.so" LIBUST_PATH="${USTTRACE_DIR}/libust/.libs/libust.so" else # Use the libraries that the dynamic link finds - USTD="ustd" - if [ ! -x "$(which ustd 2>/dev/null)" ]; then - error "cannot find an executable ustd; make sure its location is in the PATH" + UST_CONSUMERD="ust-consumerd" + if [ ! -x "$(which ust-consumerd 2>/dev/null)" ]; then + error "cannot find an executable ust-consumerd; make sure its location is in the PATH" exit 1 fi LIBINTERFORK_PATH="libustfork.so" @@ -117,25 +117,25 @@ if [ ! -d "$OUTDIR" ]; then fi fi -# Choose ustd socket path -USTDSOCKPATH="/tmp/ustd-sock-$$" +# Choose ust-consumerd socket path +UST_CONSUMERDSOCKPATH="/tmp/ust-consumerd-sock-$$" if [ "$arg_syswide_daemon" != "1" ]; then - pidfilepath="/tmp/usttrace-$USER-$(date +%Y%m%d%H%M%S%N)-ustd-pid" + pidfilepath="/tmp/usttrace-$USER-$(date +%Y%m%d%H%M%S%N)-ust-consumerd-pid" trap "sighandler $pidfilepath" SIGINT mkfifo -m 0600 "$pidfilepath" # Start daemon - $USTD --pidfile "$pidfilepath" -s "$USTDSOCKPATH" -o "$OUTDIR" >"$OUTDIR/ustd.log" 2>&1 & - # ustd sets up its server socket - # ustd opens the pidfile, blocks because no one has opened it + $UST_CONSUMERD --pidfile "$pidfilepath" -s "$UST_CONSUMERDSOCKPATH" -o "$OUTDIR" >"$OUTDIR/ust-consumerd.log" 2>&1 & + # ust-consumerd sets up its server socket + # ust-consumerd opens the pidfile, blocks because no one has opened it # we open pidfile # we block reading pidfile - # ustd writes to pidfile - # ustd closes pidfile + # ust-consumerd writes to pidfile + # ust-consumerd closes pidfile # we unblock reading pidfile - USTDPID="$(<$pidfilepath)" - export UST_DAEMON_SOCKET="$USTDSOCKPATH" + UST_CONSUMERDPID="$(<$pidfilepath)" + export UST_DAEMON_SOCKET="$UST_CONSUMERDSOCKPATH" fi # Establish the environment for the command @@ -206,10 +206,10 @@ fi if [ "$arg_syswide_daemon" != "1" ]; then # Tell the daemon to die - kill -SIGTERM "$USTDPID" + kill -SIGTERM "$UST_CONSUMERDPID" - echo "Waiting for ustd to shutdown..." - wait "$USTDPID" + echo "Waiting for ust-consumerd to shutdown..." + wait "$UST_CONSUMERDPID" rm "$pidfilepath" fi -- 2.34.1