2.2. Elements of a Tapset
The following sections describe the most important aspects of writing a tapset. Most of the content herein is suitable for developers who wish to contribute to SystemTap's upstream library of tapsets.
2.2.1. Tapset Files Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Tapset files are stored in
src/tapset/
of the SystemTap GIT directory. Most tapset files are kept at that level. If you have code that only works with a specific architecture or kernel version, you may choose to put your tapset in the appropriate subdirectory.
Installed tapsets are located in
/usr/share/systemtap/tapset/
or /usr/local/share/systemtap/tapset
.
Personal tapsets can be stored anywhere. However, to ensure that SystemTap can use them, use
-I tapset_directory
to specify their location when invoking stap
.
2.2.2. Namespace Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
Probe alias names should take the form
tapset_name.probe_name
. For example, the probe for sending a signal could be named signal.send
.
Global symbol names (probes, functions, and variables) should be unique accross all tapsets. This helps avoid namespace collisions in scripts that use multiple tapsets. To ensure this, use tapset-specific prefixes in your global symbols.
Internal symbol names should be prefixed with an underscore (
_
).
2.2.3. Comments and Documentation Copy linkLink copied to clipboard!
Copy linkLink copied to clipboard!
All probes and functions should include comment blocks that describe their purpose, the data they provide, and the context in which they run (e.g. interrupt, process, etc). Use comments in areas where your intent may not be clear from reading the code.
Note that specially-formatted comments are automatically extracted from most tapsets and included in this guide. This helps ensure that tapset contributors can write their tapset and document it in the same place. The specified format for documenting tapsets is as follows:
For example:
To override the automatically-generated
Synopsis
content, use:
* Synopsis: * New Synopsis string *
* Synopsis:
* New Synopsis string
*
For example:
It is recommended that you use the
<programlisting>
tag in this instance, since overriding the Synopsis
content of an entry does not automatically form the necessary tags.
For the purposes of improving the DocBook XML output of your comments, you can also use the following XML tags in your comments:
command
emphasis
programlisting
remark
(tagged strings will appear in Publican beta builds of the document)