From: Alexis Hallé Date: Wed, 18 Aug 2010 15:54:26 +0000 (-0400) Subject: properly install libustd and libustcmd X-Git-Tag: v0.7~5 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d6c9f207eca8cda2b30dd5d4a0a6816f25b1b796;p=ust.git properly install libustd and libustcmd --- diff --git a/Makefile.am b/Makefile.am index eb0c1b5..c77ef8f 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 libust . tests libustinstr-malloc libustd ustd ustctl libustfork include doc +SUBDIRS = snprintf libustcomm libustcmd libust . tests libustinstr-malloc libustd ustd ustctl libustfork include doc EXTRA_DIST = libust.ldscript.in libust-initializer.c dist_bin_SCRIPTS = usttrace diff --git a/configure.ac b/configure.ac index caa599d..af40e52 100644 --- a/configure.ac +++ b/configure.ac @@ -127,6 +127,7 @@ AC_CONFIG_FILES([ ustd/Makefile ustctl/Makefile libustcomm/Makefile + libustcmd/Makefile snprintf/Makefile ]) AC_OUTPUT diff --git a/include/Makefile.am b/include/Makefile.am index 4732c46..d034ac5 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -16,6 +16,8 @@ nobase_include_HEADERS = \ ust/kcompat/jhash.h \ ust/kcompat/kref.h \ ust/kcompat/simple.h \ - ust/kcompat/types.h + ust/kcompat/types.h \ + ust/ustcmd.h \ + ust/ustd.h noinst_HEADERS = share.h usterr.h ust_snprintf.h diff --git a/include/ust/ustcmd.h b/include/ust/ustcmd.h new file mode 100644 index 0000000..60f5018 --- /dev/null +++ b/include/ust/ustcmd.h @@ -0,0 +1,66 @@ +/* Copyright (C) 2009 Pierre-Marc Fournier + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _USTCMD_H +#define _USTCMD_H + +#include +#include +#include +#include +#include + +#define USTCMD_ERR_CONN 1 /* Process connection error */ +#define USTCMD_ERR_ARG 2 /* Invalid function argument */ +#define USTCMD_ERR_GEN 3 /* General ustcmd error */ + +#define USTCMD_MS_CHR_OFF '0' /* Marker state 'on' character */ +#define USTCMD_MS_CHR_ON '1' /* Marker state 'on' character */ +#define USTCMD_MS_OFF 0 /* Marker state 'on' value */ +#define USTCMD_MS_ON 1 /* Marker state 'on' value */ + +#define USTCMD_SOCK_PATH "/tmp/socks/" + +/* Channel/marker/state/format string (cmsf) info. structure */ +struct marker_status { + char *channel; /* Channel name (end of marker_status array if NULL) */ + char *marker; /* Marker name (end of marker_status array if NULL) */ + int state; /* State (0 := marker disabled, 1 := marker enabled) */ + char *fs; /* Format string (end of marker_status array if NULL) */ +}; + +extern pid_t *ustcmd_get_online_pids(void); +extern int ustcmd_set_marker_state(const char *, int, pid_t); +extern int ustcmd_set_subbuf_size(const char *, pid_t); +extern int ustcmd_set_subbuf_num(const char *, pid_t); +extern int ustcmd_get_subbuf_size(const char *, pid_t); +extern int ustcmd_get_subbuf_num(const char *, pid_t); +extern int ustcmd_destroy_trace(pid_t); +extern int ustcmd_setup_and_start(pid_t); +extern int ustcmd_stop_trace(pid_t); +extern int ustcmd_create_trace(pid_t); +extern int ustcmd_start_trace(pid_t); +extern int ustcmd_alloc_trace(pid_t); +extern int ustcmd_free_cmsf(struct marker_status *); +extern unsigned int ustcmd_count_nl(const char *); +extern int ustcmd_send_cmd(const char *, pid_t, char **); +extern int ustcmd_get_cmsf(struct marker_status **, pid_t); +extern int ustcmd_set_sock_path(const char *, pid_t); +extern int ustcmd_get_sock_path(char **, pid_t); +extern int ustcmd_force_switch(pid_t); + +#endif /* _USTCMD_H */ diff --git a/include/ust/ustd.h b/include/ust/ustd.h new file mode 100644 index 0000000..5fec7f9 --- /dev/null +++ b/include/ust/ustd.h @@ -0,0 +1,279 @@ +/* + * libustd header file + * + * Copyright 2005-2010 - + * Mathieu Desnoyers + * Copyright 2010- + * Oumarou Dicko + * Michael Sills-Lavoie + * Alexis Halle + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef USTD_H +#define USTD_H + +#include +#include +#include + +#define USTD_DEFAULT_TRACE_PATH "/tmp/usttrace" + +struct ustcomm_connection; +struct ustcomm_ustd; + +struct buffer_info { + const char *name; + pid_t pid; + struct ustcomm_connection *conn; + + int shmid; + int bufstruct_shmid; + + /* the buffer memory */ + void *mem; + /* buffer size */ + int memlen; + /* number of subbuffers in buffer */ + int n_subbufs; + /* size of each subbuffer */ + int subbuf_size; + + /* the buffer information struct */ + void *bufstruct_mem; + + long consumed_old; + + s64 pidunique; + + void *user_data; +}; + +struct libustd_callbacks; + +/** + * struct libustd_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; + int quit_program; + int is_init; + struct ustcomm_ustd *comm; + char *sock_path; + pthread_mutex_t mutex; + int active_buffers; +}; + +/** +* struct libustd_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 { + /** + * on_open_buffer - Is called after a buffer is attached to process memory + * + * @data: pointer to the callbacks structure that has been passed to the + * library. + * @buf: structure that contains the data associated with the buffer + * + * Returns 0 if the callback succeeds else not 0. + * + * It has to be thread safe, because it is called by many threads. + */ + int (*on_open_buffer)(struct libustd_callbacks *data, + struct buffer_info *buf); + + /** + * on_close_buffer - Is called after a buffer is detached from process memory + * + * @data: pointer to the callbacks structure that has been passed to the + * library. + * @buf: structure that contains the data associated with the buffer + * + * Returns 0 if the callback succeeds else not 0. + * + * It has to be thread safe, because it is called by many threads. + */ + int (*on_close_buffer)(struct libustd_callbacks *data, + struct buffer_info *buf); + + /** + * on_read_subbuffer - Is called after a subbuffer is a reserved. + * + * @data: pointer to the callbacks structure that has been passed to the + * library. + * @buf: structure that contains the data associated with the buffer + * + * Returns 0 if the callback succeeds else not 0. + * + * It has to be thread safe, because it is called by many threads. + */ + int (*on_read_subbuffer)(struct libustd_callbacks *data, + struct buffer_info *buf); + + /** + * on_read_partial_subbuffer - Is called when an incomplete subbuffer + * is being salvaged from an app crash + * + * @data: pointer to the callbacks structure that has been passed to the + * library. + * @buf: structure that contains the data associated with the buffer + * @subbuf_index: index of the subbuffer to read in the buffer + * @valid_length: number of bytes considered safe to read + * + * Returns 0 if the callback succeeds else not 0. + * + * It has to be thread safe, because it is called by many threads. + */ + int (*on_read_partial_subbuffer)(struct libustd_callbacks *data, + struct buffer_info *buf, + long subbuf_index, + unsigned long valid_length); + + /** + * on_put_error - Is called when a put error has occured and the last + * subbuffer read is no longer safe to keep + * + * @data: pointer to the callbacks structure that has been passed to the + * library. + * @buf: structure that contains the data associated with the buffer + * + * Returns 0 if the callback succeeds else not 0. + * + * It has to be thread safe, because it is called by many threads. + */ + int (*on_put_error)(struct libustd_callbacks *data, + struct buffer_info *buf); + + /** + * on_new_thread - Is called when a new thread is created + * + * @data: pointer to the callbacks structure that has been passed to the + * library. + * + * Returns 0 if the callback succeeds else not 0. + * + * It has to be thread safe, because it is called by many threads. + */ + int (*on_new_thread)(struct libustd_callbacks *data); + + /** + * on_close_thread - Is called just before a thread is destroyed + * + * @data: pointer to the callbacks structure that has been passed to the + * library. + * + * Returns 0 if the callback succeeds else not 0. + * + * It has to be thread safe, because it is called by many threads. + */ + int (*on_close_thread)(struct libustd_callbacks *data); + + /** + * on_trace_end - Is called at the very end of the tracing session. At + * this time, everything has been closed and the threads have + * been destroyed. + * + * @instance: pointer to the instance structure that has been passed to + * the library. + * + * Returns 0 if the callback succeeds else not 0. + * + * 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. + */ + int (*on_trace_end)(struct libustd_instance *instance); + + /** + * The library's data. + */ + void *user_data; +}; + +/** + * libustd_new_instance - Is called to create a new tracing session. + * + * @callbacks: Pointer to a callbacks structure that contain the user + * callbacks and data. + * @sock_path: Path to the socket used for communication with the traced app + * + * Returns the instance if the function succeeds else NULL. + */ +struct libustd_instance * +libustd_new_instance( + struct libustd_callbacks *callbacks, char *sock_path); + +/** + * libustd_delete_instance - Is called to free a libustd_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. + */ +void libustd_delete_instance(struct libustd_instance *instance); + +/** + * libustd_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 + * and the tracing application. + */ +int libustd_init_instance(struct libustd_instance *instance); + +/** + * libustd_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 + * the traced application terminates + */ +int libustd_start_instance(struct libustd_instance *instance); + +/** + * libustd_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 + * the daemon socket to force it to return from the poll syscall + * and realize that it must close. This is not necessary if the + * instance is being stopped as part of an interrupt handler, as + * the interrupt itself will cause poll to return. + * + * Returns 0 if the function succeeds. + * + * This function returns immediately, it only tells libustd 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 + * after on_trace_end is called. + */ +int libustd_stop_instance(struct libustd_instance *instance, int send_msg); + +#endif /* USTD_H */ + diff --git a/libustcmd/Makefile.am b/libustcmd/Makefile.am new file mode 100644 index 0000000..f467244 --- /dev/null +++ b/libustcmd/Makefile.am @@ -0,0 +1,14 @@ +AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/libustcomm +AM_CFLAGS = -fno-strict-aliasing + +lib_LTLIBRARIES = libustcmd.la + +libustcmd_la_SOURCES = \ + ustcmd.c + +libustcmd_la_LDFLAGS = -no-undefined -version-info 0:0:0 + +libustcmd_la_LIBADD = \ + $(top_builddir)/libustcomm/libustcomm.la + +libustcmd_la_CFLAGS = -DUST_COMPONENT="libustcmd" -fno-strict-aliasing diff --git a/libustcmd/ustcmd.c b/libustcmd/ustcmd.c index 46a9561..cf6b9d7 100644 --- a/libustcmd/ustcmd.c +++ b/libustcmd/ustcmd.c @@ -25,7 +25,7 @@ #include #include "ustcomm.h" -#include "ustcmd.h" +#include "ust/ustcmd.h" #include "usterr.h" pid_t *ustcmd_get_online_pids(void) diff --git a/libustcmd/ustcmd.h b/libustcmd/ustcmd.h deleted file mode 100644 index 60f5018..0000000 --- a/libustcmd/ustcmd.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright (C) 2009 Pierre-Marc Fournier - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef _USTCMD_H -#define _USTCMD_H - -#include -#include -#include -#include -#include - -#define USTCMD_ERR_CONN 1 /* Process connection error */ -#define USTCMD_ERR_ARG 2 /* Invalid function argument */ -#define USTCMD_ERR_GEN 3 /* General ustcmd error */ - -#define USTCMD_MS_CHR_OFF '0' /* Marker state 'on' character */ -#define USTCMD_MS_CHR_ON '1' /* Marker state 'on' character */ -#define USTCMD_MS_OFF 0 /* Marker state 'on' value */ -#define USTCMD_MS_ON 1 /* Marker state 'on' value */ - -#define USTCMD_SOCK_PATH "/tmp/socks/" - -/* Channel/marker/state/format string (cmsf) info. structure */ -struct marker_status { - char *channel; /* Channel name (end of marker_status array if NULL) */ - char *marker; /* Marker name (end of marker_status array if NULL) */ - int state; /* State (0 := marker disabled, 1 := marker enabled) */ - char *fs; /* Format string (end of marker_status array if NULL) */ -}; - -extern pid_t *ustcmd_get_online_pids(void); -extern int ustcmd_set_marker_state(const char *, int, pid_t); -extern int ustcmd_set_subbuf_size(const char *, pid_t); -extern int ustcmd_set_subbuf_num(const char *, pid_t); -extern int ustcmd_get_subbuf_size(const char *, pid_t); -extern int ustcmd_get_subbuf_num(const char *, pid_t); -extern int ustcmd_destroy_trace(pid_t); -extern int ustcmd_setup_and_start(pid_t); -extern int ustcmd_stop_trace(pid_t); -extern int ustcmd_create_trace(pid_t); -extern int ustcmd_start_trace(pid_t); -extern int ustcmd_alloc_trace(pid_t); -extern int ustcmd_free_cmsf(struct marker_status *); -extern unsigned int ustcmd_count_nl(const char *); -extern int ustcmd_send_cmd(const char *, pid_t, char **); -extern int ustcmd_get_cmsf(struct marker_status **, pid_t); -extern int ustcmd_set_sock_path(const char *, pid_t); -extern int ustcmd_get_sock_path(char **, pid_t); -extern int ustcmd_force_switch(pid_t); - -#endif /* _USTCMD_H */ diff --git a/libustd/Makefile.am b/libustd/Makefile.am index 1d6d328..1b9a961 100644 --- a/libustd/Makefile.am +++ b/libustd/Makefile.am @@ -4,7 +4,7 @@ AM_CFLAGS = -fno-strict-aliasing lib_LTLIBRARIES = libustd.la -libustd_la_SOURCES = libustd.c lowlevel.c libustd.h +libustd_la_SOURCES = libustd.c lowlevel.c lowlevel.h libustd_la_LDFLAGS = -no-undefined -version-info 0:0:0 diff --git a/libustd/libustd.c b/libustd/libustd.c index 47cb594..df945fc 100644 --- a/libustd/libustd.c +++ b/libustd/libustd.c @@ -29,7 +29,8 @@ #include #include -#include "libustd.h" +#include +#include "lowlevel.h" #include "usterr.h" #include "ustcomm.h" diff --git a/libustd/libustd.h b/libustd/libustd.h deleted file mode 100644 index 762fc71..0000000 --- a/libustd/libustd.h +++ /dev/null @@ -1,282 +0,0 @@ -/* - * libustd header file - * - * Copyright 2005-2010 - - * Mathieu Desnoyers - * Copyright 2010- - * Oumarou Dicko - * Michael Sills-Lavoie - * Alexis Halle - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef LIBUSTD_H -#define LIBUSTD_H - -#include -#include -#include - -#define USTD_DEFAULT_TRACE_PATH "/tmp/usttrace" - -struct ustcomm_connection; -struct ustcomm_ustd; - -struct buffer_info { - const char *name; - pid_t pid; - struct ustcomm_connection *conn; - - int shmid; - int bufstruct_shmid; - - /* the buffer memory */ - void *mem; - /* buffer size */ - int memlen; - /* number of subbuffers in buffer */ - int n_subbufs; - /* size of each subbuffer */ - int subbuf_size; - - /* the buffer information struct */ - void *bufstruct_mem; - - long consumed_old; - - s64 pidunique; - - void *user_data; -}; - -struct libustd_callbacks; - -/** - * struct libustd_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; - int quit_program; - int is_init; - struct ustcomm_ustd *comm; - char *sock_path; - pthread_mutex_t mutex; - int active_buffers; -}; - -/** -* struct libustd_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 { - /** - * on_open_buffer - Is called after a buffer is attached to process memory - * - * @data: pointer to the callbacks structure that has been passed to the - * library. - * @buf: structure that contains the data associated with the buffer - * - * Returns 0 if the callback succeeds else not 0. - * - * It has to be thread safe, because it is called by many threads. - */ - int (*on_open_buffer)(struct libustd_callbacks *data, - struct buffer_info *buf); - - /** - * on_close_buffer - Is called after a buffer is detached from process memory - * - * @data: pointer to the callbacks structure that has been passed to the - * library. - * @buf: structure that contains the data associated with the buffer - * - * Returns 0 if the callback succeeds else not 0. - * - * It has to be thread safe, because it is called by many threads. - */ - int (*on_close_buffer)(struct libustd_callbacks *data, - struct buffer_info *buf); - - /** - * on_read_subbuffer - Is called after a subbuffer is a reserved. - * - * @data: pointer to the callbacks structure that has been passed to the - * library. - * @buf: structure that contains the data associated with the buffer - * - * Returns 0 if the callback succeeds else not 0. - * - * It has to be thread safe, because it is called by many threads. - */ - int (*on_read_subbuffer)(struct libustd_callbacks *data, - struct buffer_info *buf); - - /** - * on_read_partial_subbuffer - Is called when an incomplete subbuffer - * is being salvaged from an app crash - * - * @data: pointer to the callbacks structure that has been passed to the - * library. - * @buf: structure that contains the data associated with the buffer - * @subbuf_index: index of the subbuffer to read in the buffer - * @valid_length: number of bytes considered safe to read - * - * Returns 0 if the callback succeeds else not 0. - * - * It has to be thread safe, because it is called by many threads. - */ - int (*on_read_partial_subbuffer)(struct libustd_callbacks *data, - struct buffer_info *buf, - long subbuf_index, - unsigned long valid_length); - - /** - * on_put_error - Is called when a put error has occured and the last - * subbuffer read is no longer safe to keep - * - * @data: pointer to the callbacks structure that has been passed to the - * library. - * @buf: structure that contains the data associated with the buffer - * - * Returns 0 if the callback succeeds else not 0. - * - * It has to be thread safe, because it is called by many threads. - */ - int (*on_put_error)(struct libustd_callbacks *data, - struct buffer_info *buf); - - /** - * on_new_thread - Is called when a new thread is created - * - * @data: pointer to the callbacks structure that has been passed to the - * library. - * - * Returns 0 if the callback succeeds else not 0. - * - * It has to be thread safe, because it is called by many threads. - */ - int (*on_new_thread)(struct libustd_callbacks *data); - - /** - * on_close_thread - Is called just before a thread is destroyed - * - * @data: pointer to the callbacks structure that has been passed to the - * library. - * - * Returns 0 if the callback succeeds else not 0. - * - * It has to be thread safe, because it is called by many threads. - */ - int (*on_close_thread)(struct libustd_callbacks *data); - - /** - * on_trace_end - Is called at the very end of the tracing session. At - * this time, everything has been closed and the threads have - * been destroyed. - * - * @instance: pointer to the instance structure that has been passed to - * the library. - * - * Returns 0 if the callback succeeds else not 0. - * - * 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. - */ - int (*on_trace_end)(struct libustd_instance *instance); - - /** - * The library's data. - */ - void *user_data; -}; - -/** - * libustd_new_instance - Is called to create a new tracing session. - * - * @callbacks: Pointer to a callbacks structure that contain the user - * callbacks and data. - * @sock_path: Path to the socket used for communication with the traced app - * - * Returns the instance if the function succeeds else NULL. - */ -struct libustd_instance * -libustd_new_instance( - struct libustd_callbacks *callbacks, char *sock_path); - -/** - * libustd_delete_instance - Is called to free a libustd_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. - */ -void libustd_delete_instance(struct libustd_instance *instance); - -/** - * libustd_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 - * and the tracing application. - */ -int libustd_init_instance(struct libustd_instance *instance); - -/** - * libustd_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 - * the traced application terminates - */ -int libustd_start_instance(struct libustd_instance *instance); - -/** - * libustd_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 - * the daemon socket to force it to return from the poll syscall - * and realize that it must close. This is not necessary if the - * instance is being stopped as part of an interrupt handler, as - * the interrupt itself will cause poll to return. - * - * Returns 0 if the function succeeds. - * - * This function returns immediately, it only tells libustd 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 - * after on_trace_end is called. - */ -int libustd_stop_instance(struct libustd_instance *instance, int send_msg); - -void finish_consuming_dead_subbuffer(struct libustd_callbacks *callbacks, struct buffer_info *buf); -size_t subbuffer_data_size(void *subbuf); - -#endif /* LIBUSTD_H */ - diff --git a/libustd/lowlevel.c b/libustd/lowlevel.c index bff27dc..a8abf92 100644 --- a/libustd/lowlevel.c +++ b/libustd/lowlevel.c @@ -19,9 +19,9 @@ #include #include +#include "ust/ustd.h" #include "buffers.h" #include "tracer.h" -#include "libustd.h" #include "usterr.h" /* This truncates to an offset in the buffer. */ diff --git a/libustd/lowlevel.h b/libustd/lowlevel.h new file mode 100644 index 0000000..a1d8da5 --- /dev/null +++ b/libustd/lowlevel.h @@ -0,0 +1,35 @@ +/* + * lowlevel libustd header file + * + * Copyright 2005-2010 - + * Mathieu Desnoyers + * Copyright 2010- + * Oumarou Dicko + * Michael Sills-Lavoie + * Alexis Halle + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef LOWLEVEL_H +#define LOWLEVEL_H + +#include + +void finish_consuming_dead_subbuffer(struct libustd_callbacks *callbacks, struct buffer_info *buf); +size_t subbuffer_data_size(void *subbuf); + +#endif /* LOWLEVEL_H */ + diff --git a/ustctl/Makefile.am b/ustctl/Makefile.am index 94e8c00..49e46f0 100644 --- a/ustctl/Makefile.am +++ b/ustctl/Makefile.am @@ -5,12 +5,11 @@ AM_CFLAGS = -fno-strict-aliasing bin_PROGRAMS = ustctl ustctl_SOURCES = \ - ustctl.c \ - $(top_srcdir)/libustcmd/ustcmd.c \ - $(top_srcdir)/libustcmd/ustcmd.h + ustctl.c ustctl_CFLAGS = -DUST_COMPONENT=ustctl -fno-strict-aliasing ustctl_LDADD = \ $(top_builddir)/snprintf/libustsnprintf.la \ - $(top_builddir)/libustcomm/libustcomm.la + $(top_builddir)/libustcomm/libustcomm.la \ + $(top_builddir)/libustcmd/libustcmd.la diff --git a/ustctl/ustctl.c b/ustctl/ustctl.c index b9f2dce..8a5f6ba 100644 --- a/ustctl/ustctl.c +++ b/ustctl/ustctl.c @@ -22,8 +22,7 @@ #include #include -#include "ustcomm.h" -#include "ustcmd.h" +#include "ust/ustcmd.h" #include "usterr.h" enum command { diff --git a/ustd/ustd.c b/ustd/ustd.c index 18dbf63..7637b40 100644 --- a/ustd/ustd.c +++ b/ustd/ustd.c @@ -32,7 +32,7 @@ #include #include -#include "libustd.h" +#include "ust/ustd.h" #include "usterr.h" char *sock_path=NULL;