# 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
ustd/Makefile
ustctl/Makefile
libustcomm/Makefile
+ libustcmd/Makefile
snprintf/Makefile
])
AC_OUTPUT
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
--- /dev/null
+/* 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 <stdio.h>
+#include <unistd.h>
+#include <getopt.h>
+#include <stdlib.h>
+#include <fcntl.h>
+
+#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 */
--- /dev/null
+/*
+ * libustd header file
+ *
+ * Copyright 2005-2010 -
+ * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+ * Copyright 2010-
+ * Oumarou Dicko <oumarou.dicko@polymtl.ca>
+ * Michael Sills-Lavoie <michael.sills-lavoie@polymtl.ca>
+ * Alexis Halle <alexis.halle@polymtl.ca>
+ *
+ * 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 <pthread.h>
+#include <dirent.h>
+#include <ust/kcompat/kcompat.h>
+
+#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 */
+
--- /dev/null
+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
#include <dirent.h>
#include "ustcomm.h"
-#include "ustcmd.h"
+#include "ust/ustcmd.h"
#include "usterr.h"
pid_t *ustcmd_get_online_pids(void)
+++ /dev/null
-/* 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 <stdio.h>
-#include <unistd.h>
-#include <getopt.h>
-#include <stdlib.h>
-#include <fcntl.h>
-
-#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 */
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
#include <errno.h>
#include <assert.h>
-#include "libustd.h"
+#include <ust/ustd.h>
+#include "lowlevel.h"
#include "usterr.h"
#include "ustcomm.h"
+++ /dev/null
-/*
- * libustd header file
- *
- * Copyright 2005-2010 -
- * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
- * Copyright 2010-
- * Oumarou Dicko <oumarou.dicko@polymtl.ca>
- * Michael Sills-Lavoie <michael.sills-lavoie@polymtl.ca>
- * Alexis Halle <alexis.halle@polymtl.ca>
- *
- * 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 <pthread.h>
-#include <dirent.h>
-#include <ust/kcompat/kcompat.h>
-
-#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 */
-
#include <assert.h>
#include <byteswap.h>
+#include "ust/ustd.h"
#include "buffers.h"
#include "tracer.h"
-#include "libustd.h"
#include "usterr.h"
/* This truncates to an offset in the buffer. */
--- /dev/null
+/*
+ * lowlevel libustd header file
+ *
+ * Copyright 2005-2010 -
+ * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+ * Copyright 2010-
+ * Oumarou Dicko <oumarou.dicko@polymtl.ca>
+ * Michael Sills-Lavoie <michael.sills-lavoie@polymtl.ca>
+ * Alexis Halle <alexis.halle@polymtl.ca>
+ *
+ * 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 <ust/ustd.h>
+
+void finish_consuming_dead_subbuffer(struct libustd_callbacks *callbacks, struct buffer_info *buf);
+size_t subbuffer_data_size(void *subbuf);
+
+#endif /* LOWLEVEL_H */
+
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
#include <stdlib.h>
#include <fcntl.h>
-#include "ustcomm.h"
-#include "ustcmd.h"
+#include "ust/ustcmd.h"
#include "usterr.h"
enum command {
#include <assert.h>
#include <getopt.h>
-#include "libustd.h"
+#include "ust/ustd.h"
#include "usterr.h"
char *sock_path=NULL;