properly install libustd and libustcmd
authorAlexis Hallé <alexis.halle@polymtl.ca>
Wed, 18 Aug 2010 15:54:26 +0000 (11:54 -0400)
committerPierre-Marc Fournier <pierre-marc.fournier@polymtl.ca>
Fri, 20 Aug 2010 04:30:09 +0000 (00:30 -0400)
16 files changed:
Makefile.am
configure.ac
include/Makefile.am
include/ust/ustcmd.h [new file with mode: 0644]
include/ust/ustd.h [new file with mode: 0644]
libustcmd/Makefile.am [new file with mode: 0644]
libustcmd/ustcmd.c
libustcmd/ustcmd.h [deleted file]
libustd/Makefile.am
libustd/libustd.c
libustd/libustd.h [deleted file]
libustd/lowlevel.c
libustd/lowlevel.h [new file with mode: 0644]
ustctl/Makefile.am
ustctl/ustctl.c
ustd/ustd.c

index eb0c1b5dade6ca3bd6933e3f553a6239ac11eb02..c77ef8f03a74154197381465c688fe91d0b63b25 100644 (file)
@@ -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
index caa599d9ccfb6348f9577c04be598beab3ac23c4..af40e5254f630cc3df5dd8697aca26e35a585eca 100644 (file)
@@ -127,6 +127,7 @@ AC_CONFIG_FILES([
        ustd/Makefile
        ustctl/Makefile
        libustcomm/Makefile
+       libustcmd/Makefile
        snprintf/Makefile
 ])
 AC_OUTPUT
index 4732c467dd4d4f258cb34ce997100d28d310f014..d034ac5b0fc2e26927f6325da5bf228080a61ab9 100644 (file)
@@ -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 (file)
index 0000000..60f5018
--- /dev/null
@@ -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 <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 */
diff --git a/include/ust/ustd.h b/include/ust/ustd.h
new file mode 100644 (file)
index 0000000..5fec7f9
--- /dev/null
@@ -0,0 +1,279 @@
+/*
+ * 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 */
+
diff --git a/libustcmd/Makefile.am b/libustcmd/Makefile.am
new file mode 100644 (file)
index 0000000..f467244
--- /dev/null
@@ -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
index 46a95618439915336fc654f9a90495b479d11039..cf6b9d720fbcdac85580664097d10580ee98c995 100644 (file)
@@ -25,7 +25,7 @@
 #include <dirent.h>
 
 #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 (file)
index 60f5018..0000000
+++ /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 <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 */
index 1d6d328ed7ccf584ff912a1dea6375b27649ae31..1b9a961ec79d6fe529391f0c46472040bcaf8b8e 100644 (file)
@@ -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
 
index 47cb59499c32de3372c23ef2bc80bc4d2c775645..df945fc7eac7e680127d5b357521fef9960e6b77 100644 (file)
@@ -29,7 +29,8 @@
 #include <errno.h>
 #include <assert.h>
 
-#include "libustd.h"
+#include <ust/ustd.h>
+#include "lowlevel.h"
 #include "usterr.h"
 #include "ustcomm.h"
 
diff --git a/libustd/libustd.h b/libustd/libustd.h
deleted file mode 100644 (file)
index 762fc71..0000000
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * 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 */
-
index bff27dc692feef7cb648143acee9e54bb55c0968..a8abf92bc7132071bea4f2a4ad359ac122e03efc 100644 (file)
@@ -19,9 +19,9 @@
 #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. */
diff --git a/libustd/lowlevel.h b/libustd/lowlevel.h
new file mode 100644 (file)
index 0000000..a1d8da5
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * 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 */
+
index 94e8c00ad0bae17d87d3fad5592e66905e380dc6..49e46f0a04899bd86ce7010d8a7df20f38c458e4 100644 (file)
@@ -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
index b9f2dce83b43913bc6aaedd766d160d9a81accdb..8a5f6baf298782461895ce688570a0f803a17746 100644 (file)
@@ -22,8 +22,7 @@
 #include <stdlib.h>
 #include <fcntl.h>
 
-#include "ustcomm.h"
-#include "ustcmd.h"
+#include "ust/ustcmd.h"
 #include "usterr.h"
 
 enum command {
index 18dbf6377a5488dbc0d3f322c7f0663791f1d81f..7637b40cf8d6685fc911f0f257bb47283b9259cc 100644 (file)
@@ -32,7 +32,7 @@
 #include <assert.h>
 #include <getopt.h>
 
-#include "libustd.h"
+#include "ust/ustd.h"
 #include "usterr.h"
 
 char *sock_path=NULL;
This page took 0.045246 seconds and 4 git commands to generate.