summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorDavid Smith <dsmith@redhat.com>2009-05-21 16:57:04 -0500
committerDavid Smith <dsmith@redhat.com>2009-05-21 16:57:04 -0500
commitc8e9eb18d8d13d099a4a177fe53de507c1d9ce8b (patch)
treeab2388afb795ed1a7ead2fbbf8b9d1b368a8231f /doc
parentdd9a3bcbef65bde65491d959e9458bc641924811 (diff)
parent3863e7999255deeaa7f8f4bba7df893773812537 (diff)
downloadsystemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.tar.gz
systemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.tar.xz
systemtap-steved-c8e9eb18d8d13d099a4a177fe53de507c1d9ce8b.zip
Merge commit 'origin/master' into pr7043
Conflicts: runtime/print.c runtime/transport/transport.c runtime/transport/transport_msgs.h
Diffstat (limited to 'doc')
-rw-r--r--doc/Makefile.in21
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/References.xml2
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-ioblktime.xml111
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-tcp_connections.xml86
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-tcpdumplike.xml116
-rw-r--r--doc/SystemTap_Beginners_Guide/en-US/Useful_SystemTap_Scripts.xml4
-rw-r--r--doc/SystemTap_Tapset_Reference/.gitignore3
-rw-r--r--doc/SystemTap_Tapset_Reference/Makefile.am20
-rw-r--r--doc/SystemTap_Tapset_Reference/Makefile.in42
-rw-r--r--doc/SystemTap_Tapset_Reference/tapsets.tmpl70
-rw-r--r--doc/Tapset_Reference_Guide/en-US/Tapset_Dev_Guide.xml24
-rwxr-xr-xdoc/Tapset_Reference_Guide/manpager.sh120
-rwxr-xr-xdoc/Tapset_Reference_Guide/publicanize.sh117
13 files changed, 618 insertions, 118 deletions
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 93753666..25b8bba2 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -79,6 +79,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+GRAPHER_CFLAGS = @GRAPHER_CFLAGS@
+GRAPHER_LIBS = @GRAPHER_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -104,6 +106,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PIECFLAGS = @PIECFLAGS@
PIECXXFLAGS = @PIECXXFLAGS@
PIELDFLAGS = @PIELDFLAGS@
+PKG_CONFIG = @PKG_CONFIG@
PROCFLAGS = @PROCFLAGS@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
@@ -131,6 +134,7 @@ docdir = @docdir@
dvidir = @dvidir@
elfutils_abs_srcdir = @elfutils_abs_srcdir@
exec_prefix = @exec_prefix@
+have_certutil = @have_certutil@
have_dvips = @have_dvips@
have_latex = @have_latex@
have_latex2html = @have_latex2html@
@@ -278,8 +282,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
@@ -304,8 +308,8 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -315,12 +319,13 @@ ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
diff --git a/doc/SystemTap_Beginners_Guide/en-US/References.xml b/doc/SystemTap_Beginners_Guide/en-US/References.xml
index ff993df2..6ab74f17 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/References.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/References.xml
@@ -43,7 +43,7 @@
The <filename>stapprobes</filename> man page enumerates a variety of probe points supported by SystemTap, along with additional aliases
defined by the SystemTap tapset library. The bottom of the man page includes a list of other man pages
enumerating similar probe points for specific system components, such as
- <filename>stapprobes.scsi</filename>, <filename>stapprobes.process</filename>,
+ <filename>stapprobes.scsi</filename>, <filename>stapprobes.kprocess</filename>,
<filename>stapprobes.signal</filename>, etc.
</para>
</listitem>
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-ioblktime.xml b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-ioblktime.xml
new file mode 100644
index 00000000..e586d81a
--- /dev/null
+++ b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-ioblktime.xml
@@ -0,0 +1,111 @@
+<?xml version='1.0'?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+]>
+
+ <section id="ioblktimesect">
+ <title>Periodically Print I/O Block Time</title>
+<indexterm>
+<primary>script examples</primary>
+<secondary>monitoring I/O block time</secondary>
+</indexterm>
+
+<indexterm>
+<primary>examples of SystemTap scripts</primary>
+<secondary>monitoring I/O block time</secondary>
+</indexterm>
+
+<indexterm>
+<primary>monitoring I/O block time</primary>
+<secondary>examples of SystemTap scripts</secondary>
+</indexterm>
+
+<indexterm>
+<primary>I/O block time, monitoring</primary>
+<secondary>examples of SystemTap scripts</secondary>
+</indexterm>
+
+<indexterm>
+<primary>printing I/O block time (periodically)</primary>
+<secondary>examples of SystemTap scripts</secondary>
+</indexterm>
+
+ <para>
+ This section describes how to track the amount of time each block I/O requests spends
+ waiting for completion. This is useful in determining whether there are too many
+ outstanding block I/O operations at any given time.
+ </para>
+
+<formalpara id="ioblktime">
+ <title>ioblktime.stp</title>
+<para>
+<programlisting>
+<xi:include parse="text" href="extras/testsuite/systemtap.examples/io/ioblktime.stp" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+</para>
+</formalpara>
+
+<!-- <remark>what does $count do, specifically?</remark> -->
+
+<para>
+ <xref linkend="ioblktime"/> computes the average waiting time for block I/O per device,
+ and prints a list every 10 seconds. As always, you can revise this refresh rate by
+ editing the specified value in <command>probe timer.s(10), end {</command>.
+</para>
+<para>
+ In some cases, there can be too many outstanding block
+ I/O operations, at which point the script can exceed the default number of
+ <command>MAXMAPENTRIES</command>. <command>MAXMAPENTRIES</command> is the maximum number of
+ rows in an array if the array size is not specified explicitly when declared. If the script
+ exceeds the default <command>MAXMAPENTRIES</command> value of 2048, run the script again with
+ the <command>stap</command> option <command>-DMAXMAPENTRIES=10000</command>.
+</para>
+
+
+<example id="ioblktimeoutput">
+ <title><xref linkend="ioblktime"/> Sample Output</title>
+<screen>
+ device rw total (us) count avg (us)
+ sda W 9659 6 1609
+ dm-0 W 20278 6 3379
+ dm-0 R 20524 5 4104
+ sda R 19277 5 3855
+</screen>
+</example>
+
+<para>
+ <xref linkend="ioblktimeoutput"/> displays the device name, operations performed
+ (<command>rw</command>), total wait time of all operations (<command>total(us)</command>),
+ number of operations (<command>count</command>), and average
+ wait time for all those operations (<command>avg (us)</command>). The times tallied by the
+ script are in microseconds.
+</para>
+
+<!--
+global reads, writes, total_io
+
+probe kernel.function("vfs_read") {
+reads[execname()] += $count
+}
+
+probe kernel.function("vfs_write") {
+writes[execname()] += $count
+}
+
+# print top 10 IO processes every 5 seconds
+probe timer.s(5) {
+foreach (name in writes)
+total_io[name] += writes[name]
+foreach (name in reads)
+total_io[name] += reads[name]
+printf ("%16s\t%10s\t%10s\n", "Process", "KB Read", "KB Written")
+foreach (name in total_io- limit 10)
+printf("%16s\t%10d\t%10d\n", name,
+reads[name]/1024, writes[name]/1024)
+delete reads
+delete writes
+delete total_io
+print("\n")
+}
+-->
+
+</section> \ No newline at end of file
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-tcp_connections.xml b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-tcp_connections.xml
new file mode 100644
index 00000000..c25465b4
--- /dev/null
+++ b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-tcp_connections.xml
@@ -0,0 +1,86 @@
+<?xml version='1.0'?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+]>
+
+
+ <section id="tcpconnectionssect">
+ <title>Monitoring Incoming TCP Connections</title>
+<indexterm>
+<primary>script examples</primary>
+<secondary>monitoring incoming TCP connections</secondary>
+</indexterm>
+
+<indexterm>
+<primary>examples of SystemTap scripts</primary>
+<secondary>monitoring incoming TCP connections</secondary>
+</indexterm>
+
+<indexterm>
+<primary>monitoring incoming TCP connections</primary>
+<secondary>examples of SystemTap scripts</secondary>
+</indexterm>
+<indexterm>
+ <primary>TCP connections (incoming), monitoring</primary>
+ <secondary>examples of SystemTap scripts</secondary>
+</indexterm>
+<indexterm>
+ <primary>incoming TCP connections, monitoring</primary>
+ <secondary>examples of SystemTap scripts</secondary>
+</indexterm>
+<!--
+<indexterm>
+ <primary>script examples</primary>
+ <secondary>net/socket.c, tracing functions from</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>examples of SystemTap scripts</primary>
+ <secondary>net/socket.c, tracing functions from</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>net/socket.c, tracing functions from</primary>
+ <secondary>examples of SystemTap scripts</secondary>
+</indexterm>
+-->
+
+<para>
+ This section illustrates how to monitor incoming TCP connections. This task is useful in
+ identifying any unauthorized, suspicious, or otherwise unwanted network access requests
+ in real time.
+</para>
+
+<formalpara id="tcpconnections">
+ <title>tcp_connections.stp</title>
+<para>
+<programlisting>
+<xi:include parse="text" href="extras/testsuite/systemtap.examples/network/tcp_connections.stp" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+</para>
+</formalpara>
+
+<para>
+ While <xref linkend="tcpconnections"/> is running, it will print out the following information
+ about any incoming TCP connections accepted by the system in real time:
+</para>
+
+<itemizedlist>
+ <listitem><para>Current <command>UID</command></para></listitem>
+ <listitem><para><command>CMD</command> - the command accepting the connection</para></listitem>
+ <listitem><para><command>PID</command> of the command</para></listitem>
+ <listitem><para>Port used by the connection</para></listitem>
+ <listitem><para>IP address from which the TCP connection originated</para></listitem>
+</itemizedlist>
+
+
+<example id="tcpconnectionsoutput">
+ <title><xref linkend="tcpconnections"/> Sample Output</title>
+<screen>
+UID CMD PID PORT IP_SOURCE
+0 sshd 3165 22 10.64.0.227
+0 sshd 3165 22 10.64.0.227
+</screen>
+</example>
+
+</section>
+
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-tcpdumplike.xml b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-tcpdumplike.xml
new file mode 100644
index 00000000..cd42edc6
--- /dev/null
+++ b/doc/SystemTap_Beginners_Guide/en-US/Useful_Scripts-tcpdumplike.xml
@@ -0,0 +1,116 @@
+<?xml version='1.0'?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+]>
+
+
+ <section id="tcpdumplikesect">
+ <title>Monitoring TCP Packets</title>
+<indexterm>
+<primary>script examples</primary>
+<secondary>monitoring TCP packets</secondary>
+</indexterm>
+
+<indexterm>
+<primary>examples of SystemTap scripts</primary>
+<secondary>monitoring TCP packets</secondary>
+</indexterm>
+
+<indexterm>
+<primary>monitoring TCP packets</primary>
+<secondary>examples of SystemTap scripts</secondary>
+</indexterm>
+<indexterm>
+ <primary>TCP packets, monitoring</primary>
+ <secondary>examples of SystemTap scripts</secondary>
+</indexterm>
+<indexterm>
+ <primary>TCP packets, monitoring</primary>
+ <secondary>examples of SystemTap scripts</secondary>
+</indexterm>
+<!--
+<indexterm>
+ <primary>script examples</primary>
+ <secondary>net/socket.c, tracing functions from</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>examples of SystemTap scripts</primary>
+ <secondary>net/socket.c, tracing functions from</secondary>
+</indexterm>
+
+<indexterm>
+ <primary>net/socket.c, tracing functions from</primary>
+ <secondary>examples of SystemTap scripts</secondary>
+</indexterm>
+-->
+
+<para>
+ This section illustrates how to monitor TCP packets received by the system. This is useful in
+ analyzing network traffic generated by applications running on the system.
+</para>
+
+
+<formalpara id="tcpdumplike">
+ <title>tcpdumplike.stp</title>
+<para>
+<programlisting>
+ <xi:include parse="text" href="extras/testsuite/systemtap.examples/network/tcpdumplike.stp" xmlns:xi="http://www.w3.org/2001/XInclude" />
+</programlisting>
+</para>
+</formalpara>
+
+<para>
+ While <xref linkend="tcpdumplike"/> is running, it will print out the following information
+ about any received TCP packets in real time:
+</para>
+
+<itemizedlist>
+ <listitem><para>Source and destination IP address (<command>saddr</command>,
+ <command>daddr</command>, respectively)</para></listitem>
+ <listitem><para>Source and destination ports (<command>sport</command>, <command>dport</command>,
+ respectively)</para></listitem>
+ <listitem><para>Packet flags</para></listitem>
+</itemizedlist>
+
+<para>
+ To determine the flags used by the packet, <xref linkend="tcpdumplike"/> uses the following
+ functions:
+</para>
+
+<itemizedlist>
+ <listitem><para><command>urg</command> - urgent</para></listitem>
+ <listitem><para><command>ack</command> - acknowledgement</para></listitem>
+ <listitem><para><command>psh</command> - push</para></listitem>
+ <listitem><para><command>rst</command> - reset</para></listitem>
+ <listitem><para><command>syn</command> - synchronize</para></listitem>
+ <listitem><para><command>fin</command> - finished</para></listitem>
+</itemizedlist>
+
+<para>
+ The aforementioned functions return <command>1</command> or <command>0</command> to
+ specify whether the packet uses the corresponding flag.
+</para>
+
+<example id="tcpdumplikeoutput">
+ <title><xref linkend="tcpdumplike"/> Sample Output</title>
+<screen>
+-----------------------------------------------------------------
+ Source IP Dest IP SPort DPort U A P R S F
+-----------------------------------------------------------------
+ 209.85.229.147 10.0.2.15 80 20373 0 1 1 0 0 0
+ 92.122.126.240 10.0.2.15 80 53214 0 1 0 0 1 0
+ 92.122.126.240 10.0.2.15 80 53214 0 1 0 0 0 0
+ 209.85.229.118 10.0.2.15 80 63433 0 1 0 0 1 0
+ 209.85.229.118 10.0.2.15 80 63433 0 1 0 0 0 0
+ 209.85.229.147 10.0.2.15 80 21141 0 1 1 0 0 0
+ 209.85.229.147 10.0.2.15 80 21141 0 1 1 0 0 0
+ 209.85.229.147 10.0.2.15 80 21141 0 1 1 0 0 0
+ 209.85.229.147 10.0.2.15 80 21141 0 1 1 0 0 0
+ 209.85.229.147 10.0.2.15 80 21141 0 1 1 0 0 0
+ 209.85.229.118 10.0.2.15 80 63433 0 1 1 0 0 0
+[...]
+</screen>
+</example>
+
+</section>
+
diff --git a/doc/SystemTap_Beginners_Guide/en-US/Useful_SystemTap_Scripts.xml b/doc/SystemTap_Beginners_Guide/en-US/Useful_SystemTap_Scripts.xml
index b18062f3..eeab9b27 100644
--- a/doc/SystemTap_Beginners_Guide/en-US/Useful_SystemTap_Scripts.xml
+++ b/doc/SystemTap_Beginners_Guide/en-US/Useful_SystemTap_Scripts.xml
@@ -41,6 +41,8 @@
<para>The following sections showcase scripts that trace network-related functions and build a profile of network activity.</para>
<xi:include href="Useful_Scripts-nettop.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Useful_Scripts-sockettrace.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="Useful_Scripts-tcp_connections.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include condition="fedora" href="Useful_Scripts-tcpdumplike.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</section>
<section id="mainsect-disk">
<title>Disk</title>
@@ -54,6 +56,7 @@
<!-- <xi:include href="Useful_Scripts-Kernel.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> -->
<xi:include href="Useful_Scripts-inodewatch.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<xi:include href="Useful_Scripts-inodewatch2.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include condition="fedora" href="Useful_Scripts-ioblktime.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
</section>
<section id="mainsect-profiling">
@@ -69,6 +72,7 @@
<!-- removed; handler function no longer working as expected
<xi:include href="Useful_Scripts-kernelprofiling.xml" xmlns:xi="http://www.w3.org/2001/XInclude" /> -->
+
<xi:include href="Useful_Scripts-futexes.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
<!-- <xi:include href="Useful_Scripts-Network.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
diff --git a/doc/SystemTap_Tapset_Reference/.gitignore b/doc/SystemTap_Tapset_Reference/.gitignore
index af43f913..3b7d1c17 100644
--- a/doc/SystemTap_Tapset_Reference/.gitignore
+++ b/doc/SystemTap_Tapset_Reference/.gitignore
@@ -1 +1,4 @@
/docproc
+stamp-*
+tapsets/
+tapsets.xml
diff --git a/doc/SystemTap_Tapset_Reference/Makefile.am b/doc/SystemTap_Tapset_Reference/Makefile.am
index 9e7d2069..30c4ffef 100644
--- a/doc/SystemTap_Tapset_Reference/Makefile.am
+++ b/doc/SystemTap_Tapset_Reference/Makefile.am
@@ -2,7 +2,7 @@
## process this file with automake to produce Makefile.in
DOC_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap
-MAN_INSTALL_DIR = $(DESTDIR)$(mandir)/man5
+MAN_INSTALL_DIR = $(DESTDIR)$(mandir)/man3
HTML_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap/tapsets
@@ -18,12 +18,17 @@ noinst_PROGRAMS = docproc
SRCTREE=$(abs_top_srcdir)/
DOCPROC=$(abs_builddir)/docproc
+if BUILD_PDFREFDOCS
+PDFDOCS = tapsets.pdf
+endif
+
if BUILD_REFDOCS
-all: tapsets.pdf stamp-htmldocs stamp-mandocs
-tapsets.xml: docproc $(shell find $(SRCTREE) -name '*.stp')
+all: $(PDFDOCS) stamp-htmldocs stamp-mandocs
+tapsets.xml: docproc $(shell find $(SRCTREE)/tapset -name '*.stp')
SRCTREE=$(SRCTREE) $(DOCPROC) doc $(abs_srcdir)/tapsets.tmpl > tapsets.xml.new
if cmp tapsets.xml.new tapsets.xml >/dev/null ; then \
echo tapsets.xml unchanged; \
+ rm tapsets.xml.new; \
else \
mv tapsets.xml.new tapsets.xml; \
fi
@@ -32,20 +37,23 @@ stamp-htmldocs: tapsets.xml
xmlto html -o tapsets tapsets.xml
touch stamp-htmldocs
+# bump up the allocated space so "xmlto pdf" works
tapsets.pdf: tapsets.xml
- xmlto pdf tapsets.xml
+ env pool_size=2000000 hash_extra=2000000 xmlto pdf tapsets.xml
stamp-mandocs: tapsets.xml
- xmlto man -o man5 tapsets.xml
+ xmlto man -o man3 tapsets.xml
touch stamp-mandocs
#FIXME need to figure out where to install things appropriately
#installmandocs: mandocs
install-data-hook:
+if BUILD_PDFREFDOCS
$(MKDIR_P) $(DOC_INSTALL_DIR)
$(INSTALL_DATA) tapsets.pdf $(DOC_INSTALL_DIR)
+endif
$(MKDIR_P) $(MAN_INSTALL_DIR)
- $(INSTALL_DATA) man5/* $(MAN_INSTALL_DIR)
+ $(INSTALL_DATA) man3/* $(MAN_INSTALL_DIR)
$(MKDIR_P) $(HTML_INSTALL_DIR)
$(INSTALL_DATA) tapsets/* $(HTML_INSTALL_DIR)
endif
diff --git a/doc/SystemTap_Tapset_Reference/Makefile.in b/doc/SystemTap_Tapset_Reference/Makefile.in
index 84d2114c..2e8b411d 100644
--- a/doc/SystemTap_Tapset_Reference/Makefile.in
+++ b/doc/SystemTap_Tapset_Reference/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -46,7 +46,7 @@ PROGRAMS = $(noinst_PROGRAMS)
docproc_SOURCES = docproc.c
docproc_OBJECTS = docproc.$(OBJEXT)
docproc_LDADD = $(LDADD)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(top_builddir)@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -82,6 +82,8 @@ ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+GRAPHER_CFLAGS = @GRAPHER_CFLAGS@
+GRAPHER_LIBS = @GRAPHER_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -107,6 +109,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@
PIECFLAGS = @PIECFLAGS@
PIECXXFLAGS = @PIECXXFLAGS@
PIELDFLAGS = @PIELDFLAGS@
+PKG_CONFIG = @PKG_CONFIG@
PROCFLAGS = @PROCFLAGS@
RANLIB = @RANLIB@
SET_MAKE = @SET_MAKE@
@@ -134,6 +137,7 @@ docdir = @docdir@
dvidir = @dvidir@
elfutils_abs_srcdir = @elfutils_abs_srcdir@
exec_prefix = @exec_prefix@
+have_certutil = @have_certutil@
have_dvips = @have_dvips@
have_latex = @have_latex@
have_latex2html = @have_latex2html@
@@ -169,10 +173,11 @@ target_alias = @target_alias@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
DOC_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap
-MAN_INSTALL_DIR = $(DESTDIR)$(mandir)/man5
+MAN_INSTALL_DIR = $(DESTDIR)$(mandir)/man3
HTML_INSTALL_DIR = $(DESTDIR)$(datadir)/doc/systemtap/tapsets
SRCTREE = $(abs_top_srcdir)/
DOCPROC = $(abs_builddir)/docproc
+@BUILD_PDFREFDOCS_TRUE@PDFDOCS = tapsets.pdf
all: all-am
.SUFFIXES:
@@ -240,8 +245,8 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
@@ -253,8 +258,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
@@ -264,12 +269,13 @@ ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
@@ -412,11 +418,12 @@ uninstall-am:
uninstall-am
-@BUILD_REFDOCS_TRUE@all: tapsets.pdf stamp-htmldocs stamp-mandocs
-@BUILD_REFDOCS_TRUE@tapsets.xml: docproc $(shell find $(SRCTREE) -name '*.stp')
+@BUILD_REFDOCS_TRUE@all: $(PDFDOCS) stamp-htmldocs stamp-mandocs
+@BUILD_REFDOCS_TRUE@tapsets.xml: docproc $(shell find $(SRCTREE)/tapset -name '*.stp')
@BUILD_REFDOCS_TRUE@ SRCTREE=$(SRCTREE) $(DOCPROC) doc $(abs_srcdir)/tapsets.tmpl > tapsets.xml.new
@BUILD_REFDOCS_TRUE@ if cmp tapsets.xml.new tapsets.xml >/dev/null ; then \
@BUILD_REFDOCS_TRUE@ echo tapsets.xml unchanged; \
+@BUILD_REFDOCS_TRUE@ rm tapsets.xml.new; \
@BUILD_REFDOCS_TRUE@ else \
@BUILD_REFDOCS_TRUE@ mv tapsets.xml.new tapsets.xml; \
@BUILD_REFDOCS_TRUE@ fi
@@ -425,20 +432,21 @@ uninstall-am:
@BUILD_REFDOCS_TRUE@ xmlto html -o tapsets tapsets.xml
@BUILD_REFDOCS_TRUE@ touch stamp-htmldocs
+# bump up the allocated space so "xmlto pdf" works
@BUILD_REFDOCS_TRUE@tapsets.pdf: tapsets.xml
-@BUILD_REFDOCS_TRUE@ xmlto pdf tapsets.xml
+@BUILD_REFDOCS_TRUE@ env pool_size=2000000 hash_extra=2000000 xmlto pdf tapsets.xml
@BUILD_REFDOCS_TRUE@stamp-mandocs: tapsets.xml
-@BUILD_REFDOCS_TRUE@ xmlto man -o man5 tapsets.xml
+@BUILD_REFDOCS_TRUE@ xmlto man -o man3 tapsets.xml
@BUILD_REFDOCS_TRUE@ touch stamp-mandocs
#FIXME need to figure out where to install things appropriately
#installmandocs: mandocs
@BUILD_REFDOCS_TRUE@install-data-hook:
-@BUILD_REFDOCS_TRUE@ $(MKDIR_P) $(DOC_INSTALL_DIR)
-@BUILD_REFDOCS_TRUE@ $(INSTALL_DATA) tapsets.pdf $(DOC_INSTALL_DIR)
+@BUILD_PDFREFDOCS_TRUE@@BUILD_REFDOCS_TRUE@ $(MKDIR_P) $(DOC_INSTALL_DIR)
+@BUILD_PDFREFDOCS_TRUE@@BUILD_REFDOCS_TRUE@ $(INSTALL_DATA) tapsets.pdf $(DOC_INSTALL_DIR)
@BUILD_REFDOCS_TRUE@ $(MKDIR_P) $(MAN_INSTALL_DIR)
-@BUILD_REFDOCS_TRUE@ $(INSTALL_DATA) man5/* $(MAN_INSTALL_DIR)
+@BUILD_REFDOCS_TRUE@ $(INSTALL_DATA) man3/* $(MAN_INSTALL_DIR)
@BUILD_REFDOCS_TRUE@ $(MKDIR_P) $(HTML_INSTALL_DIR)
@BUILD_REFDOCS_TRUE@ $(INSTALL_DATA) tapsets/* $(HTML_INSTALL_DIR)
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/doc/SystemTap_Tapset_Reference/tapsets.tmpl b/doc/SystemTap_Tapset_Reference/tapsets.tmpl
index 798cfb3b..767f9e05 100644
--- a/doc/SystemTap_Tapset_Reference/tapsets.tmpl
+++ b/doc/SystemTap_Tapset_Reference/tapsets.tmpl
@@ -5,24 +5,19 @@
<book id="TapsetRef">
<bookinfo>
<title>SystemTap Tapset Reference Manual</title>
-
+<!--starthere-->
+ <copyright>
+ <year>2008-2009</year>
+ <holder>Red Hat, Inc. and others</holder>
+ </copyright>
+
<authorgroup>
<author>
- <firstname>William</firstname>
- <surname>Cohen</surname>
- <contrib></contrib>
- <affiliation>
- <address>
- <email>wcohen@redhat.com</email>
- </address>
- </affiliation>
+ <othername>SystemTap</othername>
+ <contrib>Hackers</contrib>
</author>
</authorgroup>
- <copyright>
- <year>2008, 2009</year>
- <holder>Red Hat, Inc.</holder>
- </copyright>
<legalnotice>
<para>
@@ -53,7 +48,6 @@
</bookinfo>
<!-- pls dont remove marker comments, as they are used in publican conversion-->
<toc></toc>
-<!--starthere-->
<chapter id="introduction">
<title>Introduction</title>
<para>
@@ -117,8 +111,8 @@
<title>Context Functions</title>
<para>
The context functions provide additional information about where
- the event occurred.
- These functions can provide information such as a backtrace
+ an event occurred.
+ These functions can provide information such as a backtrace to
where the event occured
and the current register values for the processor.
</para>
@@ -132,22 +126,26 @@
<para>
Each timestamp function returns a value to indicate when
a function is executed.
- Thus, these returned values can be used to indicate
- when an event occurs, provide an ordering for events, or compute
- the amount of time elapsed between to time stamps.
+ These returned values can then be used to indicate
+ when an event occurred, provide an ordering for events, or compute
+ the amount of time elapsed between two time stamps.
</para>
!Itapset/timestamp.stp
</chapter>
<chapter id="memory_stp">
<title>Memory Tapset</title>
+ <para>
+ This family of probe points is used to probe memory-related events.
+ It contains the following probe points:
+ </para>
!Itapset/memory.stp
</chapter>
<chapter id="iosched.stp">
<title>IO Scheduler Tapset</title>
<para>
- This family of probe points is used to probe the IO scheduler activities.
+ This family of probe points is used to probe IO scheduler activities.
It contains the following probe points:
</para>
!Itapset/ioscheduler.stp
@@ -156,7 +154,7 @@
<chapter id="scsi.stp">
<title>SCSI Tapset</title>
<para>
- This family of probe points is used to probe the SCSI activities.
+ This family of probe points is used to probe SCSI activities.
It contains the following probe points:
</para>
!Itapset/scsi.stp
@@ -166,11 +164,12 @@
<title>Networking Tapset</title>
<para>
This family of probe points is used to probe the activities of
- the network device, TCP layer, and UDP layer.
+ the network device and protocol layers.
</para>
!Itapset/networking.stp
!Itapset/tcp.stp
!Itapset/udp.stp
+!Itapset/ip.stp
</chapter>
<chapter id="socket.stp">
@@ -181,32 +180,13 @@
</para>
!Itapset/socket.stp
</chapter>
-<!--
- <chapter id="tcp.stp">
- <title>TCP Tapset</title>
- <para>
- This family of probe points is used to probe TCP layer activities.
- It contains the following probe points:
- </para>
-
- </chapter>
-
- <chapter id="upd.stp">
- <title>UDP Tapset</title>
- <para>
- This family of probe points is used to probe UDP layer activities.
- It contains the following probe points:
- </para>
-
- </chapter>
--->
- <chapter id="process.stp">
- <title>Process Tapset</title>
+ <chapter id="kprocess.stp">
+ <title>Kernel Process Tapset</title>
<para>
- This family of probe points is used to probe the process activities.
+ This family of probe points is used to probe process-related activities.
It contains the following probe points:
</para>
-!Itapset/process.stp
+!Itapset/kprocess.stp
</chapter>
<chapter id="signal.stp">
<title>Signal Tapset</title>
diff --git a/doc/Tapset_Reference_Guide/en-US/Tapset_Dev_Guide.xml b/doc/Tapset_Reference_Guide/en-US/Tapset_Dev_Guide.xml
index 555fa7e6..293a0dc3 100644
--- a/doc/Tapset_Reference_Guide/en-US/Tapset_Dev_Guide.xml
+++ b/doc/Tapset_Reference_Guide/en-US/Tapset_Dev_Guide.xml
@@ -62,11 +62,13 @@
beginning of those functions:
</para>
+<para>
<programlisting>
-probe process.exec = kernel.function("do_execve"),
+probe kprocess.exec = kernel.function("do_execve"),
kernel.function("compat_do_execve")
{<replaceable>probe body</replaceable>}
</programlisting>
+</para>
<para>
Try to place probes on stable interfaces (i.e., functions
@@ -102,13 +104,15 @@ kernel.function("compat_do_execve")
defined in <filename>task.stp</filename>.
</para>
+<para>
<programlisting>
-probe process.create = kernel.function("copy_process").return
+probe kprocess.create = kernel.function("copy_process").return
{
task = $return
new_pid = task_pid(task)
}
</programlisting>
+</para>
<para>
It is not advisable to write probes for every function. Most SystemTap users
@@ -191,6 +195,7 @@ probe process.create = kernel.function("copy_process").return
The specified format for documenting tapsets is as follows:
</para>
+<para>
<programlisting>
/**
* probe tapset.name - Short summary of what the tapset does.
@@ -209,9 +214,11 @@ probe process.create = kernel.function("copy_process").return
* A paragraph that will appear under the heading "Header".
**/
</programlisting>
-
+</para>
+
<para>For example:</para>
+<para>
<programlisting>
/**
* probe vm.write_shared_copy- Page copy for shared page write.
@@ -226,17 +233,21 @@ probe process.create = kernel.function("copy_process").return
* always preceded by a <command>vm.shared_write</command>.
**/
</programlisting>
+</para>
-<para>To override the automatically-generated <command>Synopsis</command> content, use:
+<para>To override the automatically-generated <command>Synopsis</command> content, use:</para>
+<para>
<programlisting>
* Synopsis:
- * <programlisting>Synopsis string</programlisting>
+ * <replaceable>New Synopsis string</replaceable>
*
</programlisting>
+</para>
<para>For example:</para>
+<para>
<programlisting>
/**
* probe signal.handle - Fires when the signal handler is invoked
@@ -247,6 +258,7 @@ probe process.create = kernel.function("copy_process").return
* sigset_t *oldset, struct pt_regs * regs)&lt;/programlisting>
*/
</programlisting>
+</para>
<para>
It is recommended that you use the <command>&lt;programlisting&gt;</command> tag in
@@ -264,7 +276,7 @@ probe process.create = kernel.function("copy_process").return
<listitem><para><command>emphasis</command></para></listitem>
<listitem><para><command>programlisting</command></para></listitem>
<listitem><para><command>remark</command> (tagged strings will appear in Publican beta
- builds of the document.</para></listitem>
+ builds of the document)</para></listitem>
</itemizedlist>
diff --git a/doc/Tapset_Reference_Guide/manpager.sh b/doc/Tapset_Reference_Guide/manpager.sh
new file mode 100755
index 00000000..0051d208
--- /dev/null
+++ b/doc/Tapset_Reference_Guide/manpager.sh
@@ -0,0 +1,120 @@
+#!/bin/bash
+# This script builds the man pages from comments in tapsets. As such, the man page content
+# generated herein should be in sync with Tapset Reference Guide
+
+# cleanup
+rm -rf man_pages
+
+# create working directory
+mkdir workingdir ;
+
+# create list of man pages to generate
+cat ../SystemTap_Tapset_Reference/tapsets.tmpl | grep ^\!Itapset > manpageus ;
+sed -i -e 's/\!Itapset\///g' manpageus ;
+
+# copy list of man pages into working directory
+for i in `cat manpageus` ; do cp ../../tapset/$i workingdir ; done ;
+
+# enter workdir
+cd workingdir ;
+
+# copy tapsetdescriptions, then clean
+for i in `cat ../manpageus`; do
+sed -n '/\/\/ <tapsetdescription>/,/\/\/ <\/tapsetdescription>/ s/.*/&/w temp' < $i ;
+mv temp $i.tapsetdescription ;
+sed -i -e 's/\/\/ <tapsetdescription>//g' $i.tapsetdescription ;
+sed -i -e 's/\/\/ <\/tapsetdescription>//g' $i.tapsetdescription ;
+sed -i -e 's/\/\///g' $i.tapsetdescription ;
+done
+
+# strip all tapset files to just comments; but all comments must be exactly 1 space before and after "*"
+for i in `cat ../manpageus` ; do sed -i -e 's/^ \*/ \*/g' $i;
+sed -i -e 's/^ \* / \* /g' $i;
+# mark the start of each probe entry (sub "/**")
+perl -p -i -e 's|^/\*\*| *probestart|g' $i;
+sed -i -e '/^ \*/!d' $i;
+# rename all tapsets (remove .stp filename suffix), create templates
+echo $i > tempname ;
+sed -i -e 's/.stp//g' tempname ;
+mv $i `cat tempname` ; mv tempname $i ;
+done ;
+
+# create man page headers
+for i in `ls | grep -v .stp | grep -v tapsetdescription` ; do
+#echo ".\" -*- nroff -*-" >> $i.template ;
+echo ".TH STAPPROBES."$i" 5 @DATE@ "IBM"" >> $i.template ;
+echo ".SH NAME" >> $i.template ;
+echo "stapprobes."`cat $i.stp`" \- systemtap "`cat $i.stp`" probe points" >> $i.template ;
+echo " " >> $i.template ;
+echo ".SH DESCRIPTION" >> $i.template ;
+cat $i.stp.tapsetdescription >> $i.template ;
+echo " " >> $i.template ;
+echo ".SH PROBES" >> $i.template ;
+echo ".br" >> $i.template ;
+echo ".P" >> $i.template ;
+echo ".TP" >> $i.template ;
+done
+
+# MOST IMPORTANT: clean man page body!
+sed -i -e 's/\.stp$//g' ../manpageus ;
+for i in `cat ../manpageus` ;
+do mv $i $i.tmp ;
+perl -p -i -e 's| \* sfunction|.BR|g' $i.tmp ;
+perl -p -i -e 's| \* probe|.BR|g' $i.tmp ;
+perl -p -i -e 's| -|\ninitlinehere|g' $i.tmp ;
+perl -p -i -e 's|^initlinehere([^\n]*)\n|$1\n |g' $i.tmp ;
+perl -p -i -e 's| \* @([^:]*):|\n.I $1:\n|g' $i.tmp ;
+perl -p -i -e 's| \* ([^:]*):|\n.BR $1:\n|g' $i.tmp ;
+perl -p -i -e 's| \* ||g' $i.tmp
+perl -p -i -e 's|\*probestart|\n.P\n.TP|g' $i.tmp ;
+perl -p -i -e 's|\.I|\n.I|g' $i.tmp ;
+# remove empty lines
+sed -i -e '/^$/d' $i.tmp ;
+sed -i -e '/^$/d' $i.tmp ;
+sed -i -e 's/^[ \t]*//g' $i.tmp ;
+# process Description headers
+perl -p -i -e 's|^\*[^/]|\n.BR Description:\n|g' $i.tmp ;
+perl -p -i -e 'undef $/;s|\.BR Description:\n\.BR|.BR|g' $i.tmp ;
+perl -p -i -e 'undef $/;s|\.BR Description:\n\*\/||g' $i.tmp ;
+# process Argument headers
+perl -p -i -e 'undef $/;s|\n\n.I|\n.br\n.BR Arguments:\n.I|g' $i.tmp ;
+# clean up formatting of arguments
+perl -p -i -e 's|^.I([^:]*:)|\n.br\n.br\n.IR$1\n.br\n\t|g' $i.tmp ;
+done
+
+# make tags work
+for i in `cat ../manpageus` ; do
+perl -p -i -e 's|</[^>]*>([^.])|$1\n|g' $i.tmp ;
+perl -p -i -e 's|<[^>]*>|\n.B |g' $i.tmp ;
+# the previous two statements create excess empty lines, remove some of them
+sed -i -e '/^$/d' $i.tmp ;
+# increase whitespace between some headers
+perl -p -i -e 's|^\.BR ([^:]*:)|\n.br\n.BR $1\n.br\n|g' $i.tmp
+done
+
+# generate footer template
+echo ".SH SEE ALSO" >> footer
+echo ".IR stap (1)," >> footer
+echo ".IR stapprobes (5)," >> footer
+for i in `cat ../manpageus`; do echo ".IR stapprobes."$i" (5)," >> footer ; done
+
+# assemble parts
+for i in `cat ../manpageus`; do
+cat $i.template >> stapprobes.$i.5 ;
+cat $i.tmp >> stapprobes.$i.5 ;
+cat footer >> stapprobes.$i.5 ;
+# final polish
+sed -i -e 's/\*\/$//g' stapprobes.$i.5 ;
+done
+
+# cleanup
+for i in `ls | grep -v 'stapprobes.*.5'` ; do
+rm $i ;
+done
+
+rm ../manpageus ;
+cd ..
+mv workingdir man_pages
+echo " "
+echo "Finished! man pages generated in ./man_pages."
+echo " " \ No newline at end of file
diff --git a/doc/Tapset_Reference_Guide/publicanize.sh b/doc/Tapset_Reference_Guide/publicanize.sh
index d4da6e02..a97ae873 100755
--- a/doc/Tapset_Reference_Guide/publicanize.sh
+++ b/doc/Tapset_Reference_Guide/publicanize.sh
@@ -1,65 +1,112 @@
#!/bin/bash
+INFILE="../SystemTap_Tapset_Reference/tapsets.xml"
+OUTFILE="en-US/Tapset_Reference_Guide.xml"
+TMPFILE=`mktemp` || exit 1
+TMPFILE2=`mktemp` || exit 1
-#copy the automated tapsets.xml
-cp ../SystemTap_Tapset_Reference/tapsets.xml temp.xml ;
+do_help()
+{
+ echo "publicanize.sh: usage:
+ -?/--help this message
+ -i/--input=file input file name
+ -o/--output=file output file name
+" >&2
+}
+
+
+#process optional arguments -i -o
+while [ "$#" -ne 0 ]
+do
+ arg=`printf %s $1 | awk -F= '{print $1}'`
+ val=`printf %s $1 | awk -F= '{print $2}'`
+ shift
+ if test -z "$val"; then
+ local possibleval=$1
+ printf %s $1 "$possibleval" | grep ^- >/dev/null 2>&1
+ if test "$?" != "0"; then
+ val=$possibleval
+ if [ "$#" -ge 1 ]; then
+ shift
+ fi
+ fi
+ fi
+
+ case "$arg" in
+ -i|--input)
+ INFILE=$val
+ ;;
+ -o|--output)
+ OUTFILE=$val
+ ;;
+ -\?|--help)
+ do_help
+ exit 0
+ ;;
+ *)
+ echo "Unknown option \"$arg\". See opcontrol --help" >&2
+ exit 1
+ ;;
+ esac
+done
+
+
+#copy the generated tapsets.xml
+cp $INFILE $TMPFILE || exit 1
#remove all excess whitespace
-sed -i -e 's/^\s*//g' temp.xml ;
+sed -i -e 's/^\s*//g' $TMPFILE
-#remove marked Intro (starthere to endhere), then copy it to en-US
-sed '/starthere/,/endhere/d' temp.xml > Tapset_Reference_Guide.xml
-cp Tapset_Reference_Guide.xml en-US/Tapset_Reference_Guide.xml;
-rm Tapset_Reference_Guide.xml
+#remove marked Intro (starthere to endhere)
+sed -i -e '/starthere/,/endhere/d' $TMPFILE
#re-convert programlisting tags
-sed -i -e 's/&lt;programlisting&gt;/<programlisting>/g' en-US/Tapset_Reference_Guide.xml;
-sed -i -e 's/&lt;\/programlisting&gt;/<\/programlisting>/g' en-US/Tapset_Reference_Guide.xml;
+sed -i -e 's/&lt;programlisting&gt;/<programlisting>/g' $TMPFILE
+sed -i -e 's/&lt;\/programlisting&gt;/<\/programlisting>/g' $TMPFILE
#replace header
-cat en-US/Tapset_Reference_Guide.xml |
+cat $TMPFILE |
perl -p -e 'undef $/;s|<bookinfo>\n<title>SystemTap Tapset Reference Manual</title>|<xi:include href="Book_Info.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />\n<xi:include href="Preface.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />|msg' |
-perl -p -e 'undef $/;s|<authorgroup>\n<author>\n<firstname>William</firstname>\n<surname>Cohen</surname>\n<contrib></contrib>\n<affiliation>\n<address>\n<email>wcohen\@redhat.com</email>\n</address>\n</affiliation>\n</author>\n</authorgroup>||msg' |
-perl -p -e 'undef $/;s|<copyright>\n<year>2008, 2009</year>\n<holder>Red Hat, Inc.</holder>\n</copyright>||msg' |
-perl -p -e 'undef $/;s|<legalnotice>\n<para>\nThis documentation is free software\; you can redistribute\nit and/or modify it under the terms of the GNU General Public\nLicense version 2 as published by the Free Software Foundation.\n</para>||msg' |
-perl -p -e 'undef $/;s|<para>\nThis program is distributed in the hope that it will be\nuseful, but WITHOUT ANY WARRANTY; without even the implied\nwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\n</para>||msg' |
-perl -p -e 'undef $/;s|<para>\nYou should have received a copy of the GNU General Public\nLicense along with this program; if not, write to the Free\nSoftware Foundation, Inc., 59 Temple Place, Suite 330, Boston,\nMA 02111-1307 USA\n</para>||msg' |
-perl -p -e 'undef $/;s|<para>\nFor more details see the file COPYING in the source\ndistribution of Linux.\n</para>\n</legalnotice>\n</bookinfo>||msg' |
-perl -p -e 'undef $/;s|<toc></toc>||msg' |
+#perl -p -e 'undef $/;s|<authorgroup>\n<author>\n<othername>SystemTap</othername>\n<contrib>Hackers</contrib>\n</author>\n</authorgroup>||msg' |
+#perl -p -e 'undef $/;s|<copyright>\n<year>2008-2009</year>\n<holder>Red Hat, Inc. and others</holder>\n</copyright>||msg' |
+#perl -p -e 'undef $/;s|<legalnotice>\n<para>\nThis documentation is free software\; you can redistribute\nit and/or modify it under the terms of the GNU General Public\nLicense version 2 as published by the Free Software Foundation.\n</para>||msg' |
+#perl -p -e 'undef $/;s|<para>\nThis program is distributed in the hope that it will be\nuseful, but WITHOUT ANY WARRANTY; without even the implied\nwarranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\nSee the GNU General Public License for more details.\n</para>||msg' |
+#perl -p -e 'undef $/;s|<para>\nYou should have received a copy of the GNU General Public\nLicense along with this program; if not, write to the Free\nSoftware Foundation, Inc., 59 Temple Place, Suite 330, Boston,\nMA 02111-1307 USA\n</para>||msg' |
+#perl -p -e 'undef $/;s|<para>\nFor more details see the file COPYING in the source\ndistribution of Linux.\n</para>\n</legalnotice>\n</bookinfo>||msg' |
+#perl -p -e 'undef $/;s|<toc></toc>||msg' |
perl -p -e 'undef $/;s|\n\n\n\n\n\n\n\n\n\n\n\n\n\n||msg' |
perl -p -e 'undef $/;s|\n\n\n\n\n\n\n\n\n\n\n||msg' |
perl -p -e 'undef $/;s|<programlisting>\n|<programlisting>\n<emphasis>function <\/emphasis>|msg' |
perl -p -e 'undef $/;s|<para>\n</para>||msg' |
perl -p -e 'undef $/;s|<para>\n\n</para>||msg' |
perl -p -e 'undef $/;s|<para>\n<programlisting>|<programlisting>|msg' |
-perl -p -e 'undef $/;s|</programlisting>\n</para>|</programlisting>|msg' > clean.xml
+perl -p -e 'undef $/;s|</programlisting>\n</para>|</programlisting>|msg' > $TMPFILE2
#replace Intro with my own
-perl -p -i -e 's|<!--markerforxi-->|<xi:include href="Introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />\n<xi:include href="Tapset_Dev_Guide.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />|g' clean.xml
+perl -p -i -e 's|<!--markerforxi-->|<xi:include href="Introduction.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />\n<xi:include href="Tapset_Dev_Guide.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />|g' $TMPFILE2
#for tapset name format section
-#perl -p -i -e 'undef $/;s|<screen>\nname:return \(parameters\)\ndefinition\n</screen>|<screen>\n<replaceable>function/probe</replaceable> tapset_name:return \(parameters\)\n</screen>|msg' clean.xml
-#perl -p -i -e 's|<para>In this guide, tapset definitions appear in the following format:</para>|<para>In this guide, the synopsis of each tapset appears in the following format:</para>|g' clean.xml
-#perl -p -i -e 's|<!-- markerforxi pls dont remove -->|<xi:include href="tapsetnameformat-lastpara.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />\n<xi:include href="refentry-example.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />|g' clean.xml
+#perl -p -i -e 'undef $/;s|<screen>\nname:return \(parameters\)\ndefinition\n</screen>|<screen>\n<replaceable>function/probe</replaceable> tapset_name:return \(parameters\)\n</screen>|msg' $TMPFILE2
+#perl -p -i -e 's|<para>In this guide, tapset definitions appear in the following format:</para>|<para>In this guide, the synopsis of each tapset appears in the following format:</para>|g' $TMPFILE2
+#perl -p -i -e 's|<!-- markerforxi pls dont remove -->|<xi:include href="tapsetnameformat-lastpara.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />\n<xi:include href="refentry-example.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />|g' $TMPFILE2
-cp clean.xml en-US/Tapset_Reference_Guide.xml
-rm clean.xml
-
# statements change synopsis tags, as they are still currently unfixed in publican-redhat
-sed -i -e 's/refsynopsisdiv>/refsect1>/g' en-US/Tapset_Reference_Guide.xml;
-sed -i -e 's/refsect1>/refsection>/g' en-US/Tapset_Reference_Guide.xml;
-sed -i -e 's/synopsis>/programlisting>\n/g' en-US/Tapset_Reference_Guide.xml;
+sed -i -e 's/refsynopsisdiv>/refsect1>/g' $TMPFILE2
+sed -i -e 's/refsect1>/refsection>/g' $TMPFILE2
+sed -i -e 's/synopsis>/programlisting>\n/g' $TMPFILE2
# re-convert tags
-sed -i -e 's/&lt;emphasis&gt;/<emphasis>/g' en-US/Tapset_Reference_Guide.xml;
-sed -i -e 's/&lt;\/emphasis&gt;/<\/emphasis>/g' en-US/Tapset_Reference_Guide.xml;
+sed -i -e 's/&lt;emphasis&gt;/<emphasis>/g' $TMPFILE2
+sed -i -e 's/&lt;\/emphasis&gt;/<\/emphasis>/g' $TMPFILE2
-sed -i -e 's/&lt;remark&gt;/<remark>/g' en-US/Tapset_Reference_Guide.xml;
-sed -i -e 's/&lt;\/remark&gt;/<\/remark>/g' en-US/Tapset_Reference_Guide.xml;
+sed -i -e 's/&lt;remark&gt;/<remark>/g' $TMPFILE2
+sed -i -e 's/&lt;\/remark&gt;/<\/remark>/g' $TMPFILE2
-sed -i -e 's/&lt;command&gt;/<command>/g' en-US/Tapset_Reference_Guide.xml;
-sed -i -e 's/&lt;\/command&gt;/<\/command>/g' en-US/Tapset_Reference_Guide.xml;
+sed -i -e 's/&lt;command&gt;/<command>/g' $TMPFILE2
+sed -i -e 's/&lt;\/command&gt;/<\/command>/g' $TMPFILE2
#useful marker script; moves content between starthere and endhere to file target
-#sed -n '/starthere/,/endhere/ s/.*/&/w target' Tapset_Reference_Guide.xml \ No newline at end of file
+#sed -n '/starthere/,/endhere/ s/.*/&/w target' $TMPFILE2
+
+mv $TMPFILE2 $OUTFILE