From 849e99602e4b0487dad23e28cb6a94bf013f40a4 Mon Sep 17 00:00:00 2001 From: hunt Date: Thu, 26 May 2005 07:18:22 +0000 Subject: Remove all the generated html files. --- runtime/docs/html/README-source.html | 119 -- runtime/docs/html/TODO-source.html | 42 - runtime/docs/html/TODO.html | 42 - runtime/docs/html/alloc_8c-source.html | 101 -- runtime/docs/html/alloc_8c.html | 45 - runtime/docs/html/bug.html | 27 - runtime/docs/html/copy_8c-source.html | 186 --- runtime/docs/html/copy_8c.html | 34 - runtime/docs/html/current_8c-source.html | 42 - runtime/docs/html/current_8c.html | 24 - runtime/docs/html/deprecated.html | 12 - runtime/docs/html/dir_000000.html | 41 - runtime/docs/html/dir_000001.html | 89 -- runtime/docs/html/dir_000002.html | 27 - runtime/docs/html/dir_000003.html | 40 - runtime/docs/html/dir_000004.html | 28 - runtime/docs/html/dirs.html | 17 - runtime/docs/html/doxygen.css | 297 ----- runtime/docs/html/doxygen.png | Bin 1281 -> 0 bytes runtime/docs/html/dtr_8mod_8c-source.html | 65 - runtime/docs/html/files.html | 35 - runtime/docs/html/globals.html | 95 -- runtime/docs/html/globals_defs.html | 25 - runtime/docs/html/globals_enum.html | 15 - runtime/docs/html/globals_func.html | 67 - runtime/docs/html/globals_type.html | 14 - runtime/docs/html/globals_vars.html | 14 - runtime/docs/html/group__alloc.html | 247 ---- runtime/docs/html/group__copy.html | 263 ---- runtime/docs/html/group__current.html | 59 - runtime/docs/html/group__io.html | 148 --- runtime/docs/html/group__lists.html | 378 ------ runtime/docs/html/group__maps.html | 1299 -------------------- runtime/docs/html/group__print.html | 342 ------ runtime/docs/html/group__stack.html | 129 -- runtime/docs/html/group__string.html | 389 ------ runtime/docs/html/group__sym.html | 113 -- runtime/docs/html/index.html | 58 - runtime/docs/html/io_8c-source.html | 118 -- runtime/docs/html/io_8c.html | 38 - .../docs/html/kprobe__where__funct_8c-source.html | 99 -- runtime/docs/html/map_8c-source.html | 920 -------------- runtime/docs/html/map_8c.html | 102 -- runtime/docs/html/map_8h-source.html | 201 --- runtime/docs/html/map_8h.html | 77 -- runtime/docs/html/modules.html | 20 - runtime/docs/html/pages.html | 16 - runtime/docs/html/print_8c-source.html | 208 ---- runtime/docs/html/probes_2README-source.html | 14 - .../html/probes_2shellsnoop_2README-source.html | 83 -- .../docs/html/probes_2tasklet_2README-source.html | 20 - .../docs/html/probes_2test4_2README-source.html | 34 - .../html/probes_2where__func_2README-source.html | 36 - runtime/docs/html/probes_8c-source.html | 113 -- runtime/docs/html/probes_8c.html | 236 ---- runtime/docs/html/relay-app_8h-source.html | 542 -------- runtime/docs/html/runtime_8h-source.html | 34 - runtime/docs/html/runtime_8h.html | 39 - runtime/docs/html/shellsnoop_2dtr_8c-source.html | 148 --- runtime/docs/html/stack_8c-source.html | 188 --- runtime/docs/html/stack_8c.html | 28 - runtime/docs/html/stp__tasklet_8c-source.html | 69 -- runtime/docs/html/string_8c-source.html | 170 --- runtime/docs/html/string_8c.html | 52 - runtime/docs/html/sym_8c-source.html | 79 -- runtime/docs/html/test4_2dtr_8c-source.html | 152 --- runtime/docs/html/todo.html | 107 -- 67 files changed, 8911 deletions(-) delete mode 100644 runtime/docs/html/README-source.html delete mode 100644 runtime/docs/html/TODO-source.html delete mode 100644 runtime/docs/html/TODO.html delete mode 100644 runtime/docs/html/alloc_8c-source.html delete mode 100644 runtime/docs/html/alloc_8c.html delete mode 100644 runtime/docs/html/bug.html delete mode 100644 runtime/docs/html/copy_8c-source.html delete mode 100644 runtime/docs/html/copy_8c.html delete mode 100644 runtime/docs/html/current_8c-source.html delete mode 100644 runtime/docs/html/current_8c.html delete mode 100644 runtime/docs/html/deprecated.html delete mode 100644 runtime/docs/html/dir_000000.html delete mode 100644 runtime/docs/html/dir_000001.html delete mode 100644 runtime/docs/html/dir_000002.html delete mode 100644 runtime/docs/html/dir_000003.html delete mode 100644 runtime/docs/html/dir_000004.html delete mode 100644 runtime/docs/html/dirs.html delete mode 100644 runtime/docs/html/doxygen.css delete mode 100644 runtime/docs/html/doxygen.png delete mode 100644 runtime/docs/html/dtr_8mod_8c-source.html delete mode 100644 runtime/docs/html/files.html delete mode 100644 runtime/docs/html/globals.html delete mode 100644 runtime/docs/html/globals_defs.html delete mode 100644 runtime/docs/html/globals_enum.html delete mode 100644 runtime/docs/html/globals_func.html delete mode 100644 runtime/docs/html/globals_type.html delete mode 100644 runtime/docs/html/globals_vars.html delete mode 100644 runtime/docs/html/group__alloc.html delete mode 100644 runtime/docs/html/group__copy.html delete mode 100644 runtime/docs/html/group__current.html delete mode 100644 runtime/docs/html/group__io.html delete mode 100644 runtime/docs/html/group__lists.html delete mode 100644 runtime/docs/html/group__maps.html delete mode 100644 runtime/docs/html/group__print.html delete mode 100644 runtime/docs/html/group__stack.html delete mode 100644 runtime/docs/html/group__string.html delete mode 100644 runtime/docs/html/group__sym.html delete mode 100644 runtime/docs/html/index.html delete mode 100644 runtime/docs/html/io_8c-source.html delete mode 100644 runtime/docs/html/io_8c.html delete mode 100644 runtime/docs/html/kprobe__where__funct_8c-source.html delete mode 100644 runtime/docs/html/map_8c-source.html delete mode 100644 runtime/docs/html/map_8c.html delete mode 100644 runtime/docs/html/map_8h-source.html delete mode 100644 runtime/docs/html/map_8h.html delete mode 100644 runtime/docs/html/modules.html delete mode 100644 runtime/docs/html/pages.html delete mode 100644 runtime/docs/html/print_8c-source.html delete mode 100644 runtime/docs/html/probes_2README-source.html delete mode 100644 runtime/docs/html/probes_2shellsnoop_2README-source.html delete mode 100644 runtime/docs/html/probes_2tasklet_2README-source.html delete mode 100644 runtime/docs/html/probes_2test4_2README-source.html delete mode 100644 runtime/docs/html/probes_2where__func_2README-source.html delete mode 100644 runtime/docs/html/probes_8c-source.html delete mode 100644 runtime/docs/html/probes_8c.html delete mode 100644 runtime/docs/html/relay-app_8h-source.html delete mode 100644 runtime/docs/html/runtime_8h-source.html delete mode 100644 runtime/docs/html/runtime_8h.html delete mode 100644 runtime/docs/html/shellsnoop_2dtr_8c-source.html delete mode 100644 runtime/docs/html/stack_8c-source.html delete mode 100644 runtime/docs/html/stack_8c.html delete mode 100644 runtime/docs/html/stp__tasklet_8c-source.html delete mode 100644 runtime/docs/html/string_8c-source.html delete mode 100644 runtime/docs/html/string_8c.html delete mode 100644 runtime/docs/html/sym_8c-source.html delete mode 100644 runtime/docs/html/test4_2dtr_8c-source.html delete mode 100644 runtime/docs/html/todo.html (limited to 'runtime/docs') diff --git a/runtime/docs/html/README-source.html b/runtime/docs/html/README-source.html deleted file mode 100644 index 1421d7e2..00000000 --- a/runtime/docs/html/README-source.html +++ /dev/null @@ -1,119 +0,0 @@ - - -SystemTap: README Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

README

00001 /** @mainpage SystemTap Runtime
-00002 
-00003 @section intro_sec Introduction
-00004 
-00005 This document describes the implementation of the SystemTap Runtime. It is intended for developers
-00006 of the SystemTap Language translator or, possibly TapSet authors. These functions are not directly
-00007 available from the SystemTap Language.
-00008 
-00009 The SystemTap Runtime Library consists of all functions
-00010 and code fragments needed by the compiler/translator to
-00011 include in building a kernel module using kprobes. It
-00012 also include I/O code to transmit its output from the kernel to userspace.
-00013  
-00014 In addition to the library, the runtime includes a SystemTap user-space daemon
-00015 (stpd).  Stpd grabs data sent from the I/O code in the runtime and displays it
-00016 and/or saves it to files. Stpd (or a script invoking it) will handle other issues like
-00017 inserting and removing modules.
-00018 
-00019 Stpd and the I/O code make use of both relayfs and netlink for communication.  For
-00020 kernels without relayfs builtin, it is provided as a standalone module under the runtime directory.
-00021 
-00022 @section design_sec Design
-00023 @subsection impl_sec Implementation
-00024 The library is written in C and is really not a library but a collection of code
-00025 That can be conditionally included in a modules. It may become a library later, but for now
-00026 there are some advantages to being able to change the sizes of static items with simple #defines.
-00027 
-00028 @subsection map_sec Maps (Associative Arrays)
-00029 Maps are implemented as hash lists. It is not expected that users will
-00030 attempt to collect so much data in kernel space that performance problems will require
-00031 more complex solutions such as AVL trees.
-00032 
-00033 Maps are created with _stp_map_new().  Each map can hold only one type of 
-00034 data; int64, string, or statistics.  Each element belonging to a map can have up to 2 keys
-00035 and a value.  Implemented key types are strings and longs.
-00036         
-00037 To simplify the implementation, the functions to set the key and the functions to set the data are separated.
-00038 That means we need only 4 functions to set the key and 3 functions to set the value. 
-00039 
-00040 For example:
-00041 \code
-00042 /* create a map with a max of 100 elements */
-00043 MAP mymap = map_new(100, INT64);
-00044 
-00045 /* mymap[birth year] = 2000 */
-00046 map_key_str (mymap, "birth year");
-00047 map_set_int64 (mymap, 2000);
-00048 \endcode
-00049 
-00050 All elements have a default value of 0 (or NULL).  Elements are only saved to the map when their value is set
-00051 to something nonzero.  This means that querying for the existance of a key is inexpensive because
-00052 no element is created, just a hash table lookup.
-00053 
-00054 @subsection list_sec Lists
-00055 A list is a special map which has internally ascending long integer keys.  Adding a value to
-00056 a list does not require setting a key first. Create a list with _stp_list_new(). Add to it
-00057 with _stp_list_add_str() and _stp_list_add_int64().  Clear it with _stp_list_clear().
-00058 
-00059 @subsection string_sec Strings
-00060 One of the biggest restrictions the library has is that it cannot allocate things like strings off the stack.
-00061 It is also not a good idea to dynamically allocate space for strings with kmalloc().  That leaves us with 
-00062 statically allocated space for strings. This is what is implemented in the String module.  Strings use
-00063 preallocated per-cpu buffers and are safe to use (unlike C strings).
-00064 
-00065 @subsection io_sec I/O
-00066 Generally things are written to a "print buffer" using the internal
-00067 functions _stp_print_xxx().
-00068 \code
-00069 _stp_print ("Output is: ");
-00070 _stp_printf ("pid is %d ", current->pid);
-00071 _stp_printf ("name is %s", current->comm);
-00072 \endcode
-00073 before the probe returns it must call _stp_print_flush().  This
-00074 timestamps the accumulated print buffer and sends it to relayfs.
-00075 When relayfs fills an internal buffer, the user-space daemon is notified
-00076 data is ready and reads a bug per-cpu chunk, which contains a line like:
-00077 \verbatim
-00078 [123456.000002] Output is: pid is 1234 name is bash
-00079 \endverbatim
-00080 
-00081 The user-daemon (stpd) saves this data to a file named something like
-00082 "stpd_cpu2".  When the user hits ^c, a timer expires, or the probe
-00083 module notifies stpd (through a netlink command channel) that it wants
-00084 to terminate, stpd does "system(rmmod)" then collects the last output
-00085 before exiting.
-00086 As an option, if we don't need bulk per-cpu data, we can put
-00087 \code
-00088 #define STP_NETLINK_ONLY
-00089 \endcode
-00090 at the top of the module and all output will go over a netlink channel.
-00091 In the SystemTap language, we will provide some simple functions to control the buffering policy, which
-00092 will control the use of netlink and parameters to relayfs and stpd.
-00093 
-00094 @section status_sec Status
-00095 @li Maps are implemented and tested. Histograms are not yet finished.
-00096 @li Copy_From_User functions are done.
-00097 @li If maps overflow or memory runs out for some reason, globals are set but nothing is done yet.
-00098 I expect to implement a function to tell the system to either ignore it or unload the module and quit.
-00099 @li Stack functions need much improvement.
-00100 
-00101 @section probe_sec Example Probes
-00102 
-00103 Working sample probe code using the runtime is in runtime/probes.
-00104 <a href="dir_000000.html"> Browse probes.</a>
-00105 
-00106 @section todo_sec ToDo 
-00107 \link todo Click Here for Complete List \endlink
-00108 
-00109 @section links Links
-00110 <a href="http://sources.redhat.com/systemtap/">SystemTap Project Page</a>
-00111  */
-
diff --git a/runtime/docs/html/TODO-source.html b/runtime/docs/html/TODO-source.html deleted file mode 100644 index ff8d219b..00000000 --- a/runtime/docs/html/TODO-source.html +++ /dev/null @@ -1,42 +0,0 @@ - - -SystemTap: TODO Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

TODO

Go to the documentation of this file.
00001 /**
-00002 @file TODO
-00003 @brief To-Do List
-00004 
-00005 ***** STPD *****
-00006 
-00007 @todo stpd needs an option to disable ANSI colors.
-00008 
-00009 @todo stpd needs to be able to write netlink REALTIME_DATA to a file.
-00010 
-00011 @todo stpd/stp/io.c stpd needs better startup/shutdown integration with io.c in runtime. 
-00012 Shutdown works, but isn't very clean.  Currently the stp script loads the module, then
-00013 starts stpd.  Data is lost until stpd is active. Maybe stpd needs to load the module. 
-00014 Maybe it needs to signal the module that stpd is ready and the module can proceed to load the probes.
-00015 
-00016 @todo stpd/stp - What if there are multiple probes running? 
-00017 
-00018 @todo stpd/stp - Need something to post-process relayfs files and integrate into a single file.
-00019 
-00020 @todo stpd - Implement command that runtime can send to stpd to tell it to fork a specified program and pass
-00021 the output from the probe module to it.  Create example probe to use it.
-00022 
-00023 ***** relayfs *****
-00024 @todo relayfs/build - figure out how to get rid of the linker warnings when building probes. 
-00025 
-00026 ***** runtime *****
-00027 @todo runtime - Clean up #defines. Need to have a clearer way to have the probe writer (translator) 
-00028 see which defines affect what and all defines should have reasonable defaults.
-00029 
-00030 @todo runtime - current.c - implement a memory dump function. Does a hex dump into String or print buffer.
-00031 @todo runtime - put wrappers around current task struct entries, like pid, ppid, comm, etc.
-00032 @todo runtime - Implement stack functions for kprobes (not just jprobes)
-00033 
-00034 */
-
diff --git a/runtime/docs/html/TODO.html b/runtime/docs/html/TODO.html deleted file mode 100644 index e5771873..00000000 --- a/runtime/docs/html/TODO.html +++ /dev/null @@ -1,42 +0,0 @@ - - -SystemTap: TODO File Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

TODO File Reference

To-Do List. More... -

- -

-Go to the source code of this file. - -
-


Detailed Description

-To-Do List. -

-STPD *****

-

Todo:
stpd needs an option to disable ANSI colors.
-

-

Todo:
stpd needs to be able to write netlink REALTIME_DATA to a file.
-

-

Todo:
stpd/stp/io.c stpd needs better startup/shutdown integration with io.c in runtime. Shutdown works, but isn't very clean. Currently the stp script loads the module, then starts stpd. Data is lost until stpd is active. Maybe stpd needs to load the module. Maybe it needs to signal the module that stpd is ready and the module can proceed to load the probes.
-

-

Todo:
stpd/stp - What if there are multiple probes running?
-

-

Todo:
stpd/stp - Need something to post-process relayfs files and integrate into a single file.
-

-

Todo:
stpd - Implement command that runtime can send to stpd to tell it to fork a specified program and pass the output from the probe module to it. Create example probe to use it.
-relayfs *****

-

Todo:
relayfs/build - figure out how to get rid of the linker warnings when building probes.
-runtime *****

-

Todo:
runtime - Clean up #defines. Need to have a clearer way to have the probe writer (translator) see which defines affect what and all defines should have reasonable defaults.
-

-

Todo:
runtime - current.c - implement a memory dump function. Does a hex dump into String or print buffer.
-

-

Todo:
runtime - put wrappers around current task struct entries, like pid, ppid, comm, etc.
-

-

Todo:
runtime - Implement stack functions for kprobes (not just jprobes)
- -

-Definition in file TODO. diff --git a/runtime/docs/html/alloc_8c-source.html b/runtime/docs/html/alloc_8c-source.html deleted file mode 100644 index 4e76adbb..00000000 --- a/runtime/docs/html/alloc_8c-source.html +++ /dev/null @@ -1,101 +0,0 @@ - - -SystemTap: alloc.c Source File - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

alloc.c

Go to the documentation of this file.
00001 #ifndef _ALLOC_C_
-00002 #define _ALLOC_C_
-00003 
-00004 /* -*- linux-c -*- */
-00005 /** @file alloc.c
-00006  * @brief Memory functions.
-00007  */
-00008 /** @addtogroup alloc Memory Functions
-00009  * Basic malloc/calloc/free functions. These will be changed so 
-00010  * that memory allocation errors will call a handler.  The default will
-00011  * send a signal to the user-space daemon that will trigger the module to
-00012  * be unloaded.
-00013  * @todo Need error handling for memory allocations
-00014  * @todo Some of these currently use kmalloc (GFP_ATOMIC) for
-00015  * small allocations.  This should be evaluated for performance
-00016  * and stability.
-00017  * @{
-00018  */
-00019 
-00020 enum errorcode { ERR_NONE=0, ERR_NO_MEM };
-00021 enum errorcode _stp_error = ERR_NONE;
-00022 
-00023 /** Allocates memory within a probe.
-00024  * This is used for small allocations from within a running
-00025  * probe where the process cannot sleep. 
-00026  * @param len Number of bytes to allocate.
-00027  * @return a valid pointer on success or NULL on failure.
-00028  * @bug Currently uses kmalloc (GFP_ATOMIC).
-00029  */
-00030 
-00031 void *_stp_alloc(size_t len)
-00032 {
-00033         void *ptr = kmalloc(len, GFP_ATOMIC);
-00034         if (unlikely(ptr == NULL))
-00035                 _stp_error = ERR_NO_MEM;
-00036         return ptr;
-00037 }
-00038 
-00039 /** Allocates and clears memory within a probe.
-00040  * This is used for small allocations from within a running
-00041  * probe where the process cannot sleep. 
-00042  * @param len Number of bytes to allocate.
-00043  * @return a valid pointer on success or NULL on failure.
-00044  * @bug Currently uses kmalloc (GFP_ATOMIC).
-00045  */
-00046 
-00047 void *_stp_calloc(size_t len)
-00048 {
-00049         void *ptr = _stp_alloc(len);
-00050         if (likely(ptr))
-00051                 memset(ptr, 0, len);
-00052         return ptr;
-00053 }
-00054 
-00055 /** Allocates and clears memory outside a probe.
-00056  * This is typically used in the module initialization to
-00057  * allocate new maps, lists, etc.
-00058  * @param len Number of bytes to allocate.
-00059  * @return a valid pointer on success or NULL on failure.
-00060  */
-00061 
-00062 void *_stp_valloc(size_t len)
-00063 {
-00064         void *ptr = vmalloc(len);
-00065         if (likely(ptr))
-00066                 memset(ptr, 0, len);
-00067         else
-00068                 _stp_error = ERR_NO_MEM;
-00069         return ptr;
-00070 }
-00071 
-00072 /** Frees memory allocated by _stp_alloc or _stp_calloc.
-00073  * @param ptr pointer to memory to free
-00074  */
-00075 
-00076 void _stp_free(void *ptr)
-00077 {
-00078         if (likely(ptr))
-00079                 kfree(ptr);
-00080 }
-00081 
-00082 /** Frees memory allocated by _stp_valloc.
-00083  * @param ptr pointer to memory to free
-00084  */
-00085 
-00086 void _stp_vfree(void *ptr)
-00087 {
-00088         if (likely(ptr))
-00089                 vfree(ptr);
-00090 }
-00091 
-00092 /** @} */
-00093 #endif /* _ALLOC_C_ */
-
diff --git a/runtime/docs/html/alloc_8c.html b/runtime/docs/html/alloc_8c.html deleted file mode 100644 index 8e9f7d80..00000000 --- a/runtime/docs/html/alloc_8c.html +++ /dev/null @@ -1,45 +0,0 @@ - - -SystemTap: alloc.c File Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

alloc.c File Reference

Memory functions. More... -

- -

-Go to the source code of this file. - - - - - - - - - - - - - - - - - - - - - - - -

Enumerations

enum  errorcode { ERR_NONE = 0, -ERR_NO_MEM - }

Functions

void * _stp_alloc (size_t len)
 Allocates memory within a probe.
void * _stp_calloc (size_t len)
 Allocates and clears memory within a probe.
void * _stp_valloc (size_t len)
 Allocates and clears memory outside a probe.
void _stp_free (void *ptr)
 Frees memory allocated by _stp_alloc or _stp_calloc.
void _stp_vfree (void *ptr)
 Frees memory allocated by _stp_valloc.

Variables

-enum errorcode _stp_error = ERR_NONE
-


Detailed Description

-Memory functions. -

- -

-Definition in file alloc.c. diff --git a/runtime/docs/html/bug.html b/runtime/docs/html/bug.html deleted file mode 100644 index e19f1b2e..00000000 --- a/runtime/docs/html/bug.html +++ /dev/null @@ -1,27 +0,0 @@ - - -SystemTap: Bug List - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

Bug List

-
Global _stp_alloc (size_t len)
-
Currently uses kmalloc (GFP_ATOMIC).
-
-

-

-
Global _stp_calloc (size_t len)
-
Currently uses kmalloc (GFP_ATOMIC).
-
-

-

-
Global _stp_stack_print (int verbose, int levels)
-
levels parameter is not functional
-
-

-

-
Global _stp_stack_sprint (String str, int verbose, int levels)
-
levels parameter is not functional
-
- diff --git a/runtime/docs/html/copy_8c-source.html b/runtime/docs/html/copy_8c-source.html deleted file mode 100644 index 273aa45c..00000000 --- a/runtime/docs/html/copy_8c-source.html +++ /dev/null @@ -1,186 +0,0 @@ - - -SystemTap: copy.c Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

copy.c

Go to the documentation of this file.
00001 #ifndef _COPY_C_ /* -*- linux-c -*- */
-00002 #define _COPY_C_
-00003 
-00004 #include "string.c"
-00005 
-00006 /** @file copy.c
-00007  * @brief Functions to copy from user space.
-00008  */
-00009 
-00010 /** @addtogroup copy Functions to copy from user space.
-00011  * Functions to copy from user space.
-00012  * None of these functions will sleep (for example to allow pages
-00013  * to be swapped in). It is possible (although rare) that the data
-00014  * in user space will not present and these functions will return an error.
-00015  * @{
-00016  */
-00017 
-00018 long _stp_strncpy_from_user(char *dst, const char __user *src, long count);
-00019 //static long __stp_strncpy_from_user(char *dst, const char __user *src, long count);
-00020 
-00021 #if defined (__i386__)
-00022 #define __stp_strncpy_from_user(dst,src,count,res)                         \
-00023 do {                                                                       \
-00024         int __d0, __d1, __d2;                                              \
-00025         __asm__ __volatile__(                                              \
-00026                 "       testl %1,%1\n"                                     \
-00027                 "       jz 2f\n"                                           \
-00028                 "0:     lodsb\n"                                           \
-00029                 "       stosb\n"                                           \
-00030                 "       testb %%al,%%al\n"                                 \
-00031                 "       jz 1f\n"                                           \
-00032                 "       decl %1\n"                                         \
-00033                 "       jnz 0b\n"                                          \
-00034                 "1:     subl %1,%0\n"                                      \
-00035                 "2:\n"                                                     \
-00036                 ".section .fixup,\"ax\"\n"                                 \
-00037                 "3:     movl %5,%0\n"                                      \
-00038                 "       jmp 2b\n"                                          \
-00039                 ".previous\n"                                              \
-00040                 ".section __ex_table,\"a\"\n"                              \
-00041                 "       .align 4\n"                                        \
-00042                 "       .long 0b,3b\n"                                     \
-00043                 ".previous"                                                \
-00044                 : "=d"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1),      \
-00045                   "=&D" (__d2)                                             \
-00046                 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \
-00047                 : "memory");                                               \
-00048 } while (0)
-00049 #elif defined (__x86_64__)
-00050 #define __stp_strncpy_from_user(dst,src,count,res)                         \
-00051 do {                                                                       \
-00052         long __d0, __d1, __d2;                                             \
-00053         __asm__ __volatile__(                                              \
-00054                 "       testq %1,%1\n"                                     \
-00055                 "       jz 2f\n"                                           \
-00056                 "0:     lodsb\n"                                           \
-00057                 "       stosb\n"                                           \
-00058                 "       testb %%al,%%al\n"                                 \
-00059                 "       jz 1f\n"                                           \
-00060                 "       decq %1\n"                                         \
-00061                 "       jnz 0b\n"                                          \
-00062                 "1:     subq %1,%0\n"                                      \
-00063                 "2:\n"                                                     \
-00064                 ".section .fixup,\"ax\"\n"                                 \
-00065                 "3:     movq %5,%0\n"                                      \
-00066                 "       jmp 2b\n"                                          \
-00067                 ".previous\n"                                              \
-00068                 ".section __ex_table,\"a\"\n"                              \
-00069                 "       .align 8\n"                                        \
-00070                 "       .quad 0b,3b\n"                                     \
-00071                 ".previous"                                                \
-00072                 : "=r"(res), "=c"(count), "=&a" (__d0), "=&S" (__d1),      \
-00073                   "=&D" (__d2)                                             \
-00074                 : "i"(-EFAULT), "0"(count), "1"(count), "3"(src), "4"(dst) \
-00075                 : "memory");                                               \
-00076 } while (0)
-00077 #endif
-00078 
-00079 /** Copy a NULL-terminated string from userspace.
-00080  * On success, returns the length of the string (not including the trailing
-00081  * NULL).
-00082  *
-00083  * If access to userspace fails, returns -EFAULT (some data may have been
-00084  * copied).
-00085  * @param dst Destination address, in kernel space.  This buffer must be at
-00086  *         least <i>count</i> bytes long.
-00087  * @param src Source address, in user space.
-00088  * @param count Maximum number of bytes to copy, including the trailing NULL.
-00089  * 
-00090  * If <i>count</i> is smaller than the length of the string, copies 
-00091  * <i>count</i> bytes and returns <i>count</i>.
-00092  * @deprecated I can't think of why you wouldn't use _stp_string_from_user() instead.
-00093  */
-00094 
-00095 long
-00096 _stp_strncpy_from_user(char *dst, const char __user *src, long count)
-00097 {
-00098         long res;
-00099         __stp_strncpy_from_user(dst, src, count, res);
-00100         return res;
-00101 }
-00102 
-00103 /** Copy a String from userspace.
-00104  * Copies a string of up to \e count bytes from userspace into a String. 
-00105  * If access to userspace fails, returns -EFAULT (some data may have been
-00106  * copied).
-00107  * @param str Destination String.
-00108  * @param src Source address, in user space.
-00109  * @param count Maximum number of bytes to copy, including the trailing NULL.
-00110  * 
-00111  */
-00112 
-00113 void _stp_string_from_user (String str,  const char __user *src, long count)
-00114 {
-00115         long res;
-00116         if (count > STP_STRING_SIZE - str->len - 1)
-00117                 count = STP_STRING_SIZE - str->len - 1;
-00118         __stp_strncpy_from_user(str->buf + str->len, src, count, res);
-00119         if (res > 0) {
-00120                 str->len += res;
-00121                 str->buf[str->len] = '\0';
-00122         }
-00123 }
-00124 
-00125 /** Copy a block of data from user space.
-00126  *
-00127  * If some data could not be copied, this function will pad the copied
-00128  * data to the requested size using zero bytes.
-00129 
-00130  * @param dst Destination address, in kernel space.
-00131  * @param src Source address, in user space.
-00132  * @param count Number of bytes to copy.
-00133  * @return number of bytes that could not be copied. On success, 
-00134  * this will be zero.
-00135  *
-00136  */
-00137 
-00138 unsigned long
-00139 _stp_copy_from_user (char *dst, const char __user *src, unsigned long count)
-00140 {
-00141         return __copy_from_user_inatomic(dst, src, count);
-00142 }
-00143 
-00144 /** Copy an argv from user space to a List.
-00145  *
-00146  * @param list A list.
-00147  * @param argv Source argv, in user space.
-00148  * @return number of elements in <i>list</i>
-00149  *
-00150  * @b Example:
-00151  * @include argv.c
-00152  */
-00153 
-00154 int _stp_copy_argv_from_user (MAP list, char __user *__user *argv)
-00155 {
-00156         char str[128];
-00157         char __user *vstr;
-00158         int len;
-00159 
-00160         if (argv)
-00161                 argv++;
-00162 
-00163         while (argv != NULL) {
-00164                 if (get_user (vstr, argv))
-00165                         break;
-00166                 
-00167                 if (vstr == NULL)
-00168                         break;
-00169                 
-00170                 len = _stp_strncpy_from_user(str, vstr, 128);
-00171                 str[len] = 0;
-00172                 _stp_list_add_str (list, str);
-00173                 argv++;
-00174         }
-00175         return list->num;
-00176 }
-00177 /** @} */
-00178 #endif /* _COPY_C_ */
-
diff --git a/runtime/docs/html/copy_8c.html b/runtime/docs/html/copy_8c.html deleted file mode 100644 index b9c4cc23..00000000 --- a/runtime/docs/html/copy_8c.html +++ /dev/null @@ -1,34 +0,0 @@ - - -SystemTap: copy.c File Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

copy.c File Reference

Functions to copy from user space. More... -

-#include "string.c"
- -

-Go to the source code of this file. - - - - - - - - - - - - - - -

Functions

long _stp_strncpy_from_user (char *dst, const char __user *src, long count)
 Copy a NULL-terminated string from userspace.
void _stp_string_from_user (String str, const char __user *src, long count)
 Copy a String from userspace.
unsigned long _stp_copy_from_user (char *dst, const char __user *src, unsigned long count)
 Copy a block of data from user space.
int _stp_copy_argv_from_user (MAP list, char __user *__user *argv)
 Copy an argv from user space to a List.
-


Detailed Description

-Functions to copy from user space. -

- -

-Definition in file copy.c. diff --git a/runtime/docs/html/current_8c-source.html b/runtime/docs/html/current_8c-source.html deleted file mode 100644 index cbe1bca7..00000000 --- a/runtime/docs/html/current_8c-source.html +++ /dev/null @@ -1,42 +0,0 @@ - - -SystemTap: current.c Source File - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

current.c

Go to the documentation of this file.
00001 #ifndef _CURRENT_C_
-00002 #define _CURRENT_C_
-00003 
-00004 /* -*- linux-c -*- */
-00005 /** @file current.c
-00006  * @brief Functions to get the current state.
-00007  */
-00008 /** @addtogroup current Current State
-00009  * Functions to get the current state.
-00010  * @{
-00011  */
-00012 
-00013 
-00014 /** Get the current return address.
-00015  * Call from kprobes (not jprobes).
-00016  * @param regs The pt_regs saved by the kprobe.
-00017  * @return The return address saved in esp or rsp.
-00018  * @note i386 and x86_64 only so far.
-00019  */
-00020  
-00021 unsigned long _stp_ret_addr (struct pt_regs *regs)
-00022 {
-00023 #ifdef __x86_64__
-00024   unsigned long *ra = (unsigned long *)regs->rsp;
-00025 #else
-00026   unsigned long *ra = (unsigned long *)regs->esp;
-00027 #endif
-00028   if (ra)
-00029     return *ra;
-00030   else
-00031     return 0;
-00032 }
-00033 /** @} */
-00034 #endif /* _CURRENT_C_ */
-
diff --git a/runtime/docs/html/current_8c.html b/runtime/docs/html/current_8c.html deleted file mode 100644 index 698a4467..00000000 --- a/runtime/docs/html/current_8c.html +++ /dev/null @@ -1,24 +0,0 @@ - - -SystemTap: current.c File Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

current.c File Reference

Functions to get the current state. More... -

- -

-Go to the source code of this file. - - - - - -

Functions

unsigned long _stp_ret_addr (struct pt_regs *regs)
 Get the current return address.
-


Detailed Description

-Functions to get the current state. -

- -

-Definition in file current.c. diff --git a/runtime/docs/html/deprecated.html b/runtime/docs/html/deprecated.html deleted file mode 100644 index fbfbb5d0..00000000 --- a/runtime/docs/html/deprecated.html +++ /dev/null @@ -1,12 +0,0 @@ - - -SystemTap: Deprecated List - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

Deprecated List

-
Global _stp_strncpy_from_user (char *dst, const char __user *src, long count)
-
I can't think of why you wouldn't use _stp_string_from_user() instead.
-
- diff --git a/runtime/docs/html/dir_000000.html b/runtime/docs/html/dir_000000.html deleted file mode 100644 index 9ee08412..00000000 --- a/runtime/docs/html/dir_000000.html +++ /dev/null @@ -1,41 +0,0 @@ - - -SystemTap: probes/ Directory Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
- -

probes Directory Reference

This directory contains working example probes that demonstrate and test the runtime library. -More... - - - - - - -

-

- - - -

-

- - - -

-

- - - -

-

- - -

Directories

directory  shellsnoop
 Snoops on what commands are being run by shells.
directory  tasklet
 Sample probe in a tasklet.
directory  test4
 This example probe tracks file opens, reads and writes.
directory  where_func
 This is a silly little instrumentation routine to instrument functions entry by name.

Files

file  README [code]
-

Detailed Description

-This directory contains working example probes that demonstrate and test the runtime library. -

-They are tested on i386 and x86_64. diff --git a/runtime/docs/html/dir_000001.html b/runtime/docs/html/dir_000001.html deleted file mode 100644 index 3e97a453..00000000 --- a/runtime/docs/html/dir_000001.html +++ /dev/null @@ -1,89 +0,0 @@ - - -SystemTap: probes/shellsnoop/ Directory Reference - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
- -

shellsnoop Directory Reference

Snoops on what commands are being run by shells. -More... - - - - - - - - -

Files

file  dtr.c [code]
file  dtr.mod.c [code]
file  README [code]
-

Detailed Description

-Snoops on what commands are being run by shells. -

-This is a translation of on an old dtr probe. It demonstrates maps, lists, and how to use _stp_copy_argv_from_user() and _stp_strncpy_from_user().

-Original dtr source:

-

-# shellsnoop.probe - snoop shell execution as it occurs.
-# clone of dtrace shellsnoop example
-
-global {
-  long @pids[long];
-}
-
-probe do_execve:entry {
-  char __user *vstr;
-  char str[256];
-  int len;
-
-  /* watch shells only */
-  /* FIXME: detect more shells, like csh, tcsh, zsh */
-
-  if (!strcmp(current->comm,"bash") || !strcmp(current->comm,"sh") || !strcmp(current->comm, "zsh")
-      || !strcmp(current->comm, "tcsh") || !strcmp(current->comm, "pdksh"))
-    {
-      dlog ("%d\t%d\t%d\t%s ", current->uid, current->pid, current->parent->pid, filename);
-      @pids[current->pid] = 1;
-
-      /* print out argv, ignoring argv[0] */
-      if (argv) argv++;
-      while (argv != NULL)
-        {
-          if (get_user (vstr, argv))
-            break;
-          if (!vstr)
-            break;
-          len = dtr_strncpy_from_user(str, vstr, 256);
-          str[len] = 0;
-          printk ("%s ", str);
-          argv++;
-        }
-      printk ("\n");
-    }
-}
-
-# use filp_open because copy_from_user not needed there
-probe filp_open:entry {
-  if (@pids[current->pid])
-    dlog ("%d\t%d\t%s\tO %s\n", current->pid, current->parent->pid, current->comm, filename);
-}
-
-probe sys_read:entry {
-  if (@pids[current->pid])
-    dlog ("%d\t%d\t%s\tR %d\n", current->pid, current->parent->pid, current->comm, fd);
-}
-
-probe sys_write:entry {
-  size_t len;
-  char str[256];
-  if (@pids[current->pid])
-    {
-      if (count < 64) len = count;
-      else len = 64;
-      if (len = dtr_strncpy_from_user(str, buf, len)) {
-        str[len] = 0;
-        dlog ("%d\t%d\t%s\tW %s\n", current->pid, current->parent->pid, current->comm, str);
-        }
-    }
-}
-
diff --git a/runtime/docs/html/dir_000002.html b/runtime/docs/html/dir_000002.html deleted file mode 100644 index 0fe099ec..00000000 --- a/runtime/docs/html/dir_000002.html +++ /dev/null @@ -1,27 +0,0 @@ - - -SystemTap: probes/tasklet/ Directory Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
- -

tasklet Directory Reference

Sample probe in a tasklet. -More... - - - - - - -

Files

file  README [code]
file  stp_tasklet.c [code]
-

Detailed Description

-Sample probe in a tasklet. -

-Useful for interrupt context testing.

-

-> ./build
-> insmod stp_tasklet.ko
-> rmmod stp_tasklet.ko
-
diff --git a/runtime/docs/html/dir_000003.html b/runtime/docs/html/dir_000003.html deleted file mode 100644 index 497baf4d..00000000 --- a/runtime/docs/html/dir_000003.html +++ /dev/null @@ -1,40 +0,0 @@ - - -SystemTap: probes/test4/ Directory Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
- -

test4 Directory Reference

This example probe tracks file opens, reads and writes. -More... - - - - - - -

Files

file  dtr.c [code]
file  README [code]
-

Detailed Description

-This example probe tracks file opens, reads and writes. -

-It demonstrates maps, stats, and iterators.

-This is a translation of on an old dtr probe. Original source is

-global {
-  long @opens[string];
-  sum @reads[string], @writes[string];
-}
-
-probe sys_open:entry {
-  @opens[current->comm]++;
-}
-
-probe sys_read:entry {
-  @reads[current->comm] << count;
-}
-
-probe sys_write:entry {
-  @writes[current->comm] << count;
-}
-
diff --git a/runtime/docs/html/dir_000004.html b/runtime/docs/html/dir_000004.html deleted file mode 100644 index 4eeb55a8..00000000 --- a/runtime/docs/html/dir_000004.html +++ /dev/null @@ -1,28 +0,0 @@ - - -SystemTap: probes/where_func/ Directory Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
- -

where_func Directory Reference

This is a silly little instrumentation routine to instrument functions entry by name. -More... - - - - - - -

Files

file  kprobe_where_funct.c [code]
file  README [code]
-

Detailed Description

-This is a silly little instrumentation routine to instrument functions entry by name. -

-It makes use of the SystemTap runtime libraries to break down the number of times the function by caller.

-It demonstrates kprobes, passing a module parameter, using the print buffer, and using _stp_print_symbol() to map the addresses back to locations in functions.

-By default it instruments schedule().

-The instrumentation module is built by having the kernel that is going to be instrumented currently on the machine and doing

./build
-
The instrumentation is inserted as root with:
/sbin/insmod kprobe_funct_where.ko funct_name=function_name
-
The instrumentation is removed as root with:
/sbin/rmmod kprobe_funct_where
-
-Will Cohen diff --git a/runtime/docs/html/dirs.html b/runtime/docs/html/dirs.html deleted file mode 100644 index 9cc73aaf..00000000 --- a/runtime/docs/html/dirs.html +++ /dev/null @@ -1,17 +0,0 @@ - - -SystemTap: Directory Hierarchy - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

SystemTap Directories

This directory hierarchy is sorted roughly, but not completely, alphabetically: - diff --git a/runtime/docs/html/doxygen.css b/runtime/docs/html/doxygen.css deleted file mode 100644 index e5272cd1..00000000 --- a/runtime/docs/html/doxygen.css +++ /dev/null @@ -1,297 +0,0 @@ -BODY,H1,H2,H3,H4,H5,H6,P,CENTER,TD,TH,UL,DL,DIV { - font-family: Geneva, Arial, Helvetica, sans-serif; -} -BODY,TD { - font-size: 90%; -} -H1 { - text-align: center; - font-size: 160%; -} -H2 { - font-size: 120%; -} -H3 { - font-size: 110%; -} -CAPTION { font-weight: bold } -DIV.qindex { - width: 100%; - background-color: #eeeeff; - border: 1px solid #b0b0b0; - text-align: center; - margin: 2px; - padding: 2px; - line-height: 140%; -} -DIV.nav { - width: 100%; - background-color: #eeeeff; - border: 1px solid #b0b0b0; - text-align: center; - margin: 2px; - padding: 2px; - line-height: 140%; -} -A.qindex { - text-decoration: none; - font-weight: bold; - color: #1A419D; -} -A.qindex:visited { - text-decoration: none; - font-weight: bold; - color: #1A419D -} -A.qindex:hover { - text-decoration: none; - background-color: #ddddff; -} -A.qindexHL { - text-decoration: none; - font-weight: bold; - background-color: #6666cc; - color: #ffffff; - border: 1px double #9295C2; -} -A.qindexHL:hover { - text-decoration: none; - background-color: #6666cc; - color: #ffffff; -} -A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } -A.el { text-decoration: none; font-weight: bold } -A.elRef { font-weight: bold } -A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} -A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} -A.codeRef:link { font-weight: normal; color: #0000FF} -A.codeRef:visited { font-weight: normal; color: #0000FF} -A:hover { text-decoration: none; background-color: #f2f2ff } -DL.el { margin-left: -1cm } -.fragment { - font-family: monospace -} -PRE.fragment { - border: 1px solid #CCCCCC; - background-color: #f5f5f5; - margin-top: 4px; - margin-bottom: 4px; - margin-left: 2px; - margin-right: 8px; - padding-left: 6px; - padding-right: 6px; - padding-top: 4px; - padding-bottom: 4px; -} -DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } -TD.md { background-color: #F4F4FB; font-weight: bold; } -TD.mdPrefix { - background-color: #F4F4FB; - color: #606060; - font-size: 80%; -} -TD.mdname1 { background-color: #F4F4FB; font-weight: bold; color: #602020; } -TD.mdname { background-color: #F4F4FB; font-weight: bold; color: #602020; width: 600px; } -DIV.groupHeader { - margin-left: 16px; - margin-top: 12px; - margin-bottom: 6px; - font-weight: bold; -} -DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } -BODY { - background: white; - color: black; - margin-right: 20px; - margin-left: 20px; -} -TD.indexkey { - background-color: #eeeeff; - font-weight: bold; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px; - border: 1px solid #CCCCCC; -} -TD.indexvalue { - background-color: #eeeeff; - font-style: italic; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px; - border: 1px solid #CCCCCC; -} -TR.memlist { - background-color: #f0f0f0; -} -P.formulaDsp { text-align: center; } -IMG.formulaDsp { } -IMG.formulaInl { vertical-align: middle; } -SPAN.keyword { color: #008000 } -SPAN.keywordtype { color: #604020 } -SPAN.keywordflow { color: #e08000 } -SPAN.comment { color: #800000 } -SPAN.preprocessor { color: #806020 } -SPAN.stringliteral { color: #002080 } -SPAN.charliteral { color: #008080 } -.mdTable { - border: 1px solid #868686; - background-color: #F4F4FB; -} -.mdRow { - padding: 8px 10px; -} -.mdescLeft { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.mdescRight { - padding: 0px 8px 4px 8px; - font-size: 80%; - font-style: italic; - background-color: #FAFAFA; - border-top: 1px none #E0E0E0; - border-right: 1px none #E0E0E0; - border-bottom: 1px none #E0E0E0; - border-left: 1px none #E0E0E0; - margin: 0px; -} -.memItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemLeft { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplItemRight { - padding: 1px 8px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - background-color: #FAFAFA; - font-size: 80%; -} -.memTemplParams { - padding: 1px 0px 0px 8px; - margin: 4px; - border-top-width: 1px; - border-right-width: 1px; - border-bottom-width: 1px; - border-left-width: 1px; - border-top-color: #E0E0E0; - border-right-color: #E0E0E0; - border-bottom-color: #E0E0E0; - border-left-color: #E0E0E0; - border-top-style: solid; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - color: #606060; - background-color: #FAFAFA; - font-size: 80%; -} -.search { color: #003399; - font-weight: bold; -} -FORM.search { - margin-bottom: 0px; - margin-top: 0px; -} -INPUT.search { font-size: 75%; - color: #000080; - font-weight: normal; - background-color: #eeeeff; -} -TD.tiny { font-size: 75%; -} -a { - color: #252E78; -} -a:visited { - color: #3D2185; -} -.dirtab { padding: 4px; - border-collapse: collapse; - border: 1px solid #b0b0b0; -} -TH.dirtab { background: #eeeeff; - font-weight: bold; -} -HR { height: 1px; - border: none; - border-top: 1px solid black; -} diff --git a/runtime/docs/html/doxygen.png b/runtime/docs/html/doxygen.png deleted file mode 100644 index f0a274bb..00000000 Binary files a/runtime/docs/html/doxygen.png and /dev/null differ diff --git a/runtime/docs/html/dtr_8mod_8c-source.html b/runtime/docs/html/dtr_8mod_8c-source.html deleted file mode 100644 index c1483735..00000000 --- a/runtime/docs/html/dtr_8mod_8c-source.html +++ /dev/null @@ -1,65 +0,0 @@ - - -SystemTap: probes/shellsnoop/dtr.mod.c Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
- -

dtr.mod.c

00001 #include <linux/module.h>
-00002 #include <linux/vermagic.h>
-00003 #include <linux/compiler.h>
-00004 
-00005 MODULE_INFO(vermagic, VERMAGIC_STRING);
-00006 
-00007 #undef unix
-00008 struct module __this_module
-00009 __attribute__((section(".gnu.linkonce.this_module"))) = {
-00010  .name = __stringify(KBUILD_MODNAME),
-00011  .init = init_module,
-00012 #ifdef CONFIG_MODULE_UNLOAD
-00013  .exit = cleanup_module,
-00014 #endif
-00015 };
-00016 
-00017 static const struct modversion_info ____versions[]
-00018 __attribute_used__
-00019 __attribute__((section("__versions"))) = {
-00020         { 0x506abef7, "struct_module" },
-00021         { 0x1b9aca3f, "jprobe_return" },
-00022         { 0x45e5f47f, "register_kprobe" },
-00023         { 0x1e736243, "unregister_kprobe" },
-00024         { 0xdd03a51e, "register_jprobe" },
-00025         { 0x49a83d3a, "unregister_jprobe" },
-00026         { 0xaa27f890, "__get_user_8" },
-00027         { 0x21e5679c, "copy_user_generic" },
-00028         { 0x3fa03a97, "memset" },
-00029         { 0xc16fe12d, "__memcpy" },
-00030         { 0xe914e41e, "strcpy" },
-00031         { 0xe2d5255a, "strcmp" },
-00032         { 0x2fd1d81c, "vfree" },
-00033         { 0x37a0cba, "kfree" },
-00034         { 0xd6ee688f, "vmalloc" },
-00035         { 0x8ce16b3f, "__kmalloc" },
-00036         { 0xfcdec747, "sock_release" },
-00037         { 0x8968634b, "netlink_kernel_create" },
-00038         { 0x7ec9bfbc, "strncpy" },
-00039         { 0xe3b0192b, "vscnprintf" },
-00040         { 0x757b6858, "skb_dequeue" },
-00041         { 0xd4aed67a, "netlink_ack" },
-00042         { 0xdd132261, "printk" },
-00043         { 0x5fc0695e, "__kfree_skb" },
-00044         { 0xaa1449d7, "netlink_unicast" },
-00045         { 0x3958414f, "skb_over_panic" },
-00046         { 0x559dbbb8, "alloc_skb" },
-00047 };
-00048 
-00049 static const char __module_depends[]
-00050 __attribute_used__
-00051 __attribute__((section(".modinfo"))) =
-00052 "depends=";
-00053 
-00054 
-00055 MODULE_INFO(srcversion, "F330A962246F179FE15E94B");
-
diff --git a/runtime/docs/html/files.html b/runtime/docs/html/files.html deleted file mode 100644 index 0099797e..00000000 --- a/runtime/docs/html/files.html +++ /dev/null @@ -1,35 +0,0 @@ - - -SystemTap: File Index - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

SystemTap File List

Here is a list of all documented files with brief descriptions: - - - - - - - - - - - - - - - - - - - - - - - - - -
alloc.c [code]Memory functions
copy.c [code]Functions to copy from user space
current.c [code]Functions to get the current state
io.c [code]I/O functions
map.c [code]Implements maps (associative arrays) and lists
map.h [code]Header file for maps and lists
print.c [code]
probes.c [code]Functions to assist loading and unloading groups of probes
README [code]
relay-app.h [code]
runtime.h [code]Main include file for runtime functions
stack.c [code]Stack Tracing Functions
string.c [code]Implements String type
sym.c [code]
TODO [code]To-Do List
probes/README [code]
probes/shellsnoop/dtr.c [code]
probes/shellsnoop/dtr.mod.c [code]
probes/shellsnoop/README [code]
probes/tasklet/README [code]
probes/tasklet/stp_tasklet.c [code]
probes/test4/dtr.c [code]
probes/test4/README [code]
probes/where_func/kprobe_where_funct.c [code]
probes/where_func/README [code]
- diff --git a/runtime/docs/html/globals.html b/runtime/docs/html/globals.html deleted file mode 100644 index bc04b2aa..00000000 --- a/runtime/docs/html/globals.html +++ /dev/null @@ -1,95 +0,0 @@ - - -SystemTap: Globals - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-
All | Functions | Variables | Typedefs | Enumerations | Defines
-
_ | f | k | m | p | s | v
- -

- -

-Here is a list of all documented functions, variables, defines, enums, and typedefs with links to the documentation:

- _ -

-

- f -

-

- k -

-

- m -

-

- p -

-

- s -

-

- v -

- diff --git a/runtime/docs/html/globals_defs.html b/runtime/docs/html/globals_defs.html deleted file mode 100644 index 93e7a777..00000000 --- a/runtime/docs/html/globals_defs.html +++ /dev/null @@ -1,25 +0,0 @@ - - -SystemTap: Globals - Defines - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-
All | Functions | Variables | Typedefs | Enumerations | Defines
- -

-

- diff --git a/runtime/docs/html/globals_enum.html b/runtime/docs/html/globals_enum.html deleted file mode 100644 index f283f502..00000000 --- a/runtime/docs/html/globals_enum.html +++ /dev/null @@ -1,15 +0,0 @@ - - -SystemTap: Globals - Enumerations - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-
All | Functions | Variables | Typedefs | Enumerations | Defines
- -

-

- diff --git a/runtime/docs/html/globals_func.html b/runtime/docs/html/globals_func.html deleted file mode 100644 index a74e4ad0..00000000 --- a/runtime/docs/html/globals_func.html +++ /dev/null @@ -1,67 +0,0 @@ - - -SystemTap: Globals - Functions - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-
All | Functions | Variables | Typedefs | Enumerations | Defines
-
_
- -

- -

-

- _ -

- diff --git a/runtime/docs/html/globals_type.html b/runtime/docs/html/globals_type.html deleted file mode 100644 index 87f1e8a8..00000000 --- a/runtime/docs/html/globals_type.html +++ /dev/null @@ -1,14 +0,0 @@ - - -SystemTap: Globals - Typedefs - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-
All | Functions | Variables | Typedefs | Enumerations | Defines
- -

-

- diff --git a/runtime/docs/html/globals_vars.html b/runtime/docs/html/globals_vars.html deleted file mode 100644 index 8c4140c4..00000000 --- a/runtime/docs/html/globals_vars.html +++ /dev/null @@ -1,14 +0,0 @@ - - -SystemTap: Globals - Variables - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-
All | Functions | Variables | Typedefs | Enumerations | Defines
- -

-

- diff --git a/runtime/docs/html/group__alloc.html b/runtime/docs/html/group__alloc.html deleted file mode 100644 index b1151b86..00000000 --- a/runtime/docs/html/group__alloc.html +++ /dev/null @@ -1,247 +0,0 @@ - - -SystemTap: Memory Functions - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

Memory Functions

Basic malloc/calloc/free functions. -More... - - - - - - - - - - - - - - - - - - - - - - - -

Enumerations

enum  errorcode { ERR_NONE = 0, -ERR_NO_MEM - }

Functions

void * _stp_alloc (size_t len)
 Allocates memory within a probe.
void * _stp_calloc (size_t len)
 Allocates and clears memory within a probe.
void * _stp_valloc (size_t len)
 Allocates and clears memory outside a probe.
void _stp_free (void *ptr)
 Frees memory allocated by _stp_alloc or _stp_calloc.
void _stp_vfree (void *ptr)
 Frees memory allocated by _stp_valloc.

Variables

-enum errorcode _stp_error = ERR_NONE
-

Detailed Description

-Basic malloc/calloc/free functions. -

-These will be changed so that memory allocation errors will call a handler. The default will send a signal to the user-space daemon that will trigger the module to be unloaded.

-

Todo:
Need error handling for memory allocations
-

-

Todo:
Some of these currently use kmalloc (GFP_ATOMIC) for small allocations. This should be evaluated for performance and stability.
-

Function Documentation

-

- - - - -
- - - - - - - - - -
void* _stp_alloc size_t  len  ) 
-
- - - - - -
-   - - -

-Allocates memory within a probe. -

-This is used for small allocations from within a running probe where the process cannot sleep.

Parameters:
- - -
len Number of bytes to allocate.
-
-
Returns:
a valid pointer on success or NULL on failure.
-
Bug:
Currently uses kmalloc (GFP_ATOMIC).
- -

-Definition at line 31 of file alloc.c. -

-Referenced by _stp_calloc(), and _stp_map_set_str().

-

- - - - -
- - - - - - - - - -
void* _stp_calloc size_t  len  ) 
-
- - - - - -
-   - - -

-Allocates and clears memory within a probe. -

-This is used for small allocations from within a running probe where the process cannot sleep.

Parameters:
- - -
len Number of bytes to allocate.
-
-
Returns:
a valid pointer on success or NULL on failure.
-
Bug:
Currently uses kmalloc (GFP_ATOMIC).
- -

-Definition at line 47 of file alloc.c. -

-References _stp_alloc(). -

-Referenced by _stp_map_set_stat(), and _stp_map_set_str().

-

- - - - -
- - - - - - - - - -
void _stp_free void *  ptr  ) 
-
- - - - - -
-   - - -

-Frees memory allocated by _stp_alloc or _stp_calloc. -

-

Parameters:
- - -
ptr pointer to memory to free
-
- -

-Definition at line 76 of file alloc.c. -

-Referenced by _stp_list_clear(), _stp_map_key_del(), and _stp_map_set_str().

-

- - - - -
- - - - - - - - - -
void* _stp_valloc size_t  len  ) 
-
- - - - - -
-   - - -

-Allocates and clears memory outside a probe. -

-This is typically used in the module initialization to allocate new maps, lists, etc.

Parameters:
- - -
len Number of bytes to allocate.
-
-
Returns:
a valid pointer on success or NULL on failure.
- -

-Definition at line 62 of file alloc.c. -

-Referenced by _stp_map_new().

-

- - - - -
- - - - - - - - - -
void _stp_vfree void *  ptr  ) 
-
- - - - - -
-   - - -

-Frees memory allocated by _stp_valloc. -

-

Parameters:
- - -
ptr pointer to memory to free
-
- -

-Definition at line 86 of file alloc.c. -

-Referenced by _stp_map_del().

- diff --git a/runtime/docs/html/group__copy.html b/runtime/docs/html/group__copy.html deleted file mode 100644 index 72321187..00000000 --- a/runtime/docs/html/group__copy.html +++ /dev/null @@ -1,263 +0,0 @@ - - -SystemTap: Functions to copy from user space. - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

Functions to copy from user space.

Functions to copy from user space. -More... - - - - - - - - - - - - - - -

Functions

long _stp_strncpy_from_user (char *dst, const char __user *src, long count)
 Copy a NULL-terminated string from userspace.
void _stp_string_from_user (String str, const char __user *src, long count)
 Copy a String from userspace.
unsigned long _stp_copy_from_user (char *dst, const char __user *src, unsigned long count)
 Copy a block of data from user space.
int _stp_copy_argv_from_user (MAP list, char __user *__user *argv)
 Copy an argv from user space to a List.
-

Detailed Description

-Functions to copy from user space. -

-None of these functions will sleep (for example to allow pages to be swapped in). It is possible (although rare) that the data in user space will not present and these functions will return an error.


Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - -
int _stp_copy_argv_from_user MAP  list,
char __user *__user *  argv
-
- - - - - -
-   - - -

-Copy an argv from user space to a List. -

-

Parameters:
- - - -
list A list.
argv Source argv, in user space.
-
-
Returns:
number of elements in list
-Example:
MAP arglist ;
-
-int inst_do_execve (char * filename, char __user *__user *argv, char __user *__user *envp, struct pt_regs * regs)
-{
-  struct map_node_str *ptr;
-
-  _stp_list_clear (arglist);
-  _stp_copy_argv_from_user (arglist, argv);
-
-  foreach (arglist, ptr)
-    printk ("%s ", ptr->str);
-  printk ("\n");
-}
-
-

-Definition at line 154 of file copy.c. -

-References _stp_list_add_str(), and _stp_strncpy_from_user().

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
unsigned long _stp_copy_from_user char *  dst,
const char __user *  src,
unsigned long  count
-
- - - - - -
-   - - -

-Copy a block of data from user space. -

-If some data could not be copied, this function will pad the copied data to the requested size using zero bytes.

-

Parameters:
- - - - -
dst Destination address, in kernel space.
src Source address, in user space.
count Number of bytes to copy.
-
-
Returns:
number of bytes that could not be copied. On success, this will be zero.
- -

-Definition at line 139 of file copy.c.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
void _stp_string_from_user String  str,
const char __user *  src,
long  count
-
- - - - - -
-   - - -

-Copy a String from userspace. -

-Copies a string of up to count bytes from userspace into a String. If access to userspace fails, returns -EFAULT (some data may have been copied).

Parameters:
- - - - -
str Destination String.
src Source address, in user space.
count Maximum number of bytes to copy, including the trailing NULL.
-
- -

-Definition at line 113 of file copy.c. -

-References STP_STRING_SIZE.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
long _stp_strncpy_from_user char *  dst,
const char __user *  src,
long  count
-
- - - - - -
-   - - -

-Copy a NULL-terminated string from userspace. -

-On success, returns the length of the string (not including the trailing NULL).

-If access to userspace fails, returns -EFAULT (some data may have been copied).

Parameters:
- - - - -
dst Destination address, in kernel space. This buffer must be at least count bytes long.
src Source address, in user space.
count Maximum number of bytes to copy, including the trailing NULL.
-
-If count is smaller than the length of the string, copies count bytes and returns count.

-

Deprecated:
I can't think of why you wouldn't use _stp_string_from_user() instead.
- -

-Definition at line 96 of file copy.c. -

-Referenced by _stp_copy_argv_from_user().

- diff --git a/runtime/docs/html/group__current.html b/runtime/docs/html/group__current.html deleted file mode 100644 index 03008852..00000000 --- a/runtime/docs/html/group__current.html +++ /dev/null @@ -1,59 +0,0 @@ - - -SystemTap: Current State - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

Current State

Functions to get the current state. -More... - - - - - -

Functions

unsigned long _stp_ret_addr (struct pt_regs *regs)
 Get the current return address.
-

Detailed Description

-Functions to get the current state. -

-


Function Documentation

-

- - - - -
- - - - - - - - - -
unsigned long _stp_ret_addr struct pt_regs *  regs  ) 
-
- - - - - -
-   - - -

-Get the current return address. -

-Call from kprobes (not jprobes).

Parameters:
- - -
regs The pt_regs saved by the kprobe.
-
-
Returns:
The return address saved in esp or rsp.
-
Note:
i386 and x86_64 only so far.
- -

-Definition at line 21 of file current.c.

- diff --git a/runtime/docs/html/group__io.html b/runtime/docs/html/group__io.html deleted file mode 100644 index 76051d30..00000000 --- a/runtime/docs/html/group__io.html +++ /dev/null @@ -1,148 +0,0 @@ - - -SystemTap: I/O - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

I/O

I/O functions. -More... - - - - - - - - - - - - - - - -

Defines

-#define STP_LOG_BUF_LEN   2047
 private buffer for _stp_log()

Functions

void _stp_log (const char *fmt,...)
 Logs Data.
int _stp_netlink_open (void)
 Opens netlink and relayfs connections to stpd.
void _stp_netlink_close (void)
 Closes netlink and relayfs connections to stpd.
-

Detailed Description

-I/O functions. -

-


Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_log const char *  fmt,
  ...
-
- - - - - -
-   - - -

-Logs Data. -

-This function prints to the system log if stpd has not connected yet. Otherwise it sends the message immediately to stpd.

Parameters:
- - -
fmt A variable number of args.
-
-
Note:
Lines are limited in length by printk buffer. If there is no newline in the format string, then other syslog output could get appended to the SystemTap line.
-
Todo:
Evaluate if this function is necessary.
- -

-Definition at line 29 of file io.c. -

-References STP_LOG_BUF_LEN. -

-Referenced by _stp_list_clear(), _stp_register_jprobes(), _stp_register_kprobes(), _stp_stack_sprint(), _stp_string_init(), _stp_unregister_jprobes(), and _stp_unregister_kprobes().

-

- - - - -
- - - - - - - - - -
void _stp_netlink_close void   ) 
-
- - - - - -
-   - - -

-Closes netlink and relayfs connections to stpd. -

-This must be called after all I/O is done, probably at the end of module cleanup.

Returns:
0 on success. -1 if there is a problem establishing a connection.
- -

-Definition at line 103 of file io.c.

-

- - - - -
- - - - - - - - - -
int _stp_netlink_open void   ) 
-
- - - - - -
-   - - -

-Opens netlink and relayfs connections to stpd. -

-This must be called before any I/O is done, probably at the start of module initialization. -

-Definition at line 87 of file io.c.

- diff --git a/runtime/docs/html/group__lists.html b/runtime/docs/html/group__lists.html deleted file mode 100644 index 30b83a00..00000000 --- a/runtime/docs/html/group__lists.html +++ /dev/null @@ -1,378 +0,0 @@ - - -SystemTap: Lists - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

Lists

Lists are special cases of maps. -More... - - - - - - - - - - - - - - - - - - - - - - - - -

Defines

#define _stp_list_add(map, val)
 Macro to call the proper _stp_list_add function based on the types of the argument.

Functions

MAP _stp_list_new (unsigned max_entries, enum valtype type)
 Create a new list.
void _stp_list_clear (MAP map)
 Clears a list.
void _stp_list_add_str (MAP map, char *str)
 Adds a C string to a list.
void _stp_list_add_string (MAP map, String str)
 Adds a String to a list.
void _stp_list_add_int64 (MAP map, int64_t val)
 Adds an int64 to a list.
int _stp_list_size (MAP map)
 Get the number of elements in a list.
-

Detailed Description

-Lists are special cases of maps. -

-Example:

-struct map_node_str *ptr;
-
-MAP map = _stp_list_new(10, STRING);
-
-for (i = 0; i < 10; i++) {
-     sprintf (buf, "Item%d", i);
-     _stp_list_add (map, buf);
- }
-
-foreach (map, ptr)
-     printf ("map[%ld] = %s\n", key1int(ptr), ptr->str);
-
-
-

Define Documentation

-

- - - - -
- - - - - - - - - - - - -
#define _stp_list_add map,
val   ) 
-
- - - - - -
-   - - -

-Value:

({                                                                      \
-    if (__builtin_types_compatible_p (typeof (val), char[]))            \
-      _stp_list_add_str (map, (char *)(val));                           \
-    else if (__builtin_types_compatible_p (typeof (val), String))       \
-      _stp_list_add_string (map, (String)(val));                        \
-    else                                                                \
-      _stp_list_add_int64 (map, (int64_t)(val));                        \
-  })
-
Macro to call the proper _stp_list_add function based on the types of the argument. -

-

Note:
May cause compiler warning on some GCCs
- -

-Definition at line 183 of file map.h.

-


Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_list_add_int64 MAP  map,
int64_t  val
[inline]
-
- - - - - -
-   - - -

-Adds an int64 to a list. -

-

Parameters:
- - - -
map 
val 
-
-
See also:
_stp_list_add()
- -

-Definition at line 896 of file map.c. -

-References _stp_map_key_long(), and _stp_map_set_int64().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_list_add_str MAP  map,
char *  str
[inline]
-
- - - - - -
-   - - -

-Adds a C string to a list. -

-

Parameters:
- - - -
map 
str 
-
-
See also:
_stp_list_add()
- -

-Definition at line 872 of file map.c. -

-References _stp_map_key_long(), and _stp_map_set_str(). -

-Referenced by _stp_copy_argv_from_user().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_list_add_string MAP  map,
String  str
[inline]
-
- - - - - -
-   - - -

-Adds a String to a list. -

-

Parameters:
- - - -
map 
str String to add.
-
-
See also:
_stp_list_add()
- -

-Definition at line 884 of file map.c. -

-References _stp_map_key_long(), and _stp_map_set_str().

-

- - - - -
- - - - - - - - - -
void _stp_list_clear MAP  map  ) 
-
- - - - - -
-   - - -

-Clears a list. -

-All elements in the list are deleted.

Parameters:
- - -
map 
-
- -

-Definition at line 831 of file map.c. -

-References _stp_free(), and _stp_log().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
MAP _stp_list_new unsigned  max_entries,
enum valtype  type
-
- - - - - -
-   - - -

-Create a new list. -

-A list is a map that internally has an incrementing long key for each member. Lists do not wrap if elements are added to exceed their maximum size.

Parameters:
- - - -
max_entries The maximum number of entries allowed. Currently that number will be preallocated. If max_entries is 0, there will be no maximum and entries will be allocated dynamically.
type Type of values stored in this list.
-
-
Returns:
A MAP on success or NULL on failure.
-
See also:
foreach
- -

-Definition at line 819 of file map.c. -

-References _stp_map_new().

-

- - - - -
- - - - - - - - - -
int _stp_list_size MAP  map  )  [inline]
-
- - - - - -
-   - - -

-Get the number of elements in a list. -

-

Parameters:
- - -
map 
-
-
Returns:
The number of elements in a list.
- -

-Definition at line 907 of file map.c.

- diff --git a/runtime/docs/html/group__maps.html b/runtime/docs/html/group__maps.html deleted file mode 100644 index 1b6e170e..00000000 --- a/runtime/docs/html/group__maps.html +++ /dev/null @@ -1,1299 +0,0 @@ - - -SystemTap: Maps - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

Maps

Implements maps (associative arrays) and lists. -More... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Data Structures

struct  stat
union  key_data
struct  map_node
struct  map_node_int64
struct  map_node_str
struct  map_node_stat
struct  map_root

Defines

-#define key1str(ptr)   (ptr->n.key1.str)
 Extracts string from key1 union.
-#define key2str(ptr)   (ptr->n.key2.str)
 Extracts string from key2 union.
-#define key1int(ptr)   (ptr->n.key1.val)
 Extracts int from key1 union.
-#define key2int(ptr)   (ptr->n.key2.val)
 Extracts int from key2 union.
#define _stp_map_key2(map, key1, key2)
 Macro to call the proper _stp_map_key functions based on the types of the arguments.
#define _stp_map_key(map, key)
 Macro to call the proper _stp_map_key function based on the type of the argument.
#define _stp_map_set(map, val)
 Macro to call the proper _stp_map_set function based on the type of the argument.
#define foreach(map, ptr)
 Loop through all elements of a map or list.

Typedefs

-typedef map_root * MAP
 All maps are of this type.

Enumerations

enum  keytype { NONE, -LONG, -STR - }
 keys can be longs or strings
enum  valtype { INT64, -STAT, -STRING, -END - }
 values can be either int64, stats or strings

Functions

MAP _stp_map_new (unsigned max_entries, enum valtype type)
 Create a new map.
void _stp_map_key_del (MAP map)
 Deletes the current element.
map_node * _stp_map_start (MAP map)
 Get the first element in a map.
map_node * _stp_map_iter (MAP map, struct map_node *m)
 Get the next element in a map.
void _stp_map_del (MAP map)
 Deletes a map.
void _stp_map_key_long_long (MAP map, long key1, long key2)
 Set the map's key to two longs.
void _stp_map_key_str_str (MAP map, char *key1, char *key2)
 Set the map's key to two strings.
void _stp_map_key_str_long (MAP map, char *key1, long key2)
 Set the map's key to a string and a long.
void _stp_map_key_long_str (MAP map, long key1, char *key2)
 Set the map's key to a long and a string.
void _stp_map_key_str (MAP map, char *key)
 Set the map's key to a string.
void _stp_map_key_long (MAP map, long key)
 Set the map's key to a long.
void _stp_map_set_int64 (MAP map, int64_t val)
 Set the current element's value to an int64.
void _stp_map_add_int64 (MAP map, int64_t val)
 Adds an int64 to the current element's value.
int64_t _stp_map_get_int64 (MAP map)
 Gets the current element's value.
void _stp_map_set_str (MAP map, char *val)
 Set the current element's value to a C string.
void _stp_map_set_string (MAP map, String str)
 Set the current element's value to String.
char * _stp_map_get_str (MAP map)
 Gets the current element's value.
void _stp_map_set_stat (MAP map, stat *stats)
 Set the current element's value to a stat.
stat * _stp_map_get_stat (MAP map)
 Gets the current element's value.
void _stp_map_stat_add (MAP map, int64_t val)
 Add to the current element's statistics.

Variables

-enum keytype packed
 keys can be longs or strings
-

Detailed Description

-Implements maps (associative arrays) and lists. -

-

Todo:
Needs to be made SMP-safe for when the big lock is removed from kprobes.
-

Define Documentation

-

- - - - -
- - - - - - - - - - - - -
#define _stp_map_key map,
key   ) 
-
- - - - - -
-   - - -

-Value:

({                                                              \
-    if (__builtin_types_compatible_p (typeof (key), char[]))    \
-      _stp_map_key_str (map, (char *)(key));                            \
-    else                                                        \
-      _stp_map_key_long (map, (long)(key));                             \
-  })
-
Macro to call the proper _stp_map_key function based on the type of the argument. -

-

Note:
May cause compiler warning on some GCCs
- -

-Definition at line 141 of file map.h.

-

- - - - -
- - - - - - - - - - - - - - - -
#define _stp_map_key2 map,
key1,
key2   ) 
-
- - - - - -
-   - - -

-Value:

({                                                              \
-    if (__builtin_types_compatible_p (typeof (key1), char[]))   \
-      if (__builtin_types_compatible_p (typeof (key2), char[])) \
-        _stp_map_key_str_str (map, (char *)(key1), (char *)(key2));     \
-      else                                                      \
-        _stp_map_key_str_long (map, (char *)(key1), (long)(key2));      \
-    else                                                        \
-      if (__builtin_types_compatible_p (typeof (key2), char[])) \
-        _stp_map_key_long_str (map, (long)(key1), (char *)(key2));      \
-      else                                                      \
-        _stp_map_key_long_long (map, (long)(key1), (long)(key2));       \
-  })
-
Macro to call the proper _stp_map_key functions based on the types of the arguments. -

-

Note:
May cause compiler warning on some GCCs
- -

-Definition at line 123 of file map.h.

-

- - - - -
- - - - - - - - - - - - -
#define _stp_map_set map,
val   ) 
-
- - - - - -
-   - - -

-Value:

({                                                              \
-    if (__builtin_types_compatible_p (typeof (val), char[]))            \
-      _stp_map_set_str (map, (char *)(val));                            \
-    else  if (__builtin_types_compatible_p (typeof (val), String))      \
-      _stp_map_set_string (map, (String)(val));                         \
-    else                                                                \
-      _stp_map_set_int64 (map, (int64_t)(val));                         \
-  })
-
Macro to call the proper _stp_map_set function based on the type of the argument. -

-

Note:
May cause compiler warning on some GCCs
- -

-Definition at line 153 of file map.h.

-

- - - - -
- - - - - - - - - - - - -
#define foreach map,
ptr   ) 
-
- - - - - -
-   - - -

-Value:

for (ptr = (typeof(ptr))_stp_map_start(map); ptr; \
-       ptr = (typeof(ptr))_stp_map_iter (map, (struct map_node *)ptr))
-
Loop through all elements of a map or list. -

-

Parameters:
- - - -
map 
ptr pointer to a map_node_stat, map_node_int64 or map_node_str
-
-Example:
/* example showing how to print all the stats in a map using foreach() */
-
-struct map_node_stat *ptr;
-
-foreach (map, ptr)
-     printf ("map[%s,%ld] = [c=%lld s=%lld min=%lld max=%lld]\n", key1str(ptr), 
-             key2int(ptr), ptr->stats.count, ptr->stats.sum, ptr->stats.min, 
-             ptr->stats.max);
-
-
-

-Definition at line 171 of file map.h.

-


Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_map_add_int64 MAP  map,
int64_t  val
-
- - - - - -
-   - - -

-Adds an int64 to the current element's value. -

-This adds an int64 to the current element's value. The map must have been created to hold int64s using _stp_map_new()

-If the element doesn't exist, it is created. If no current element (key) is set for the map, this function does nothing.

Parameters:
- - - -
map 
val value
-
-
See also:
_stp_map_set_int64
- -

-Definition at line 559 of file map.c.

-

- - - - -
- - - - - - - - - -
void _stp_map_del MAP  map  ) 
-
- - - - - -
-   - - -

-Deletes a map. -

-Deletes a map, freeing all memory in all elements. Normally done only when the module exits.

Parameters:
- - -
map 
-
- -

-Definition at line 205 of file map.c. -

-References _stp_vfree().

-

- - - - -
- - - - - - - - - -
int64_t _stp_map_get_int64 MAP  map  ) 
-
- - - - - -
-   - - -

-Gets the current element's value. -

-

Parameters:
- - -
map 
-
-
Returns:
The value. If the current element is not set or doesn't exist, returns 0.
- -

-Definition at line 569 of file map.c.

-

- - - - -
- - - - - - - - - -
stat* _stp_map_get_stat MAP  map  ) 
-
- - - - - -
-   - - -

-Gets the current element's value. -

-

Parameters:
- - -
map 
-
-
Returns:
A pointer to the stats struct. If the current element is not set or doesn't exist, returns NULL.
- -

-Definition at line 750 of file map.c.

-

- - - - -
- - - - - - - - - -
char* _stp_map_get_str MAP  map  ) 
-
- - - - - -
-   - - -

-Gets the current element's value. -

-

Parameters:
- - -
map 
-
-
Returns:
A string pointer. If the current element is not set or doesn't exist, returns NULL.
- -

-Definition at line 667 of file map.c.

-

- - - - -
- - - - - - - - - - - - - - - - - - -
struct map_node* _stp_map_iter MAP  map,
struct map_node *  m
-
- - - - - -
-   - - -

-Get the next element in a map. -

-

Parameters:
- - - -
map 
m a pointer to the current element, returned from _stp_map_start() or _stp_map_iter().
-
-
Returns:
a pointer to the next element. This is typically used with _stp_map_start(). See the foreach() macro for typical usage. It probably does what you want anyway.
-
See also:
foreach
- -

-Definition at line 186 of file map.c.

-

- - - - -
- - - - - - - - - -
void _stp_map_key_del MAP  map  ) 
-
- - - - - -
-   - - -

-Deletes the current element. -

-If no current element (key) for this map is set, this function does nothing.

Parameters:
- - -
map 
-
- -

-Definition at line 118 of file map.c. -

-References _stp_free(). -

-Referenced by _stp_map_set_stat(), and _stp_map_set_str().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_map_key_long MAP  map,
long  key
-
- - - - - -
-   - - -

-Set the map's key to a long. -

-This sets the current element based on a long key. If the key is not found, a new element will not be created until a _stp_map_set_xxx call.

Parameters:
- - - -
map 
key 
-
- -

-Definition at line 430 of file map.c. -

-References _stp_map_key_long_long(). -

-Referenced by _stp_list_add_int64(), _stp_list_add_str(), and _stp_list_add_string().

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
void _stp_map_key_long_long MAP  map,
long  key1,
long  key2
-
- - - - - -
-   - - -

-Set the map's key to two longs. -

-This sets the current element based on a key of two strings. If the keys are not found, a new element will not be created until a _stp_map_set_xxx call.

Parameters:
- - - - -
map 
key1 first key
key2 second key
-
- -

-Definition at line 233 of file map.c. -

-Referenced by _stp_map_key_long().

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
void _stp_map_key_long_str MAP  map,
long  key1,
char *  key2
-
- - - - - -
-   - - -

-Set the map's key to a long and a string. -

-This sets the current element based on a key of a long and a string. If the keys are not found, a new element will not be created until a _stp_map_set_xxx call.

Parameters:
- - - - -
map 
key1 first key
key2 second key
-
- -

-Definition at line 373 of file map.c.

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_map_key_str MAP  map,
char *  key
-
- - - - - -
-   - - -

-Set the map's key to a string. -

-This sets the current element based on a string key. If the key is not found, a new element will not be created until a _stp_map_set_xxx call.

Parameters:
- - - -
map 
key 
-
- -

-Definition at line 414 of file map.c. -

-References _stp_map_key_str_str().

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
void _stp_map_key_str_long MAP  map,
char *  key1,
long  key2
-
- - - - - -
-   - - -

-Set the map's key to a string and a long. -

-This sets the current element based on a key of a string and a long. If the keys are not found, a new element will not be created until a _stp_map_set_xxx call.

Parameters:
- - - - -
map 
key1 first key
key2 second key
-
- -

-Definition at line 325 of file map.c.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
void _stp_map_key_str_str MAP  map,
char *  key1,
char *  key2
-
- - - - - -
-   - - -

-Set the map's key to two strings. -

-This sets the current element based on a key of two strings. If the keys are not found, a new element will not be created until a _stp_map_set_xxx call.

Parameters:
- - - - -
map 
key1 first key
key2 second key
-
- -

-Definition at line 276 of file map.c. -

-Referenced by _stp_map_key_str().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
MAP _stp_map_new unsigned  max_entries,
enum valtype  type
-
- - - - - -
-   - - -

-Create a new map. -

-Maps must be created at module initialization time.

Parameters:
- - - -
max_entries The maximum number of entries allowed. Currently that number will be preallocated. If more entries are required, the oldest ones will be deleted. This makes it effectively a circular buffer. If max_entries is 0, there will be no maximum and entries will be allocated dynamically.
type Type of values stored in this map.
-
-
Returns:
A MAP on success or NULL on failure.
- -

-Definition at line 57 of file map.c. -

-References _stp_valloc(). -

-Referenced by _stp_list_new().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_map_set_int64 MAP  map,
int64_t  val
-
- - - - - -
-   - - -

-Set the current element's value to an int64. -

-This sets the current element's value to an int64. The map must have been created to hold int64s using _stp_map_new()

-If the element doesn't exist, it is created. If no current element (key) is set for the map, this function does nothing.

Parameters:
- - - -
map 
val new value
-
-
See also:
_stp_map_add_int64

-_stp_map_set()

- -

-Definition at line 542 of file map.c. -

-Referenced by _stp_list_add_int64().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_map_set_stat MAP  map,
stat *  stats
-
- - - - - -
-   - - -

-Set the current element's value to a stat. -

-This sets the current element's value to an stat struct. The map must have been created to hold stats using _stp_map_new(xxx, STAT). This function would only be used if we wanted to set stats to something other than the normal initial values (count = 0, sum = 0, etc). It may be deleted if it doesn't turn out to be useful.

See also:
_stp_map_stat_add
-If the element doesn't exist, it is created. If no current element (key) is set for the map, this function does nothing.
Parameters:
- - - -
map 
stats pointer to stats struct.
-
-
Todo:
Histograms don't work yet.
- -

-Definition at line 691 of file map.c. -

-References _stp_calloc(), and _stp_map_key_del(). -

-Referenced by _stp_map_stat_add().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_map_set_str MAP  map,
char *  val
-
- - - - - -
-   - - -

-Set the current element's value to a C string. -

-This sets the current element's value to an C string. The map must have been created to hold int64s using _stp_map_new(xxx, STRING)

-If the element doesn't exist, it is created. If no current element (key) is set for the map, this function does nothing.

Parameters:
- - - -
map 
val new string
-
-
See also:
_stp_map_set()
- -

-Definition at line 590 of file map.c. -

-References _stp_alloc(), _stp_calloc(), _stp_free(), and _stp_map_key_del(). -

-Referenced by _stp_list_add_str(), _stp_list_add_string(), and _stp_map_set_string().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_map_set_string MAP  map,
String  str
-
- - - - - -
-   - - -

-Set the current element's value to String. -

-This sets the current element's value to a String. The map must have been created to hold int64s using _stp_map_new(xxx, STRING)

-If the element doesn't exist, it is created. If no current element (key) is set for the map, this function does nothing.

Parameters:
- - - -
map 
str String containing new value.
-
-
See also:
_stp_map_set()
- -

-Definition at line 657 of file map.c. -

-References _stp_map_set_str().

-

- - - - -
- - - - - - - - - -
struct map_node* _stp_map_start MAP  map  ) 
-
- - - - - -
-   - - -

-Get the first element in a map. -

-

Parameters:
- - -
map 
-
-
Returns:
a pointer to the first element. This is typically used with _stp_map_iter(). See the foreach() macro for typical usage. It probably does what you want anyway.
-
See also:
foreach
- -

-Definition at line 163 of file map.c.

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_map_stat_add MAP  map,
int64_t  val
-
- - - - - -
-   - - -

-Add to the current element's statistics. -

-Increments the statistics counter by one and the sum by val. Adjusts minimum, maximum, and histogram.

-If the element doesn't exist, it is created. If no current element (key) is set for the map, this function does nothing.

Parameters:
- - - -
map 
val value to add to the statistics
-
-
Todo:
Histograms don't work yet.
- -

-Definition at line 771 of file map.c. -

-References _stp_map_set_stat().

- diff --git a/runtime/docs/html/group__print.html b/runtime/docs/html/group__print.html deleted file mode 100644 index f18a05bf..00000000 --- a/runtime/docs/html/group__print.html +++ /dev/null @@ -1,342 +0,0 @@ - - -SystemTap: Print Buffer - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

Print Buffer

Print Buffer Functions. -More... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Defines

-#define STP_PRINT_BUF_LEN   8000
 Size of buffer, not including terminating NULL.
-#define TIMESTAMP_SIZE   19
-#define STP_PRINT_BUF_START   (TIMESTAMP_SIZE + 1)
#define _stp_print(str)
 Write a String or C string into the print buffer.

Functions

void _stp_print_flush (void)
 Send the print buffer now.
void _stp_printf (const char *fmt,...)
 Print into the print buffer.
void _stp_vprintf (const char *fmt, va_list args)
 Print into the print buffer.
void _stp_print_cstr (const char *str)
 Write a C string into the print buffer.
char * _stp_print_clear (void)
 Clear the scratch buffer.
void _stp_print_string (String str)
 Write a String into the print buffer.
-

Detailed Description

-Print Buffer Functions. -

-The print buffer is for collecting output to send to the user daemon. This is a per-cpu static buffer. The buffer is sent when _stp_print_flush() is called.

-The reason to do this is to allow multiple small prints to be combined then timestamped and sent together to stpd. It could flush automatically on newlines, but what about stack traces which span many lines? So try this and see how it works for us.


Define Documentation

-

- - - - -
- - - - - - - - - -
#define _stp_print str   ) 
-
- - - - - -
-   - - -

-Value:

({                                                              \
-          if (__builtin_types_compatible_p (typeof (str), char[])) {    \
-                  char *x = (char *)str;                                \
-                  _stp_print_cstr(x);                                   \
-          } else {                                                      \
-                  String x = (String)str;                               \
-                  _stp_print_string(x);                                 \
-          }                                                             \
-  })
-
Write a String or C string into the print buffer. -

-This macro selects the proper function to call.

Parameters:
- - -
str A String or C string (char *)
-
-
See also:
_stp_print_cstr _stp_print_string
- -

-Definition at line 188 of file print.c.

-


Function Documentation

-

- - - - -
- - - - - - - - - -
char* _stp_print_clear void   ) 
-
- - - - - -
-   - - -

-Clear the scratch buffer. -

-This function should be called before anything is written to the scratch buffer. Output will accumulate in the buffer until this function is called again.

Returns:
A pointer to the buffer.
- -

-Definition at line 156 of file print.c.

-

- - - - -
- - - - - - - - - -
void _stp_print_cstr const char *  str  ) 
-
- - - - - -
-   - - -

-Write a C string into the print buffer. -

-Copies a string into a print buffer. Safe because overflowing the buffer is not allowed. Size is limited by length of print buffer, STP_PRINT_BUF_LEN. This is more efficient than using _stp_printf() if you don't need fancy formatting.

-

Parameters:
- - -
str A C string.
-
-
See also:
_stp_print
- -

-Definition at line 138 of file print.c. -

-References STP_PRINT_BUF_LEN. -

-Referenced by _stp_print_string().

-

- - - - -
- - - - - - - - - -
void _stp_print_flush void   ) 
-
- - - - - -
-   - - -

-Send the print buffer now. -

-Output accumulates in the print buffer until this is called. Size is limited by length of print buffer, STP_PRINT_BUF_LEN. -

-Definition at line 65 of file print.c.

-

- - - - -
- - - - - - - - - -
void _stp_print_string String  str  ) 
-
- - - - - -
-   - - -

-Write a String into the print buffer. -

-Copies a String into a print buffer. Safe because overflowing the buffer is not allowed. Size is limited by length of print buffer, STP_PRINT_BUF_LEN. This is more efficient than using _stp_printf() if you don't need fancy formatting.

-

Parameters:
- - -
str A String.
-
-
See also:
_stp_print
- -

-Definition at line 176 of file print.c. -

-References _stp_print_cstr().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_printf const char *  fmt,
  ...
-
- - - - - -
-   - - -

-Print into the print buffer. -

-Like printf, except output goes to the print buffer. Safe because overflowing the buffer is not allowed. Size is limited by length of print buffer, STP_PRINT_BUF_LEN.

-

Parameters:
- - -
fmt A printf-style format string followed by a variable number of args.
-
-
See also:
_stp_print_flush()
- -

-Definition at line 99 of file print.c. -

-References STP_PRINT_BUF_LEN. -

-Referenced by _stp_symbol_print().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_vprintf const char *  fmt,
va_list  args
-
- - - - - -
-   - - -

-Print into the print buffer. -

-Use this if your function already has a va_list. You probably want _stp_printf(). -

-Definition at line 117 of file print.c. -

-References STP_PRINT_BUF_LEN.

- diff --git a/runtime/docs/html/group__stack.html b/runtime/docs/html/group__stack.html deleted file mode 100644 index ab4922e5..00000000 --- a/runtime/docs/html/group__stack.html +++ /dev/null @@ -1,129 +0,0 @@ - - -SystemTap: Stack Tracing Functions - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

Stack Tracing Functions

- - - - - - - - -

Functions

void _stp_stack_print (int verbose, int levels)
 Print stack dump.
String _stp_stack_sprint (String str, int verbose, int levels)
 Writes stack dump to a String.
-

Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_stack_print int  verbose,
int  levels
-
- - - - - -
-   - - -

-Print stack dump. -

-Prints a stack dump to the print buffer.

Parameters:
- - - -
verbose Verbosity
levels Number of levels to trace.
-
-
Todo:
Implement verbosity and levels parameters.
-

-

Bug:
levels parameter is not functional
- -

-Definition at line 155 of file stack.c.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
String _stp_stack_sprint String  str,
int  verbose,
int  levels
-
- - - - - -
-   - - -

-Writes stack dump to a String. -

-

Parameters:
- - - - -
str String
verbose Verbosity
levels Number of levels to trace.
-
-
Returns:
Same String as was input.
-
Todo:
Implement verbosity and levels parameters.
-

-

Bug:
levels parameter is not functional
- -

-Definition at line 171 of file stack.c. -

-References _stp_log().

- diff --git a/runtime/docs/html/group__string.html b/runtime/docs/html/group__string.html deleted file mode 100644 index 834b7513..00000000 --- a/runtime/docs/html/group__string.html +++ /dev/null @@ -1,389 +0,0 @@ - - -SystemTap: String Functions - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

String Functions

One of the biggest restrictions the library has is that it cannot allocate things like strings off the stack. -More... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Data Structures

struct  string

Defines

-#define STP_STRING_SIZE   2048
 Maximum string size allowed in Strings.
#define _stp_string_cat(str1, str2)
 ConCATenate (append) a String or C string to a String.

Typedefs

-typedef string * String

Functions

String _stp_string_init (int num)
 Initialize a String for our use.
void _stp_sprintf (String str, const char *fmt,...)
 Sprintf into a String.
void _stp_vsprintf (String str, const char *fmt, va_list args)
 Vsprintf into a String Use this if your function already has a va_list.
void _stp_string_cat_cstr (String str1, const char *str2)
 ConCATenate (append) a C string to a String.
void _stp_string_cat_string (String str1, String str2)
 ConCATenate (append) a String to a String.
char * _stp_string_ptr (String str)
 Get a pointer to String's buffer For rare cases when a C string is needed and you have a String.
-

Detailed Description

-One of the biggest restrictions the library has is that it cannot allocate things like strings off the stack. -

-It is also not a good idea to dynamically allocate space for strings with kmalloc(). That leaves us with statically allocated space for strings. This is what is implemented in the String module. Strings use preallocated per-cpu buffers and are safe to use (unlike C strings).


Define Documentation

-

- - - - -
- - - - - - - - - - - - -
#define _stp_string_cat str1,
str2   ) 
-
- - - - - -
-   - - -

-Value:

({                                                            \
-          if (__builtin_types_compatible_p (typeof (str2), char[])) {   \
-                  char *x = (char *)str2;                               \
-                  _str_string_cat_cstr(str1,x);                         \
-          } else {                                                      \
-                  String x = (String)str2;                              \
-                  _str_string_cat_string(str1,x);                       \
-          }                                                             \
-  })
-
ConCATenate (append) a String or C string to a String. -

-This macro selects the proper function to call.

Parameters:
- - - -
str1 A String
str2 A String or C string (char *)
-
-
See also:
_stp_string_cat_cstr _stp_string_cat_string
- -

-Definition at line 150 of file string.c.

-


Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
void _stp_sprintf String  str,
const char *  fmt,
  ...
-
- - - - - -
-   - - -

-Sprintf into a String. -

-Like printf, except output goes into a String. Safe because overflowing the buffer is not allowed. Size is limited by length of String, STP_STRING_SIZE.

-

Parameters:
- - - -
str String
fmt A printf-style format string followed by a variable number of args.
-
- -

-Definition at line 77 of file string.c. -

-References STP_STRING_SIZE. -

-Referenced by _stp_symbol_sprint().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_string_cat_cstr String  str1,
const char *  str2
-
- - - - - -
-   - - -

-ConCATenate (append) a C string to a String. -

-Like strcat().

Parameters:
- - - -
str1 String
str2 C string (char *)
-
-
See also:
_stp_string_cat
- -

-Definition at line 106 of file string.c. -

-References STP_STRING_SIZE.

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_string_cat_string String  str1,
String  str2
-
- - - - - -
-   - - -

-ConCATenate (append) a String to a String. -

-Like strcat().

Parameters:
- - - -
str1 String
str2 String
-
-
See also:
_stp_string_cat
- -

-Definition at line 121 of file string.c. -

-References STP_STRING_SIZE.

-

- - - - -
- - - - - - - - - -
String _stp_string_init int  num  ) 
-
- - - - - -
-   - - -

-Initialize a String for our use. -

-This grabs one of the global Strings for our use.

-

Parameters:
- - -
num Number of the preallocated String to use. #STP_NUM_STRINGS are statically allocated for our use. The translator (or author) should be sure to grab a free one.
-
-
Todo:
Global (and static) Strings not implemented yet.
- -

-Definition at line 42 of file string.c. -

-References _stp_log().

-

- - - - -
- - - - - - - - - -
char* _stp_string_ptr String  str  ) 
-
- - - - - -
-   - - -

-Get a pointer to String's buffer For rare cases when a C string is needed and you have a String. -

-One example is when you want to print a String with _stp_printf().

Parameters:
- - -
str String
-
-
Returns:
A C string (char *)
-
Note:
Readonly. Don't write to this pointer or it will mess up the internal String state and probably mess up your output or crash something.
- -

-Definition at line 138 of file string.c.

-

- - - - -
- - - - - - - - - - - - - - - - - - - - - - - - -
void _stp_vsprintf String  str,
const char *  fmt,
va_list  args
-
- - - - - -
-   - - -

-Vsprintf into a String Use this if your function already has a va_list. -

-You probably want _stp_sprintf(). -

-Definition at line 92 of file string.c. -

-References STP_STRING_SIZE.

- diff --git a/runtime/docs/html/group__sym.html b/runtime/docs/html/group__sym.html deleted file mode 100644 index d5b24087..00000000 --- a/runtime/docs/html/group__sym.html +++ /dev/null @@ -1,113 +0,0 @@ - - -SystemTap: Symbolic Functions - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

Symbolic Functions

Symbolic Lookup Functions. -More... - - - - - - - - -

Functions

String _stp_symbol_sprint (String str, unsigned long address)
 Write addresses symbolically into a String.
void _stp_symbol_print (unsigned long address)
 Print addresses symbolically to the print buffer.
-

Detailed Description

-Symbolic Lookup Functions. -

-


Function Documentation

-

- - - - -
- - - - - - - - - -
void _stp_symbol_print unsigned long  address  ) 
-
- - - - - -
-   - - -

-Print addresses symbolically to the print buffer. -

-

Parameters:
- - -
address The address to lookup.
-
-
Note:
Symbolic lookups should not normally be done within a probe because it is too time-consuming. Use at module exit time.
- -

-Definition at line 54 of file sym.c. -

-References _stp_printf().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
String _stp_symbol_sprint String  str,
unsigned long  address
-
- - - - - -
-   - - -

-Write addresses symbolically into a String. -

-

Parameters:
- - - -
str String
address The address to lookup.
-
-
Note:
Symbolic lookups should not normally be done within a probe because it is too time-consuming. Use at module exit time.
- -

-Definition at line 30 of file sym.c. -

-References _stp_sprintf().

- diff --git a/runtime/docs/html/index.html b/runtime/docs/html/index.html deleted file mode 100644 index e51162e4..00000000 --- a/runtime/docs/html/index.html +++ /dev/null @@ -1,58 +0,0 @@ - - -SystemTap: SystemTap Runtime - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

SystemTap Runtime

-

-

0.2

-Introduction

-This document describes the implementation of the SystemTap Runtime. It is intended for developers of the SystemTap Language translator or, possibly TapSet authors. These functions are not directly available from the SystemTap Language.

-The SystemTap Runtime Library consists of all functions and code fragments needed by the compiler/translator to include in building a kernel module using kprobes. It also include I/O code to transmit its output from the kernel to userspace.

-In addition to the library, the runtime includes a SystemTap user-space daemon (stpd). Stpd grabs data sent from the I/O code in the runtime and displays it and/or saves it to files. Stpd (or a script invoking it) will handle other issues like inserting and removing modules.

-Stpd and the I/O code make use of both relayfs and netlink for communication. For kernels without relayfs builtin, it is provided as a standalone module under the runtime directory.

-Design

-

-Implementation

-The library is written in C and is really not a library but a collection of code That can be conditionally included in a modules. It may become a library later, but for now there are some advantages to being able to change the sizes of static items with simple #defines.

-Maps (Associative Arrays)

-Maps are implemented as hash lists. It is not expected that users will attempt to collect so much data in kernel space that performance problems will require more complex solutions such as AVL trees.

-Maps are created with _stp_map_new(). Each map can hold only one type of data; int64, string, or statistics. Each element belonging to a map can have up to 2 keys and a value. Implemented key types are strings and longs.

-To simplify the implementation, the functions to set the key and the functions to set the data are separated. That means we need only 4 functions to set the key and 3 functions to set the value.

-For example:

/* create a map with a max of 100 elements */
-MAP mymap = map_new(100, INT64);
-
-/* mymap[birth year] = 2000 */
-map_key_str (mymap, "birth year");
-map_set_int64 (mymap, 2000);
-

-All elements have a default value of 0 (or NULL). Elements are only saved to the map when their value is set to something nonzero. This means that querying for the existance of a key is inexpensive because no element is created, just a hash table lookup.

-Lists

-A list is a special map which has internally ascending long integer keys. Adding a value to a list does not require setting a key first. Create a list with _stp_list_new(). Add to it with _stp_list_add_str() and _stp_list_add_int64(). Clear it with _stp_list_clear().

-Strings

-One of the biggest restrictions the library has is that it cannot allocate things like strings off the stack. It is also not a good idea to dynamically allocate space for strings with kmalloc(). That leaves us with statically allocated space for strings. This is what is implemented in the String module. Strings use preallocated per-cpu buffers and are safe to use (unlike C strings).

-I/O

-Generally things are written to a "print buffer" using the internal functions _stp_print_xxx().
_stp_print ("Output is: ");
-_stp_printf ("pid is %d ", current->pid);
-_stp_printf ("name is %s", current->comm);
-
before the probe returns it must call _stp_print_flush(). This timestamps the accumulated print buffer and sends it to relayfs. When relayfs fills an internal buffer, the user-space daemon is notified data is ready and reads a bug per-cpu chunk, which contains a line like:
-[123456.000002] Output is: pid is 1234 name is bash
-

-The user-daemon (stpd) saves this data to a file named something like "stpd_cpu2". When the user hits ^c, a timer expires, or the probe module notifies stpd (through a netlink command channel) that it wants to terminate, stpd does "system(rmmod)" then collects the last output before exiting. As an option, if we don't need bulk per-cpu data, we can put

#define STP_NETLINK_ONLY
-
at the top of the module and all output will go over a netlink channel. In the SystemTap language, we will provide some simple functions to control the buffering policy, which will control the use of netlink and parameters to relayfs and stpd.

-Status

- -

-Example Probes

-Working sample probe code using the runtime is in runtime/probes. Browse probes.

-ToDo

-Click Here for Complete List

-Links

-SystemTap Project Page diff --git a/runtime/docs/html/io_8c-source.html b/runtime/docs/html/io_8c-source.html deleted file mode 100644 index 82721232..00000000 --- a/runtime/docs/html/io_8c-source.html +++ /dev/null @@ -1,118 +0,0 @@ - - -SystemTap: io.c Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

io.c

Go to the documentation of this file.
00001 #ifndef _IO_C_ /* -*- linux-c -*- */
-00002 #define _IO_C_
-00003 
-00004 #include "relay-app.h"
-00005 #include "print.c"
-00006 
-00007 /** @file io.c
-00008  * @brief I/O functions
-00009  */
-00010 /** @addtogroup io I/O
-00011  * I/O functions
-00012  * @{
-00013  */
-00014 
-00015 /** private buffer for _stp_log() */
-00016 #define STP_LOG_BUF_LEN 2047
-00017 static char _stp_lbuf[NR_CPUS][STP_LOG_BUF_LEN + 1];
-00018 
-00019 /** Logs Data.
-00020  * This function prints to the system log if stpd has not connected
-00021  * yet.  Otherwise it sends the message immediately to stpd.
-00022  * @param fmt A variable number of args.
-00023  * @note Lines are limited in length by printk buffer. If there is
-00024  * no newline in the format string, then other syslog output could
-00025  * get appended to the SystemTap line.
-00026  * @todo Evaluate if this function is necessary.
-00027  */
-00028 
-00029 void _stp_log (const char *fmt, ...)
-00030 {
-00031         int num;
-00032         char *buf = &_stp_lbuf[smp_processor_id()][0];
-00033         va_list args;
-00034         va_start(args, fmt);
-00035         num = vscnprintf (buf, STP_LOG_BUF_LEN, fmt, args);
-00036         va_end(args);
-00037         buf[num] = '\0';
-00038 
-00039         if (app.logging)
-00040                 send_reply (STP_REALTIME_DATA, buf, num + 1, stpd_pid);
-00041         else
-00042                 printk("STP: %s", buf);
-00043 }
-00044 
-00045 static void stpd_app_started(void)
-00046 {
-00047         printk ("stpd has started.\n");
-00048 }
-00049 
-00050 static void stpd_app_stopped(void)
-00051 {
-00052         printk ("stpd has stopped.\n");
-00053 }
-00054 
-00055 static void probe_exit(void);
-00056 
-00057 #include <linux/delay.h>
-00058 static int stpd_command (int type, void *data)
-00059 {
-00060         if (type == STP_EXIT) {
-00061                 printk ("STP_EXIT received\n");
-00062                 probe_exit();
-00063 #ifndef STP_NETLINK_ONLY
-00064                 relay_flush(app.chan);
-00065                 ssleep(2); /* FIXME: time for data to be flushed */
-00066 #endif
-00067                 send_reply (STP_EXIT, __this_module.name, strlen(__this_module.name) + 1, stpd_pid);
-00068                 return 1;
-00069         }
-00070         return 0;
-00071 }
-00072 
-00073 /*
-00074  * relay-app callbacks
-00075  */
-00076 static struct relay_app_callbacks stp_callbacks =
-00077 {
-00078         .app_started = stpd_app_started,
-00079         .app_stopped = stpd_app_stopped,
-00080         .user_command = stpd_command
-00081 };
-00082 
-00083 /** Opens netlink and relayfs connections to stpd.
-00084  * This must be called before any I/O is done, probably 
-00085  * at the start of module initialization.
-00086  */
-00087 int _stp_netlink_open(void)
-00088 {
-00089         if (init_relay_app("stpd", "cpu", &stp_callbacks)) {
-00090                 printk ("STP: couldn't init relay app\n");
-00091                 return -1;
-00092         }
-00093         return 0;
-00094 }
-00095 
-00096 /** Closes netlink and relayfs connections to stpd.
-00097  * This must be called after all I/O is done, probably 
-00098  * at the end of module cleanup.
-00099  * @returns 0 on success.  -1 if there is a problem establishing
-00100  * a connection.
-00101  */
-00102         
-00103 void _stp_netlink_close (void)
-00104 {
-00105         send_reply (STP_DONE, NULL, 0, stpd_pid);
-00106         close_relay_app();
-00107 }
-00108 
-00109 /** @} */
-00110 #endif /* _IO_C_ */
-
diff --git a/runtime/docs/html/io_8c.html b/runtime/docs/html/io_8c.html deleted file mode 100644 index 1aca24d7..00000000 --- a/runtime/docs/html/io_8c.html +++ /dev/null @@ -1,38 +0,0 @@ - - -SystemTap: io.c File Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

io.c File Reference

I/O functions. More... -

-#include "relay-app.h"
-#include "print.c"
-#include <linux/delay.h>
- -

-Go to the source code of this file. - - - - - - - - - - - - - - - -

Defines

-#define STP_LOG_BUF_LEN   2047
 private buffer for _stp_log()

Functions

void _stp_log (const char *fmt,...)
 Logs Data.
int _stp_netlink_open (void)
 Opens netlink and relayfs connections to stpd.
void _stp_netlink_close (void)
 Closes netlink and relayfs connections to stpd.
-


Detailed Description

-I/O functions. -

- -

-Definition in file io.c. diff --git a/runtime/docs/html/kprobe__where__funct_8c-source.html b/runtime/docs/html/kprobe__where__funct_8c-source.html deleted file mode 100644 index a1d096a5..00000000 --- a/runtime/docs/html/kprobe__where__funct_8c-source.html +++ /dev/null @@ -1,99 +0,0 @@ - - -SystemTap: probes/where_func/kprobe_where_funct.c Source File - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
- -

kprobe_where_funct.c

00001 /* kprobe_where_funct.c
-00002    this is a simple module to get information about calls to a function that is passed as a module option
-00003    Will Cohen
-00004 */
-00005 
-00006 #define HASH_TABLE_BITS 8
-00007 #define HASH_TABLE_SIZE (1<<HASH_TABLE_BITS)
-00008 #define BUCKETS 16              /* largest histogram width */
-00009 #define STP_NETLINK_ONLY
-00010 #define STP_NUM_STRINGS 1
-00011 
-00012 #include "runtime.h"
-00013 #include "map.c"
-00014 #include "probes.c"
-00015 #include "current.c"
-00016 #include "sym.c"
-00017 
-00018 MODULE_DESCRIPTION("SystemTap probe: where_func");
-00019 MODULE_AUTHOR("Will Cohen and Martin Hunt");
-00020 
-00021 static char default_name[] = "schedule";
-00022 static char *funct_name = default_name;
-00023 module_param(funct_name, charp, 0);
-00024 MODULE_PARM_DESC(funct_name, "function entry name.\n");
-00025 
-00026 static int count_funct = 0;
-00027 
-00028 MAP funct_locations;
-00029 
-00030 static int inst_funct(struct kprobe *p, struct pt_regs *regs)
-00031 {
-00032         long ret_addr = _stp_ret_addr(regs);
-00033         ++count_funct;
-00034         _stp_map_key_long(funct_locations, ret_addr);
-00035         _stp_map_add_int64(funct_locations, 1);
-00036         return 0;
-00037 }
-00038 
-00039 /*For each probe you need to allocate a kprobe structure*/
-00040 static struct kprobe kp[] = {
-00041         {
-00042                 .addr = default_name,
-00043                 .pre_handler = inst_funct,
-00044         }
-00045 };
-00046 #define MAX_KPROBES (sizeof(kp)/sizeof(struct kprobe))
-00047 
-00048 int init_module(void)
-00049 {
-00050         int ret;
-00051  
-00052         if (_stp_netlink_open() < 0)
-00053                 return -1;
-00054   
-00055         funct_locations = _stp_map_new(1000, INT64);
-00056 
-00057         if (funct_name)
-00058                 kp[0].addr = funct_name;
-00059 
-00060         ret = _stp_register_kprobes (kp, MAX_KPROBES);
-00061 
-00062         return ret;
-00063 }
-00064 
-00065 static void probe_exit (void)
-00066 {
-00067         struct map_node_int64 *ptr;
-00068 
-00069         _stp_unregister_kprobes (kp, MAX_KPROBES);
-00070 
-00071         _stp_printf("%s() called %d times.\n", funct_name, count_funct);
-00072         _stp_printf("NUM\tCaller\n", funct_name);
-00073 
-00074         /* now walk the hash table and print out all the information */
-00075         foreach(funct_locations, ptr) {
-00076                 _stp_printf("%lld\t", ptr->val);
-00077                 _stp_symbol_print (key1int(ptr));
-00078                 _stp_print_flush();
-00079         }
-00080         
-00081         _stp_map_del(funct_locations);
-00082 }
-00083 
-00084 void cleanup_module(void)
-00085 {
-00086   _stp_netlink_close(); 
-00087 }
-00088 
-00089 MODULE_LICENSE("GPL");
-
diff --git a/runtime/docs/html/map_8c-source.html b/runtime/docs/html/map_8c-source.html deleted file mode 100644 index 4dac0d8f..00000000 --- a/runtime/docs/html/map_8c-source.html +++ /dev/null @@ -1,920 +0,0 @@ - - -SystemTap: map.c Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

map.c

Go to the documentation of this file.
00001 #ifndef _MAP_C_ /* -*- linux-c -*- */
-00002 #define _MAP_C_
-00003 
-00004 /** @file map.c
-00005  * @brief Implements maps (associative arrays) and lists
-00006  */
-00007 
-00008 #include "map.h"
-00009 #include "alloc.c"
-00010 #include "string.c"
-00011 
-00012 static int map_sizes[] = {
-00013         sizeof(struct map_node_int64),
-00014         sizeof(struct map_node_stat),
-00015         sizeof(struct map_node_str),
-00016         0
-00017 };
-00018 
-00019 static unsigned string_hash(const char *key1, const char *key2)
-00020 {
-00021         int hash = 0, count = 0;
-00022         char *v1 = (char *)key1;
-00023         char *v2 = (char *)key2;
-00024         while (*v1 && count++ < 5) {
-00025                 hash += *v1++;
-00026         }
-00027         while (v2 && *v2 && count++ < 5) {
-00028                 hash += *v2++;
-00029         }
-00030         return hash_long((unsigned long)hash, HASH_TABLE_BITS);
-00031 }
-00032 
-00033 static unsigned mixed_hash(const char *key1, long key2)
-00034 {
-00035         int hash = 0, count = 0;
-00036         char *v = (char *)key1;
-00037         while (v && *v && count++ < 5)
-00038                 hash += *v++;
-00039         return hash_long((unsigned long)(hash ^ key2), HASH_TABLE_BITS);
-00040 }
-00041 
-00042 /** @addtogroup maps 
-00043  * Implements maps (associative arrays) and lists
-00044  * @{ 
-00045  */
-00046 
-00047 /** Create a new map.
-00048  * Maps must be created at module initialization time.
-00049  * @param max_entries The maximum number of entries allowed. Currently that number will
-00050  * be preallocated.  If more entries are required, the oldest ones will be deleted. This makes
-00051  * it effectively a circular buffer.  If max_entries is 0, there will be no maximum and entries
-00052  * will be allocated dynamically.
-00053  * @param type Type of values stored in this map. 
-00054  * @return A MAP on success or NULL on failure.
-00055  */
-00056 
-00057 MAP _stp_map_new(unsigned max_entries, enum valtype type)
-00058 {
-00059         size_t size;
-00060         MAP m = (MAP) _stp_valloc(sizeof(struct map_root));
-00061         if (m == NULL)
-00062                 return NULL;
-00063 
-00064         INIT_LIST_HEAD(&m->head);
-00065 
-00066         m->maxnum = max_entries;
-00067         m->type = type;
-00068         if (type >= END) {
-00069                 dbug ("map_new: unknown type %d\n", type);
-00070                 return NULL;
-00071         }
-00072 
-00073         if (max_entries) {
-00074                 void *tmp;
-00075                 int i;
-00076                 struct list_head *e;
-00077 
-00078                 INIT_LIST_HEAD(&m->pool);
-00079                 size = map_sizes[type];
-00080                 tmp = _stp_valloc(max_entries * size);
-00081 
-00082                 for (i = max_entries - 1; i >= 0; i--) {
-00083                         e = i * size + tmp;
-00084                         dbug ("e=%lx\n", (long)e);
-00085                         list_add(e, &m->pool);
-00086                 }
-00087                 m->membuf = tmp;
-00088         }
-00089         return m;
-00090 }
-00091 
-00092 static void map_free_strings(MAP map, struct map_node *n)
-00093 {
-00094         struct map_node_str *m = (struct map_node_str *)n;
-00095         dbug ("n = %lx\n", (long)n);
-00096         if (map->type == STRING) {
-00097                 dbug ("val STRING %lx\n", (long)m->str);
-00098                 if (m->str)
-00099                         _stp_free(m->str);
-00100         }
-00101         if (m->n.key1type == STR) {
-00102                 dbug ("key1 STR %lx\n", (long)key1str(m));
-00103                 if (key1str(m))
-00104                         _stp_free(key1str(m));
-00105         }
-00106         if (m->n.key2type == STR) {
-00107                 dbug ("key2 STR %lx\n", (long)key2str(m));
-00108                 if (key2str(m))
-00109                         _stp_free(key2str(m));
-00110         }
-00111 }
-00112 
-00113 /** Deletes the current element.
-00114  * If no current element (key) for this map is set, this function does nothing.
-00115  * @param map 
-00116  */
-00117 
-00118 void _stp_map_key_del(MAP map)
-00119 {
-00120         struct map_node *m;
-00121 
-00122         dbug ("create=%d key=%lx\n", map->create, (long)map->key);
-00123         if (map == NULL)
-00124                 return;
-00125 
-00126         if (map->create) {
-00127                 map->create = 0;
-00128                 map->key = NULL;
-00129                 return;
-00130         }
-00131 
-00132         if (map->key == NULL)
-00133                 return;
-00134 
-00135         m = (struct map_node *)map->key;
-00136 
-00137         /* remove node from old hash list */
-00138         hlist_del_init(&m->hnode);
-00139 
-00140         /* remove from entry list */
-00141         list_del(&m->lnode);
-00142 
-00143         /* remove any allocated string storage */
-00144         map_free_strings(map, (struct map_node *)map->key);
-00145 
-00146         if (map->maxnum)
-00147                 list_add(&m->lnode, &map->pool);
-00148         else
-00149                 _stp_free(m);
-00150 
-00151         map->key = NULL;
-00152         map->num--;
-00153 }
-00154 
-00155 /** Get the first element in a map.
-00156  * @param map 
-00157  * @returns a pointer to the first element.
-00158  * This is typically used with _stp_map_iter().  See the foreach() macro
-00159  * for typical usage.  It probably does what you want anyway.
-00160  * @sa foreach
-00161  */
-00162 
-00163 struct map_node *_stp_map_start(MAP map)
-00164 {
-00165         if (map == NULL)
-00166                 return NULL;
-00167 
-00168         dbug ("%lx\n", (long)map->head.next);
-00169 
-00170         if (list_empty(&map->head))
-00171                 return NULL;
-00172 
-00173         return (struct map_node *)map->head.next;
-00174 }
-00175 
-00176 /** Get the next element in a map.
-00177  * @param map 
-00178  * @param m a pointer to the current element, returned from _stp_map_start()
-00179  * or _stp_map_iter().
-00180  * @returns a pointer to the next element.
-00181  * This is typically used with _stp_map_start().  See the foreach() macro
-00182  * for typical usage.  It probably does what you want anyway.
-00183  * @sa foreach
-00184  */
-00185 
-00186 struct map_node *_stp_map_iter(MAP map, struct map_node *m)
-00187 {
-00188         if (map == NULL)
-00189                 return NULL;
-00190 
-00191         dbug ("%lx next=%lx  prev=%lx  map->head.next=%lx\n", (long)m, 
-00192               (long)m->lnode.next, (long)m->lnode.prev, (long)map->head.next);
-00193 
-00194         if (m->lnode.next == &map->head)
-00195                 return NULL;
-00196 
-00197         return (struct map_node *)m->lnode.next;
-00198 }
-00199 
-00200 /** Deletes a map.
-00201  * Deletes a map, freeing all memory in all elements.  Normally done only when the module exits.
-00202  * @param map
-00203  */
-00204 
-00205 void _stp_map_del(MAP map)
-00206 {
-00207         if (map == NULL)
-00208                 return;
-00209 
-00210         if (!list_empty(&map->head)) {
-00211                 struct map_node *ptr = (struct map_node *)map->head.next;
-00212                 while (ptr && ptr != (struct map_node *)&map->head) {
-00213                         map_free_strings(map, ptr);
-00214                         ptr = (struct map_node *)ptr->lnode.next;
-00215                 }
-00216         }
-00217         _stp_vfree(map->membuf);
-00218         _stp_vfree(map);
-00219 }
-00220 
-00221 /**********************  KEY FUNCTIONS *********************/
-00222 
-00223 
-00224 /** Set the map's key to two longs.
-00225  * This sets the current element based on a key of two strings. If the keys are
-00226  * not found, a new element will not be created until a <i>_stp_map_set_xxx</i>
-00227  * call.
-00228  * @param map
-00229  * @param key1 first key
-00230  * @param key2 second key
-00231  */
-00232 
-00233 void _stp_map_key_long_long(MAP map, long key1, long key2)
-00234 {
-00235         unsigned hv;
-00236         struct hlist_head *head;
-00237         struct hlist_node *e;
-00238 
-00239         if (map == NULL)
-00240                 return;
-00241 
-00242         hv = hash_long(key1 ^ key2, HASH_TABLE_BITS);
-00243         head = &map->hashes[hv];
-00244 
-00245         dbug ("hash for %ld,%ld is %d\n", key1, key2, hv);
-00246 
-00247         hlist_for_each(e, head) {
-00248                 struct map_node *n =
-00249                         (struct map_node *)((long)e - sizeof(struct hlist_node));
-00250                 dbug ("n =%lx  key=%ld,%ld\n", (long)n, n->key1.val, n->key2.val);
-00251                 if (key1 == n->key1.val && key2 == n->key2.val) {
-00252                         map->key = n;
-00253                         dbug ("saving key %lx\n", (long)map->key);
-00254                         map->create = 0;
-00255                         return;
-00256                 }
-00257         }
-00258 
-00259         map->c_key1.val = key1;
-00260         map->c_key2.val = key2;
-00261         map->c_key1type = LONG;
-00262         map->c_key2type = LONG;
-00263         map->c_keyhead = head;
-00264         map->create = 1;
-00265 }
-00266 
-00267 /** Set the map's key to two strings.
-00268  * This sets the current element based on a key of two strings. If the keys are
-00269  * not found, a new element will not be created until a <i>_stp_map_set_xxx</i>
-00270  * call.
-00271  * @param map
-00272  * @param key1 first key
-00273  * @param key2 second key
-00274  */
-00275 
-00276 void _stp_map_key_str_str(MAP map, char *key1, char *key2)
-00277 {
-00278         unsigned hv;
-00279         struct hlist_head *head;
-00280         struct hlist_node *e;
-00281 
-00282         if (map == NULL)
-00283                 return;
-00284 
-00285         if (key1 == NULL) {
-00286                 map->key = NULL;
-00287                 return;
-00288         }
-00289 
-00290         hv = string_hash(key1, key2);
-00291         head = &map->hashes[hv];
-00292 
-00293         dbug ("hash for %s,%s is %d\n", key1, key2, hv);
-00294 
-00295         hlist_for_each(e, head) {
-00296                 struct map_node *n =
-00297                         (struct map_node *)((long)e - sizeof(struct hlist_node));
-00298                 dbug ("e =%lx  key=%s,%s\n", (long)e, n->key1.str,n->key2.str);
-00299                 if (strcmp(key1, n->key1.str) == 0
-00300                     && (key2 == NULL || strcmp(key2, n->key2.str) == 0)) {
-00301                         map->key = n;
-00302                         dbug ("saving key %lx\n", (long)map->key);
-00303                         map->create = 0;
-00304                         return;
-00305                 }
-00306         }
-00307 
-00308         map->c_key1.str = key1;
-00309         map->c_key2.str = key2;
-00310         map->c_key1type = STR;
-00311         map->c_key2type = STR;
-00312         map->c_keyhead = head;
-00313         map->create = 1;
-00314 }
-00315 
-00316 /** Set the map's key to a string and a long.
-00317  * This sets the current element based on a key of a string and a long. If the keys are
-00318  * not found, a new element will not be created until a <i>_stp_map_set_xxx</i>
-00319  * call.
-00320  * @param map
-00321  * @param key1 first key
-00322  * @param key2 second key
-00323  */
-00324 
-00325 void _stp_map_key_str_long(MAP map, char *key1, long key2)
-00326 {
-00327         unsigned hv;
-00328         struct hlist_head *head;
-00329         struct hlist_node *e;
-00330 
-00331         if (map == NULL)
-00332                 return;
-00333 
-00334         if (key1 == NULL) {
-00335                 map->key = NULL;
-00336                 return;
-00337         }
-00338 
-00339         hv = mixed_hash(key1, key2);
-00340         head = &map->hashes[hv];
-00341 
-00342         dbug ("hash for %s,%ld is %d\n", key1, key2, hv);
-00343 
-00344         hlist_for_each(e, head) {
-00345                 struct map_node *n =
-00346                         (struct map_node *)((long)e - sizeof(struct hlist_node));
-00347                 dbug ("e =%lx  key=%s,%ld\n", (long)e, n->key1.str,(long)n->key2.val);
-00348                 if (strcmp(key1, n->key1.str) == 0 && key2 == n->key2.val) {
-00349                         map->key = n;
-00350                         dbug ("saving key %lx\n", (long)map->key);
-00351                         map->create = 0;
-00352                         return;
-00353                 }
-00354         }
-00355 
-00356         map->c_key1.str = key1;
-00357         map->c_key2.val = key2;
-00358         map->c_key1type = STR;
-00359         map->c_key2type = LONG;
-00360         map->c_keyhead = head;
-00361         map->create = 1;
-00362 }
-00363 
-00364 /** Set the map's key to a long and a string.
-00365  * This sets the current element based on a key of a long and a string. If the keys are
-00366  * not found, a new element will not be created until a <i>_stp_map_set_xxx</i>
-00367  * call.
-00368  * @param map
-00369  * @param key1 first key
-00370  * @param key2 second key
-00371  */
-00372 
-00373 void _stp_map_key_long_str(MAP map, long key1, char *key2)
-00374 {
-00375         unsigned hv;
-00376         struct hlist_head *head;
-00377         struct hlist_node *e;
-00378 
-00379         if (map == NULL)
-00380                 return;
-00381 
-00382         hv = mixed_hash(key2, key1);
-00383         head = &map->hashes[hv];
-00384         dbug ("hash for %ld,%s is %d\n", key1, key2, hv);
-00385 
-00386         hlist_for_each(e, head) {
-00387                 struct map_node *n =
-00388                         (struct map_node *)((long)e - sizeof(struct hlist_node));
-00389                 dbug ("e =%lx  key=%ld,%s\n", (long)e, n->key1.val,n->key2.str);
-00390                 if (key1 == n->key1.val && strcmp(key2, n->key2.str) == 0) {
-00391                         map->key = n;
-00392                         dbug ("saving key %lx\n", (long)map->key);
-00393                         map->create = 0;
-00394                         return;
-00395                 }
-00396         }
-00397 
-00398         map->c_key1.val = key1;
-00399         map->c_key2.str = key2;
-00400         map->c_key1type = LONG;
-00401         map->c_key2type = STR;
-00402         map->c_keyhead = head;
-00403         map->create = 1;
-00404 }
-00405 
-00406 /** Set the map's key to a string.
-00407  * This sets the current element based on a string key. If the key is
-00408  * not found, a new element will not be created until a <i>_stp_map_set_xxx</i>
-00409  * call.
-00410  * @param map
-00411  * @param key
-00412  */
-00413 
-00414 void _stp_map_key_str(MAP map, char *key)
-00415 {
-00416         if (map == NULL)
-00417                 return;
-00418         _stp_map_key_str_str(map, key, NULL);
-00419         map->c_key2type = NONE;
-00420 }
-00421 
-00422 /** Set the map's key to a long.
-00423  * This sets the current element based on a long key. If the key is
-00424  * not found, a new element will not be created until a <i>_stp_map_set_xxx</i>
-00425  * call.
-00426  * @param map
-00427  * @param key 
-00428  */
-00429 
-00430 void _stp_map_key_long(MAP map, long key)
-00431 {
-00432         if (map == NULL)
-00433                 return;
-00434         _stp_map_key_long_long(map, key, 0);
-00435         map->c_key2type = NONE;
-00436 }
-00437 
-00438 /**********************  SET/GET VALUES *********************/
-00439 
-00440 static void map_copy_keys(MAP map, struct map_node *m)
-00441 {
-00442         m->key1type = map->c_key1type;
-00443         m->key2type = map->c_key2type;
-00444         switch (map->c_key1type) {
-00445         case STR:
-00446                 m->key1.str = _stp_alloc(strlen(map->c_key1.str) + 1);
-00447                 strcpy(m->key1.str, map->c_key1.str);
-00448                 break;
-00449         case LONG:
-00450                 m->key1.val = map->c_key1.val;
-00451                 break;
-00452         case NONE:
-00453                 /* ERROR */
-00454                 break;
-00455         }
-00456         switch (map->c_key2type) {
-00457         case STR:
-00458                 m->key2.str = _stp_alloc(strlen(map->c_key2.str) + 1);
-00459                 strcpy(m->key2.str, map->c_key2.str);
-00460                 break;
-00461         case LONG:
-00462                 m->key2.val = map->c_key2.val;
-00463                 break;
-00464         case NONE:
-00465                 break;
-00466         }
-00467 
-00468         /* add node to new hash list */
-00469         hlist_add_head(&m->hnode, map->c_keyhead);
-00470         
-00471         map->key = m;
-00472         map->create = 0;
-00473         map->num++;
-00474 }
-00475 
-00476 static void __stp_map_set_int64(MAP map, int64_t val, int add)
-00477 {
-00478         struct map_node_int64 *m;
-00479 
-00480         if (map == NULL)
-00481                 return;
-00482 
-00483         if (map->create) {
-00484                 if (val == 0)
-00485                         return;
-00486 
-00487                 if (map->maxnum) {
-00488                         if (list_empty(&map->pool)) {
-00489                                 if (map->no_wrap) {
-00490                                         /* ERROR. FIXME */
-00491                                         return;
-00492                                 }
-00493                                 m = (struct map_node_int64 *)map->head.next;
-00494                                 hlist_del_init(&m->n.hnode);
-00495                                 map_free_strings(map, (struct map_node *)m);
-00496                                 dbug ("got %lx off head\n", (long)m);
-00497                         } else {
-00498                                 m = (struct map_node_int64 *)map->pool.next;
-00499                                 dbug ("got %lx off pool\n", (long)m);
-00500                         }
-00501                         list_move_tail(&m->n.lnode, &map->head);
-00502                 } else {
-00503                         m = (struct map_node_int64 *)
-00504                             _stp_calloc(sizeof(struct map_node_int64));
-00505                         /* add node to list */
-00506                         list_add_tail(&m->n.lnode, &map->head);
-00507                 }
-00508 
-00509                 /* copy the key(s) */
-00510                 map_copy_keys(map, &m->n);
-00511 
-00512                 /* set the value */
-00513                 m->val = val;
-00514         } else {
-00515                 if (map->key == NULL)
-00516                         return;
-00517 
-00518                 if (val) {
-00519                         m = (struct map_node_int64 *)map->key;
-00520                         if (add)
-00521                                 m->val += val;
-00522                         else
-00523                                 m->val = val;
-00524                 } else if (!add) {
-00525                         /* setting value to 0 is the same as deleting */
-00526                         _stp_map_key_del(map);
-00527                 }
-00528         }
-00529 }
-00530 
-00531 /** Set the current element's value to an int64.
-00532  * This sets the current element's value to an int64. The map must have been created
-00533  * to hold int64s using _stp_map_new()
-00534  *
-00535  * If the element doesn't exist, it is created.  If no current element (key)
-00536  * is set for the map, this function does nothing.
-00537  * @param map
-00538  * @param val new value
-00539  * @sa _stp_map_add_int64
-00540  * @sa _stp_map_set()
-00541  */
-00542 void _stp_map_set_int64(MAP map, int64_t val)
-00543 {
-00544         __stp_map_set_int64 (map, val, 0);
-00545 }
-00546 
-00547 
-00548 /** Adds an int64 to the current element's value.
-00549  * This adds an int64 to the current element's value. The map must have been created
-00550  * to hold int64s using _stp_map_new()
-00551  *
-00552  * If the element doesn't exist, it is created.  If no current element (key)
-00553  * is set for the map, this function does nothing.
-00554  * @param map
-00555  * @param val value
-00556  * @sa _stp_map_set_int64
-00557  */
-00558 
-00559 void _stp_map_add_int64(MAP map, int64_t val)
-00560 {
-00561         __stp_map_set_int64 (map, val, 1);
-00562 }
-00563 
-00564 /** Gets the current element's value.
-00565  * @param map
-00566  * @returns The value. If the current element is not set or doesn't exist, returns 0.
-00567  */
-00568 
-00569 int64_t _stp_map_get_int64(MAP map)
-00570 {
-00571         struct map_node_int64 *m;
-00572         if (map == NULL || map->create || map->key == NULL)
-00573                 return 0;
-00574         dbug ("%lx\n", (long)map->key);
-00575         m = (struct map_node_int64 *)map->key;
-00576         return m->val;
-00577 }
-00578 
-00579 /** Set the current element's value to a C string.
-00580  * This sets the current element's value to an C string. The map must have been created
-00581  * to hold int64s using <i>_stp_map_new(xxx, STRING)</i>
-00582  *
-00583  * If the element doesn't exist, it is created.  If no current element (key)
-00584  * is set for the map, this function does nothing.
-00585  * @param map
-00586  * @param val new string
-00587  * @sa _stp_map_set()
-00588  */
-00589 
-00590 void _stp_map_set_str(MAP map, char *val)
-00591 {
-00592         struct map_node_str *m;
-00593 
-00594         if (map == NULL)
-00595                 return;
-00596 
-00597         if (map->create) {
-00598                 if (val == NULL)
-00599                         return;
-00600 
-00601                 if (map->maxnum) {
-00602                         if (list_empty(&map->pool)) {
-00603                                 if (map->no_wrap) {
-00604                                         /* ERROR. FIXME */
-00605                                         return;
-00606                                 }
-00607                                 m = (struct map_node_str *)map->head.next;
-00608                                 hlist_del_init(&m->n.hnode);
-00609                                 map_free_strings(map, (struct map_node *)m);
-00610                                 dbug ("got %lx off head\n", (long)m);
-00611                         } else {
-00612                                 m = (struct map_node_str *)map->pool.next;
-00613                                 dbug ("got %lx off pool\n", (long)m);
-00614                         }
-00615                         list_move_tail(&m->n.lnode, &map->head);
-00616                 } else {
-00617                         m = (struct map_node_str *)
-00618                             _stp_calloc(sizeof(struct map_node_str));
-00619                         /* add node to list */
-00620                         list_add_tail(&m->n.lnode, &map->head);
-00621                 }
-00622 
-00623                 /* copy the key(s) */
-00624                 map_copy_keys(map, &m->n);
-00625 
-00626                 /* set the value */
-00627                 m->str = _stp_alloc(strlen(val) + 1);
-00628                 strcpy(m->str, val);
-00629         } else {
-00630                 if (map->key == NULL)
-00631                         return;
-00632 
-00633                 if (val) {
-00634                         m = (struct map_node_str *)map->key;
-00635                         if (m->str)
-00636                                 _stp_free(m->str);
-00637                         m->str = _stp_alloc(strlen(val) + 1);
-00638                         strcpy(m->str, val);
-00639                 } else {
-00640                         /* setting value to 0 is the same as deleting */
-00641                         _stp_map_key_del(map);
-00642                 }
-00643         }
-00644 }
-00645 
-00646 /** Set the current element's value to String.
-00647  * This sets the current element's value to a String. The map must have been created
-00648  * to hold int64s using <i>_stp_map_new(xxx, STRING)</i>
-00649  *
-00650  * If the element doesn't exist, it is created.  If no current element (key)
-00651  * is set for the map, this function does nothing.
-00652  * @param map
-00653  * @param str String containing new value.
-00654  * @sa _stp_map_set()
-00655  */
-00656 
-00657 void _stp_map_set_string (MAP map, String str)
-00658 {
-00659   _stp_map_set_str (map, str->buf);
-00660 }
-00661 
-00662 /** Gets the current element's value.
-00663  * @param map
-00664  * @returns A string pointer. If the current element is not set or doesn't exist, returns NULL.
-00665  */
-00666 
-00667 char *_stp_map_get_str(MAP map)
-00668 {
-00669         struct map_node_str *m;
-00670         if (map == NULL || map->create || map->key == NULL)
-00671                 return NULL;
-00672         dbug ("%lx\n", (long)map->key);
-00673         m = (struct map_node_str *)map->key;
-00674         return m->str;
-00675 }
-00676 
-00677 /** Set the current element's value to a stat.
-00678  * This sets the current element's value to an stat struct. The map must have been created
-00679  * to hold stats using <i>_stp_map_new(xxx, STAT)</i>.  This function would only be used
-00680  * if we wanted to set stats to something other than the normal initial values (count = 0,
-00681  * sum = 0, etc).  It may be deleted if it doesn't turn out to be useful.
-00682  * @sa _stp_map_stat_add 
-00683  *
-00684  * If the element doesn't exist, it is created.  If no current element (key)
-00685  * is set for the map, this function does nothing.
-00686  * @param map
-00687  * @param stats pointer to stats struct.
-00688  * @todo Histograms don't work yet.
-00689  */
-00690 
-00691 void _stp_map_set_stat(MAP map, stat * stats)
-00692 {
-00693         struct map_node_stat *m;
-00694 
-00695         if (map == NULL)
-00696                 return;
-00697         dbug ("set_stat %lx\n", (long)map->key);
-00698 
-00699         if (map->create) {
-00700                 if (stats == NULL)
-00701                         return;
-00702 
-00703                 if (map->maxnum) {
-00704                         if (list_empty(&map->pool)) {
-00705                                 if (map->no_wrap) {
-00706                                         /* ERROR. FIXME */
-00707                                         return;
-00708                                 }
-00709                                 m = (struct map_node_stat *)map->head.next;
-00710                                 hlist_del_init(&m->n.hnode);
-00711                                 map_free_strings(map, (struct map_node *)m);
-00712                                 dbug ("got %lx off head\n", (long)m);
-00713                         } else {
-00714                                 m = (struct map_node_stat *)map->pool.next;
-00715                                 dbug ("got %lx off pool\n", (long)m);
-00716                         }
-00717                         list_move_tail(&m->n.lnode, &map->head);
-00718                 } else {
-00719                         m = (struct map_node_stat *)
-00720                             _stp_calloc(sizeof(struct map_node_stat));
-00721                         /* add node to list */
-00722                         list_add_tail(&m->n.lnode, &map->head);
-00723                 }
-00724 
-00725                 /* copy the key(s) */
-00726                 map_copy_keys(map, &m->n);
-00727 
-00728                 /* set the value */
-00729                 memcpy(&m->stats, stats, sizeof(stat));
-00730         } else {
-00731                 if (map->key == NULL)
-00732                         return;
-00733 
-00734                 if (stats) {
-00735                         m = (struct map_node_stat *)map->key;
-00736                         memcpy(&m->stats, stats, sizeof(stat));
-00737                 } else {
-00738                         /* setting value to NULL is the same as deleting */
-00739                         _stp_map_key_del(map);
-00740                 }
-00741         }
-00742 }
-00743 
-00744 /** Gets the current element's value.
-00745  * @param map
-00746  * @returns A pointer to the stats struct. If the current element is not set 
-00747  * or doesn't exist, returns NULL.
-00748  */
-00749 
-00750 stat *_stp_map_get_stat(MAP map)
-00751 {
-00752         struct map_node_stat *m;
-00753         if (map == NULL || map->create || map->key == NULL)
-00754                 return NULL;
-00755         dbug ("%lx\n", (long)map->key);
-00756         m = (struct map_node_stat *)map->key;
-00757         return &m->stats;
-00758 }
-00759 
-00760 /** Add to the current element's statistics.
-00761  * Increments the statistics counter by one and the sum by <i>val</i>.
-00762  * Adjusts minimum, maximum, and histogram.
-00763  *
-00764  * If the element doesn't exist, it is created.  If no current element (key)
-00765  * is set for the map, this function does nothing.
-00766  * @param map
-00767  * @param val value to add to the statistics
-00768  * @todo Histograms don't work yet.
-00769  */
-00770 
-00771 void _stp_map_stat_add(MAP map, int64_t val)
-00772 {
-00773         struct map_node_stat *m;
-00774         if (map == NULL)
-00775                 return;
-00776 
-00777         if (map->create) {
-00778                 stat st = { 1, val, val, val };
-00779                 /* histogram */
-00780                 _stp_map_set_stat(map, &st);
-00781                 return;
-00782         }
-00783 
-00784         if (map->key == NULL)
-00785                 return;
-00786 
-00787         dbug ("add_stat %lx\n", (long)map->key);
-00788         m = (struct map_node_stat *)map->key;
-00789         m->stats.count++;
-00790         m->stats.sum += val;
-00791         if (val > m->stats.max)
-00792                 m->stats.max = val;
-00793         if (val < m->stats.min)
-00794                 m->stats.min = val;
-00795         /* histogram */
-00796 }
-00797 
-00798 /** @} */
-00799 
-00800 /**********************  List Functions *********************/
-00801 
-00802 /** @addtogroup lists
-00803  * Lists are special cases of maps.
-00804  * @b Example:
-00805  * @include list.c
-00806  * @{ */
-00807 
-00808 /** Create a new list.
-00809  * A list is a map that internally has an incrementing long key for each member.
-00810  * Lists do not wrap if elements are added to exceed their maximum size.
-00811  * @param max_entries The maximum number of entries allowed. Currently that number will
-00812  * be preallocated.  If max_entries is 0, there will be no maximum and entries
-00813  * will be allocated dynamically.
-00814  * @param type Type of values stored in this list. 
-00815  * @return A MAP on success or NULL on failure.
-00816  * @sa foreach
-00817  */
-00818 
-00819 MAP _stp_list_new(unsigned max_entries, enum valtype type)
-00820 {
-00821   MAP map = _stp_map_new (max_entries, type);
-00822   map->no_wrap = 1;
-00823   return map;
-00824 }
-00825 
-00826 /** Clears a list.
-00827  * All elements in the list are deleted.
-00828  * @param map 
-00829  */
-00830 
-00831 void _stp_list_clear(MAP map)
-00832 {
-00833         if (map == NULL)
-00834                 return;
-00835 
-00836         if (!list_empty(&map->head)) {
-00837                 struct map_node *ptr = (struct map_node *)map->head.next;
-00838 
-00839                 while (ptr && ptr != (struct map_node *)&map->head) {
-00840                         struct map_node *next = (struct map_node *)ptr->lnode.next;
-00841 
-00842                         /* remove node from old hash list */
-00843                         hlist_del_init(&ptr->hnode);
-00844 
-00845                         /* remove from entry list */
-00846                         list_del(&ptr->lnode);
-00847                         
-00848                         /* remove any allocated string storage */
-00849                         map_free_strings(map, ptr);
-00850                         
-00851                         if (map->maxnum)
-00852                                 list_add(&ptr->lnode, &map->pool);
-00853                         else
-00854                                 _stp_free(ptr);
-00855 
-00856                         map->num--;
-00857                         ptr = next;
-00858                 }
-00859         }
-00860 
-00861         if (map->num != 0) {
-00862                 _stp_log ("ERROR: list is supposed to be empty (has %d)\n", map->num);
-00863         }
-00864 }
-00865 
-00866 /** Adds a C string to a list.
-00867  * @param map
-00868  * @param str
-00869  * @sa _stp_list_add()
-00870  */
-00871 
-00872 inline void _stp_list_add_str(MAP map, char *str)
-00873 {
-00874         _stp_map_key_long(map, map->num);
-00875         _stp_map_set_str(map, str);
-00876 }
-00877 
-00878 /** Adds a String to a list.
-00879  * @param map
-00880  * @param str String to add.
-00881  * @sa _stp_list_add()
-00882  */
-00883 
-00884 inline void _stp_list_add_string (MAP map, String str)
-00885 {
-00886         _stp_map_key_long(map, map->num);
-00887         _stp_map_set_str(map, str->buf);
-00888 }
-00889 
-00890 /** Adds an int64 to a list.
-00891  * @param map
-00892  * @param val
-00893  * @sa _stp_list_add()
-00894  */
-00895 
-00896 inline void _stp_list_add_int64(MAP map, int64_t val)
-00897 {
-00898         _stp_map_key_long(map, map->num);
-00899         _stp_map_set_int64(map, val);
-00900 }
-00901 
-00902 /** Get the number of elements in a list.
-00903  * @param map
-00904  * @returns The number of elements in a list.
-00905  */
-00906 
-00907 inline int _stp_list_size(MAP map)
-00908 {
-00909         return map->num;
-00910 }
-00911 /** @} */
-00912 #endif /* _MAP_C_ */
-
diff --git a/runtime/docs/html/map_8c.html b/runtime/docs/html/map_8c.html deleted file mode 100644 index 5193f3f0..00000000 --- a/runtime/docs/html/map_8c.html +++ /dev/null @@ -1,102 +0,0 @@ - - -SystemTap: map.c File Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

map.c File Reference

Implements maps (associative arrays) and lists. More... -

-#include "map.h"
-#include "alloc.c"
-#include "string.c"
- -

-Go to the source code of this file. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Functions

MAP _stp_map_new (unsigned max_entries, enum valtype type)
 Create a new map.
void _stp_map_key_del (MAP map)
 Deletes the current element.
map_node * _stp_map_start (MAP map)
 Get the first element in a map.
map_node * _stp_map_iter (MAP map, struct map_node *m)
 Get the next element in a map.
void _stp_map_del (MAP map)
 Deletes a map.
void _stp_map_key_long_long (MAP map, long key1, long key2)
 Set the map's key to two longs.
void _stp_map_key_str_str (MAP map, char *key1, char *key2)
 Set the map's key to two strings.
void _stp_map_key_str_long (MAP map, char *key1, long key2)
 Set the map's key to a string and a long.
void _stp_map_key_long_str (MAP map, long key1, char *key2)
 Set the map's key to a long and a string.
void _stp_map_key_str (MAP map, char *key)
 Set the map's key to a string.
void _stp_map_key_long (MAP map, long key)
 Set the map's key to a long.
void _stp_map_set_int64 (MAP map, int64_t val)
 Set the current element's value to an int64.
void _stp_map_add_int64 (MAP map, int64_t val)
 Adds an int64 to the current element's value.
int64_t _stp_map_get_int64 (MAP map)
 Gets the current element's value.
void _stp_map_set_str (MAP map, char *val)
 Set the current element's value to a C string.
void _stp_map_set_string (MAP map, String str)
 Set the current element's value to String.
char * _stp_map_get_str (MAP map)
 Gets the current element's value.
void _stp_map_set_stat (MAP map, stat *stats)
 Set the current element's value to a stat.
stat * _stp_map_get_stat (MAP map)
 Gets the current element's value.
void _stp_map_stat_add (MAP map, int64_t val)
 Add to the current element's statistics.
MAP _stp_list_new (unsigned max_entries, enum valtype type)
 Create a new list.
void _stp_list_clear (MAP map)
 Clears a list.
void _stp_list_add_str (MAP map, char *str)
 Adds a C string to a list.
void _stp_list_add_string (MAP map, String str)
 Adds a String to a list.
void _stp_list_add_int64 (MAP map, int64_t val)
 Adds an int64 to a list.
int _stp_list_size (MAP map)
 Get the number of elements in a list.
-


Detailed Description

-Implements maps (associative arrays) and lists. -

- -

-Definition in file map.c. diff --git a/runtime/docs/html/map_8h-source.html b/runtime/docs/html/map_8h-source.html deleted file mode 100644 index 956ac200..00000000 --- a/runtime/docs/html/map_8h-source.html +++ /dev/null @@ -1,201 +0,0 @@ - - -SystemTap: map.h Source File - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

map.h

Go to the documentation of this file.
00001 #ifndef _MAP_H_ /* -*- linux-c -*- */
-00002 #define _MAP_H_
-00003 
-00004 /** @file map.h
-00005  * @brief Header file for maps and lists 
-00006  */
-00007 /** @addtogroup maps 
-00008  * @todo Needs to be made SMP-safe for when the big lock is removed from kprobes.
-00009  * @{ 
-00010  */
-00011 
-00012 #include <linux/types.h>
-00013 
-00014 /* Statistics are stored in this struct */
-00015 typedef struct {
-00016         int64_t count;
-00017         int64_t sum;
-00018         int64_t min, max;
-00019         int64_t histogram[BUCKETS];
-00020 } stat;
-00021 
-00022 /* Keys are either longs or char * */
-00023 union key_data {
-00024         long val;
-00025         char *str;
-00026 };
-00027 
-00028 /** keys can be longs or strings */
-00029 enum keytype { NONE, LONG, STR } __attribute__ ((packed));
-00030 /** values can be either int64, stats or strings */
-00031 enum valtype { INT64, STAT, STRING, END };
-00032 
-00033 
-00034 /* basic map element */
-00035 struct map_node {
-00036         /* list of other nodes in the map */
-00037         struct list_head lnode;
-00038         /* list of nodes with the same hash value */
-00039         struct hlist_node hnode; 
-00040         union key_data key1;
-00041         union key_data key2;
-00042         enum keytype key1type;
-00043         enum keytype key2type;
-00044 };
-00045 
-00046 /* map element containing int64 */
-00047 struct map_node_int64 {
-00048         struct map_node n;
-00049         int64_t val;
-00050 };
-00051 
-00052 /* map element containing string */
-00053 struct map_node_str {
-00054         struct map_node n;
-00055         char *str;
-00056 };
-00057 
-00058 /* map element containing stats */
-00059 struct map_node_stat {
-00060         struct map_node n;
-00061         stat stats;
-00062 };
-00063 
-00064 /* This structure contains all information about a map.
-00065  * It is allocated once when _stp_map_new() is called. 
-00066  */
-00067 struct map_root {
-00068         /* type of the values stored in the array */
-00069         enum valtype type;
-00070         
-00071         /* maximum number of elements allowed in the array. */
-00072         int maxnum;
-00073 
-00074         /* current number of used elements */
-00075         int num;
-00076 
-00077         /* when more than maxnum elements, wrap or discard? */
-00078         int no_wrap;
-00079 
-00080         /* linked list of current entries */
-00081         struct list_head head;
-00082 
-00083         /* pool of unused entries.  Used only when entries are statically allocated
-00084             at startup. */
-00085         struct list_head pool;
-00086 
-00087         /* saved key entry for lookups */
-00088         struct map_node *key;
-00089 
-00090         /** this is the creation data saved between the key functions and the
-00091             set/get functions 
-00092             @todo Needs to be per-cpu data for SMP support */
-00093         u_int8_t create;
-00094         enum keytype c_key1type;
-00095         enum keytype c_key2type;
-00096         struct hlist_head *c_keyhead;
-00097         union key_data c_key1;
-00098         union key_data c_key2;
-00099 
-00100         /** the hash table for this array */
-00101         struct hlist_head hashes[HASH_TABLE_SIZE];
-00102 
-00103         /** pointer to allocated memory space. Used for freeing memory. */
-00104         void *membuf;
-00105 };
-00106 
-00107 /** All maps are of this type. */
-00108 typedef struct map_root *MAP;
-00109 
-00110 /** Extracts string from key1 union */
-00111 #define key1str(ptr) (ptr->n.key1.str)
-00112 /** Extracts string from key2 union */
-00113 #define key2str(ptr) (ptr->n.key2.str)
-00114 /** Extracts int from key1 union */
-00115 #define key1int(ptr) (ptr->n.key1.val)
-00116 /** Extracts int from key2 union */
-00117 #define key2int(ptr) (ptr->n.key2.val)
-00118 
-00119 /** Macro to call the proper _stp_map_key functions based on the
-00120  * types of the arguments. 
-00121  * @note May cause compiler warning on some GCCs 
-00122  */
-00123 #define _stp_map_key2(map, key1, key2)                          \
-00124   ({                                                            \
-00125     if (__builtin_types_compatible_p (typeof (key1), char[]))   \
-00126       if (__builtin_types_compatible_p (typeof (key2), char[])) \
-00127         _stp_map_key_str_str (map, (char *)(key1), (char *)(key2));     \
-00128       else                                                      \
-00129         _stp_map_key_str_long (map, (char *)(key1), (long)(key2));      \
-00130     else                                                        \
-00131       if (__builtin_types_compatible_p (typeof (key2), char[])) \
-00132         _stp_map_key_long_str (map, (long)(key1), (char *)(key2));      \
-00133       else                                                      \
-00134         _stp_map_key_long_long (map, (long)(key1), (long)(key2));       \
-00135   })
-00136 
-00137 /** Macro to call the proper _stp_map_key function based on the
-00138  * type of the argument. 
-00139  * @note May cause compiler warning on some GCCs 
-00140  */
-00141 #define _stp_map_key(map, key)                          \
-00142   ({                                                            \
-00143     if (__builtin_types_compatible_p (typeof (key), char[]))    \
-00144       _stp_map_key_str (map, (char *)(key));                            \
-00145     else                                                        \
-00146       _stp_map_key_long (map, (long)(key));                             \
-00147   })
-00148 
-00149 /** Macro to call the proper _stp_map_set function based on the
-00150  * type of the argument. 
-00151  * @note May cause compiler warning on some GCCs 
-00152  */
-00153 #define _stp_map_set(map, val)                                  \
-00154   ({                                                            \
-00155     if (__builtin_types_compatible_p (typeof (val), char[]))            \
-00156       _stp_map_set_str (map, (char *)(val));                            \
-00157     else  if (__builtin_types_compatible_p (typeof (val), String))      \
-00158       _stp_map_set_string (map, (String)(val));                         \
-00159     else                                                                \
-00160       _stp_map_set_int64 (map, (int64_t)(val));                         \
-00161   })
-00162 
-00163 /** Loop through all elements of a map or list.
-00164  * @param map 
-00165  * @param ptr pointer to a map_node_stat, map_node_int64 or map_node_str
-00166  *
-00167  * @b Example:
-00168  * @include foreach.c
-00169  */
-00170 
-00171 #define foreach(map, ptr)                               \
-00172   for (ptr = (typeof(ptr))_stp_map_start(map); ptr; \
-00173        ptr = (typeof(ptr))_stp_map_iter (map, (struct map_node *)ptr))
-00174 
-00175 /** @} */
-00176 
-00177 /** @ingroup lists
-00178  * @brief Macro to call the proper _stp_list_add function based on the
-00179  * types of the argument. 
-00180  *
-00181  * @note May cause compiler warning on some GCCs 
-00182  */
-00183 #define _stp_list_add(map, val)                                 \
-00184   ({                                                                    \
-00185     if (__builtin_types_compatible_p (typeof (val), char[]))            \
-00186       _stp_list_add_str (map, (char *)(val));                           \
-00187     else if (__builtin_types_compatible_p (typeof (val), String))       \
-00188       _stp_list_add_string (map, (String)(val));                        \
-00189     else                                                                \
-00190       _stp_list_add_int64 (map, (int64_t)(val));                        \
-00191   })
-00192 
-00193 #endif /* _MAP_H_ */
-
diff --git a/runtime/docs/html/map_8h.html b/runtime/docs/html/map_8h.html deleted file mode 100644 index 23b5430b..00000000 --- a/runtime/docs/html/map_8h.html +++ /dev/null @@ -1,77 +0,0 @@ - - -SystemTap: map.h File Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

map.h File Reference

Header file for maps and lists. More... -

-#include <linux/types.h>
- -

-Go to the source code of this file. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Defines

-#define key1str(ptr)   (ptr->n.key1.str)
 Extracts string from key1 union.
-#define key2str(ptr)   (ptr->n.key2.str)
 Extracts string from key2 union.
-#define key1int(ptr)   (ptr->n.key1.val)
 Extracts int from key1 union.
-#define key2int(ptr)   (ptr->n.key2.val)
 Extracts int from key2 union.
#define _stp_map_key2(map, key1, key2)
 Macro to call the proper _stp_map_key functions based on the types of the arguments.
#define _stp_map_key(map, key)
 Macro to call the proper _stp_map_key function based on the type of the argument.
#define _stp_map_set(map, val)
 Macro to call the proper _stp_map_set function based on the type of the argument.
#define foreach(map, ptr)
 Loop through all elements of a map or list.
#define _stp_list_add(map, val)
 Macro to call the proper _stp_list_add function based on the types of the argument.

Typedefs

-typedef map_root * MAP
 All maps are of this type.

Enumerations

enum  keytype { NONE, -LONG, -STR - }
 keys can be longs or strings
enum  valtype { INT64, -STAT, -STRING, -END - }
 values can be either int64, stats or strings

Variables

-enum keytype packed
 keys can be longs or strings
-


Detailed Description

-Header file for maps and lists. -

- -

-Definition in file map.h. diff --git a/runtime/docs/html/modules.html b/runtime/docs/html/modules.html deleted file mode 100644 index 1c46a1f7..00000000 --- a/runtime/docs/html/modules.html +++ /dev/null @@ -1,20 +0,0 @@ - - -SystemTap: Module Index - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

SystemTap Modules

Here is a list of all modules: - diff --git a/runtime/docs/html/pages.html b/runtime/docs/html/pages.html deleted file mode 100644 index e1ceb057..00000000 --- a/runtime/docs/html/pages.html +++ /dev/null @@ -1,16 +0,0 @@ - - -SystemTap: Page Index - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

SystemTap Related Pages

Here is a list of all related documentation pages: - diff --git a/runtime/docs/html/print_8c-source.html b/runtime/docs/html/print_8c-source.html deleted file mode 100644 index c020fff3..00000000 --- a/runtime/docs/html/print_8c-source.html +++ /dev/null @@ -1,208 +0,0 @@ - - -SystemTap: print.c Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

print.c

00001 #ifndef _PRINT_C_ /* -*- linux-c -*- */
-00002 #define _PRINT_C_
-00003 
-00004 #include <linux/config.h>
-00005 
-00006 #include "io.c"
-00007 
-00008 /** @file print.c
-00009  * @addtogroup print Print Buffer
-00010  * Print Buffer Functions.
-00011  * The print buffer is for collecting output to send to the user daemon.
-00012  * This is a per-cpu static buffer.  The buffer is sent when
-00013  * _stp_print_flush() is called.
-00014  *
-00015  * The reason to do this is to allow multiple small prints to be combined then
-00016  * timestamped and sent together to stpd. It could flush automatically on newlines,
-00017  * but what about stack traces which span many lines?  So try this and see how it works for us.
-00018  * @{
-00019  */
-00020 
-00021 /** Size of buffer, not including terminating NULL */
-00022 #define STP_PRINT_BUF_LEN 8000
-00023 
-00024 static int _stp_pbuf_len[NR_CPUS];
-00025 
-00026 #ifdef STP_NETLINK_ONLY
-00027 #define STP_PRINT_BUF_START 0
-00028 static char _stp_pbuf[NR_CPUS][STP_PRINT_BUF_LEN + 1];
-00029 
-00030 void _stp_print_flush (void)
-00031 {
-00032         int cpu = smp_processor_id();
-00033         char *buf = &_stp_pbuf[cpu][0];
-00034         int len = _stp_pbuf_len[cpu];
-00035 
-00036         if (len == 0)
-00037                 return;
-00038 
-00039         if ( app.logging == 0) {
-00040                 _stp_pbuf_len[cpu] = 0;
-00041                 return;
-00042         }
-00043         
-00044         /* enforce newline at end  */
-00045         if (buf[len - 1] != '\n') {
-00046                 buf[len++] = '\n';
-00047                 buf[len] = '\0';
-00048         }
-00049         
-00050         send_reply (STP_REALTIME_DATA, buf, len + 1, stpd_pid);
-00051         _stp_pbuf_len[cpu] = 0;
-00052 }
-00053 
-00054 #else /* ! STP_NETLINK_ONLY */
-00055 /* size of timestamp, in bytes, including space */
-00056 #define TIMESTAMP_SIZE 19
-00057 #define STP_PRINT_BUF_START (TIMESTAMP_SIZE + 1)
-00058 static char _stp_pbuf[NR_CPUS][STP_PRINT_BUF_LEN + STP_PRINT_BUF_START + 1];
-00059 
-00060 /** Send the print buffer now.
-00061  * Output accumulates in the print buffer until this is called.
-00062  * Size is limited by length of print buffer, #STP_PRINT_BUF_LEN.
-00063  */
-00064 
-00065 void _stp_print_flush (void)
-00066 {
-00067         int cpu = smp_processor_id();
-00068         char *buf = &_stp_pbuf[cpu][0];
-00069         char *ptr = buf + STP_PRINT_BUF_START;
-00070         struct timeval tv;
-00071 
-00072         if (_stp_pbuf_len[cpu] == 0)
-00073                 return;
-00074         
-00075         /* enforce newline at end  */
-00076         if (ptr[_stp_pbuf_len[cpu]-1] != '\n') {
-00077                 ptr[_stp_pbuf_len[cpu]++] = '\n';
-00078                 ptr[_stp_pbuf_len[cpu]] = '\0';
-00079         }
-00080         
-00081         do_gettimeofday(&tv);
-00082         scnprintf (buf, TIMESTAMP_SIZE+1, "[%li.%06li] ", tv.tv_sec, tv.tv_usec);
-00083         buf[TIMESTAMP_SIZE] = ' ';
-00084         relayapp_write(buf, _stp_pbuf_len[cpu] + TIMESTAMP_SIZE + 2);
-00085         _stp_pbuf_len[cpu] = 0;
-00086 }
-00087 #endif /* STP_NETLINK_ONLY */
-00088 
-00089 /** Print into the print buffer.
-00090  * Like printf, except output goes to the print buffer.
-00091  * Safe because overflowing the buffer is not allowed.
-00092  * Size is limited by length of print buffer, #STP_PRINT_BUF_LEN.
-00093  * 
-00094  * @param fmt A printf-style format string followed by a 
-00095  * variable number of args.
-00096  * @sa _stp_print_flush()
-00097  */
-00098 
-00099 void _stp_printf (const char *fmt, ...)
-00100 {
-00101         int num;
-00102         va_list args;
-00103         int cpu = smp_processor_id();
-00104         char *buf = &_stp_pbuf[cpu][STP_PRINT_BUF_START] + _stp_pbuf_len[cpu];
-00105         va_start(args, fmt);
-00106         num = vscnprintf(buf, STP_PRINT_BUF_LEN - _stp_pbuf_len[cpu], fmt, args);
-00107         va_end(args);
-00108         if (num > 0)
-00109                 _stp_pbuf_len[cpu] += num;
-00110 }
-00111 
-00112 /** Print into the print buffer.
-00113  * Use this if your function already has a va_list.
-00114  * You probably want _stp_printf().
-00115  */
-00116 
-00117 void _stp_vprintf (const char *fmt, va_list args)
-00118 {
-00119         int num;
-00120         int cpu = smp_processor_id();
-00121         char *buf = &_stp_pbuf[cpu][STP_PRINT_BUF_START] + _stp_pbuf_len[cpu];
-00122         num = vscnprintf(buf, STP_PRINT_BUF_LEN -_stp_pbuf_len[cpu], fmt, args);
-00123         if (num > 0)
-00124                 _stp_pbuf_len[cpu] += num;
-00125 }
-00126 
-00127 /** Write a C string into the print buffer.
-00128  * Copies a string into a print buffer.
-00129  * Safe because overflowing the buffer is not allowed.
-00130  * Size is limited by length of print buffer, #STP_PRINT_BUF_LEN.
-00131  * This is more efficient than using _stp_printf() if you don't
-00132  * need fancy formatting.
-00133  *
-00134  * @param str A C string.
-00135  * @sa _stp_print
-00136  */
-00137 
-00138 void _stp_print_cstr (const char *str)
-00139 {
-00140         int cpu = smp_processor_id();
-00141         char *buf = &_stp_pbuf[cpu][STP_PRINT_BUF_START] + _stp_pbuf_len[cpu];
-00142         int num = strlen (str);
-00143         if (num > STP_PRINT_BUF_LEN - _stp_pbuf_len[cpu])
-00144                 num = STP_PRINT_BUF_LEN - _stp_pbuf_len[cpu];
-00145         strncpy (buf, str, num+1);
-00146         _stp_pbuf_len[cpu] += num;
-00147 }
-00148 
-00149 /** Clear the scratch buffer.
-00150  * This function should be called before anything is written to 
-00151  * the scratch buffer.  Output will accumulate in the buffer
-00152  * until this function is called again.  
-00153  * @returns A pointer to the buffer.
-00154  */
-00155 
-00156 char *_stp_print_clear (void)
-00157 {
-00158         int cpu = smp_processor_id();
-00159         _stp_pbuf_len[cpu] = 0;
-00160         return &_stp_pbuf[cpu][STP_PRINT_BUF_START];
-00161 }
-00162 
-00163 #include "string.c"
-00164 
-00165 /** Write a String into the print buffer.
-00166  * Copies a String into a print buffer.
-00167  * Safe because overflowing the buffer is not allowed.
-00168  * Size is limited by length of print buffer, #STP_PRINT_BUF_LEN.
-00169  * This is more efficient than using _stp_printf() if you don't
-00170  * need fancy formatting.
-00171  *
-00172  * @param str A String.
-00173  * @sa _stp_print
-00174  */
-00175 
-00176 void _stp_print_string (String str)
-00177 {
-00178         if (str->len)
-00179                 _stp_print_cstr (str->buf);
-00180 }
-00181 
-00182 /** Write a String or C string into the print buffer.
-00183  * This macro selects the proper function to call.
-00184  * @param str A String or C string (char *)
-00185  * @sa _stp_print_cstr _stp_print_string
-00186  */
-00187 
-00188 #define _stp_print(str)                                                 \
-00189         ({                                                              \
-00190           if (__builtin_types_compatible_p (typeof (str), char[])) {    \
-00191                   char *x = (char *)str;                                \
-00192                   _stp_print_cstr(x);                                   \
-00193           } else {                                                      \
-00194                   String x = (String)str;                               \
-00195                   _stp_print_string(x);                                 \
-00196           }                                                             \
-00197   })
-00198 
-00199 /** @} */
-00200 #endif /* _PRINT_C_ */
-
diff --git a/runtime/docs/html/probes_2README-source.html b/runtime/docs/html/probes_2README-source.html deleted file mode 100644 index ee82281f..00000000 --- a/runtime/docs/html/probes_2README-source.html +++ /dev/null @@ -1,14 +0,0 @@ - - -SystemTap: probes/README Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
- -

README

00001 /** @dir probes
-00002 This directory contains working example probes that demonstrate and test
-00003 the runtime library. They are tested on i386 and x86_64.
-00004 */
-
diff --git a/runtime/docs/html/probes_2shellsnoop_2README-source.html b/runtime/docs/html/probes_2shellsnoop_2README-source.html deleted file mode 100644 index e7384ecb..00000000 --- a/runtime/docs/html/probes_2shellsnoop_2README-source.html +++ /dev/null @@ -1,83 +0,0 @@ - - -SystemTap: probes/shellsnoop/README Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
- -

README

00001 /** @dir shellsnoop
-00002 Snoops on what commands are being run by shells.
-00003 
-00004 This is a translation of on an old dtr probe. It demonstrates maps,
-00005 lists, and how to use _stp_copy_argv_from_user() and  _stp_strncpy_from_user().
-00006 
-00007 Original dtr source:
-00008 
-00009 \verbatim
-00010 # shellsnoop.probe - snoop shell execution as it occurs.
-00011 # clone of dtrace shellsnoop example
-00012 
-00013 global {
-00014   long @pids[long];
-00015 }
-00016 
-00017 probe do_execve:entry {
-00018   char __user *vstr;
-00019   char str[256];
-00020   int len;
-00021 
-00022   /* watch shells only */
-00023   /* FIXME: detect more shells, like csh, tcsh, zsh */
-00024 
-00025   if (!strcmp(current->comm,"bash") || !strcmp(current->comm,"sh") || !strcmp(current->comm, "zsh")
-00026       || !strcmp(current->comm, "tcsh") || !strcmp(current->comm, "pdksh"))
-00027     {
-00028       dlog ("%d\t%d\t%d\t%s ", current->uid, current->pid, current->parent->pid, filename);
-00029       @pids[current->pid] = 1;
-00030 
-00031       /* print out argv, ignoring argv[0] */
-00032       if (argv) argv++;
-00033       while (argv != NULL)
-00034         {
-00035           if (get_user (vstr, argv))
-00036             break;
-00037           if (!vstr)
-00038             break;
-00039           len = dtr_strncpy_from_user(str, vstr, 256);
-00040           str[len] = 0;
-00041           printk ("%s ", str);
-00042           argv++;
-00043         }
-00044       printk ("\n");
-00045     }
-00046 }
-00047 
-00048 # use filp_open because copy_from_user not needed there
-00049 probe filp_open:entry {
-00050   if (@pids[current->pid])
-00051     dlog ("%d\t%d\t%s\tO %s\n", current->pid, current->parent->pid, current->comm, filename);
-00052 }
-00053 
-00054 probe sys_read:entry {
-00055   if (@pids[current->pid])
-00056     dlog ("%d\t%d\t%s\tR %d\n", current->pid, current->parent->pid, current->comm, fd);
-00057 }
-00058 
-00059 probe sys_write:entry {
-00060   size_t len;
-00061   char str[256];
-00062   if (@pids[current->pid])
-00063     {
-00064       if (count < 64) len = count;
-00065       else len = 64;
-00066       if (len = dtr_strncpy_from_user(str, buf, len)) {
-00067         str[len] = 0;
-00068         dlog ("%d\t%d\t%s\tW %s\n", current->pid, current->parent->pid, current->comm, str);
-00069         }
-00070     }
-00071 }
-00072 \endverbatim
-00073 */
-
diff --git a/runtime/docs/html/probes_2tasklet_2README-source.html b/runtime/docs/html/probes_2tasklet_2README-source.html deleted file mode 100644 index d49f0a1f..00000000 --- a/runtime/docs/html/probes_2tasklet_2README-source.html +++ /dev/null @@ -1,20 +0,0 @@ - - -SystemTap: probes/tasklet/README Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
- -

README

00001 /** @dir tasklet
-00002 Sample probe in a tasklet.  Useful for interrupt context testing.
-00003 
-00004 \verbatim
-00005 > ./build
-00006 > insmod stp_tasklet.ko
-00007 > rmmod stp_tasklet.ko
-00008 \endverbatim
-00009 
-00010 */
-
diff --git a/runtime/docs/html/probes_2test4_2README-source.html b/runtime/docs/html/probes_2test4_2README-source.html deleted file mode 100644 index 20ebcf80..00000000 --- a/runtime/docs/html/probes_2test4_2README-source.html +++ /dev/null @@ -1,34 +0,0 @@ - - -SystemTap: probes/test4/README Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
- -

README

00001 /** @dir test4
-00002 This example probe tracks file opens, reads and writes.
-00003 It demonstrates maps, stats, and iterators.
-00004 
-00005 This is a translation of on an old dtr probe.  Original source is
-00006 \verbatim
-00007 global {
-00008   long @opens[string];
-00009   sum @reads[string], @writes[string];
-00010 }
-00011 
-00012 probe sys_open:entry {
-00013   @opens[current->comm]++;
-00014 }
-00015 
-00016 probe sys_read:entry {
-00017   @reads[current->comm] << count;
-00018 }
-00019 
-00020 probe sys_write:entry {
-00021   @writes[current->comm] << count;
-00022 }
-00023 \endverbatim
-00024 */
-
diff --git a/runtime/docs/html/probes_2where__func_2README-source.html b/runtime/docs/html/probes_2where__func_2README-source.html deleted file mode 100644 index eb81beda..00000000 --- a/runtime/docs/html/probes_2where__func_2README-source.html +++ /dev/null @@ -1,36 +0,0 @@ - - -SystemTap: probes/where_func/README Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
- -

README

00001 /** @dir where_func
-00002 This is a silly little instrumentation routine to instrument functions
-00003 entry by name. It makes use of the SystemTap runtime libraries to break
-00004 down the number of times the function by caller. 
-00005 
-00006 It demonstrates kprobes, passing a module parameter, using the print buffer,
-00007 and using _stp_print_symbol() to map the addresses back to locations 
-00008 in functions.
-00009 
-00010 By default it instruments schedule().
-00011 
-00012 The instrumentation module is built by having the kernel that is going
-00013 to be instrumented currently on the machine and doing 
-00014 \code
-00015 ./build
-00016 \endcode
-00017 The instrumentation is inserted as root with:
-00018 \code
-00019 /sbin/insmod kprobe_funct_where.ko funct_name=function_name
-00020 \endcode
-00021 The instrumentation is removed as root with:
-00022 \code
-00023 /sbin/rmmod kprobe_funct_where
-00024 \endcode
-00025 -Will Cohen
-00026 */
-
diff --git a/runtime/docs/html/probes_8c-source.html b/runtime/docs/html/probes_8c-source.html deleted file mode 100644 index 6084bad3..00000000 --- a/runtime/docs/html/probes_8c-source.html +++ /dev/null @@ -1,113 +0,0 @@ - - -SystemTap: probes.c Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

probes.c

Go to the documentation of this file.
00001 #ifndef _PROBES_C_ /* -*- linux-c -*- */
-00002 #define _PROBES_C
-00003 
-00004 /** @file probes.c
-00005  * @brief Functions to assist loading and unloading groups of probes.
-00006  */
-00007 
-00008 /** Lookup name.
-00009  * This simply calls the kernel function kallsyms_lookup_name().
-00010  * That function is not exported, so this workaround is required.
-00011  * See the kernel source, kernel/kallsyms.c for more information.
-00012  */
-00013 static unsigned long (*_stp_lookup_name)(char *name)=(void *)KALLSYMS_LOOKUP_NAME;
-00014 
-00015 /** Unregister a group of jprobes.
-00016  * @param probes Pointer to an array of struct jprobe.
-00017  * @param num_probes Number of probes in the array.
-00018  */
-00019 
-00020 void _stp_unregister_jprobes (struct jprobe *probes, int num_probes)
-00021 {
-00022         int i;
-00023         for (i = 0; i < num_probes; i++)
-00024                 unregister_jprobe(&probes[i]);
-00025         _stp_log ("All jprobes removed\n");
-00026 }
-00027 
-00028 /** Register a group of jprobes.
-00029  * @param probes Pointer to an array of struct jprobe.
-00030  * @param num_probes Number of probes in the array.
-00031  * @return 0 on success.
-00032  */
-00033 
-00034 int _stp_register_jprobes (struct jprobe *probes, int num_probes)
-00035 {
-00036         int i, ret ;
-00037         unsigned long addr;
-00038 
-00039         for (i = 0; i < num_probes; i++) {
-00040                 addr =_stp_lookup_name((char *)probes[i].kp.addr);
-00041                 if (addr == 0) {
-00042                         _stp_log ("ERROR: function %s not found!\n", 
-00043                               (char *)probes[i].kp.addr);
-00044                         ret = -1; /* FIXME */
-00045                         goto out;
-00046                 }
-00047                 _stp_log("inserting jprobe at %s (%p)\n", probes[i].kp.addr, addr);
-00048                 probes[i].kp.addr = (kprobe_opcode_t *)addr;
-00049                 ret = register_jprobe(&probes[i]);
-00050                 if (ret)
-00051                         goto out;
-00052         }
-00053         return 0;
-00054 out:
-00055         _stp_log ("probe module initialization failed.  Exiting...\n");
-00056         _stp_unregister_jprobes(probes, i);
-00057         return ret;
-00058 }
-00059 
-00060 /** Unregister a group of kprobes.
-00061  * @param probes Pointer to an array of struct kprobe.
-00062  * @param num_probes Number of probes in the array.
-00063  */
-00064 
-00065 void _stp_unregister_kprobes (struct kprobe *probes, int num_probes)
-00066 {
-00067         int i;
-00068         for (i = 0; i < num_probes; i++)
-00069                 unregister_kprobe(&probes[i]);
-00070         _stp_log ("All kprobes removed\n");
-00071 }
-00072 
-00073 /** Register a group of kprobes.
-00074  * @param probes Pointer to an array of struct kprobe.
-00075  * @param num_probes Number of probes in the array.
-00076  * @return 0 on success.
-00077  */
-00078 
-00079 int _stp_register_kprobes (struct kprobe *probes, int num_probes)
-00080 {
-00081         int i, ret ;
-00082         unsigned long addr;
-00083 
-00084         for (i = 0; i < num_probes; i++) {
-00085                 addr =_stp_lookup_name((char *)probes[i].addr);
-00086                 if (addr == 0) {
-00087                         _stp_log ("ERROR: function %s not found!\n", 
-00088                               (char *)probes[i].addr);
-00089                         ret = -1; /* FIXME */
-00090                         goto out;
-00091                 }
-00092                 _stp_log("inserting kprobe at %s (%p)\n", probes[i].addr, addr);
-00093                 probes[i].addr = (kprobe_opcode_t *)addr;
-00094                 ret = register_kprobe(&probes[i]);
-00095                 if (ret)
-00096                         goto out;
-00097         }
-00098         return 0;
-00099 out:
-00100         _stp_log ("probe module initialization failed.  Exiting...\n");
-00101         _stp_unregister_kprobes(probes, i);
-00102         return ret;
-00103 }
-00104 
-00105 #endif /* _PROBES_C */
-
diff --git a/runtime/docs/html/probes_8c.html b/runtime/docs/html/probes_8c.html deleted file mode 100644 index a43b04af..00000000 --- a/runtime/docs/html/probes_8c.html +++ /dev/null @@ -1,236 +0,0 @@ - - -SystemTap: probes.c File Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

probes.c File Reference

Functions to assist loading and unloading groups of probes. More... -

- -

-Go to the source code of this file. - - - - - - - - - - - - - - -

Functions

void _stp_unregister_jprobes (struct jprobe *probes, int num_probes)
 Unregister a group of jprobes.
int _stp_register_jprobes (struct jprobe *probes, int num_probes)
 Register a group of jprobes.
void _stp_unregister_kprobes (struct kprobe *probes, int num_probes)
 Unregister a group of kprobes.
int _stp_register_kprobes (struct kprobe *probes, int num_probes)
 Register a group of kprobes.
-


Detailed Description

-Functions to assist loading and unloading groups of probes. -

- -

-Definition in file probes.c.


Function Documentation

-

- - - - -
- - - - - - - - - - - - - - - - - - -
int _stp_register_jprobes struct jprobe *  probes,
int  num_probes
-
- - - - - -
-   - - -

-Register a group of jprobes. -

-

Parameters:
- - - -
probes Pointer to an array of struct jprobe.
num_probes Number of probes in the array.
-
-
Returns:
0 on success.
- -

-Definition at line 34 of file probes.c. -

-References _stp_log(), and _stp_unregister_jprobes().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
int _stp_register_kprobes struct kprobe *  probes,
int  num_probes
-
- - - - - -
-   - - -

-Register a group of kprobes. -

-

Parameters:
- - - -
probes Pointer to an array of struct kprobe.
num_probes Number of probes in the array.
-
-
Returns:
0 on success.
- -

-Definition at line 79 of file probes.c. -

-References _stp_log(), and _stp_unregister_kprobes().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_unregister_jprobes struct jprobe *  probes,
int  num_probes
-
- - - - - -
-   - - -

-Unregister a group of jprobes. -

-

Parameters:
- - - -
probes Pointer to an array of struct jprobe.
num_probes Number of probes in the array.
-
- -

-Definition at line 20 of file probes.c. -

-References _stp_log(). -

-Referenced by _stp_register_jprobes().

-

- - - - -
- - - - - - - - - - - - - - - - - - -
void _stp_unregister_kprobes struct kprobe *  probes,
int  num_probes
-
- - - - - -
-   - - -

-Unregister a group of kprobes. -

-

Parameters:
- - - -
probes Pointer to an array of struct kprobe.
num_probes Number of probes in the array.
-
- -

-Definition at line 65 of file probes.c. -

-References _stp_log(). -

-Referenced by _stp_register_kprobes().

- diff --git a/runtime/docs/html/relay-app_8h-source.html b/runtime/docs/html/relay-app_8h-source.html deleted file mode 100644 index 16feefe0..00000000 --- a/runtime/docs/html/relay-app_8h-source.html +++ /dev/null @@ -1,542 +0,0 @@ - - -SystemTap: relay-app.h Source File - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

relay-app.h

00001 /*
-00002  *  relay-app.h - kernel 'library' functions for typical relayfs applications
-00003  *
-00004  * This program is free software; you can redistribute it and/or modify
-00005  * it under the terms of the GNU General Public License as published by
-00006  * the Free Software Foundation; either version 2 of the License, or
-00007  * (at your option) any later version.
-00008  *
-00009  * This program is distributed in the hope that it will be useful,
-00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
-00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-00012  * GNU General Public License for more details.
-00013  *
-00014  * You should have received a copy of the GNU General Public License
-00015  * along with this program; if not, write to the Free Software
-00016  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-00017  *
-00018  * Copyright (C) IBM Corporation, 2005
-00019  *
-00020  * 2005-Feb     Created by Tom Zanussi <zanussi@us.ibm.com>
-00021  *
-00022  * This header file encapsulates the details of channel setup and
-00023  * teardown and communication between the kernel and user parts of a
-00024  * typical and common type of relayfs application, which is that
-00025  * kernel logging is kicked off when a userspace data collection
-00026  * application starts and stopped when the collection app exits, and
-00027  * data is automatically logged to disk in-between.  Channels are
-00028  * created when the collection app is started and destroyed when it
-00029  * exits, not when the kernel module is inserted, so different channel
-00030  * buffer sizes can be specified for each separate run via
-00031  * command-line options for instance.
-00032  *
-00033  * Writing to the channel is done using 2 macros, relayapp_write() and
-00034  * _relayapp_write(), which are just wrappers around relay_write() and
-00035  * _relay_write() but without the channel param.  You can safely call
-00036  * these at any time - if there's no channel yet, they'll just be
-00037  * ignored.
-00038  *
-00039  * To create a relay-app application, do the following:
-00040  *
-00041  * In your kernel module:
-00042  *
-00043  * - #include "relay-app.h"
-00044  *
-00045  * - Call init_relay_app() in your module_init function, with the
-00046  *   names of the directory to create relayfs files in and the base name
-00047  *   of the per-cpu relayfs files e.g. to have /mnt/relay/myapp/cpuXXX
-00048  *   created call init_relay_app("myapp", "cpu", callbacks).
-00049  *
-00050  *   NOTE: The callbacks are entirely optional - pass NULL if you
-00051  *   don't want to define any.  If you want to define some but not
-00052  *   others, just set the ones you want, and ignore or NULL out the
-00053  *   others.
-00054  *
-00055  *   NOTE: This won't actually create the relayfs files - that will
-00056  *   happen when the userspace application starts (i.e. you can supply
-00057  *   the buffer sizes on the application command-line for each new run
-00058  *   of your program).
-00059  *
-00060  *   NOTE: If you pass in NULL for the directory name, the relay files
-00061  *   will be created in the root directory of the relayfs filesystem.
-00062  *
-00063  * - Call close_relay_app() in your module_exit function - this cleans
-00064  *   up the control channel and the relay files from the previous run,
-00065  *   if any.
-00066  *
-00067  * - relay-apps use a control channel to communicate initialization
-00068  *   and status information between the kernel module and user space
-00069  *   program.  This is hidden beneath the API so you normally don't need
-00070  *   to know anything about it, but if you want you can also use it to
-00071  *   send user-defined commands from your user space application.  To do
-00072  *   this, you need to define a definition for the user_command()
-00073  *   callback and in the callback sort out and handle handle the
-00074  *   commands you send from user space (via send_request()).  The
-00075  *   callback must return 1 if the command was handled, or 0 if not
-00076  *   (which will result in a send_error in the user space program,
-00077  *   alerting you to the fact that you're sending something bogus).
-00078  *
-00079  *   NOTE: Currently commands can only be sent before the user space
-00080  *   application enters relay_app_main_loop() i.e. for initialization
-00081  *   purposes only.
-00082  *
-00083  * - the app_started() and app_stopped() callbacks provide an
-00084  *   opportunity for your kernel module to perform app-specific
-00085  *   initialization and cleanup, if desired.  They are purely
-00086  *   informational.  app_started() is called when the user space
-00087  *   application has started and app_stopped() is called when the user
-00088  *   space application has stopped.
-00089  *
-00090  * In your user space application do the following:
-00091  *
-00092  * - Call init_relay_app() with the names of the relayfs file base
-00093  *   name and the base filename of the output files that will be
-00094  *   created, as well as the sub-buffer size and count for the current
-00095  *   run (which can be passed in on the command-line if you want).  This
-00096  *   will create the channel and set up the ouptut files and buffer
-00097  *   mappings.  e.g. to set up reading from the relayfs files specified in the
-00098  *   above example and write them to a set of per-cpu output files named
-00099  *   myoutputXXX:
-00100  * 
-00101  *   init_relay_app("/mnt/relay/myapp/cpu", "myoutput",
-00102  *                  subbuf_size_opt, n_subbufs_opt, 1);
-00103  *
-00104  *   (the last parameter just specifies whether or not to print out a
-00105  *   summary of the number of buffers processed, and the maximum backlog
-00106  *   of sub-buffers encountered e.g. if you have 4 sub-buffers, a
-00107  *   maximum backlog of 3 would mean that you came close to having a
-00108  *   full buffer, so you might want to use more or bigger sub-buffers
-00109  *   next time.  Of course, if the buffers actually filled up, the
-00110  *   maximum backlog would be 4 and you'd have lost data).
-00111  *
-00112  * - Call relay_app_main_loop().  This will set up an infinite loop
-00113  *   (press Control-C to break out and finalize the data) which
-00114  *   automatically reads the data from the relayfs buffers as it becomes
-00115  *   available and and writes it out to per-cpu output files.
-00116  *
-00117  *   NOTE: The control channel is implemented as a netlink socket.
-00118  *   relay-app defaults to using NETLINK_USERSOCK for all
-00119  *   applications, which means that you can't have more than 1
-00120  *   relay-app in use at a time, unless you use different netlink
-00121  *   'units' for each one.  If you want to have more than one
-00122  *   relay-app in use at a time, you can specify a different netlink
-00123  *   'unit' by using the _init_relay_app() versions of the
-00124  *   init_relay_app() functions, on both the kernel and user sides,
-00125  *   which are the same as the init_relay_app() functions but add a
-00126  *   netlink unit param.  See netlink.h for the currently unused
-00127  *   numbers.
-00128  */
-00129 
-00130 #include <linux/inet.h>
-00131 #include <linux/ip.h>
-00132 #include <linux/netlink.h>
-00133 #include <linux/relayfs_fs.h>
-00134 
-00135 /* relay-app pseudo-API */
-00136 
-00137 /*
-00138  * relay-app callbacks
-00139  */
-00140 struct relay_app_callbacks
-00141 {
-00142         /*
-00143          *      user_command - app-specific command callback
-00144          *      @command: user-defined command id
-00145          *      @data: user-defined data associated with the command
-00146          *
-00147          *      Return value: 1 if this callback handled it, 0 if not
-00148          *
-00149          *      define this callback to handle user-defined commands sent
-00150          *      from the user space application via send_request()
-00151          *
-00152          *      NOTE: user commands must be >= RELAY_APP_USERCMD_START
-00153          */
-00154         int (*user_command) (int command, void *data);
-00155 
-00156         /*
-00157          *      app_started - the user-space application has started
-00158          *
-00159          *      Do app-specific initializations now, if desired
-00160          */
-00161         void (*app_started) (void);
-00162 
-00163         /*
-00164          *      app_stopped - the user-space application has stopped
-00165          *
-00166          *      Do app-specific cleanup now, if desired
-00167          */
-00168         void (*app_stopped) (void);
-00169 };
-00170 
-00171 /*
-00172  * relay-app API functions
-00173  */
-00174 static int init_relay_app(const char *dirname,
-00175                           const char *file_basename,
-00176                           struct relay_app_callbacks *callbacks);
-00177 static void close_relay_app(void);
-00178 
-00179 /*
-00180  * relay-app write wrapper macros - use these instead of directly
-00181  * using relay_write() and _relay_write() relayfs functions.
-00182  */
-00183 #define relayapp_write(data, len) \
-00184         if (app.logging) relay_write(app.chan, data, len)
-00185 
-00186 #define _relayapp_write(data, len) \
-00187         if (app.logging) _relay_write(app.chan, data, len)
-00188 
-00189 /* relay-app control channel command values */
-00190 enum
-00191 {
-00192         RELAY_APP_BUF_INFO = 1,
-00193         RELAY_APP_SUBBUFS_CONSUMED,
-00194         RELAY_APP_START,
-00195         RELAY_APP_STOP,
-00196         RELAY_APP_CHAN_CREATE,
-00197         RELAY_APP_CHAN_DESTROY,
-00198         RELAY_APP_USERCMD_START = 32
-00199 };
-00200 
-00201 /* SystemTap extensions */
-00202 enum
-00203 {
-00204         STP_REALTIME_DATA = RELAY_APP_USERCMD_START,
-00205         STP_EXIT,
-00206         STP_DONE
-00207 };
-00208 
-00209 /* internal stuff below here */
-00210 
-00211 /* netlink control channel */
-00212 static struct sock *control;
-00213 static int seq;
-00214 static int stpd_pid = 0;
-00215 
-00216 /* info for this application */
-00217 static struct relay_app
-00218 {
-00219         char dirname[1024];
-00220         char file_basename[1024];
-00221         struct relay_app_callbacks *cb;
-00222         struct rchan *chan;
-00223         struct dentry *dir;
-00224         int logging;
-00225         int mappings;
-00226 } app;
-00227 
-00228 /*
-00229  * subbuf_start() relayfs callback.
-00230  */
-00231 static int relay_app_subbuf_start(struct rchan_buf *buf,
-00232                                   void *subbuf,
-00233                                   unsigned prev_subbuf_idx,
-00234                                   void *prev_subbuf)
-00235 {
-00236         unsigned padding = buf->padding[prev_subbuf_idx];
-00237         if (prev_subbuf)
-00238                 *((unsigned *)prev_subbuf) = padding;
-00239 
-00240         return sizeof(padding); /* reserve space for padding */
-00241 }
-00242 
-00243 /*
-00244  * buf_full() relayfs callback.
-00245  */
-00246 static void relay_app_buf_full(struct rchan_buf *buf,
-00247                                unsigned subbuf_idx,
-00248                                void *subbuf)
-00249 {
-00250         unsigned padding = buf->padding[subbuf_idx];
-00251         *((unsigned *)subbuf) = padding;
-00252 }
-00253 
-00254 static void relay_app_buf_mapped(struct rchan_buf *buf, struct file *filp)
-00255 {
-00256         if (app.cb && app.cb->app_started && !app.mappings++)
-00257                 app.cb->app_started();
-00258 }
-00259 
-00260 static void relay_app_buf_unmapped(struct rchan_buf *buf, struct file *filp)
-00261 {
-00262         if (app.cb && app.cb->app_started && !--app.mappings)
-00263                 app.cb->app_stopped();
-00264 }
-00265 
-00266 static struct rchan_callbacks app_rchan_callbacks =
-00267 {
-00268         .subbuf_start = relay_app_subbuf_start,
-00269         .buf_full = relay_app_buf_full,
-00270         .buf_mapped = relay_app_buf_mapped,
-00271         .buf_unmapped = relay_app_buf_unmapped
-00272 };
-00273 
-00274 /**
-00275  *      create_app_chan - creates channel /mnt/relay/dirname/filebaseXXX
-00276  *
-00277  *      Returns channel on success, NULL otherwise.
-00278  */
-00279 static struct rchan *create_app_chan(unsigned subbuf_size,
-00280                                      unsigned n_subbufs)
-00281 {
-00282         struct rchan *chan;
-00283 
-00284         if (strlen(app.dirname)) {
-00285                 app.dir = relayfs_create_dir(app.dirname, NULL);
-00286                 if (!app.dir) {
-00287                         printk("Couldn't create relayfs app directory %s.\n", app.dirname);
-00288                         return NULL;
-00289                 }
-00290         }
-00291 
-00292         chan = relay_open(app.file_basename, app.dir, subbuf_size,
-00293                               n_subbufs, 0, &app_rchan_callbacks);
-00294         
-00295         if (!chan) {
-00296                 printk("relay app channel creation failed\n");
-00297                 if (app.dir)
-00298                         relayfs_remove_dir(app.dir);
-00299                 return NULL;
-00300         }
-00301 
-00302         return chan;
-00303 }
-00304 
-00305 /**
-00306  *      destroy_app_chan - destroys channel /mnt/relay/dirname/filebaseXXX
-00307  */
-00308 static void destroy_app_chan(struct rchan *chan)
-00309 {
-00310         if (chan)
-00311                 relay_close(chan);
-00312         if (app.dir)
-00313                 relayfs_remove_dir(app.dir);
-00314 
-00315         app.chan = NULL;
-00316         app.dir = NULL;
-00317 }
-00318 
-00319 /* netlink control channel communication with userspace */
-00320 
-00321 struct buf_info
-00322 {
-00323         int cpu;
-00324         unsigned produced;
-00325         unsigned consumed;
-00326 };
-00327 
-00328 struct consumed_info
-00329 {
-00330         int cpu;
-00331         unsigned consumed;
-00332 };
-00333 
-00334 struct channel_create_info
-00335 {
-00336         unsigned subbuf_size;
-00337         unsigned n_subbufs;
-00338 };
-00339 
-00340 /*
-00341  * send_reply - send reply to userspace over netlink control channel
-00342  */
-00343 static int send_reply(int type, void *reply, int len, int pid)
-00344 {
-00345         struct sk_buff *skb;
-00346         struct nlmsghdr *nlh;
-00347         void *data;
-00348         int size;
-00349         int err;
-00350                 
-00351         size = NLMSG_SPACE(len);
-00352         skb = alloc_skb(size, GFP_ATOMIC);
-00353         if (!skb)
-00354                 return -1;
-00355         nlh = NLMSG_PUT(skb, pid, seq++, type, size - sizeof(*nlh));
-00356         nlh->nlmsg_flags = 0;
-00357         data = NLMSG_DATA(nlh);
-00358         memcpy(data, reply, len);
-00359         err = netlink_unicast(control, skb, pid, MSG_DONTWAIT);
-00360 
-00361         return 0;
-00362 
-00363 nlmsg_failure:
-00364         if (skb)
-00365                 kfree_skb(skb);
-00366         
-00367         return -1;
-00368 }
-00369 
-00370 static void handle_buf_info(struct buf_info *in, int pid)
-00371 {
-00372         struct buf_info out;
-00373 
-00374         if (!app.chan)
-00375                 return;
-00376 
-00377         out.cpu = in->cpu;
-00378         out.produced = atomic_read(&app.chan->buf[in->cpu]->subbufs_produced);
-00379         out.consumed = atomic_read(&app.chan->buf[in->cpu]->subbufs_consumed);
-00380 
-00381         send_reply(RELAY_APP_BUF_INFO, &out, sizeof(out), pid);
-00382 }
-00383 
-00384 static inline void handle_subbufs_consumed(struct consumed_info *info)
-00385 {
-00386         if (!app.chan)
-00387                 return;
-00388 
-00389         relay_subbufs_consumed(app.chan, info->cpu, info->consumed);
-00390 }
-00391 
-00392 static inline void handle_create(struct channel_create_info *info)
-00393 {
-00394         destroy_app_chan(app.chan);
-00395         app.chan = create_app_chan(info->subbuf_size, info->n_subbufs);
-00396         if(!app.chan)
-00397                 return;
-00398         app.mappings = 0;
-00399 }
-00400 
-00401 /*
-00402  * msg_rcv_skb - dispatch userspace requests from netlink control channel
-00403  */
-00404 static void msg_rcv_skb(struct sk_buff *skb)
-00405 {
-00406         struct nlmsghdr *nlh = NULL;
-00407         int pid, flags;
-00408         int nlmsglen, skblen;
-00409         void *data;
-00410         
-00411         skblen = skb->len;
-00412         
-00413         if (skblen < sizeof (*nlh))
-00414                 return; 
-00415 
-00416         nlh = (struct nlmsghdr *)skb->data;
-00417         nlmsglen = nlh->nlmsg_len;
-00418         
-00419         if (nlmsglen < sizeof(*nlh) || skblen < nlmsglen)
-00420                 return;
-00421 
-00422         stpd_pid = pid = nlh->nlmsg_pid;
-00423         flags = nlh->nlmsg_flags;
-00424 
-00425         if (pid <= 0 || !(flags & NLM_F_REQUEST)) {
-00426                 netlink_ack(skb, nlh, -EINVAL);
-00427                 return;
-00428         }
-00429 
-00430         if (flags & MSG_TRUNC) {
-00431                 netlink_ack(skb, nlh, -ECOMM);
-00432                 return;
-00433         }
-00434         
-00435         data = NLMSG_DATA(nlh);
-00436 
-00437         switch (nlh->nlmsg_type) {
-00438         case RELAY_APP_CHAN_CREATE:
-00439                 handle_create(data);
-00440                 break;
-00441         case RELAY_APP_CHAN_DESTROY:
-00442                 destroy_app_chan(app.chan);
-00443                 break;
-00444         case RELAY_APP_START:
-00445                 app.logging = 1;
-00446                 break;
-00447         case RELAY_APP_STOP:
-00448                 app.logging = 0;
-00449                 relay_flush(app.chan);
-00450                 break;
-00451         case RELAY_APP_BUF_INFO:
-00452                 handle_buf_info(data, pid);
-00453                 break;
-00454         case RELAY_APP_SUBBUFS_CONSUMED:
-00455                 handle_subbufs_consumed(data);
-00456                 break;
-00457         default:
-00458                 if (!app.cb || !app.cb->user_command ||
-00459                     !app.cb->user_command(nlh->nlmsg_type, data))
-00460                         netlink_ack(skb, nlh, -EINVAL);
-00461                 return;
-00462         }
-00463         
-00464         if (flags & NLM_F_ACK)
-00465                 netlink_ack(skb, nlh, 0);
-00466 }
-00467 
-00468 /*
-00469  * msg_rcv - handle netlink control channel requests
-00470  */
-00471 static void msg_rcv(struct sock *sk, int len)
-00472 {
-00473         struct sk_buff *skb;
-00474         
-00475         while ((skb = skb_dequeue(&sk->sk_receive_queue))) {
-00476                 msg_rcv_skb(skb);
-00477                 kfree_skb(skb);
-00478         }
-00479 }
-00480 
-00481 /*
-00482  * _init_relay_app - adds netlink 'unit' if other than NETLINK_USERSOCK wanted
-00483  */
-00484 static int _init_relay_app(const char *dirname,
-00485                            const char *file_basename,
-00486                            struct relay_app_callbacks *callbacks,
-00487                            int unit)
-00488 {
-00489         if (!file_basename)
-00490                 return -1;
-00491 
-00492         if (dirname)
-00493                 strncpy(app.dirname, dirname, 1024);
-00494         strncpy(app.file_basename, file_basename, 1024);
-00495         app.cb = callbacks;
-00496 
-00497         control = netlink_kernel_create(unit, msg_rcv);
-00498         if (!control) {
-00499                 printk("Couldn't create control channel\n");
-00500                 return -1;
-00501         }
-00502 
-00503         return 0;
-00504 }
-00505 
-00506 /**
-00507  *      init_relay_app - initialize /mnt/relay/dirname/file_basenameXXX
-00508  *      @dirname: the directory to contain relayfs files for this app
-00509  *      @file_basename: the base filename of the relayfs files for this app
-00510  *      @callbacks: the relay_app_callbacks implemented for this app
-00511  *
-00512  *      Returns 0 on success, -1 otherwise.
-00513  *
-00514  *      NOTE: this doesn't create the relayfs files.  That happens via the
-00515  *      control channel protocol.
-00516  */
-00517 static int init_relay_app(const char *dirname,
-00518                           const char *file_basename,
-00519                           struct relay_app_callbacks *callbacks)
-00520 {
-00521         return _init_relay_app(dirname, file_basename, callbacks, NETLINK_USERSOCK);
-00522 }
-00523 
-00524 /**
-00525  *      close_relay_app - close netlink socket and destroy channel if it exists
-00526  *
-00527  *      Returns 0 on success, -1 otherwise.
-00528  */
-00529 static void close_relay_app(void)
-00530 {
-00531         if (control)
-00532                 sock_release(control->sk_socket);
-00533         destroy_app_chan(app.chan);
-00534 }
-
diff --git a/runtime/docs/html/runtime_8h-source.html b/runtime/docs/html/runtime_8h-source.html deleted file mode 100644 index 76c74dec..00000000 --- a/runtime/docs/html/runtime_8h-source.html +++ /dev/null @@ -1,34 +0,0 @@ - - -SystemTap: runtime.h Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

runtime.h

Go to the documentation of this file.
00001 #ifndef _RUNTIME_H_
-00002 #define _RUNTIME_H_
-00003 /** @file runtime.h
-00004  * @brief Main include file for runtime functions.
-00005  */
-00006 
-00007 #include <linux/module.h>
-00008 #include <linux/kernel.h>
-00009 #include <linux/miscdevice.h>
-00010 #include <linux/init.h>
-00011 #include <linux/hash.h>
-00012 #include <linux/string.h>
-00013 #include <linux/kprobes.h>
-00014 #include <linux/proc_fs.h>
-00015 #include <linux/vmalloc.h>
-00016 #include <linux/time.h>
-00017 #include <linux/spinlock.h>
-00018 #include <linux/hardirq.h>
-00019 #include <asm/uaccess.h>
-00020 #include <linux/kallsyms.h>
-00021 
-00022 #define dbug(args...) ;
-00023 
-00024 #include "print.c"
-00025 
-00026 #endif /* _RUNTIME_H_ */
-
diff --git a/runtime/docs/html/runtime_8h.html b/runtime/docs/html/runtime_8h.html deleted file mode 100644 index a11057b4..00000000 --- a/runtime/docs/html/runtime_8h.html +++ /dev/null @@ -1,39 +0,0 @@ - - -SystemTap: runtime.h File Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

runtime.h File Reference

Main include file for runtime functions. More... -

-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/miscdevice.h>
-#include <linux/init.h>
-#include <linux/hash.h>
-#include <linux/string.h>
-#include <linux/kprobes.h>
-#include <linux/proc_fs.h>
-#include <linux/vmalloc.h>
-#include <linux/time.h>
-#include <linux/spinlock.h>
-#include <linux/hardirq.h>
-#include <asm/uaccess.h>
-#include <linux/kallsyms.h>
-#include "print.c"
- -

-Go to the source code of this file. - - - - -

Defines

-#define dbug(args...)   ;
-


Detailed Description

-Main include file for runtime functions. -

- -

-Definition in file runtime.h. diff --git a/runtime/docs/html/shellsnoop_2dtr_8c-source.html b/runtime/docs/html/shellsnoop_2dtr_8c-source.html deleted file mode 100644 index bbc55f7e..00000000 --- a/runtime/docs/html/shellsnoop_2dtr_8c-source.html +++ /dev/null @@ -1,148 +0,0 @@ - - -SystemTap: probes/shellsnoop/dtr.c Source File - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
- -

dtr.c

00001 #define HASH_TABLE_BITS 8
-00002 #define HASH_TABLE_SIZE (1<<HASH_TABLE_BITS)
-00003 #define BUCKETS 16 /* largest histogram width */
-00004 
-00005 #define STP_NETLINK_ONLY
-00006 #define STP_NUM_STRINGS 1
-00007 
-00008 #include "runtime.h"
-00009 #include "map.c"
-00010 #include "copy.c"
-00011 #include "probes.c"
-00012 
-00013 MODULE_DESCRIPTION("SystemTap probe: shellsnoop");
-00014 MODULE_AUTHOR("Martin Hunt <hunt@redhat.com>");
-00015 
-00016 MAP pids, arglist ;
-00017 
-00018 int inst_do_execve (char * filename, char __user *__user *argv, char __user *__user *envp, struct pt_regs * regs)
-00019 {
-00020   struct map_node_str *ptr;
-00021 
-00022   /* watch shells only */
-00023   /* FIXME: detect more shells, like csh, tcsh, zsh */
-00024   
-00025   if (!strcmp(current->comm,"bash") || !strcmp(current->comm,"sh") || !strcmp(current->comm, "zsh")
-00026       || !strcmp(current->comm, "tcsh") || !strcmp(current->comm, "pdksh"))
-00027     {
-00028       _stp_printf ("%d\t%d\t%d\t%s ", current->uid, current->pid, current->parent->pid, filename);
-00029 
-00030       _stp_map_key_long (pids, current->pid);
-00031       _stp_map_set_int64 (pids, 1);
-00032       
-00033       _stp_list_clear (arglist);
-00034       _stp_copy_argv_from_user (arglist, argv);
-00035       
-00036       foreach (arglist, ptr)
-00037         _stp_printf ("%s ", ptr->str);
-00038       
-00039       _stp_print_flush();
-00040     }
-00041   jprobe_return();
-00042   return 0;
-00043 }
-00044 
-00045 struct file * inst_filp_open (const char * filename, int flags, int mode)
-00046 {
-00047   _stp_map_key_long (pids, current->pid);
-00048   if (_stp_map_get_int64 (pids))
-00049     _stp_printf ("%d\t%d\t%s\tO %s", current->pid, current->parent->pid, current->comm, filename);
-00050 
-00051   _stp_print_flush();
-00052   jprobe_return();
-00053   return 0;
-00054 }
-00055 
-00056 asmlinkage ssize_t inst_sys_read (unsigned int fd, char __user * buf, size_t count)
-00057 {
-00058   _stp_map_key_long (pids, current->pid);
-00059   if (_stp_map_get_int64 (pids))
-00060     _stp_printf ("%d\t%d\t%s\tR %d", current->pid, current->parent->pid, current->comm, fd);
-00061   
-00062   _stp_print_flush();
-00063   jprobe_return();
-00064   return 0;
-00065 }
-00066 
-00067 asmlinkage ssize_t inst_sys_write (unsigned int fd, const char __user * buf, size_t count)
-00068 {
-00069   _stp_map_key_long (pids, current->pid);
-00070   if (_stp_map_get_int64 (pids))
-00071     {
-00072       String str = _stp_string_init (0);
-00073       _stp_string_from_user(str, buf, count);
-00074       _stp_printf ("%d\t%d\t%s\tW %s", current->pid, current->parent->pid, current->comm, str->buf);
-00075       _stp_print_flush();
-00076     }
-00077   
-00078   jprobe_return();
-00079   return 0;
-00080 }
-00081 
-00082 static struct jprobe dtr_probes[] = {
-00083   {
-00084     .kp.addr = (kprobe_opcode_t *)"do_execve",
-00085     .entry = (kprobe_opcode_t *) inst_do_execve
-00086   },
-00087   {
-00088     .kp.addr = (kprobe_opcode_t *)"filp_open",
-00089     .entry = (kprobe_opcode_t *) inst_filp_open
-00090   },
-00091   {
-00092     .kp.addr = (kprobe_opcode_t *)"sys_read",
-00093     .entry = (kprobe_opcode_t *) inst_sys_read
-00094   },
-00095   {
-00096     .kp.addr = (kprobe_opcode_t *)"sys_write",
-00097     .entry = (kprobe_opcode_t *) inst_sys_write
-00098   }, 
-00099 };
-00100 
-00101 #define MAX_DTR_ROUTINE (sizeof(dtr_probes)/sizeof(struct jprobe))
-00102 
-00103 static int init_dtr(void)
-00104 {
-00105   int ret;
-00106 
-00107   if (_stp_netlink_open() < 0)
-00108     return -1;
-00109 
-00110   pids = _stp_map_new (10000, INT64);
-00111   arglist = _stp_list_new (10, STRING);
-00112 
-00113   ret = _stp_register_jprobes (dtr_probes, MAX_DTR_ROUTINE);
-00114 
-00115   _stp_log("instrumentation is enabled... %s\n", __this_module.name);
-00116   return ret;
-00117 }
-00118 
-00119 static void probe_exit (void)
-00120 {
-00121   _stp_unregister_jprobes (dtr_probes, MAX_DTR_ROUTINE);
-00122 
-00123   _stp_print ("In probe_exit now.");
-00124   _stp_map_del (pids);
-00125   _stp_print_flush();
-00126 }
-00127 
-00128 
-00129 static void cleanup_dtr(void)
-00130 {
-00131   _stp_netlink_close();
-00132 
-00133 }
-00134 
-00135 module_init(init_dtr);
-00136 module_exit(cleanup_dtr);
-00137 MODULE_LICENSE("GPL");
-00138 
-
diff --git a/runtime/docs/html/stack_8c-source.html b/runtime/docs/html/stack_8c-source.html deleted file mode 100644 index eda90dc4..00000000 --- a/runtime/docs/html/stack_8c-source.html +++ /dev/null @@ -1,188 +0,0 @@ - - -SystemTap: stack.c Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

stack.c

Go to the documentation of this file.
00001 #ifndef _STACK_C_ /* -*- linux-c -*- */
-00002 #define _STACK_C_
-00003 
-00004 
-00005 /** @file stack.c
-00006  * @brief Stack Tracing Functions
-00007  */
-00008 
-00009 /** @addtogroup stack Stack Tracing Functions
-00010  * @{
-00011  */
-00012 
-00013 #include "sym.c"
-00014 
-00015 static int (*_stp_kta)(unsigned long addr)=(void *)KTA;
-00016 
-00017 #ifdef __x86_64__
-00018 static void __stp_stack_print (unsigned long *stack, int verbose, int levels)
-00019 {
-00020         unsigned long addr;
-00021 
-00022         if (verbose)
-00023                 _stp_printf ("trace for %d (%s)\n", current->pid, current->comm);
-00024 
-00025         while (((long) stack & (THREAD_SIZE-1)) != 0) {
-00026                 addr = *stack++;
-00027                 if (_stp_kta(addr)) {
-00028                         if (verbose) {
-00029                                 _stp_symbol_print (addr);
-00030                                 _stp_print ("\n");
-00031                         } else
-00032                                 _stp_printf ("0x%lx ", addr);
-00033                 }
-00034         }
-00035         _stp_print_flush();
-00036 }
-00037 
-00038 
-00039 static void __stp_stack_sprint (String str, unsigned long *stack, int verbose, int levels)
-00040 {
-00041         unsigned long addr;
-00042         while (((long) stack & (THREAD_SIZE-1)) != 0) {
-00043                 addr = *stack++;
-00044                 if (_stp_kta(addr)) {
-00045                         if (verbose)
-00046                                 _stp_symbol_sprint (str, addr);
-00047                         else
-00048                                 _stp_sprintf (str, "0x%lx ", addr);
-00049                 }
-00050         }
-00051 }
-00052 
-00053 #else  /* i386 */
-00054 
-00055 static inline int valid_stack_ptr (struct thread_info *tinfo, void *p)
-00056 {
-00057         return  p > (void *)tinfo &&
-00058                 p < (void *)tinfo + THREAD_SIZE - 3;
-00059 }
-00060 
-00061 static inline unsigned long _stp_print_context_stack (
-00062         struct thread_info *tinfo,
-00063         unsigned long *stack, 
-00064         unsigned long ebp )
-00065 {
-00066         unsigned long addr;
-00067 
-00068 #ifdef  CONFIG_FRAME_POINTER
-00069         while (valid_stack_ptr(tinfo, (void *)ebp)) {
-00070                 addr = *(unsigned long *)(ebp + 4);
-00071                 _stp_symbol_print (addr);
-00072                 _stp_print_cstr("\n");
-00073                 ebp = *(unsigned long *)ebp;
-00074         }
-00075 #else
-00076         while (valid_stack_ptr(tinfo, stack)) {
-00077                 addr = *stack++;
-00078                 if (_stp_kta (addr)) {
-00079                         _stp_symbol_print (addr);
-00080                         _stp_print_cstr ("\n");
-00081                 }
-00082         }
-00083 #endif
-00084         _stp_print_flush();
-00085         return ebp;
-00086 }
-00087 
-00088 static inline unsigned long _stp_sprint_context_stack (
-00089         String str,
-00090         struct thread_info *tinfo,
-00091         unsigned long *stack, 
-00092         unsigned long ebp )
-00093 {
-00094         unsigned long addr;
-00095 
-00096 #ifdef  CONFIG_FRAME_POINTER
-00097         while (valid_stack_ptr(tinfo, (void *)ebp)) {
-00098                 addr = *(unsigned long *)(ebp + 4);
-00099                 _stp_symbol_sprint (str, addr);
-00100                 _stp_string_cat ("\n");
-00101                 ebp = *(unsigned long *)ebp;
-00102         }
-00103 #else
-00104         while (valid_stack_ptr(tinfo, stack)) {
-00105                 addr = *stack++;
-00106                 if (_stp_kta (addr)) {
-00107                         _stp_symbol_sprint (addr);
-00108                         _stp_string_cat ("\n");
-00109                 }
-00110         }
-00111 #endif
-00112         return ebp;
-00113 }
-00114 
-00115 static void __stp_stack_print (unsigned long *stack, int verbose, int levels)
-00116 {
-00117         unsigned long ebp;
-00118 
-00119         /* Grab ebp right from our regs */
-00120         asm ("movl %%ebp, %0" : "=r" (ebp) : );
-00121 
-00122         while (stack) {
-00123                 struct thread_info *context = (struct thread_info *)
-00124                         ((unsigned long)stack & (~(THREAD_SIZE - 1)));
-00125                 ebp = _stp_print_context_stack (context, stack, ebp);
-00126                 stack = (unsigned long*)context->previous_esp;
-00127         }
-00128 }
-00129 
-00130 static void __stp_stack_sprint (String str, unsigned long *stack, int verbose, int levels)
-00131 {
-00132         unsigned long ebp;
-00133 
-00134         /* Grab ebp right from our regs */
-00135         asm ("movl %%ebp, %0" : "=r" (ebp) : );
-00136 
-00137         while (stack) {
-00138                 struct thread_info *context = (struct thread_info *)
-00139                         ((unsigned long)stack & (~(THREAD_SIZE - 1)));
-00140                 ebp = _stp_sprint_context_stack (str, context, stack, ebp);
-00141                 stack = (unsigned long*)context->previous_esp;
-00142         }
-00143 }
-00144 
-00145 #endif /* i386 */
-00146 
-00147 /** Print stack dump.
-00148  * Prints a stack dump to the print buffer.
-00149  * @param verbose Verbosity
-00150  * @param levels Number of levels to trace.
-00151  * @todo Implement verbosity and levels parameters.
-00152  * @bug levels parameter is not functional
-00153  */
-00154 
-00155 void _stp_stack_print (int verbose, int levels)
-00156 {
-00157   unsigned long stack;
-00158   __stp_stack_print (&stack, verbose, levels);
-00159 }
-00160 
-00161 /** Writes stack dump to a String
-00162  *
-00163  * @param str String
-00164  * @param verbose Verbosity
-00165  * @param levels Number of levels to trace.
-00166  * @returns Same String as was input.
-00167  * @todo Implement verbosity and levels parameters.
-00168  * @bug levels parameter is not functional
-00169  */
-00170 
-00171 String _stp_stack_sprint (String str, int verbose, int levels)
-00172 {
-00173   unsigned long stack;
-00174   __stp_stack_sprint (str, &stack, verbose, levels);
-00175   _stp_log ("sss: str=%s\n", str->buf);
-00176   return str;
-00177 }
-00178 
-00179 /** @} */
-00180 #endif /* _STACK_C_ */
-
diff --git a/runtime/docs/html/stack_8c.html b/runtime/docs/html/stack_8c.html deleted file mode 100644 index 4c769ce8..00000000 --- a/runtime/docs/html/stack_8c.html +++ /dev/null @@ -1,28 +0,0 @@ - - -SystemTap: stack.c File Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

stack.c File Reference

Stack Tracing Functions. More... -

-#include "sym.c"
- -

-Go to the source code of this file. - - - - - - - - -

Functions

void _stp_stack_print (int verbose, int levels)
 Print stack dump.
String _stp_stack_sprint (String str, int verbose, int levels)
 Writes stack dump to a String.
-


Detailed Description

-Stack Tracing Functions. -

- -

-Definition in file stack.c. diff --git a/runtime/docs/html/stp__tasklet_8c-source.html b/runtime/docs/html/stp__tasklet_8c-source.html deleted file mode 100644 index 16fdfdf7..00000000 --- a/runtime/docs/html/stp__tasklet_8c-source.html +++ /dev/null @@ -1,69 +0,0 @@ - - -SystemTap: probes/tasklet/stp_tasklet.c Source File - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
- -

stp_tasklet.c

00001 /* Framework for putting a jprobe in a tasklet. */
-00002 /* Useful for testing probes in interrupt context. */
-00003 /* Doesn't do anything useful as is.  Put test code in the inst func */
-00004 
-00005 #define HASH_TABLE_BITS 8
-00006 #define HASH_TABLE_SIZE (1<<HASH_TABLE_BITS)
-00007 #define BUCKETS 16 /* largest histogram width */
-00008 
-00009 #define STP_NETLINK_ONLY
-00010 #define STP_NUM_STRINGS 1
-00011 
-00012 #include "runtime.h"
-00013 #include "probes.c"
-00014 
-00015 MODULE_DESCRIPTION("test jprobes of tasklets");
-00016 MODULE_AUTHOR("Martin Hunt <hunt@redhat.com>");
-00017 
-00018 void inst__rcu_process_callbacks(struct rcu_ctrlblk *rcp,
-00019                                  struct rcu_state *rsp, struct rcu_data *rdp)
-00020 {
-00021   _stp_log ("interrupt=%d\n", in_interrupt());
-00022   jprobe_return();
-00023 }
-00024 
-00025 static struct jprobe stp_probes[] = {
-00026   {
-00027     .kp.addr =  (kprobe_opcode_t *)"__rcu_process_callbacks",
-00028     .entry = (kprobe_opcode_t *) inst__rcu_process_callbacks
-00029   },
-00030 };
-00031 #define MAX_STP_PROBES (sizeof(stp_probes)/sizeof(struct jprobe))
-00032 
-00033 
-00034 static int init_stp(void)
-00035 {
-00036   int ret;
-00037 
-00038   if (_stp_netlink_open() < 0)
-00039     return -1;
-00040   ret = _stp_register_jprobes (stp_probes, MAX_STP_PROBES);
-00041   _stp_log ("instrumentation is enabled...\n");
-00042   return ret;
-00043 }
-00044 
-00045 static void probe_exit (void)
-00046 {
-00047   _stp_unregister_jprobes (stp_probes, MAX_STP_PROBES);
-00048   _stp_log ("EXIT\n");
-00049 
-00050 }
-00051 static void cleanup_stp(void)
-00052 {
-00053   _stp_netlink_close();
-00054 }
-00055 
-00056 module_init(init_stp);
-00057 module_exit(cleanup_stp);
-00058 MODULE_LICENSE("GPL");
-00059 
-
diff --git a/runtime/docs/html/string_8c-source.html b/runtime/docs/html/string_8c-source.html deleted file mode 100644 index 462913e3..00000000 --- a/runtime/docs/html/string_8c-source.html +++ /dev/null @@ -1,170 +0,0 @@ - - -SystemTap: string.c Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

string.c

Go to the documentation of this file.
00001 #ifndef _STRING_C_ /* -*- linux-c -*- */
-00002 #define _STRING_C_
-00003 
-00004 #include <linux/config.h>
-00005 
-00006 /** @file string.c
-00007  * @brief Implements String type.
-00008  */
-00009 /** @addtogroup string String Functions
-00010  *
-00011  * One of the biggest restrictions the library has is that it cannot allocate things like strings off the stack.
-00012  * It is also not a good idea to dynamically allocate space for strings with kmalloc().  That leaves us with 
-00013  * statically allocated space for strings. This is what is implemented in the String module.  Strings use
-00014  * preallocated per-cpu buffers and are safe to use (unlike C strings).
-00015  * @{
-00016  */
-00017 
-00018 /** Maximum string size allowed in Strings */
-00019 #ifndef STP_STRING_SIZE
-00020 #define STP_STRING_SIZE 2048
-00021 #endif
-00022 
-00023 struct string {
-00024         short len;
-00025         short global;
-00026         char buf[STP_STRING_SIZE];
-00027 };
-00028 
-00029 static struct string _stp_string[STP_NUM_STRINGS][NR_CPUS];
-00030 
-00031 typedef struct string *String;
-00032 
-00033 /** Initialize a String for our use.
-00034  * This grabs one of the global Strings for our use.
-00035  *
-00036  * @param num Number of the preallocated String to use. 
-00037  * #STP_NUM_STRINGS are statically allocated for our use. The
-00038  * translator (or author) should be sure to grab a free one.
-00039  * @todo Global (and static) Strings not implemented yet. 
-00040  */
-00041 
-00042 String _stp_string_init (int num)
-00043 {
-00044         int global = 0;
-00045         String str;
-00046 
-00047         if (num  < 0) {
-00048                 num = -num;
-00049                 global = 1;
-00050         }
-00051         
-00052         if (num >= STP_NUM_STRINGS) {
-00053                 _stp_log ("_stp_string_init internal error: requested string exceeded allocated number");
-00054                 return NULL;
-00055         }
-00056 
-00057         if (global)
-00058                 str = &_stp_string[num][0];
-00059         else
-00060                 str = &_stp_string[num][smp_processor_id()];
-00061 
-00062         str->global = global;
-00063         str->len = 0;
-00064         return str;
-00065 }
-00066 
-00067 
-00068 /** Sprintf into a String.
-00069  * Like printf, except output goes into a String.
-00070  * Safe because overflowing the buffer is not allowed.
-00071  * Size is limited by length of String, #STP_STRING_SIZE.
-00072  *
-00073  * @param str String
-00074  * @param fmt A printf-style format string followed by a 
-00075  * variable number of args.
-00076  */
-00077 void _stp_sprintf (String str, const char *fmt, ...)
-00078 {
-00079         int num;
-00080         va_list args;
-00081         va_start(args, fmt);
-00082         num = vscnprintf(str->buf + str->len, STP_STRING_SIZE - str->len - 1, fmt, args);
-00083         va_end(args);
-00084         if (num > 0)
-00085                 str->len += num;
-00086 }
-00087 
-00088 /** Vsprintf into a String
-00089  * Use this if your function already has a va_list.
-00090  * You probably want _stp_sprintf().
-00091  */
-00092 void _stp_vsprintf (String str, const char *fmt, va_list args)
-00093 {
-00094         int num;
-00095         num = vscnprintf(str->buf + str->len, STP_STRING_SIZE - str->len - 1, fmt, args);
-00096         if (num > 0)
-00097                 str->len += num;
-00098 }
-00099 
-00100 /** ConCATenate (append) a C string to a String.
-00101  * Like strcat().
-00102  * @param str1 String
-00103  * @param str2 C string (char *)
-00104  * @sa _stp_string_cat
-00105  */
-00106 void _stp_string_cat_cstr (String str1, const char *str2)
-00107 {
-00108         int num = strlen (str2);
-00109         if (num > STP_STRING_SIZE - str1->len - 1)
-00110                 num = STP_STRING_SIZE - str1->len - 1;
-00111         strncpy (str1->buf + str1->len, str2, num+1);
-00112         str1->len += num;
-00113 }
-00114 
-00115 /** ConCATenate (append) a String to a String.
-00116  * Like strcat().
-00117  * @param str1 String
-00118  * @param str2 String
-00119  * @sa _stp_string_cat
-00120  */
-00121 void _stp_string_cat_string (String str1, String str2)
-00122 {
-00123         int num = str2->len;
-00124         if (num > STP_STRING_SIZE - str1->len - 1)
-00125                 num = STP_STRING_SIZE - str1->len - 1;
-00126         strncpy (str1->buf + str1->len, str2->buf, num);
-00127         str1->len += num;
-00128 }
-00129 
-00130 /** Get a pointer to String's buffer
-00131  * For rare cases when a C string is needed and you have a String.
-00132  * One example is when you want to print a String with _stp_printf().
-00133  * @param str String
-00134  * @returns A C string (char *)
-00135  * @note Readonly. Don't write to this pointer or it will mess up
-00136  * the internal String state and probably mess up your output or crash something.
-00137  */
-00138 char * _stp_string_ptr (String str)
-00139 {
-00140         return str->buf;
-00141 }
-00142 
-00143 
-00144 /** ConCATenate (append) a String or C string to a String.
-00145  * This macro selects the proper function to call.
-00146  * @param str1 A String
-00147  * @param str2 A String or C string (char *)
-00148  * @sa _stp_string_cat_cstr _stp_string_cat_string
-00149  */
-00150 #define _stp_string_cat(str1, str2)                                     \
-00151   ({                                                            \
-00152           if (__builtin_types_compatible_p (typeof (str2), char[])) {   \
-00153                   char *x = (char *)str2;                               \
-00154                   _str_string_cat_cstr(str1,x);                         \
-00155           } else {                                                      \
-00156                   String x = (String)str2;                              \
-00157                   _str_string_cat_string(str1,x);                       \
-00158           }                                                             \
-00159   })
-00160 
-00161 /** @} */
-00162 #endif /* _STRING_C_ */
-
diff --git a/runtime/docs/html/string_8c.html b/runtime/docs/html/string_8c.html deleted file mode 100644 index 07151c62..00000000 --- a/runtime/docs/html/string_8c.html +++ /dev/null @@ -1,52 +0,0 @@ - - -SystemTap: string.c File Reference - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

string.c File Reference

Implements String type. More... -

-#include <linux/config.h>
- -

-Go to the source code of this file. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Defines

-#define STP_STRING_SIZE   2048
 Maximum string size allowed in Strings.
#define _stp_string_cat(str1, str2)
 ConCATenate (append) a String or C string to a String.

Typedefs

-typedef string * String

Functions

String _stp_string_init (int num)
 Initialize a String for our use.
void _stp_sprintf (String str, const char *fmt,...)
 Sprintf into a String.
void _stp_vsprintf (String str, const char *fmt, va_list args)
 Vsprintf into a String Use this if your function already has a va_list.
void _stp_string_cat_cstr (String str1, const char *str2)
 ConCATenate (append) a C string to a String.
void _stp_string_cat_string (String str1, String str2)
 ConCATenate (append) a String to a String.
char * _stp_string_ptr (String str)
 Get a pointer to String's buffer For rare cases when a C string is needed and you have a String.
-


Detailed Description

-Implements String type. -

- -

-Definition in file string.c. diff --git a/runtime/docs/html/sym_8c-source.html b/runtime/docs/html/sym_8c-source.html deleted file mode 100644 index 8e7f21b8..00000000 --- a/runtime/docs/html/sym_8c-source.html +++ /dev/null @@ -1,79 +0,0 @@ - - -SystemTap: sym.c Source File - - - -

Main Page | Modules | Directories | File List | Globals | Related Pages
-

sym.c

00001 #ifndef _SYM_C_ /* -*- linux-c -*- */
-00002 #define _SYM_C_
-00003 
-00004 #include "string.c"
-00005 
-00006 /** @file sym.c
-00007  * @addtogroup sym Symbolic Functions
-00008  * Symbolic Lookup Functions
-00009  * @{
-00010  */
-00011 
-00012 /** Lookup symbol.
-00013  * This simply calls the kernel function kallsyms_lookup().
-00014  * That function is not exported, so this workaround is required.
-00015  * See the kernel source, kernel/kallsyms.c for more information.
-00016  */
-00017 static const char * (*_stp_kallsyms_lookup)(unsigned long addr,
-00018                             unsigned long *symbolsize,
-00019                             unsigned long *offset,
-00020                             char **modname, char *namebuf)=(void *)KALLSYMS_LOOKUP;
-00021 
-00022 
-00023 /** Write addresses symbolically into a String
-00024  * @param str String
-00025  * @param address The address to lookup.
-00026  * @note Symbolic lookups should not normally be done within
-00027  * a probe because it is too time-consuming. Use at module exit time.
-00028  */
-00029 
-00030 String _stp_symbol_sprint (String str, unsigned long address)
-00031 { 
-00032         char *modname;
-00033         const char *name;
-00034         unsigned long offset, size;
-00035         char namebuf[KSYM_NAME_LEN+1];
-00036 
-00037         name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf);
-00038 
-00039         _stp_sprintf (str, "0x%lx : ", address);
-00040         if (modname)
-00041                 _stp_sprintf (str, "%s+%#lx/%#lx [%s]", name, offset, size, modname);
-00042         else
-00043                 _stp_sprintf (str, "%s+%#lx/%#lx", name, offset, size);
-00044         return str;
-00045 }
-00046 
-00047 
-00048 /** Print addresses symbolically to the print buffer.
-00049  * @param address The address to lookup.
-00050  * @note Symbolic lookups should not normally be done within
-00051  * a probe because it is too time-consuming. Use at module exit time.
-00052  */
-00053 
-00054 void _stp_symbol_print (unsigned long address)
-00055 {
-00056         char *modname;
-00057         const char *name;
-00058         unsigned long offset, size;
-00059         char namebuf[KSYM_NAME_LEN+1];
-00060 
-00061         name = _stp_kallsyms_lookup(address, &size, &offset, &modname, namebuf);
-00062 
-00063         _stp_printf ("0x%lx : ", address);
-00064         if (modname)
-00065                 _stp_printf ("%s+%#lx/%#lx [%s]", name, offset, size, modname);
-00066         else
-00067                 _stp_printf ("%s+%#lx/%#lx", name, offset, size);
-00068 }
-00069 
-00070 /** @} */
-00071 #endif /* _SYM_C_ */
-
diff --git a/runtime/docs/html/test4_2dtr_8c-source.html b/runtime/docs/html/test4_2dtr_8c-source.html deleted file mode 100644 index c3d65197..00000000 --- a/runtime/docs/html/test4_2dtr_8c-source.html +++ /dev/null @@ -1,152 +0,0 @@ - - -SystemTap: probes/test4/dtr.c Source File - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
- -

dtr.c

00001 #define HASH_TABLE_BITS 8
-00002 #define HASH_TABLE_SIZE (1<<HASH_TABLE_BITS)
-00003 #define BUCKETS 16 /* largest histogram width */
-00004 
-00005 #define STP_NETLINK_ONLY
-00006 #define STP_NUM_STRINGS 1
-00007 
-00008 #include <linux/module.h>
-00009 #include <linux/interrupt.h>
-00010 #include <net/sock.h>
-00011 #include <linux/netlink.h>
-00012 
-00013 #include "runtime.h"
-00014 #include "map.c"
-00015 #include "probes.c"
-00016 #include "stack.c"
-00017 
-00018 MODULE_DESCRIPTION("SystemTap probe: test4");
-00019 MODULE_AUTHOR("Martin Hunt <hunt@redhat.com>");
-00020 
-00021 
-00022 MAP opens, reads, writes, traces;
-00023 
-00024 asmlinkage long inst_sys_open (const char __user * filename, int flags, int mode)
-00025 {
-00026   _stp_map_key_str (opens, current->comm);
-00027   _stp_map_add_int64 (opens, 1);
-00028   jprobe_return();
-00029   return 0;
-00030 }
-00031 
-00032 asmlinkage ssize_t inst_sys_read (unsigned int fd, char __user * buf, size_t count)
-00033 {
-00034   _stp_map_key_str (reads, current->comm);
-00035   _stp_map_stat_add (reads, count);
-00036   jprobe_return();
-00037   return 0;
-00038 }
-00039 
-00040 asmlinkage ssize_t inst_sys_write (unsigned int fd, const char __user * buf, size_t count)
-00041 {
-00042   _stp_map_key_str (writes, current->comm);
-00043   _stp_map_stat_add (writes, count);
-00044   jprobe_return();
-00045   return 0;
-00046 }
-00047 
-00048 int inst_show_cpuinfo(struct seq_file *m, void *v)
-00049 {
-00050   String str = _stp_string_init (0);
-00051   _stp_stack_print (0,0);
-00052   _stp_stack_print (1,0);
-00053   _stp_list_add (traces, _stp_stack_sprint(str, 0, 0));
-00054 
-00055   jprobe_return();
-00056   return 0;
-00057 }
-00058 
-00059 
-00060 static struct jprobe dtr_probes[] = {
-00061   {
-00062     .kp.addr = (kprobe_opcode_t *)"sys_open",
-00063     .entry = (kprobe_opcode_t *) inst_sys_open
-00064   },
-00065   {
-00066     .kp.addr = (kprobe_opcode_t *)"sys_read",
-00067     .entry = (kprobe_opcode_t *) inst_sys_read
-00068   },
-00069   {
-00070     .kp.addr = (kprobe_opcode_t *)"sys_write",
-00071     .entry = (kprobe_opcode_t *) inst_sys_write
-00072   },
-00073   {
-00074     .kp.addr = (kprobe_opcode_t *)"show_cpuinfo",
-00075     .entry = (kprobe_opcode_t *) inst_show_cpuinfo,
-00076   },
-00077 };
-00078 
-00079 #define MAX_DTR_ROUTINE (sizeof(dtr_probes)/sizeof(struct jprobe))
-00080 
-00081 static int init_dtr(void)
-00082 {
-00083   int ret;
-00084   
-00085   if (_stp_netlink_open() < 0)
-00086     return -1;
-00087   
-00088   opens = _stp_map_new (1000, INT64);
-00089   reads = _stp_map_new (1000, STAT);
-00090   writes = _stp_map_new (1000, STAT);
-00091   traces = _stp_list_new (1000, STRING);
-00092 
-00093   ret = _stp_register_jprobes (dtr_probes, MAX_DTR_ROUTINE);
-00094 
-00095   _stp_log("instrumentation is enabled...\n");
-00096   return ret;
-00097 }
-00098 
-00099 static void probe_exit (void)
-00100 {
-00101   struct map_node_stat *st;
-00102   struct map_node_int64 *ptr;
-00103   struct map_node_str *sptr;
-00104 
-00105   _stp_unregister_jprobes (dtr_probes, MAX_DTR_ROUTINE);
-00106 
-00107   foreach (traces, sptr) {
-00108     _stp_printf ("trace: %s\n", sptr->str);
-00109     _stp_print_flush ();
-00110   }
-00111 
-00112   foreach (opens, ptr) {
-00113     _stp_printf ("opens[%s] = %lld\n", key1str(ptr), ptr->val); 
-00114     _stp_print_flush ();
-00115   }
-00116 
-00117   foreach (reads, st) {
-00118     _stp_printf ("reads[%s] = [count=%lld  sum=%lld   min=%lld   max=%lld]\n", key1str(st), 
-00119                 st->stats.count, st->stats.sum, st->stats.min, st->stats.max);
-00120     _stp_print_flush ();
-00121   }
-00122   
-00123   foreach (writes, st) {
-00124     _stp_printf ("writes[%s] = [count=%lld  sum=%lld   min=%lld   max=%lld]\n", key1str(st), 
-00125                 st->stats.count, st->stats.sum, st->stats.min, st->stats.max);
-00126     _stp_print_flush();
-00127   }
-00128 
-00129   _stp_map_del (opens);
-00130   _stp_map_del (reads);
-00131   _stp_map_del (writes);
-00132 }
-00133 
-00134 static void cleanup_dtr(void)
-00135 {
-00136   _stp_netlink_close();
-00137 }
-00138 
-00139 module_init(init_dtr);
-00140 module_exit(cleanup_dtr);
-00141 MODULE_LICENSE("GPL");
-00142 
-
diff --git a/runtime/docs/html/todo.html b/runtime/docs/html/todo.html deleted file mode 100644 index 8b147af8..00000000 --- a/runtime/docs/html/todo.html +++ /dev/null @@ -1,107 +0,0 @@ - - -SystemTap: Todo List - - - -
Main Page | Modules | Directories | File List | Globals | Related Pages
-

Todo List

-
File TODO
-
stpd needs an option to disable ANSI colors.
-
-

-

-
File TODO
-
stpd needs to be able to write netlink REALTIME_DATA to a file.
-
-

-

-
File TODO
-
stpd/stp/io.c stpd needs better startup/shutdown integration with io.c in runtime. Shutdown works, but isn't very clean. Currently the stp script loads the module, then starts stpd. Data is lost until stpd is active. Maybe stpd needs to load the module. Maybe it needs to signal the module that stpd is ready and the module can proceed to load the probes.
-
-

-

-
File TODO
-
stpd/stp - What if there are multiple probes running?
-
-

-

-
File TODO
-
stpd/stp - Need something to post-process relayfs files and integrate into a single file.
-
-

-

-
File TODO
-
stpd - Implement command that runtime can send to stpd to tell it to fork a specified program and pass the output from the probe module to it. Create example probe to use it.
-
-

-

-
File TODO
-
relayfs/build - figure out how to get rid of the linker warnings when building probes.
-
-

-

-
File TODO
-
runtime - Clean up #defines. Need to have a clearer way to have the probe writer (translator) see which defines affect what and all defines should have reasonable defaults.
-
-

-

-
File TODO
-
runtime - current.c - implement a memory dump function. Does a hex dump into String or print buffer.
-
-

-

-
File TODO
-
runtime - put wrappers around current task struct entries, like pid, ppid, comm, etc.
-
-

-

-
File TODO
-
runtime - Implement stack functions for kprobes (not just jprobes)
-
-

-

-
Group alloc
-
Need error handling for memory allocations
-
-

-

-
Group alloc
-
Some of these currently use kmalloc (GFP_ATOMIC) for small allocations. This should be evaluated for performance and stability.
-
-

-

-
Global _stp_log (const char *fmt,...)
-
Evaluate if this function is necessary.
-
-

-

-
Group maps
-
Needs to be made SMP-safe for when the big lock is removed from kprobes.
-
-

-

-
Global _stp_map_set_stat (MAP map, stat *stats)
-
Histograms don't work yet.
-
-

-

-
Global _stp_map_stat_add (MAP map, int64_t val)
-
Histograms don't work yet.
-
-

-

-
Global _stp_stack_print (int verbose, int levels)
-
Implement verbosity and levels parameters.
-
-

-

-
Global _stp_stack_sprint (String str, int verbose, int levels)
-
Implement verbosity and levels parameters.
-
-

-

-
Global _stp_string_init (int num)
-
Global (and static) Strings not implemented yet.
-
- -- cgit