gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r6113 - in flightrecorder/src: include libflightrecorder


From: gnunet
Subject: [GNUnet-SVN] r6113 - in flightrecorder/src: include libflightrecorder
Date: Tue, 22 Jan 2008 15:29:16 -0700 (MST)

Author: durner
Date: 2008-01-22 15:29:15 -0700 (Tue, 22 Jan 2008)
New Revision: 6113

Added:
   flightrecorder/src/libflightrecorder/clientapi.c
   flightrecorder/src/libflightrecorder/session.c
Modified:
   flightrecorder/src/include/flightrecorder.h
   flightrecorder/src/libflightrecorder/Makefile.am
   flightrecorder/src/libflightrecorder/func.c
   flightrecorder/src/libflightrecorder/main.c
   flightrecorder/src/libflightrecorder/opt.c
   flightrecorder/src/libflightrecorder/stack_trace.c
Log:
add sessions

Modified: flightrecorder/src/include/flightrecorder.h
===================================================================
--- flightrecorder/src/include/flightrecorder.h 2008-01-22 22:27:58 UTC (rev 
6112)
+++ flightrecorder/src/include/flightrecorder.h 2008-01-22 22:29:15 UTC (rev 
6113)
@@ -41,11 +41,132 @@
   unsigned int tid;
 } StackTrace;
 
+typedef struct
+{
+  unsigned int opt;
+  void *val;
+} FR_Option_Entry;
+
+typedef struct
+{
+  FR_Option_Entry *options;
+  unsigned long option_count;
+  StackTrace *traces;
+  unsigned int trace_count;
+} FR_Session;
+
+typedef enum {FR_OPT_RECORD_STACK_TRACE} FR_Option;
+
 void *fr_malloc (size_t n);
 void *fr_calloc (size_t n, size_t s);
 void *fr_realloc (void *p, size_t n);
 char *fr_strdup (char *p);
 void fr_free(void *p);
 
+/* --- Sessions --- */
+FR_Session *fr_session_create();
+void fr_session_destroy(FR_Session *ses);
+FR_Session *fr_session_get_local();
 
+/* --- Options - Simple API --- */
+int fr_opt_set(const FR_Option opt, const void *val, const unsigned int len);
+int fr_opt_set_int(const FR_Option opt, const unsigned int val);
+int fr_opt_set_str(const FR_Option opt, const char *val);
+const void *fr_opt_get(const FR_Option opt);
+const char *fr_opt_get_str(const FR_Option opt);
+unsigned int fr_opt_get_int(const FR_Option opt);
+void fr_opt_cleanup();
+
+/* --- Options - C/S API --- */
+int fr_srv_opt_set(FR_Session *ses, const FR_Option opt, const void *val, 
const unsigned int len);
+int fr_srv_opt_set_int(FR_Session *ses, const FR_Option opt, const unsigned 
int val);
+int fr_srv_opt_set_str(FR_Session *ses, const FR_Option opt, const char *val);
+const void *fr_srv_opt_get(FR_Session *ses, const FR_Option opt);
+const char *fr_srv_opt_get_str(FR_Session *ses, const FR_Option opt);
+unsigned int fr_srv_opt_get_int(FR_Session *ses, const FR_Option opt);
+void fr_srv_opt_cleanup(FR_Session *ses);
+
+/**
+ * @brief Add function to the stack trace
+ * @param file source file from which the function is called
+ * @param line source line from which the function is called
+ * @param function name of the function that is called
+ * @return 1 on success, 0 otherwise
+ */
+int fr_st_enter(char *file, unsigned int line, char *function);
+
+/**
+ * @brief Remove function from the stack trace
+ * @param file source file from which the function is called
+ * @param line source line from which the function is called
+ * @param function name of the function that is called
+ * @return 1 on success, 0 otherwise
+ */
+int fr_st_leave(char *file, unsigned int line, char *function);
+
+/**
+ * @brief Add a info to the last stack trace entry
+ * @param info diagnostics information/log/...
+ * @return 1 on success, 0 on error
+ */
+int fr_st_add_info(char *info);
+
+/**
+ * @brief Return the stack trace for a particular thread
+ * @param tid thread ID
+ * @return pointer stack trace, NULL on error
+ */
+StackTrace *fr_st_get(unsigned int tid);
+
+/**
+ * @brief Return a list of thread IDs 
+ * @return array of thread IDs, NULL on error
+ */
+unsigned int *fr_st_threads();
+
+/* --- Stack traces - C/S API --- */
+
+/**
+ * @brief Add function to the stack trace
+ * @param ses C/S session
+ * @param file source file from which the function is called
+ * @param line source line from which the function is called
+ * @param function name of the function that is called
+ * @return 1 on success, 0 otherwise
+ */
+int fr_srv_st_enter(FR_Session *ses, char *file, unsigned int line, char 
*function);
+
+/**
+ * @brief Remove function from the stack trace
+ * @param ses C/S session
+ * @param file source file from which the function is called
+ * @param line source line from which the function is called
+ * @param function name of the function that is called
+ * @return 1 on success, 0 otherwise
+ */
+int fr_srv_st_leave(FR_Session *ses, char *file, unsigned int line, char 
*function);
+
+/**
+ * @brief Add a info to the last stack trace entry
+ * @param ses C/S session
+ * @param info diagnostics information/log/...
+ * @return 1 on success, 0 on error
+ */
+int fr_srv_st_add_info(FR_Session *ses, char *info);
+
+/**
+ * @brief Return the stack trace for a particular thread
+ * @param ses C/S session
+ * @param tid thread ID
+ * @return pointer stack trace, NULL on error
+ */
+StackTrace *fr_srv_st_get(FR_Session *ses, unsigned int tid);
+
+/**
+ * @brief Return a list of thread IDs 
+ * @param ses C/S session
+ * @return array of thread IDs, NULL on error
+ */
+unsigned int *fr_srv_st_threads(FR_Session *ses);
+
 #endif /*FLIGHTRECORDER_H_*/

Modified: flightrecorder/src/libflightrecorder/Makefile.am
===================================================================
--- flightrecorder/src/libflightrecorder/Makefile.am    2008-01-22 22:27:58 UTC 
(rev 6112)
+++ flightrecorder/src/libflightrecorder/Makefile.am    2008-01-22 22:29:15 UTC 
(rev 6113)
@@ -1,4 +1,3 @@
-EXTRA_DIST=private.h
 INCLUDES = -I$(top_srcdir)/src/include
 
 lib_LTLIBRARIES = libflightrecorder.la
@@ -13,7 +12,11 @@
  -version-info 1:0:0
 
 libflightrecorder_la_SOURCES = \
+ clientapi.c \
+ func.c \
  main.c \
+ opt.c \
+ session.c \
  stack_trace.c \
  threads.c \
  xmalloc.c

Added: flightrecorder/src/libflightrecorder/clientapi.c
===================================================================
--- flightrecorder/src/libflightrecorder/clientapi.c                            
(rev 0)
+++ flightrecorder/src/libflightrecorder/clientapi.c    2008-01-22 22:29:15 UTC 
(rev 6113)
@@ -0,0 +1,132 @@
+/* 
+   libflightrecorder - Client library for flightrecorder, a recorder for
+   runtime information gathered by AOP advices or other process internal
+   checks
+
+   Copyright (C) 2007, 2008 Nils Durner
+
+   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
+*/
+
+/**
+ * @brief Simple client API
+ * @file src/libflightrecorder/client.c
+ * @author Nils Durner
+ */
+
+#include "flightrecorder.h"
+
+/**
+ * @brief Add function to the stack trace
+ * @param file source file from which the function is called
+ * @param line source line from which the function is called
+ * @param function name of the function that is called
+ * @return 1 on success, 0 otherwise
+ */
+int fr_st_enter(char *file, unsigned int line, char *function)
+{
+  return fr_srv_st_enter(fr_session_get_local(), file, line, function);
+}
+
+/**
+ * @brief Remove function from the stack trace
+ * @param file source file from which the function is called
+ * @param line source line from which the function is called
+ * @param function name of the function that is called
+ * @return 1 on success, 0 otherwise
+ */
+int fr_st_leave(char *file, unsigned int line, char *function)
+{
+  return fr_srv_st_leave(fr_session_get_local(), file, line, function);
+}
+
+/**
+ * @brief Add a info to the last stack trace entry
+ * @param info diagnostics information/log/...
+ * @return 1 on success, 0 on error
+ */
+int fr_st_add_info(char *info)
+{
+  return fr_srv_st_add_info(fr_session_get_local(), info);
+}
+
+/**
+ * @brief Return the stack trace for a particular thread
+ * @param tid thread ID
+ * @return pointer stack trace, NULL on error
+ */
+StackTrace *fr_st_get(unsigned int tid)
+{
+  return fr_srv_st_get(fr_session_get_local(), tid);
+}
+
+/**
+ * @brief Return a list of thread IDs 
+ * @return array of thread IDs, NULL on error
+ */
+unsigned int *fr_st_threads()
+{
+  return fr_srv_st_threads(fr_session_get_local());
+}
+
+int fr_func_enter(char *file, unsigned int line, char *function)
+{
+  return fr_srv_func_enter(fr_session_get_local(), file, line, function);
+}
+
+int fr_func_leave(char *file, unsigned int line, char *function)
+{
+  return fr_srv_func_leave(fr_session_get_local(), file, line, function);
+}
+
+int fr_func_add_info(char *info)
+{
+  return fr_srv_func_add_info(fr_session_get_local(), info);
+}
+
+int fr_opt_set(const FR_Option opt, const void *val, const unsigned int len)
+{
+  return fr_srv_opt_set(fr_session_get_local(), opt, val, len);
+}
+
+int fr_opt_set_int(const FR_Option opt, const unsigned int val)
+{
+  return fr_srv_opt_set_int(fr_session_get_local(), opt, val);
+}
+
+int fr_opt_set_str(const FR_Option opt, const char *val)
+{
+  return fr_srv_opt_set_str(fr_session_get_local(), opt, val);
+}
+
+const void *fr_opt_get(const FR_Option opt)
+{
+  return fr_srv_opt_get(fr_session_get_local(), opt);
+}
+
+const char *fr_opt_get_str(const FR_Option opt)
+{
+  return fr_srv_opt_get_str(fr_session_get_local(), opt);
+}
+
+unsigned int fr_opt_get_int(const FR_Option opt)
+{
+  return fr_srv_opt_get_int(fr_session_get_local(), opt);
+}
+
+void fr_opt_cleanup()
+{
+ fr_srv_opt_cleanup(fr_session_get_local());
+}

Modified: flightrecorder/src/libflightrecorder/func.c
===================================================================
--- flightrecorder/src/libflightrecorder/func.c 2008-01-22 22:27:58 UTC (rev 
6112)
+++ flightrecorder/src/libflightrecorder/func.c 2008-01-22 22:29:15 UTC (rev 
6113)
@@ -3,7 +3,7 @@
    runtime information gathered by AOP advices or other process internal
    checks
 
-   Copyright (C) 2007 Nils Durner
+   Copyright (C) 2007, 2008 Nils Durner
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -20,33 +20,35 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  
USA
 */
 
-int fr_func_enter(char *file, unsigned int line, char *function)
+#include "flightrecorder.h"
+
+int fr_srv_func_enter(FR_Session *ses, char *file, unsigned int line, char 
*function)
 {
-       if (fr_opt_get_int(FR_OPT_RECORD_STACK_TRACE))
+       if (fr_srv_opt_get_int(ses, FR_OPT_RECORD_STACK_TRACE))
        {
-               if (!fr_st_enter(file, line, function))
+               if (!fr_srv_st_enter(ses, file, line, function))
                        return 0;
        }
        
        return 1;
 }
 
-int fr_func_leave(char *file, unsigned int line, char *function)
+int fr_srv_func_leave(FR_Session *ses, char *file, unsigned int line, char 
*function)
 {
-       if (fr_opt_get_int(FR_OPT_RECORD_STACK_TRACE))
+       if (fr_srv_opt_get_int(ses, FR_OPT_RECORD_STACK_TRACE))
        {
-               if (!fr_st_leave(file, line, function))
+               if (!fr_srv_st_leave(ses, file, line, function))
                        return 0;
        }
        
        return 1;
 }
 
-int fr_func_add_info(char *info)
+int fr_srv_func_add_info(FR_Session *ses, char *info)
 {
-       if (fr_opt_get_int(FR_OPT_RECORD_STACK_TRACE))
+       if (fr_srv_opt_get_int(ses, FR_OPT_RECORD_STACK_TRACE))
        {
-               if (!fr_st_add_info(info))
+               if (!fr_srv_st_add_info(ses, info))
                        return 0;
        }
        

Modified: flightrecorder/src/libflightrecorder/main.c
===================================================================
--- flightrecorder/src/libflightrecorder/main.c 2008-01-22 22:27:58 UTC (rev 
6112)
+++ flightrecorder/src/libflightrecorder/main.c 2008-01-22 22:29:15 UTC (rev 
6113)
@@ -23,13 +23,6 @@
 #include <stddef.h>
 #include "flightrecorder.h"
 
-typedef struct
-{
-  unsigned int sock;
-} Session;
-
-static Session *sessions = NULL;
-static unsigned session_count = 0;
 static int remote_operation;
 
 // FIXME
@@ -45,23 +38,16 @@
  */
 int fr_init(char *server, unsigned int port, FLIGHT_REC_OPTS opts, char *desc)
 {
-  if (!sessions)
-  {
-    sessions = (Session *) fr_malloc(sizeof(Session));
-    session_count = 1;
-  }
-  else
-    sessions = (Session *) fr_realloc(sessions, ++session_count * 
sizeof(Session));
-    
-  if (! sessions)
-    return 0;
-  
   if (server)
   {
     remote_operation = 1;
   }
   else
+  {
     remote_operation = 0;
+    
+    memset(fr_session_get_local(), 0, sizeof(FR_Session));
+  }
   
   // FIXME
   // ...

Modified: flightrecorder/src/libflightrecorder/opt.c
===================================================================
--- flightrecorder/src/libflightrecorder/opt.c  2008-01-22 22:27:58 UTC (rev 
6112)
+++ flightrecorder/src/libflightrecorder/opt.c  2008-01-22 22:29:15 UTC (rev 
6113)
@@ -24,23 +24,14 @@
 #include "flightrecorder.h"
 #include "private.h"
 
-typedef struct
+int fr_srv_opt_set(FR_Session *ses, const FR_Option opt, const void *val, 
const unsigned int len)
 {
-  unsigned int opt;
-  void *val;
-} Option;
-
-static Option *options = NULL;
-static unsigned long option_count = 0;
-
-int fr_opt_set(const unsigned int opt, const void *val, const unsigned int len)
-{
-       Option *option;
+       FR_Option_Entry *option;
        unsigned int idx, found;
        
        found = 0;
-       option = options;
-       for (idx = 0; idx <= option_count; idx++)
+       option = ses->options;
+       for (idx = 0; idx <= ses->option_count; idx++)
        {
                if (opt == option->opt)
                {
@@ -51,42 +42,42 @@
 
        if (!found)
        {
-               if (option_count == 0)
-                       options = (Option *) fr_malloc(sizeof(Option));
+               if (ses->option_count == 0)
+                       ses->options = (FR_Option_Entry *) 
fr_malloc(sizeof(FR_Option_Entry));
                else
-                       options = (Option *) fr_realloc(options, (option_count 
+ 1) * sizeof(Option));
+                       ses->options = (FR_Option_Entry *) 
fr_realloc(ses->options, (ses->option_count + 1) * sizeof(FR_Option_Entry));
        }
        
-       if (!options)
+       if (!ses->options)
                return 0;
        
-       option = options + option_count;
+       option = ses->options + ses->option_count;
        
        option->opt = opt;
        option->val = fr_malloc(len);
-       memcpy(option->val, val);
-       option_count++;
+       memcpy(option->val, val, len);
+       ses->option_count++;
        
        return 1;
 }
 
-int fr_opt_set_int(const unsigned int opt, const unsigned int val)
+int fr_srv_opt_set_int(FR_Session *ses, const FR_Option opt, const unsigned 
int val)
 {
-       return fr_opt_set(opt, &val, sizeof(val));
+       return fr_srv_opt_set(ses, opt, &val, sizeof(val));
 }
 
-int fr_opt_set_str(const unsigned int opt, const char *val)
+int fr_srv_opt_set_str(FR_Session *ses, const FR_Option opt, const char *val)
 {
-       return fr_opt_set(opt, val, strlen(val));
+       return fr_srv_opt_set(ses, opt, val, strlen(val));
 }
 
-const void *fr_opt_get(const unsigned int opt)
+const void *fr_srv_opt_get(FR_Session *ses, const FR_Option opt)
 {
-       Option *option;
+       FR_Option_Entry *option;
        unsigned int idx;
        
-       option = options;
-       for (idx = 0; idx <= option_count; idx++)
+       option = ses->options;
+       for (idx = 0; idx <= ses->option_count; idx++)
        {
                if (opt == option->opt)
                        return option->val;
@@ -95,28 +86,28 @@
        return NULL;
 }
 
-const char *fr_opt_get_str(const unsigned int opt)
+const char *fr_srv_opt_get_str(FR_Session *ses, const FR_Option opt)
 {
-       return (const char *) fr_opt_get(opt);
+       return (const char *) fr_srv_opt_get(ses, opt);
 }
 
-unsigned int fr_opt_get_int(const unsigned int opt)
+unsigned int fr_srv_opt_get_int(FR_Session *ses, const FR_Option opt)
 {
-       return *((unsigned int) fr_opt_get(opt));
+       return *((unsigned int *) fr_srv_opt_get(ses, opt));
 }
 
-void fr_opt_cleanup()
+void fr_srv_opt_cleanup(FR_Session *ses)
 {
-       Option *opt;
+       FR_Option_Entry *opt;
        unsigned int idx;
        
-       opt = options;
-       for (idx = 0; idx <= option_count; idx++)
+       opt = ses->options;
+       for (idx = 0; idx <= ses->option_count; idx++)
        {
                fr_free(opt->val);
                opt++;
        }
        
-       fr_free(options);
-       options = NULL;
+       fr_free(ses->options);
+       ses->options = NULL;
 }

Added: flightrecorder/src/libflightrecorder/session.c
===================================================================
--- flightrecorder/src/libflightrecorder/session.c                              
(rev 0)
+++ flightrecorder/src/libflightrecorder/session.c      2008-01-22 22:29:15 UTC 
(rev 6113)
@@ -0,0 +1,45 @@
+/* 
+   libflightrecorder - Client library for flightrecorder, a recorder for
+   runtime information gathered by AOP advices or other process internal
+   checks
+
+   Copyright (C) 2008 Nils Durner
+
+   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
+*/
+
+#include "flightrecorder.h"
+
+static FR_Session local_session;
+
+FR_Session *fr_session_create()
+{
+  FR_Session *ret;
+  
+  ret = (FR_Session *) fr_malloc(sizeof(FR_Session));
+  memset(ret, 0, sizeof(FR_Session));
+  
+  return ret;
+}
+
+void fr_session_destroy(FR_Session *ses)
+{
+  fr_free(ses);
+}
+
+FR_Session *fr_session_get_local()
+{
+  return &local_session;
+}

Modified: flightrecorder/src/libflightrecorder/stack_trace.c
===================================================================
--- flightrecorder/src/libflightrecorder/stack_trace.c  2008-01-22 22:27:58 UTC 
(rev 6112)
+++ flightrecorder/src/libflightrecorder/stack_trace.c  2008-01-22 22:29:15 UTC 
(rev 6113)
@@ -3,7 +3,7 @@
    runtime information gathered by AOP advices or other process internal
    checks
 
-   Copyright (C) 2007 Nils Durner
+   Copyright (C) 2007, 2008 Nils Durner
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
@@ -24,24 +24,21 @@
 #include "flightrecorder.h"
 #include "private.h"
 
-static StackTrace *traces = NULL;
-static unsigned int threads = 0;
-
-static StackTrace *get_trace(unsigned int tid)
+static StackTrace *get_trace(FR_Session *ses, unsigned int tid)
 {
   StackTrace *trace;
   unsigned idx;
 
-  if (!threads)
+  if (!ses->trace_count)
   {
-    traces = (StackTrace *) fr_malloc(sizeof(StackTrace));
-    threads++;
+    ses->traces = (StackTrace *) fr_malloc(sizeof(StackTrace));
+    ses->trace_count++;
     
-    return traces;
+    return ses->traces;
   }
   
-  trace = traces;
-  for (idx = 0; idx < threads; idx++)
+  trace = ses->traces;
+  for (idx = 0; idx < ses->trace_count; idx++)
   {
     if (fr_thread_cmp(trace->tid, tid))
       return trace;
@@ -49,12 +46,12 @@
       trace++;
   }
   
-  traces = (StackTrace *) fr_realloc(traces, ++threads * sizeof(StackTrace));
+  ses->traces = (StackTrace *) fr_realloc(ses->traces, ++ses->trace_count * 
sizeof(StackTrace));
     
-  if (!traces)
+  if (!ses->traces)
     return NULL;
     
-  trace = traces + threads - 1;
+  trace = ses->traces + ses->trace_count - 1;
   trace->tid = tid;
   trace->depth = 0;
   trace->entries = NULL;
@@ -63,17 +60,18 @@
 
 /**
  * @brief Add function to the stack trace
+ * @param ses C/S session
  * @param file source file from which the function is called
  * @param line source line from which the function is called
  * @param function name of the function that is called
  * @return 1 on success, 0 otherwise
  */
-int fr_st_enter(char *file, unsigned int line, char *function)
+int fr_srv_st_enter(FR_Session *ses, char *file, unsigned int line, char 
*function)
 {
   StackTrace *trace;
   StackTraceEntry *entry;
   
-  trace = get_trace(fr_thread_get_tid());
+  trace = get_trace(ses, fr_thread_get_tid());
   if (!trace)
     return 0;
 
@@ -97,16 +95,17 @@
 
 /**
  * @brief Remove function from the stack trace
+ * @param ses C/S session
  * @param file source file from which the function is called
  * @param line source line from which the function is called
  * @param function name of the function that is called
  * @return 1 on success, 0 otherwise
  */
-int fr_st_leave(char *file, unsigned int line, char *function)
+int fr_srv_st_leave(FR_Session *ses, char *file, unsigned int line, char 
*function)
 {
   StackTrace *trace;
   
-  trace = get_trace(fr_thread_get_tid());
+  trace = get_trace(ses, fr_thread_get_tid());
   if (!trace || trace->depth == 0)
     return 0;
   
@@ -134,15 +133,16 @@
 
 /**
  * @brief Add a info to the last stack trace entry
+ * @param ses C/S session
  * @param info diagnostics information/log/...
  * @return 1 on success, 0 on error
  */
-int fr_st_add_info(char *info)
+int fr_srv_st_add_info(FR_Session *ses, char *info)
 {
   StackTrace *trace;
   StackTraceEntry *entry;
   
-  trace = get_trace(fr_thread_get_tid());
+  trace = get_trace(ses, fr_thread_get_tid());
   if (!trace || !trace->depth)
     return 0;
 
@@ -155,36 +155,38 @@
   if (!entry->info)
     return 0;
     
-  entry->info[entry->info_count - 1] = strdup(info);
+  entry->info[entry->info_count - 1] = fr_strdup(info);
   
   return 1;
 }
 
 /**
  * @brief Return the stack trace for a particular thread
+ * @param ses C/S session
  * @param tid thread ID
  * @return pointer stack trace, NULL on error
  */
-StackTrace *fr_st_get(unsigned int tid)
+StackTrace *fr_srv_st_get(FR_Session *ses, unsigned int tid)
 {
-  return get_trace(tid);
+  return get_trace(ses, tid);
 }
 
 /**
  * @brief Return a list of thread IDs 
+ * @param ses C/S session
  * @return array of thread IDs, NULL on error
  */
-unsigned int *fr_st_threads()
+unsigned int *fr_srv_st_threads(FR_Session *ses)
 {
   unsigned int idx;
   unsigned int *ret;
   
-  ret = fr_malloc(threads * sizeof(unsigned int));
+  ret = fr_malloc(ses->trace_count * sizeof(unsigned int));
   if (!ret)
     return NULL;
   
-  for (idx = 0; idx < threads; idx++)
-    ret[idx] = traces[idx].tid;
+  for (idx = 0; idx < ses->trace_count; idx++)
+    ret[idx] = ses->traces[idx].tid;
   
   return ret;
 }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]