--- HISTORY	2006/09/24 18:19:09
+++ HISTORY	2006/11/05 23:47:03
@@ -1,3 +1,11 @@
+OpenBSM 1.0 alpha 13
+
+- compat/clock_gettime.h now provides a compatibility implementation of
+  clock_gettime(), which fixes building on Mac OS X.
+- Countless man page fixes.
+- praudit XML support via "praudit -x".
+- audit.log.5 expanded to include additional BSM token types.
+
 OpenBSM 1.0 alpha 12
 
 - Correct bug in auditreduce which prevented the -c option from working
--- README	2006/08/23 06:16:19
+++ README	2006/11/05 23:30:33
@@ -76,6 +76,8 @@
     Martin Fong
     Pawel Worach
     Martin Englund
+    Ruslan Ermilov
+    Martin Voros
 
 In addition, Coverity, Inc.'s Prevent(tm) static analysis tool and Gimpel
 Software's FlexeLint tool were used to identify a number of bugs in the
--- TODO	2006/09/24 15:35:32
+++ TODO	2006/11/05 23:30:33
@@ -1,4 +1,3 @@
-- Teach praudit how to general XML format BSM streams.
 - Teach libbsm about any additional 64-bit token types that are present
   in more recent Solaris versions.
 - Build a regression test suite for libbsm that generates each token
--- VERSION	2006/09/21 22:37:23
+++ VERSION	2006/09/24 23:26:29
@@ -1,1 +1,1 @@
-OPENBSM_1_0_ALPHA_12
+OPENBSM_1_0_ALPHA_13
--- bin/audit/audit.8	2006/02/04 20:10:02
+++ bin/audit/audit.8	2006/10/05 12:05:39
@@ -2,20 +2,20 @@
 .\" All rights reserved.
 .\"
 .\" @APPLE_BSD_LICENSE_HEADER_START@
-.\" 
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
-.\" 
+.\"
 .\" 1.  Redistributions of source code must retain the above copyright
-.\"     notice, this list of conditions and the following disclaimer. 
+.\"     notice, this list of conditions and the following disclaimer.
 .\" 2.  Redistributions in binary form must reproduce the above copyright
 .\"     notice, this list of conditions and the following disclaimer in the
-.\"     documentation and/or other materials provided with the distribution. 
+.\"     documentation and/or other materials provided with the distribution.
 .\" 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 .\"     its contributors may be used to endorse or promote products derived
-.\"     from this software without specific prior written permission. 
-.\" 
+.\"     from this software without specific prior written permission.
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -26,32 +26,27 @@
 .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-.\" 
+.\"
 .\" @APPLE_BSD_LICENSE_HEADER_END@
 .\"
 .\" $P4$
 .\"
-.Dd January 24, 2004
+.Dd October 2, 2006
 .Dt AUDIT 8
 .Os
 .Sh NAME
 .Nm audit
 .Nd audit management utility
 .Sh SYNOPSIS
-.Nm audit
-.Op Fl nst
-.Op Ar file
+.Nm
+.Fl n | s | t
 .Sh DESCRIPTION
 The
-.Nm 
+.Nm
 utility controls the state of the audit system.
-The optional
-.Ar file
-operand specifies the location of the audit control input file (default
-.Pa /etc/security/audit_control ) .
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
+One of the following flags is required as an argument to
+.Nm :
+.Bl -tag -width indent
 .It Fl n
 Forces the audit system to close the existing audit log file and rotate to
 a new log file in a location specified in the audit control file.
@@ -69,22 +64,27 @@
 .Xr auditd 8
 daemon must already be running.
 .Sh FILES
-.Bl -tag -width "/etc/security/audit_control" -compact
+.Bl -tag -width ".Pa /etc/security/audit_control" -compact
 .It Pa /etc/security/audit_control
-Default audit policy file used to configure the auditing system.
+Audit policy file used to configure the auditing system.
 .El
 .Sh SEE ALSO
+.Xr audit 4 ,
 .Xr audit_control 5 ,
 .Xr auditd 8
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- bin/auditd/auditd.8	2006/09/18 14:32:34
+++ bin/auditd/auditd.8	2006/10/05 12:05:39
@@ -31,44 +31,33 @@
 .\"
 .\" $P4$
 .\"
-.Dd January 24, 2004
+.Dd October 2, 2006
 .Dt AUDITD 8
 .Os
 .Sh NAME
 .Nm auditd
 .Nd audit log management daemon
 .Sh SYNOPSIS
-.Nm auditd
-.Op Fl dhs
+.Nm
+.Op Fl d
 .Sh DESCRIPTION
 The
 .Nm
-daemon responds to requests from the audit(1) utility and notifications
-from the kernel.  It manages the resulting audit log files and specified
+daemon responds to requests from the
+.Xr audit 8
+utility and notifications
+from the kernel.
+It manages the resulting audit log files and specified
 log file locations.
 .Pp
 The options are as follows:
-.Bl -tag -width Ds
+.Bl -tag -width indent
 .It Fl d
-Starts the daemon in debug mode - it will not daemonize.
+Starts the daemon in debug mode \[em] it will not daemonize.
 .El
-.Pp
-The historical
-.Fl h
-and
-.Fl s
-flags are now configured using
-.Xr audit_control 5
-policy flags
-.Dv ahlt
-and
-.Dv cnt ,
-and are no longer available as arguments to
-.Xr auditd 8 .
 .Sh NOTE
-.Pp
 To assure uninterrupted audit support, the
-.Nm auditd
+.Nm
 daemon should not be started and stopped manually.
 Instead, the
 .Xr audit 8
@@ -78,28 +67,51 @@
 .Pa audit_control
 file.
 .Pp
-.\" Sending a SIGHUP to a running
-.\" .Nm auditd
+.\" Sending a
+.\" .Dv SIGHUP
+.\" to a running
+.\" .Nm
 .\" daemon will force it to exit.
-Sending a SIGTERM to a running
-.Nm auditd
+Sending a
+.Dv SIGTERM
+to a running
+.Nm
 daemon will force it to exit.
 .Sh FILES
-.Bl -tag -width "/var/audit" -compact
+.Bl -tag -width ".Pa /var/audit" -compact
 .It Pa /var/audit
 Default directory for storing audit log files.
 .El
+.Sh COMPATIBILITY
+The historical
+.Fl h
+and
+.Fl s
+flags are now configured using
+.Xr audit_control 5
+policy flags
+.Cm ahlt
+and
+.Cm cnt ,
+and are no longer available as arguments to
+.Nm .
 .Sh SEE ALSO
+.Xr audit 4 ,
+.Xr audit_control 5 ,
 .Xr audit 8
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- bin/auditd/auditd.c	2006/09/22 13:15:35
+++ bin/auditd/auditd.c	2006/10/02 20:03:55
@@ -896,7 +896,7 @@
 	int debug = 0;
 	int rc;
 
-	while ((ch = getopt(argc, argv, "dhs")) != -1) {
+	while ((ch = getopt(argc, argv, "d")) != -1) {
 		switch(ch) {
 		case 'd':
 			/* Debug option. */
--- bin/auditfilterd/auditfilterd.8	2006/03/28 13:35:41
+++ bin/auditfilterd/auditfilterd.8	2006/10/03 12:16:37
@@ -25,16 +25,17 @@
 .\"
 .\" $P4$
 .\"
-.Dd March 27, 2006
+.Dd October 3, 2006
 .Dt AUDITFILTERD 8
 .Os
 .Sh NAME
 .Nm auditfilterd
 .Nd audit filter daemon
 .Sh SYNOPSIS
-.Nm auditfilterd
+.Nm
 .Op Fl d
 .Op Fl c Ar conffile
+.Op Fl p Ar pipefile
 .Op Fl t Ar trailfile
 .Sh DESCRIPTION
 The
@@ -44,18 +45,23 @@
 It is configured using the
 .Xr audit_filter 5
 configuration file.
+The source can either be a pipe or a file.
 .Pp
 The options are as follows:
-.Bl -tag -width Ds
-.It Fl d
-Starts the daemon in debug mode - it will not daemonize.
+.Bl -tag -width indent
 .It Fl c Ar conffile
 Specify an alternative configuration file.
+.It Fl d
+Starts the daemon in debug mode \[em] it will not daemonize.
+.It Fl p Ar pipefile
+Specify a pipe as an alternative source of audit event records.
+Default is
+.Pa /dev/auditpipe .
 .It Fl t Ar trailfile
-Specify an alternative source of audit event records.
+Specify a file as an alternative source of audit event records.
 .El
 .Sh FILES
-.Bl -tag -width "/etc/security/audit_filterd" -compact
+.Bl -tag -width ".Pa /etc/security/audit_filterd" -compact
 .It Pa /etc/security/audit_filterd
 Default configuration file for
 .Nm .
@@ -66,12 +72,13 @@
 .Sh SEE ALSO
 .Xr audit 8 ,
 .Xr auditd 8
-.Sh AUTHORS
-The
-.Nm
-daemon and audit filter APIs were created by Robert Watson.
 .Sh HISTORY
 The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
 It was subsequently adopted by the TrustedBSD Project as the foundation for
 the OpenBSM distribution.
+.Sh AUTHORS
+The
+.Nm
+daemon and audit filter APIs were created by
+.An Robert Watson .
--- bin/auditfilterd/auditfilterd.c	2006/08/23 07:49:54
+++ bin/auditfilterd/auditfilterd.c	2006/10/03 12:16:37
@@ -48,6 +48,10 @@
 #include <compat/queue.h>
 #endif
 
+#ifndef HAVE_CLOCK_GETTIME
+#include <compat/clock_gettime.h>
+#endif
+
 #include <bsm/libbsm.h>
 #include <bsm/audit_filter.h>
 
@@ -76,7 +80,7 @@
 usage(void)
 {
 
-	fprintf(stderr, "auditfilterd [-c conffile] [-d] [-p pipefile]"
+	fprintf(stderr, "auditfilterd [-d] [-c conffile] [-p pipefile]"
 	    " [-t trailfile]\n");
 	fprintf(stderr, "  -c    Specify configuration file (default: %s)\n",
 	    AUDITFILTERD_CONFFILE);
--- bin/auditreduce/auditreduce.1	2006/09/24 15:36:33
+++ bin/auditreduce/auditreduce.1	2006/10/03 14:11:12
@@ -1,18 +1,18 @@
 .\" Copyright (c) 2004 Apple Computer, Inc.
 .\" All rights reserved.
-.\" 
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" 1.  Redistributions of source code must retain the above copyright
-.\"     notice, this list of conditions and the following disclaimer. 
+.\"     notice, this list of conditions and the following disclaimer.
 .\" 2.  Redistributions in binary form must reproduce the above copyright
 .\"     notice, this list of conditions and the following disclaimer in the
-.\"     documentation and/or other materials provided with the distribution. 
+.\"     documentation and/or other materials provided with the distribution.
 .\" 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 .\"     its contributors may be used to endorse or promote products derived
-.\"     from this software without specific prior written permission. 
-.\" 
+.\"     from this software without specific prior written permission.
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -34,44 +34,43 @@
 .Nm auditreduce
 .Nd "select records from audit trail files"
 .Sh SYNOPSIS
-.Nm auditreduce
+.Nm
 .Op Fl A
-.Op Fl a Ar YYYYMMDD[HH[MM[SS]]]
-.Op Fl b Ar YYYYMMDD[HH[MM[SS]]]
+.Op Fl a Ar YYYYMMDD Ns Op Ar HH Ns Op Ar MM Ns Op Ar SS
+.Op Fl b Ar YYYYMMDD Ns Op Ar HH Ns Op Ar MM Ns Op Ar SS
 .Op Fl c Ar flags
 .Op Fl d Ar YYYYMMDD
 .Op Fl e Ar euid
 .Op Fl f Ar egid
 .Op Fl g Ar rgid
+.Op Fl j Ar id
+.Op Fl m Ar event
+.Op Fl o Ar object Ns = Ns Ar value
 .Op Fl r Ar ruid
 .Op Fl u Ar auid
-.Op Fl j Ar id
-.Op Fl m Ar event
-.Op Fl o Ar object=value
-.Op Ar file ...
+.Op Ar
 .Sh DESCRIPTION
 The
-.Nm 
+.Nm
 utility selects records from the audit trail files based on the specified
 criteria.
 Matching audit records are printed to the standard output in
 their raw binary form.
-If no filename is specified, the standard input is used
+If no
+.Ar file
+argument is specified, the standard input is used
 by default.
-Use the 
-.Nm praudit
+Use the
+.Xr praudit 1
 utility to print the selected audit records in human-readable form.
-See
-.Xr praudit 1
-for more information.
 .Pp
 The options are as follows:
-.Bl -tag -width Ds
+.Bl -tag -width indent
 .It Fl A
 Select all records.
-.It Fl a Ar YYYYMMDD[HH[MM[SS]]]
+.It Fl a Ar YYYYMMDD Ns Op Ar HH Ns Op Ar MM Ns Op Ar SS
 Select records that occurred after or on the given datetime.
-.It Fl b Ar YYYYMMDD[HH[MM[SS]]]
+.It Fl b Ar YYYYMMDD Ns Op Ar HH Ns Op Ar MM Ns Op Ar SS
 Select records that occurred before the given datetime.
 .It Fl c Ar flags
 Select records matching the given audit classes specified as a comma
@@ -86,15 +85,11 @@
 or
 .Fl b .
 .It Fl e Ar euid
-Select records with the given effective user id or name.
+Select records with the given effective user ID or name.
 .It Fl f Ar egid
-Select records with the given effective group id or name.
+Select records with the given effective group ID or name.
 .It Fl g Ar rgid
-Select records with the given real group id or name.
-.It Fl r Ar ruid
-Select records with the given real user id or name.
-.It Fl u Ar auid
-Select records with the given audit id.
+Select records with the given real group ID or name.
 .It Fl j Ar id
 Select records having a subject token with matching ID.
 .It Fl m Ar event
@@ -102,82 +97,97 @@
 See
 .Xr audit_event 5
 for a description of audit event names and numbers.
-.It Fl o Ar object=value
-.Bl -tag -width Ds
-.It Nm file
+.It Fl o Ar object Ns = Ns Ar value
+.Bl -tag -width ".Cm msgqid"
+.It Cm file
 Select records containing path tokens, where the pathname matches
 one of the comma delimited extended regular expression contained in
 given specification.
-Regular expressions which are prefixed with a tilde (~) are excluded
+Regular expressions which are prefixed with a tilde
+.Pq Ql ~
+are excluded
 from the search results.
 These extended regular expressions are processed from left to right,
 and a path will either be selected or deslected based on the first match.
 .Pp
-Since commas are used to delimit the regular expressions, a backslash (\\)
-character should be used to escape the comma if it's a part of the search
+Since commas are used to delimit the regular expressions, a backslash
+.Pq Ql \e
+character should be used to escape the comma if it is a part of the search
 pattern.
-.It Nm msgqid
-Select records containing the given message queue id.
-.It Nm pid
-Select records containing the given process id.
-.It Nm semid
-Select records containing the given semaphore id.
-.It Nm shmid
-Select records containing the given shared memory id.
+.It Cm msgqid
+Select records containing the given message queue ID.
+.It Cm pid
+Select records containing the given process ID.
+.It Cm semid
+Select records containing the given semaphore ID.
+.It Cm shmid
+Select records containing the given shared memory ID.
 .El
+.It Fl r Ar ruid
+Select records with the given real user ID or name.
+.It Fl u Ar auid
+Select records with the given audit ID.
 .El
-.Sh Examples
-.Pp
+.Sh EXAMPLES
 To select all records associated with effective user ID root from the audit
 log
 .Pa /var/audit/20031016184719.20031017122634 :
+.Bd -literal -offset indent
+auditreduce -e root \e
+    /var/audit/20031016184719.20031017122634
+.Ed
 .Pp
-.Nm
--e root /var/audit/20031016184719.20031017122634
-.Pp
 To select all
 .Xr setlogin 2
 events from that log:
+.Bd -literal -offset indent
+auditreduce -m AUE_SETLOGIN \e
+    /var/audit/20031016184719.20031017122634
+.Ed
 .Pp
-.Nm
--m AUE_SETLOGIN /var/audit/20031016184719.20031017122634
-.Pp
 Output from the above command lines will typically be piped to a new trail
 file, or via standard output to the
 .Xr praudit 1
 command.
 .Pp
 Select all records containing a path token where the pathname contains
-.Pa /etc/master.passwd
+.Pa /etc/master.passwd :
+.Bd -literal -offset indent
+auditreduce -o file="/etc/master.passwd" \e
+    /var/audit/20031016184719.20031017122634
+.Ed
 .Pp
-.Nm
--ofile="/etc/master.passwd" /var/audit/20031016184719.20031017122634
-.Pp
 Select all records containing path tokens, where the pathname is a TTY
 device:
-.Pp
-.Nm
--ofile="/dev/tty[a-zA-Z][0-9]+" /var/audit/20031016184719.20031017122634
+.Bd -literal -offset indent
+auditreduce -o file="/dev/tty[a-zA-Z][0-9]+" \e
+    /var/audit/20031016184719.20031017122634
+.Ed
 .Pp
 Select all records containing path tokens, where the pathname is a TTY
 except for
-.Pa /dev/ttyp2
-.Pp
-.Nm
--ofile="~/dev/ttyp2,/dev/tty[a-zA-Z][0-9]+" /var/audit/20031016184719.20031017122634
+.Pa /dev/ttyp2 :
+.Bd -literal -offset indent
+auditreduce -o file="~/dev/ttyp2,/dev/tty[a-zA-Z][0-9]+" \e
+    /var/audit/20031016184719.20031017122634
+.Ed
 .Sh SEE ALSO
 .Xr praudit 1 ,
 .Xr audit_control 5 ,
 .Xr audit_event 5
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- bin/praudit/praudit.1	2006/02/04 18:31:05
+++ bin/praudit/praudit.1	2006/11/05 23:30:33
@@ -1,18 +1,18 @@
 .\" Copyright (c) 2004 Apple Computer, Inc.
 .\" All rights reserved.
-.\" 
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" 1.  Redistributions of source code must retain the above copyright
-.\"     notice, this list of conditions and the following disclaimer. 
+.\"     notice, this list of conditions and the following disclaimer.
 .\" 2.  Redistributions in binary form must reproduce the above copyright
 .\"     notice, this list of conditions and the following disclaimer in the
-.\"     documentation and/or other materials provided with the distribution. 
+.\"     documentation and/or other materials provided with the distribution.
 .\" 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 .\"     its contributors may be used to endorse or promote products derived
-.\"     from this software without specific prior written permission. 
-.\" 
+.\"     from this software without specific prior written permission.
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -27,71 +27,92 @@
 .\"
 .\" $P4$
 .\"
-.Dd January 24, 2004
+.Dd November 5, 2006
 .Dt PRAUDIT 1
 .Os
 .Sh NAME
 .Nm praudit
 .Nd "print the contents of audit trail files"
 .Sh SYNOPSIS
-.Nm praudit
-.Op Fl lrs
+.Nm
+.Op Fl lpx
+.Op Fl r | s
 .Op Fl d Ar del
-.Op Ar file ...
+.Op Ar
 .Sh DESCRIPTION
 The
-.Nm 
+.Nm
 utility prints the contents of the audit trail files to the standard output in
 human-readable form.
-If no filename is specified, the standard input is used
+If no
+.Ar file
+argument is specified, the standard input is used
 by default.
 .Pp
 The options are as follows:
-.Bl -tag -width Ds
+.Bl -tag -width indent
+.It Fl d Ar del
+Specifies the delimiter.
+The default delimiter is the comma.
 .It Fl l
 Prints the entire record on the same line.
 If this option is not specified,
 every token is displayed on a different line.
+.It Fl p
+Specify this option if input to
+.Nm
+is piped from the
+.Xr tail 1
+utility.
+This causes
+.Nm
+to sync to the start of the next record.
 .It Fl r
 Prints the records in their raw, numeric form.
-This option is exclusive from 
-.Fl s
+This option is exclusive from
+.Fl s .
 .It Fl s
 Prints the tokens in their short form.
 Short text representations for
 record and event type are displayed.
 This option is exclusive from
-.Fl  r
-.It Fl d Ar del
-Specifies the delimiter.
-The default delimiter is the comma.
+.Fl r .
+.It Fl x
+Print audit records in the XML output format.
 .El
 .Pp
 If the raw or short forms are not specified, the default is to print the tokens
 in their long form.
 Events are displayed as per their descriptions given in
 .Pa /etc/security/audit_event ;
-uids and gids are expanded to their names;
+UIDs and GIDs are expanded to their names;
 dates and times are displayed in human-readable format.
 .Sh FILES
-.Bl -tag -width "/etc/security/audit_control" -compact
+.Bl -tag -width ".Pa /etc/security/audit_control" -compact
 .It Pa /etc/security/audit_class
-Descriptions of audit event classes
+Descriptions of audit event classes.
 .It Pa /etc/security/audit_event
-Descriptions of audit events
+Descriptions of audit events.
 .El
 .Sh SEE ALSO
+.Xr auditreduce 1 ,
+.Xr audit 4 ,
+.Xr auditpipe 4 ,
 .Xr audit_class 5 ,
 .Xr audit_event 5
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- bin/praudit/praudit.c	2006/02/04 17:00:11
+++ bin/praudit/praudit.c	2006/11/05 23:30:33
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2004 Apple Computer, Inc.
+ * Copyright (c) 2006 Martin Voros
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,7 +35,7 @@
  */
 
 /*
- * praudit [-lrs] [-ddel] [filenames]
+ * praudit [-lpx] [-r | -s] [-d del] [file ...]
  */
 
 #include <bsm/libbsm.h>
@@ -51,12 +52,14 @@
 static int	 raw = 0;
 static int	 shortfrm = 0;
 static int	 partial = 0;
+static int	 xml = 0;
 
 static void
-usage()
+usage(void)
 {
 
-	fprintf(stderr, "Usage: praudit [-lrs] [-ddel] [filenames]\n");
+	fprintf(stderr, "usage: praudit [-lpx] [-r | -s] [-d del] "
+	    "[file ...]\n");
 	exit(1);
 }
 
@@ -88,11 +91,17 @@
 			if (-1 == au_fetch_tok(&tok, buf + bytesread,
 			    reclen - bytesread))
 				break;
-			au_print_tok(stdout, &tok, del, raw, shortfrm);
+			if (xml)
+				au_print_tok_xml(stdout, &tok, del, raw,
+				    shortfrm);
+			else
+				au_print_tok(stdout, &tok, del, raw,
+				    shortfrm);
 			bytesread += tok.len;
-			if (oneline)
-				printf("%s", del);
-			else
+			if (oneline) {
+				if (!xml)
+					printf("%s", del);
+			} else
 				printf("\n");
 		}
 		free(buf);
@@ -109,12 +118,20 @@
 	int i;
 	FILE *fp;
 
-	while ((ch = getopt(argc, argv, "lprsd:")) != -1) {
+	while ((ch = getopt(argc, argv, "d:lprsx")) != -1) {
 		switch(ch) {
+		case 'd':
+			del = optarg;
+			break;
+
 		case 'l':
 			oneline = 1;
 			break;
 
+		case 'p':
+			partial = 1;
+			break;
+
 		case 'r':
 			if (shortfrm)
 				usage();	/* Exclusive from shortfrm. */
@@ -127,12 +144,8 @@
 			shortfrm = 1;
 			break;
 
-		case 'd':
-			del = optarg;
-			break;
-
-		case 'p':
-			partial = 1;
+		case 'x':
+			xml = 1;
 			break;
 
 		case '?':
@@ -141,6 +154,9 @@
 		}
 	}
 
+	if (xml)
+		au_print_xml_header(stdout);
+
 	/* For each of the files passed as arguments dump the contents. */
 	if (optind == argc) {
 		print_tokens(stdin);
@@ -153,5 +169,9 @@
 		if (fp != NULL)
 			fclose(fp);
 	}
+
+	if (xml)
+		au_print_xml_footer(stdout);
+
 	return (1);
 }
--- bsm/audit_kevents.h	2006/09/22 11:13:41
+++ bsm/audit_kevents.h	2006/10/03 21:35:23
@@ -474,6 +474,28 @@
 #define	AUE_READDIR		43118	/* Linux. */
 #define	AUE_IOPL		43119	/* Linux. */
 #define	AUE_VM86		43120	/* Linux. */
+#define	AUE_MAC_GET_PROC	43121	/* FreeBSD. */
+#define	AUE_MAC_SET_PROC	43122	/* FreeBSD. */
+#define	AUE_MAC_GET_FD		43123	/* FreeBSD. */
+#define	AUE_MAC_GET_FILE	43124	/* FreeBSD. */
+#define	AUE_MAC_SET_FD		43125	/* FreeBSD. */
+#define	AUE_MAC_SET_FILE	43126	/* FreeBSD. */
+#define	AUE_MAC_SYSCALL		43127	/* FreeBSD. */
+#define	AUE_MAC_GET_PID		43128	/* FreeBSD. */
+#define	AUE_MAC_GET_LINK	43129	/* FreeBSD. */
+#define	AUE_MAC_SET_LINK	43130	/* FreeBSD. */
+#define	AUE_MAC_EXECVE		43131	/* FreeBSD. */
+#define	AUE_GETPATH_FROMFD	43132	/* FreeBSD. */
+#define	AUE_GETPATH_FROMADDR	43133	/* FreeBSD. */
+#define	AUE_KMQ_OPEN		43134	/* FreeBSD. */
+#define	AUE_KMQ_SETATTR		43135	/* FreeBSD. */
+#define	AUE_KMQ_TIMEDRECEIVE	43136	/* FreeBSD. */
+#define	AUE_KMQ_TIMEDSEND	43137	/* FreeBSD. */
+#define	AUE_KMQ_NOTIFY		43138	/* FreeBSD. */
+#define	AUE_KMQ_UNLINK		43139	/* FreeBSD. */
+#define	AUE_LISTEN		43140	/* FreeBSD/Darwin/Linux. */
+#define	AUE_MLOCKALL		43141	/* FreeBSD. */
+#define	AUE_MUNLOCKALL		43142	/* FreeBSD. */
 
 /*
  * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the
@@ -571,16 +593,13 @@
 #define	AUE_GETSOCKOPT		AUE_NULL
 #define	AUE_GTSOCKOPT		AUE_GETSOCKOPT	/* XXX: Typo in Darwin. */
 #define	AUE_ISSETUGID		AUE_NULL
-#define	AUE_LISTEN		AUE_NULL
 #define	AUE_LSTATV		AUE_NULL
 #define	AUE_MADVISE		AUE_NULL
 #define	AUE_MINCORE		AUE_NULL
 #define	AUE_MKCOMPLEX		AUE_NULL
-#define	AUE_MLOCKALL		AUE_NULL
 #define	AUE_MODWATCH		AUE_NULL
 #define	AUE_MSGCL		AUE_NULL
 #define	AUE_MSYNC		AUE_NULL
-#define	AUE_MUNLOCKALL		AUE_NULL
 #define	AUE_PREAD		AUE_NULL
 #define	AUE_PWRITE		AUE_NULL
 #define	AUE_PREADV		AUE_NULL
--- bsm/libbsm.h	2006/09/22 11:30:25
+++ bsm/libbsm.h	2006/11/05 23:30:33
@@ -771,6 +771,14 @@
 //XXX The following interface has different prototype from BSM
 void			 au_print_tok(FILE *outfp, tokenstr_t *tok,
 			    char *del, char raw, char sfrm);
+void			 au_print_tok_xml(FILE *outfp, tokenstr_t *tok,
+			    char *del, char raw, char sfrm);
+
+/* 
+ * Functions relating to XML output.
+ */
+void			 au_print_xml_header(FILE *outfp);
+void			 au_print_xml_footer(FILE *outfp);
 __END_DECLS
 
 /*
--- configure	2006/09/21 22:38:19
+++ configure	2006/09/24 23:27:29
@@ -1,7 +1,7 @@
 #! /bin/sh
-# From configure.ac P4: configure.ac#32 .
+# From configure.ac P4: configure.ac#33 .
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for OpenBSM 1.0a12.
+# Generated by GNU Autoconf 2.59 for OpenBSM 1.0a13.
 #
 # Report bugs to <trustedbsd-audit@TrustesdBSD.org>.
 #
@@ -424,8 +424,8 @@
 # Identity of this package.
 PACKAGE_NAME='OpenBSM'
 PACKAGE_TARNAME='openbsm'
-PACKAGE_VERSION='1.0a12'
-PACKAGE_STRING='OpenBSM 1.0a12'
+PACKAGE_VERSION='1.0a13'
+PACKAGE_STRING='OpenBSM 1.0a13'
 PACKAGE_BUGREPORT='trustedbsd-audit@TrustesdBSD.org'
 
 ac_unique_file="bin/auditreduce/auditreduce.c"
@@ -955,7 +955,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures OpenBSM 1.0a12 to adapt to many kinds of systems.
+\`configure' configures OpenBSM 1.0a13 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1021,7 +1021,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of OpenBSM 1.0a12:";;
+     short | recursive ) echo "Configuration of OpenBSM 1.0a13:";;
    esac
   cat <<\_ACEOF
 
@@ -1162,7 +1162,7 @@
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-OpenBSM configure 1.0a12
+OpenBSM configure 1.0a13
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1176,7 +1176,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by OpenBSM $as_me 1.0a12, which was
+It was created by OpenBSM $as_me 1.0a13, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -19278,7 +19278,7 @@
 
 # Define the identity of the package.
  PACKAGE=OpenBSM
- VERSION=1.0a12
+ VERSION=1.0a13
 
 
 cat >>confdefs.h <<_ACEOF
@@ -23479,7 +23479,7 @@
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by OpenBSM $as_me 1.0a12, which was
+This file was extended by OpenBSM $as_me 1.0a13, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -23542,7 +23542,7 @@
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-OpenBSM config.status 1.0a12
+OpenBSM config.status 1.0a13
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
--- configure.ac	2006/09/21 22:37:23
+++ configure.ac	2006/09/24 23:26:29
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([OpenBSM], [1.0a12], [trustedbsd-audit@TrustesdBSD.org],[openbsm])
+AC_INIT([OpenBSM], [1.0a13], [trustedbsd-audit@TrustesdBSD.org],[openbsm])
 AC_REVISION([$P4$])
 AC_CONFIG_SRCDIR([bin/auditreduce/auditreduce.c])
 AC_CONFIG_AUX_DIR(config)
--- etc/audit_event	2006/09/22 11:13:41
+++ etc/audit_event	2006/10/03 21:35:23
@@ -422,6 +422,28 @@
 43118:AUE_READDIR:readdir(3):no
 43119:AUE_IOPL:linux iopl:ad
 43120:AUE_VM86:linux vm86:pc
+43121:AUE_MAC_GET_PROC:mac_get_proc(2):pc
+43122:AUE_MAC_SET_PROC:mac_set_proc(2):pc
+43123:AUE_MAC_GET_FD:mac_get_fd(2):fa
+43124:AUE_MAC_GET_FILE:mac_get_file(2):fa
+43125:AUE_MAC_SET_FD:mac_set_fd(2):fm
+43126:AUE_MAC_SET_FILE:mac_set_file(2):fm
+43127:AUE_MAC_SYSCALL:mac_syscall(2):ad
+43128:AUE_MAC_GET_PID:mac_get_pid(2):pc
+43129:AUE_MAC_GET_LINK:mac_get_link(2):fa
+43130:AUE_MAC_SET_LINK:mac_set_link(2):fm
+43131:AUE_MAC_EXECVE:mac_exeve(2):ex,pc
+43132:AUE_GETPATH_FROMFD:getpath_fromfd(2):fa
+43133:AUE_GETPATH_FROMADDR:getpath_fromaddr(2):fa
+43134:AUE_KMQ_OPEN:mq_open(2):ip
+43135:AUE_KMQ_SETATTR:mq_setattr(2):ip
+43136:AUE_KMQ_TIMEDRECEIVE:mq_timedreceive(2):ip
+43137:AUE_KMQ_TIMEDSEND:mq_timedsend(2):ip
+43138:AUE_KMQ_NOTIFY:mq_notify(2):ip
+43139:AUE_KMQ_UNLINK:mq_unlink(2):ip
+43140:AUE_LISTEN:listen(2):nt
+43141:AUE_MLOCKALL:mlockall(2):pc
+43142:AUE_MUNLOCKALL:munlockall(2):pc
 #
 # User space system events.
 #
--- libbsm/au_class.3	2006/01/29 00:43:58
+++ libbsm/au_class.3	2006/10/05 19:57:21
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -35,69 +35,81 @@
 .Nm getauclassnam_r ,
 .Nm setauclass ,
 .Nm endauclass
-.Nd "Look up information from the audit_class database"
+.Nd "look up information from the audit_class database"
 .Sh LIBRARY
 .Lb libbsm
 .Sh SYNOPSIS
-.In libbsm.h
-.Ft struct au_class_ent *
-.Fn getauclassent "void"
-.Ft struct au_class_ent *
+.In bsm/libbsm.h
+.Ft "struct au_class_ent *"
+.Fn getauclassent void
+.Ft "struct au_class_ent *"
 .Fn getauclassent_r "struct au_class_ent *e"
-.Ft struct au_class_ent *
+.Ft "struct au_class_ent *"
 .Fn getauclassnam "const char *name"
-.Ft struct au_class_ent *
+.Ft "struct au_class_ent *"
 .Fn getauclassnam_r "struct au_class_ent *e" "const char *name"
 .Ft void
-.Fn setauclass "void"
+.Fn setauclass void
 .Ft void
-.Fn endauclass "void"
+.Fn endauclass void
 .Sh DESCRIPTION
 These interfaces may be used to look up information from the
 .Xr audit_class 5
 database, which describes audit event classes.
 Audit event classes are described by
-.Vt struct au_class_ent .
+.Vt "struct au_class_ent" .
 .Pp
-.Pp
+The
 .Fn getauclassent
+function
 will return the next class found in the
 .Xr audit_class 5
 database, or the first if the function has not yet been called.
 .Dv NULL
 will be returned if no further records are available.
 .Pp
+The
 .Fn getauclassnam
+function
 looks up a class by name.
 .Dv NULL
 will be returned if no matching class can be found.
 .Pp
+The
 .Fn setauclass
+function
 resets the iterator through the
 .Xr audit_class 5
 database, causing the next call to
 .Fn getauclassent
 to start again from the beginning of the file.
 .Pp
+The
 .Fn endauclass
+function
 closes the
 .Xr audit_class 5
 database, if open.
 .Sh SEE ALSO
 .Xr libbsm 3 ,
 .Xr audit_class 5
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
-This software was created by Robert Watson, Wayne Salamon, and Suresh
-Krishnaswamy for McAfee Research, the security research division of McAfee,
+.An -nosplit
+This software was created by
+.An Robert Watson ,
+.An Wayne Salamon ,
+and
+.An Suresh Krishnaswamy
+for McAfee Research, the security research division of McAfee,
 Inc., under contract to Apple Computer, Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
 .Sh BUGS
 These routines cannot currently distinguish between an entry not being found
 and an error accessing the database.
--- libbsm/au_control.3	2006/09/22 11:30:25
+++ libbsm/au_control.3	2006/10/05 19:57:21
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -37,17 +37,17 @@
 .Nm getacflg ,
 .Nm getacna ,
 .Nm getacpol ,
-.Nm au_poltostr
+.Nm au_poltostr ,
 .Nm au_strtopol
-.Nd "Look up information from the audit_control database"
+.Nd "look up information from the audit_control database"
 .Sh LIBRARY
 .Lb libbsm
 .Sh SYNOPSIS
-.In libbsm.h
+.In bsm/libbsm.h
 .Ft void
-.Fn setac "void"
+.Fn setac void
 .Ft void
-.Fn endac "void"
+.Fn endac void
 .Ft int
 .Fn getacdir "char *name" "int len"
 .Ft int
@@ -69,64 +69,88 @@
 .Xr audit_control 5
 database, which contains various audit-related administrative parameters.
 .Pp
+The
 .Fn setac
+function
 resets the database iterator to the beginning of the database; see the
-BUGS section for more information.
+.Sx BUGS
+section for more information.
 .Pp
+The
 .Fn sendac
+function
 closes the
 .Xr audit_control 5
 database.
 .Pp
+The
 .Fn getacdir
+function
 returns the name of the directory where log data is stored via the passed
 character buffer
-.Va name
+.Fa name
 of length
-.Va len .
+.Fa len .
 .Pp
+The
 .Fn getacmin
+function
 returns the minimum free disk space for the audit log target file system via
 the passed
-.Va min_val
+.Fa min_val
 variable.
 .Pp
+The
 .Fn getacfilesz
-returns the audit trail rotation size in the passed size_t buffer
+function
+returns the audit trail rotation size in the passed
+.Vt size_t
+buffer
 .Fa size_val .
 .Pp
+The
 .Fn getacflg
+function
 returns the audit system flags via the the passed character buffer
-.Va auditstr
+.Fa auditstr
 of length
-.Va len .
+.Fa len .
 .Pp
+The
 .Fn getacna
+function
 returns the non-attributable flags via the passed character buffer
-.Va auditstr
+.Fa auditstr
 of length
-.Va len .
+.Fa len .
 .Pp
+The
 .Fn getacpol
+function
 returns the audit policy flags via the passed character buffer
-.Va auditstr
+.Fa auditstr
 of length
-.Va len .
+.Fa len .
 .Pp
+The
 .Fn au_poltostr
+function
 converts a numeric audit policy mask,
-.Va policy ,
-value to a string in the passed character buffer
-.Va buf
+.Fa policy ,
+to a string in the passed character buffer
+.Fa buf
 of lenth
-.Va maxsize .
+.Fa maxsize .
 .Pp
+The
 .Fn au_strtopol
+function
 converts an audit policy flags string,
-.Va polstr ,
+.Fa polstr ,
 to a numeric audit policy mask returned via
-.Va policy .
+.Fa policy .
 .Sh RETURN VALULES
+The
 .Fn getacdir ,
 .Fn getacmin ,
 .Fn getacflg ,
@@ -134,11 +158,14 @@
 .Fn getacpol ,
 and
 .Fn au_strtopol
+functions
 return 0 on success, or a negative value on failure, along with error
 information in
 .Va errno .
 .Pp
+The
 .Fn au_poltostr
+function
 returns a string length of 0 or more on success, or a negative value on
 if there is a failure.
 .Pp
@@ -147,18 +174,23 @@
 .Sh SEE ALSO
 .Xr libbsm 3 ,
 .Xr audit_control 5
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
-This software was created by Robert Watson, Wayne Salamon, and Suresh
-Krishnaswamy for McAfee Research, the security research division of McAfee,
+.An -nosplit
+This software was created by
+.An Robert Watson ,
+.An Wayne Salamon ,
+and
+.An Suresh Krishnaswamy
+for McAfee Research, the security research division of McAfee,
 Inc., under contract to Apple Computer, Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
 .Sh BUGS
 These routines cannot currently distinguish between an entry not being found
 and an error accessing the database.
--- libbsm/au_event.3	2006/02/04 22:51:56
+++ libbsm/au_event.3	2006/10/05 19:57:21
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -39,76 +39,86 @@
 .Nm getauevnum ,
 .Nm getauevnum_r ,
 .Nm getauevnonam ,
-.Nm getauevnonam_r ,
-.Nd "Look up information from the audit_event database"
+.Nm getauevnonam_r
+.Nd "look up information from the audit_event database"
 .Sh LIBRARY
 .Lb libbsm
 .Sh SYNOPSIS
-.In libbsm.h
+.In bsm/libbsm.h
 .Ft void
-.Fn setauevent "void"
+.Fn setauevent void
 .Ft void
-.Fn endauevent "void"
+.Fn endauevent void
 .Ft "struct au_event_ent *"
-.Fn getauevent "void"
+.Fn getauevent void
 .Ft "struct au_event_ent *"
 .Fn getauevent_r "struct au_event_ent *e"
 .Ft "struct au_event_ent *"
-.Fn getauevnam "char *name"
+.Fn getauevnam "const char *name"
 .Ft "struct au_event_ent *"
-.Fn getauevnam_r "struct au_event_ent *e" "char *name"
+.Fn getauevnam_r "struct au_event_ent *e" "const char *name"
 .Ft "struct au_event_ent *"
 .Fn getauevnum "au_event_t event_number"
 .Ft "struct au_event_ent *"
 .Fn getauevnum_r "struct au_event_ent *e" "au_event_t event_number"
 .Ft "au_event_t *"
-.Fn getauevnonam "char *event_name"
+.Fn getauevnonam "const char *event_name"
 .Ft "au_event_t *"
-.Fn getauevnonam_r "au_event_t *ev" "char *event_name"
+.Fn getauevnonam_r "au_event_t *ev" "const char *event_name"
 .Sh DESCRIPTION
 These interfaces may be used to look up information from the
 .Xr audit_event 5
 database, which describes audit events.
 Entries in the database are described by
-.Vt struct au_event_ent
+.Vt "struct au_event_ent"
 entries, which are returned by calls to
 .Fn getauevent ,
 .Fn getauevnam ,
 or
 .Fn getauevnum .
-It is also possible look up an event number via a call to
-.Nm getauevnonam .
+It is also possible to look up an event number via a call to
+.Fn getauevnonam .
 .Pp
+The
 .Fn setauevent
+function
 resets the database access session for
 .Xr audit_event 5 ,
 so that the next call to
 .Fn getauevent
 will start with the first entry in the database.
 .Pp
+The
 .Fn endauevent
+function
 closes the
 .Xr audit_event 5
 database session.
 .Pp
+The
 .Fn getauevent
+function
 returns a reference to the next entry in the
 .Xr audit_event 5
 database.
 .Pp
+The
 .Fn getauevnam
+function
 returns a reference to the entry in the
 .Xr audit_event 5
 database with a name of
-.Va name .
+.Fa name .
 .Pp
 .Fn getauevnum
 returns a reference to the entry in the
 .Xr audit_event 5
 database with an event number of
-.Va event_number .
+.Fa event_number .
 .Pp
+The
 .Fn getauevnonam
+function
 returns a reference to an audit event number using the
 .Xr audit_event 5
 database.
@@ -123,30 +133,38 @@
 and
 .Fn getauevnuam
 will return a reference to a
-.Ft struct au_event_ent
+.Vt "struct au_event_ent"
 or
-.Ft au_event_t
+.Vt au_event_t
 on success, or
-.Dv NULL on failure, with
+.Dv NULL
+on failure, with
 .Va errno
 set to provide further error information.
 .Sh SEE ALSO
 .Xr libbsm 3 ,
 .Xr audit_event 5
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
-This software was created by Robert Watson, Wayne Salamon, and Suresh
-Krishnaswamy for McAfee Research, the security research division of McAfee,
+.An -nosplit
+This software was created by
+.An Robert Watson ,
+.An Wayne Salamon ,
+and
+.An Suresh Krishnaswamy
+for McAfee Research, the security research division of McAfee,
 Inc., under contract to Apple Computer, Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
 .Sh BUGS
+The
 .Va errno
+variable
 is not always properly set following a failure.
 .Pp
 These routines are thread-safe, but not re-entrant, so simultaneous or
--- libbsm/au_free_token.3	2006/02/04 22:51:56
+++ libbsm/au_free_token.3	2006/10/05 19:57:21
@@ -13,7 +13,7 @@
 .\"    documentation and/or other materials provided with the distribution.
 .\" 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 .\"     its contributors may be used to endorse or promote products derived
-.\"     from this software without specific prior written permission. 
+.\"     from this software without specific prior written permission.
 .\"
 .\" THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -34,11 +34,11 @@
 .Os
 .Sh NAME
 .Nm au_free_token
-.Nd "Deallocate a token_t created by any of the au_to_*() BSM API functions"
+.Nd "deallocate a token_t created by any of the au_to_*() BSM API functions"
 .Sh LIBRARY
 .Lb libbsm
 .Sh SYNOPSIS
-.In libbsm.h
+.In bsm/libbsm.h
 .Ft void
 .Fn au_free_token "token_t *tok"
 .Sh DESCRIPTION
@@ -48,44 +48,50 @@
 However, if
 .Xr au_write 3
 is passed a bad audit descriptor, the
-.Vt token_t *
+.Vt "token_t *"
 parameter will be left untouched.
 In that case, the caller can deallocate the
 .Vt token_t
 using
-.Nm
+.Fn au_free_token
 if desired.
 .Pp
 The
-.Va tok
+.Fa tok
 argument is a
-.Vt token_t *
-generated by one of the au_to_*() BSM API calls.
+.Vt "token_t *"
+generated by one of the
+.Fn au_to_*
+BSM API calls.
 For convenience,
-.Va tok
+.Fa tok
 may be
 .Dv NULL ,
 in which case
-.Nm
+.Fn au_free_token
 returns immediately.
 .Sh IMPLEMENTATION NOTES
 This is, in fact, what
 .Xr audit_write 3
 does, in keeping with the existing memory management model of the BSM API.
 .Sh SEE ALSO
+.Xr audit_write 3 ,
 .Xr au_write 3 ,
-.Xr audit_write 3 ,
 .Xr libbsm 3
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
-This software was created by Robert Watson, Wayne Salamon, and Suresh
-Krishnaswamy for McAfee Research, the security research division of McAfee,
+.An -nosplit
+This software was created by
+.An Robert Watson ,
+.An Wayne Salamon ,
+and
+.An Suresh Krishnaswamy
+for McAfee Research, the security research division of McAfee,
 Inc., under contract to Apple Computer, Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
-
--- libbsm/au_io.3	2006/01/29 00:43:58
+++ libbsm/au_io.3	2006/10/05 19:57:21
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -32,15 +32,17 @@
 .Nm au_fetch_tok ,
 .Nm au_print_tok ,
 .Nm au_read_rec
-.Nd "Perform I/O involving an audit record"
+.Nd "perform I/O involving an audit record"
 .Sh LIBRARY
 .Lb libbsm
 .Sh SYNOPSIS
-.In libbsm.h
+.In bsm/libbsm.h
 .Ft int
 .Fn au_fetch_tok "tokenstr_t *tok" "u_char *buf" "int len"
 .Ft void
-.Fn au_print_tok "FILE outfp" "tokenstr_t *tok" "char *del" "char raw" "char sfrm"
+.Fo au_print_tok
+.Fa "FILE *outfp" "tokenstr_t *tok" "char *del" "char raw" "char sfrm"
+.Fc
 .Ft int
 .Fn au_read_rec "FILE *fp" "u_char **buf"
 .Sh DESCRIPTION
@@ -48,31 +50,37 @@
 internalizing an audit record from a byte stream, converting a token to
 either a raw or default string, and reading a single record from a file.
 .Pp
+The
 .Fn au_fetch_tok
+function
 reads a token from the passed buffer
-.Va buf
+.Fa buf
 of length
-.Va len
+.Fa len
 bytes, and returns a pointer to the token via
-.Va tok .
+.Fa tok .
 .Pp
+The
 .Fn au_print_tok
+function
 prints a string form of the token
-.Va tok
+.Fa tok
 to the file output stream
-.Va outfp,
+.Fa outfp ,
 either in default mode, or raw mode if
-.Va raw
+.Fa raw
 is set non-zero.
 The delimiter
-.Va del
+.Fa del
 is used when printing.
 .Pp
+The
 .Fn au_read_rec
+function
 reads an audit record from the file stream
-.Va fp ,
+.Fa fp ,
 and returns an allocated memory buffer containing the record via
-.Va *buf ,
+.Fa *buf ,
 which must be freed by the caller using
 .Xr free 3 .
 .Pp
@@ -93,27 +101,36 @@
 Finally, the source stream would be closed by a call to
 .Xr fclose 3 .
 .Sh RETURN VALUES
+The
 .Fn au_fetch_tok
 and
 .Fn au_read_rec
-return 0 on success, or -1 on failure along with additional error information
+functions
+return 0 on success, or \-1 on failure along with additional error information
 returned via
 .Va errno .
 .Sh SEE ALSO
 .Xr free 3 ,
 .Xr libbsm 3
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
-This software was created by Robert Watson, Wayne Salamon, and Suresh
-Krishnaswamy for McAfee Research, the security research division of McAfee,
+.An -nosplit
+This software was created by
+.An Robert Watson ,
+.An Wayne Salamon ,
+and
+.An Suresh Krishnaswamy
+for McAfee Research, the security research division of McAfee,
 Inc., under contract to Apple Computer, Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
 .Sh BUGS
+The
 .Va errno
+variable
 may not always be properly set in the event of an error.
--- libbsm/au_mask.3	2006/02/04 22:51:56
+++ libbsm/au_mask.3	2006/10/05 19:57:21
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -32,11 +32,11 @@
 .Nm au_preselect ,
 .Nm getauditflagsbin ,
 .Nm getauditflagschar
-.Nd "Convert between string and numeric values of audit masks"
+.Nd "convert between string and numeric values of audit masks"
 .Sh LIBRARY
 .Lb libbsm
 .Sh SYNOPSIS
-.In libbsm.h
+.In bsm/libbsm.h
 .Ft int
 .Fn au_preselect "au_event_t event" "au_mask_t *mask_p" "int sorf" "int flag"
 .Ft int
@@ -49,13 +49,15 @@
 including conversion between numeric and text formats, and computing whether
 or not an event is matched by a mask.
 .Pp
+The
 .Fn au_preselect
+function
 calculates whether or not the audit event passed via
-.Va event
+.Fa event
 is matched by the audit mask passed via
-.Va au_mask_t .
+.Fa mask_p .
 The
-.Va sorf
+.Fa sorf
 argument indicates whether or not to consider the event as a success,
 if the
 .Dv AU_PRS_SUCCESS
@@ -63,7 +65,7 @@
 .Dv AU_PRS_FAILURE
 flag is set.
 The
-.Va flag
+.Fa flag
 argument accepts additional arguments influencing the behavior of
 .Fn au_preselect ,
 including
@@ -73,64 +75,78 @@
 .Dv AU_PRS_USECACHE
 which forces use of the cache.
 .Pp
+The
 .Fn getauditflagsbin
+function
 converts a string representation of an audit mask passed via a character
 string pointed to by
-.Va auditstr ,
+.Fa auditstr ,
 returning the resulting mask, if valid, via
-.Va *masks .
+.Fa *masks .
 .Pp
+The
 .Fn getauditflagschar
+function
 converts the audit event mask passed via
-.Va *masks
+.Fa *masks
 and converts it to a character string in a buffer pointed to by
-.Va auditstr .
-See the BUGS section for more information on how to provide a buffer of
+.Fa auditstr .
+See the
+.Sx BUGS
+section for more information on how to provide a buffer of
 sufficient size.
 If the
-.Va verbose
+.Fa verbose
 flag is set, the class description string retrieved from
 .Xr audit_class 5
 will be used; otherwise, the two-character class name.
+.Sh IMPLEMENTATION NOTES
+The
+.Fn au_preselect
+function
+makes implicit use of various audit database routines, and may influence
+the behavior of simultaneous or interleaved processing of those databases by
+other code.
 .Sh RETURN VALUES
+The
 .Fn au_preselect
-returns 0 on success, or returns -1 if there is a failure looking up the
+function
+returns 0 on success, or returns \-1 if there is a failure looking up the
 event type or other database access, in which case
 .Va errno
 will be set to indicate the error.
 It returns 1 if the event is matched; 0 if not.
 .Pp
-.Fn getauditflagsbin
-and
-.Fn getauditflagschar
-returns 0 on success, or -1 if there is a failure, in which case
-.Va errno
-will be set to indicate the error.
-.Sh IMPLEMENTATION NOTES
-.Fn au_preselect
-makes implicit use of various audit database routines, and may influence
-the behavior of simultaneous or interleaved processing of those databases by
-other code.
+.Rv -std getauditflagsbin getauditflagschar
 .Sh SEE ALSO
 .Xr libbsm 3 ,
 .Xr audit_class 5
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
-This software was created by Robert Watson, Wayne Salamon, and Suresh
-Krishnaswamy for McAfee Research, the security research division of McAfee,
+.An -nosplit
+This software was created by
+.An Robert Watson ,
+.An Wayne Salamon ,
+and
+.An Suresh Krishnaswamy
+for McAfee Research, the security research division of McAfee,
 Inc., under contract to Apple Computer, Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
 .Sh BUGS
+The
 .Va errno
+variable
 may not always be properly set in the event of an error.
 .Pp
+The
 .Fn getauditflagschar
+function
 does not provide a way to indicate how long the character buffer is, in order
 to detect overflow.
 As a result, the caller must always provide a buffer of sufficient length for
--- libbsm/au_open.3	2006/09/19 10:04:36
+++ libbsm/au_open.3	2006/10/05 19:57:21
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -34,13 +34,13 @@
 .Nm au_close_token ,
 .Nm au_open ,
 .Nm au_write
-.Nd "Create and commit audit records"
+.Nd "create and commit audit records"
 .Sh LIBRARY
 .Lb libbsm
 .Sh SYNOPSIS
-.In libbsm.h
+.In bsm/libbsm.h
 .Ft int
-.Fn au_open "void"
+.Fn au_open void
 .Ft int
 .Fn au_write "int d" "token_t *tok"
 .Ft int
@@ -73,7 +73,7 @@
 abandon the record.
 In either cases, all resources associated with the record will be released.
 The
-.Va keep
+.Fa keep
 argument determines the behavior: a value of
 .Dv AU_TO_WRITE
 causes the record to be committed; a value of
@@ -81,28 +81,30 @@
 causes it to be abandoned.
 When the audit record is committed, a BSM header will be inserted before
 tokens added to the record, using the event identifier passed via
-.Va event ,
+.Fa event ,
 and a trailer added to the end.
 Committing a record to the system audit log requires privilege.
 .Pp
 The
 .Fn au_close_buffer
 function writes the resulting record to an in-memory buffer of size
-.Va *buflen ;
+.Fa *buflen ;
 it will write back the filled buffer length into the same variable.
 The argument
-.Va short
+.Fa event
 is the event identifier to use in the record header.
 .Pp
 The
 .Fn au_close_token
 function generates the BSM stream output for a single token,
-.Va tok ,
+.Fa tok ,
 in the passed buffer
-.Va buffer .
+.Fa buffer .
 The initial buffer size and resulting data size are passed via
-.Va *buflen .
+.Fa *buflen .
+The
 .Fn au_close_token
+function
 will free the token before returning.
 .Sh RETURN VALUES
 The function
@@ -123,18 +125,23 @@
 .Sh SEE ALSO
 .Xr audit_submit 3 ,
 .Xr libbsm 3
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
-This software was created by Robert Watson, Wayne Salamon, and Suresh
-Krishnaswamy for McAfee Research, the security research division of McAfee,
+.An -nosplit
+This software was created by
+.An Robert Watson ,
+.An Wayne Salamon ,
+and
+.An Suresh Krishnaswamy
+for McAfee Research, the security research division of McAfee,
 Inc., under contract to Apple Computer, Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
 .Sh BUGS
 Currently,
 .Fn au_open
--- libbsm/au_token.3	2006/07/11 00:07:01
+++ libbsm/au_token.3	2006/10/05 19:57:21
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -38,7 +38,7 @@
 .Nm au_to_groups ,
 .Nm au_to_newgroups ,
 .Nm au_to_in_addr ,
-.Nm au_to_in_addr_ex ,  
+.Nm au_to_in_addr_ex ,
 .Nm au_to_ip ,
 .Nm au_to_ipc ,
 .Nm au_to_ipc_perm ,
@@ -72,103 +72,133 @@
 .Nm au_to_header ,
 .Nm au_to_header32 ,
 .Nm au_to_header64 ,
-.Nm au_to_trailer .
-.Nd "Routines for generating BSM audit tokens"
+.Nm au_to_trailer
+.Nd "routines for generating BSM audit tokens"
 .Sh LIBRARY
 .Lb libbsm
 .Sh SYNOPSIS
-.In libbsm.h
-.Ft token_t *
+.In bsm/libbsm.h
+.Ft "token_t *"
 .Fn au_to_arg32 "char n" "char *text" "u_int32_t v"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_arg64 "char n" "char *text" "u_int64_t v"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_arg "char n" "char *text" "u_int32_t v"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_attr32 "struct vattr *attr"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_attr64 "struct vattr *attr"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_attr "struct vattr *attr"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_data "char unit_print" "char unit_type" "char unit_count" "char *p"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_exit "int retval" "int err"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_groups "int *groups"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_newgroups "u_int16_t n" "gid_t *groups"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_in_addr "struct in_addr *internet_addr"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_in_addr_ex "struct in6_addr *internet_addr"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_ip "struct ip *ip"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_ipc "char type" "int id"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_ipc_perm "struct ipc_perm *perm"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_iport "u_int16_t iport"
-.Ft token_t *
-.Fn au_to_opaque "char *data" "u_int64_t bytes"
-.Ft token_t *
+.Ft "token_t *"
+.Fn au_to_opaque "char *data" "u_int16_t bytes"
+.Ft "token_t *"
 .Fn au_to_file "char *file" "struct timeval tm"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_text "char *text"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_path "char *text"
-.Ft token_t *
-.Fn au_to_process32 "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid" "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
-.Ft token_t *
-.Fn au_to_process64 "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid" "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
-.Ft token_t *
-.Fn au_to_process32_ex "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid" "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
-.Ft token_t *
-.Fn au_to_process64_ex "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid" "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
-.Ft token_t *
+.Ft "token_t *"
+.Fo au_to_process32
+.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
+.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
+.Fc
+.Ft "token_t *"
+.Fo au_to_process64
+.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
+.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
+.Fc
+.Ft "token_t *"
+.Fo au_to_process32_ex
+.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
+.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
+.Fc
+.Ft "token_t *"
+.Fo au_to_process64_ex
+.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
+.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
+.Fc
+.Ft "token_t *"
 .Fn au_to_return32 "char status" "u_int32_t ret"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_return64 "char status" "u_int64_t ret"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_return "char status" "u_int32_t ret"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_seq "long audit_count"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_sock_inet32 "struct sockaddr_in *so"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_sock_inet128 "struct sockaddr_in6 *so"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_sock_int "struct sockaddr_in *so"
-.Ft token_t *
-.Fn au_to_subject32 "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid" "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
-.Ft token_t *
-.Fn au_to_subject64 "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid" "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
-.Ft token_t *
-.Fn au_to_subject "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid" "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
-.Ft token_t *
-.Fn au_to_subject32_ex "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid" "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
-.Ft token_t *
-.Fn au_to_subject64_ex "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid" "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
-.Ft token_t *
-.Fn au_to_subject_ex "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid" "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
-.Ft token_t *
-.Fn au_to_me "void"
-.Ft token_t *
+.Ft "token_t *"
+.Fo au_to_subject32
+.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
+.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
+.Fc
+.Ft "token_t *"
+.Fo au_to_subject64
+.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
+.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
+.Fc
+.Ft "token_t *"
+.Fo au_to_subject
+.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
+.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_t *tid"
+.Fc
+.Ft "token_t *"
+.Fo au_to_subject32_ex
+.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
+.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
+.Fc
+.Ft "token_t *"
+.Fo au_to_subject64_ex
+.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
+.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
+.Fc
+.Ft "token_t *"
+.Fo au_to_subject_ex
+.Fa "au_id_t auid" "uid_t euid" "gid_t egid" "uid_t ruid"
+.Fa "gid_t rgid" "pid_t pid" "au_asid_t sid" "au_tid_addr_t *tid"
+.Fc
+.Ft "token_t *"
+.Fn au_to_me void
+.Ft "token_t *"
 .Fn au_to_exec_args "char **argv"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_exec_env "char **envp"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_header "int rec_size" "au_event_t e_type" "au_emod_t emod"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_header32 "int rec_size" "au_event_t e_type" "au_emod_t emod"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_header64 "int rec_size" "au_event_t e_type" "au_emod_t e_mod"
-.Ft token_t *
+.Ft "token_t *"
 .Fn au_to_trailer "int rec_size"
 .Sh DESCRIPTION
 These interfaces support the allocation of BSM audit tokens, represented by
-.Ft token_t ,
+.Vt token_t ,
 for various data types.
 .Sh RETURN VALUES
 On success, a pointer to a
@@ -183,16 +213,20 @@
 .Va errno .
 .Sh SEE ALSO
 .Xr libbsm 3
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
-This software was created by Robert Watson, Wayne Salamon, and Suresh
-Krishnaswamy for McAfee Research, the security research division of McAfee,
+.An -nosplit
+This software was created by
+.An Robert Watson ,
+.An Wayne Salamon ,
+and
+.An Suresh Krishnaswamy
+for McAfee Research, the security research division of McAfee,
 Inc., under contract to Apple Computer, Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
-.Sh BUGS
--- libbsm/au_user.3	2006/02/04 22:51:56
+++ libbsm/au_user.3	2006/10/05 19:57:21
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -37,27 +37,29 @@
 .Nm getauusernam_r ,
 .Nm au_user_mask ,
 .Nm getfauditflags
-.Nd "Look up information from the audit_user database"
+.Nd "look up information from the audit_user database"
 .Sh LIBRARY
 .Lb libbsm
 .Sh SYNOPSIS
-.In libbsm.h
+.In bsm/libbsm.h
 .Ft void
-.Fn setauuser "void"
+.Fn setauuser void
 .Ft void
-.Fn endauuser "void"
-.Ft struct au_user_ent *
-.Fn getauuserent "void"
-.Ft struct au_user_ent *
-.Fn getauuserent_r "struct au_user_ent *u" "void"
-.Ft struct au_user_ent *
+.Fn endauuser void
+.Ft "struct au_user_ent *"
+.Fn getauuserent void
+.Ft "struct au_user_ent *"
+.Fn getauuserent_r "struct au_user_ent *u"
+.Ft "struct au_user_ent *"
 .Fn getauusernam "const char *name"
-.Ft struct au_user_ent *
+.Ft "struct au_user_ent *"
 .Fn getauusernam_r "struct au_user_ent *u" "const char *name"
 .Ft int
 .Fn au_user_mask "char *username" "au_mask_t *mask_p"
 .Ft int
-.Fn getfauditflags "au_mask_t *usremask" "au_mask_t *usrdmask" "au_mask_t *lastmask"
+.Fo getfauditflags
+.Fa "au_mask_t *usremask" "au_mask_t *usrdmask" "au_mask_t *lastmask"
+.Fc
 .Sh DESCRIPTION
 These interfaces may be used to look up information from the
 .Xr audit_user 5
@@ -65,41 +67,51 @@
 Audit user entries are described by a
 .Vt au_user_ent ,
 which stores the user's name in
-.Dv au_name ,
+.Va au_name ,
 events to always audit in
-.Dv au_always ,
+.Va au_always ,
 and events never to audit
-.Dv au_never .
+.Va au_never .
 .Pp
+The
 .Fn getauuserent
+function
 returns the next user found in the
 .Xr audit_user 5
 database, or the first if the function has not yet been called.
 .Dv NULL
 will be returned if no further records are available.
 .Pp
+The
 .Fn getauusernam
+function
 looks up a user by name.
 .Dv NULL
 will be returned if no matching class can be found.
 .Pp
+The
 .Fn setauuser
+function
 resets the iterator through the
 .Xr audit_user 5
 database, causing the next call to
 .Fn getauuserent
 to start again from the beginning of the file.
 .Pp
+The
 .Fn endauuser
+function
 closes the
 .Xr audit_user 5
 database, if open.
 .Pp
-.Nm au_user_mask
+The
+.Fn au_user_mask
+function
 calculates a new session audit mask to be returned via
-.Dv mask_p
+.Fa mask_p
 for the user identified by
-.Dv username .
+.Fa username .
 If the user audit configuration is not found, the default system audit
 properties returned by
 .Xr getacflg 3 .
@@ -107,25 +119,32 @@
 .Xr setaudit 3
 or related variants.
 .Pp
-.Nm getfauditflags
+The
+.Fn getfauditflags
+function
 XXXXXXXXXXXXXXXXX
 .Sh SEE ALSO
+.Xr getacflg 3 ,
 .Xr libbsm 3 ,
-.Xr getacflg 3 ,
 .Xr setaudit 3 ,
 .Xr audit_user 5
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
-This software was created by Robert Watson, Wayne Salamon, and Suresh
-Krishnaswamy for McAfee Research, the security research division of McAfee,
+.An -nosplit
+This software was created by
+.An Robert Watson ,
+.An Wayne Salamon ,
+and
+.An Suresh Krishnaswamy
+for McAfee Research, the security research division of McAfee,
 Inc., under contract to Apple Computer, Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
 .Sh BUGS
 These routines cannot currently distinguish between an entry not being found
 and an error accessing the database.
--- libbsm/audit_submit.3	2006/05/29 20:21:40
+++ libbsm/audit_submit.3	2006/10/05 19:57:21
@@ -34,16 +34,19 @@
 .Os
 .Sh NAME
 .Nm audit_submit
-.Nd general purpose audit record submission
+.Nd "general purpose audit record submission"
 .Sh LIBRARY
 .Lb libbsm
 .Sh SYNOPSIS
-.In stdio.h
+.In bsm/libbsm.h
 .Ft int
-.Fn audit_submit "short au_event" "au_id_t auid" "char status" "int reterr" "const char * restrict format" ...
+.Fo audit_submit
+.Fa "short au_event" "au_id_t auid" "char status"
+.Fa "int reterr" "const char * restrict format" ...
+.Fc
 .Sh DESCRIPTION
 The
-.Nm
+.Fn audit_submit
 function provides a generic programming interface for audit record submission.
 This audit record will contain a header, subject token, an optional text token,
 return token, and a trailer.
@@ -66,14 +69,16 @@
 are converted for output.
 If
 .Fa format
-is NULL, then no text token is created in the audit record.
+is
+.Dv NULL ,
+then no text token is created in the audit record.
 .Pp
 It should be noted that
-.Nm
+.Fn audit_submit
 assumes that
 .Xr setaudit 2 ,
 or
-.Xr setaudit_addr 2 
+.Xr setaudit_addr 2
 has already been called.
 As a direct result, the terminal ID for the
 subject will be retrieved from the kernel via
@@ -116,11 +121,12 @@
 .Xr stdarg 3
 .Sh HISTORY
 The
-.Nm
+.Fn audit_submit
 function first appeared in OpenBSM version 1.0.
-OpenBSM 1.0 was introduced in FreeBSD 7.0.
+OpenBSM 1.0 was introduced in
+.Fx 7.0 .
 .Sh AUTHORS
 The
-.Nm
+.Fn audit_submit
 function was written by
 .An Christian S.J. Peron Aq csjp@FreeBSD.org .
--- libbsm/bsm_io.c	2006/09/19 08:27:50
+++ libbsm/bsm_io.c	2006/11/05 23:30:33
@@ -2,6 +2,7 @@
  * Copyright (c) 2004 Apple Computer, Inc.
  * Copyright (c) 2005 SPARTA, Inc.
  * Copyright (c) 2006 Robert N. M. Watson
+ * Copyright (c) 2006 Martin Voros
  * All rights reserved.
  *
  * This code was developed in part by Robert N. M. Watson, Senior Principal
@@ -126,6 +127,12 @@
 } while (0)
 
 /*
+ * XML option.
+ */
+#define	AU_PLAIN	0
+#define	AU_XML		1
+
+/*
  * Prints the delimiter string.
  */
 static void
@@ -207,16 +214,334 @@
 }
 
 /*
+ * Prints the beggining of attribute.
+ */
+static void
+open_attr(FILE *fp, u_char *str)
+{
+
+	fprintf(fp,"%s=\"", str);
+}
+
+/*
+ * Prints the end of attribute.
+ */
+static void
+close_attr(FILE *fp)
+{
+
+	fprintf(fp,"\" ");
+}
+
+/*
+ * Prints the end of tag.
+ */
+static void
+close_tag(FILE *fp, u_char type)
+{
+
+	switch(type) {
+	case AUT_HEADER32:
+		fprintf(fp, ">");
+		break;
+
+	case AUT_HEADER32_EX:
+		fprintf(fp, ">");
+		break;
+
+	case AUT_HEADER64:
+		fprintf(fp, ">");
+		break;
+
+	case AUT_HEADER64_EX:
+		fprintf(fp, ">");
+		break;
+
+	case AUT_ARG32:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_ARG64:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_ATTR32:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_ATTR64:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_EXIT:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_EXEC_ARGS:
+		fprintf(fp, "</exec_args>");
+		break;
+
+	case AUT_EXEC_ENV:
+		fprintf(fp, "</exec_env>");
+		break;
+
+	case AUT_OTHER_FILE32:
+		fprintf(fp, "</file>");
+		break;
+
+	case AUT_NEWGROUPS:
+		fprintf(fp, "</group>");
+		break;
+
+	case AUT_IN_ADDR:
+		fprintf(fp, "</ip_address>");
+		break;
+
+	case AUT_IN_ADDR_EX:
+		fprintf(fp, "</ip_address>");
+		break;
+
+	case AUT_IP:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_IPC:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_IPC_PERM:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_IPORT:
+		fprintf(fp, "</ip_port>");
+		break;
+
+	case AUT_OPAQUE:
+		fprintf(fp, "</opaque>");
+		break;
+
+	case AUT_PATH:
+		fprintf(fp, "</path>");
+		break;
+
+	case AUT_PROCESS32:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_PROCESS32_EX:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_RETURN32:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_RETURN64:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_SEQ:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_SOCKET:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_SOCKINET32:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_SOCKUNIX:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_SUBJECT32:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_SUBJECT64:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_SUBJECT32_EX:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_TEXT:
+		fprintf(fp, "</text>");
+		break;
+
+	case AUT_SOCKET_EX:
+		fprintf(fp, "/>");
+		break;
+
+	case AUT_DATA:
+		fprintf(fp, "</arbitrary>");
+		break;
+	}
+}
+
+/*
  * Prints the token type in either the raw or the default form.
  */
 static void
-print_tok_type(FILE *fp, u_char type, const char *tokname, char raw)
+print_tok_type(FILE *fp, u_char type, const char *tokname, char raw, int xml)
 {
 
-	if (raw)
-		fprintf(fp, "%u", type);
-	else
-		fprintf(fp, "%s", tokname);
+	if (xml) {
+		switch(type) {
+		case AUT_HEADER32:
+			fprintf(fp, "<record ");
+			break;
+
+		case AUT_HEADER32_EX:
+			fprintf(fp, "<record ");
+			break;
+
+		case AUT_HEADER64:
+			fprintf(fp, "<record ");
+			break;
+
+		case AUT_HEADER64_EX:
+			fprintf(fp, "<record ");
+			break;
+
+		case AUT_TRAILER:
+			fprintf(fp, "</record>");
+			break;
+
+		case AUT_ARG32:
+			fprintf(fp, "<argument ");
+			break;
+
+		case AUT_ARG64:
+			fprintf(fp, "<argument ");
+			break;
+
+		case AUT_ATTR32:
+			fprintf(fp, "<attribute ");
+			break;
+
+		case AUT_ATTR64:
+			fprintf(fp, "<attribute ");
+			break;
+
+		case AUT_EXIT:
+			fprintf(fp, "<exit ");
+			break;
+
+		case AUT_EXEC_ARGS:
+			fprintf(fp, "<exec_args>");
+			break;
+
+		case AUT_EXEC_ENV:
+			fprintf(fp, "<exec_env>");
+			break;
+
+		case AUT_OTHER_FILE32:
+			fprintf(fp, "<file ");
+			break;
+
+		case AUT_NEWGROUPS:
+			fprintf(fp, "<group>");
+			break;
+
+		case AUT_IN_ADDR:
+			fprintf(fp, "<ip_address>");
+			break;
+
+		case AUT_IN_ADDR_EX:
+			fprintf(fp, "<ip_address>");
+			break;
+
+		case AUT_IP:
+			fprintf(fp, "<ip ");
+			break;
+
+		case AUT_IPC:
+			fprintf(fp, "<IPC");
+			break;
+
+		case AUT_IPC_PERM:
+			fprintf(fp, "<IPC_perm ");
+			break;
+
+		case AUT_IPORT:
+			fprintf(fp, "<ip_port>");
+			break;
+
+		case AUT_OPAQUE:
+			fprintf(fp, "<opaque>");
+			break;
+
+		case AUT_PATH:
+			fprintf(fp, "<path>");
+			break;
+
+		case AUT_PROCESS32:
+			fprintf(fp, "<process ");
+			break;
+
+		case AUT_PROCESS32_EX:
+			fprintf(fp, "<process ");
+			break;
+
+		case AUT_RETURN32:
+			fprintf(fp, "<return ");
+			break;
+
+		case AUT_RETURN64:
+			fprintf(fp, "<return ");
+			break;
+
+		case AUT_SEQ:
+			fprintf(fp, "<sequence ");
+			break;
+
+		case AUT_SOCKET:
+			fprintf(fp, "<socket ");
+			break;
+
+		case AUT_SOCKINET32:
+			fprintf(fp, "<old_socket");
+			break;
+
+		case AUT_SOCKUNIX:
+			fprintf(fp, "<old_socket");
+			break;
+
+		case AUT_SUBJECT32:
+			fprintf(fp, "<subject ");
+			break;
+
+		case AUT_SUBJECT64:
+			fprintf(fp, "<subject ");
+			break;
+
+		case AUT_SUBJECT32_EX:
+			fprintf(fp, "<subject ");
+			break;
+
+		case AUT_TEXT:
+			fprintf(fp, "<text>");
+			break;
+
+		case AUT_SOCKET_EX:
+			fprintf(fp, "<socket ");
+			break;
+
+		case AUT_DATA:
+			fprintf(fp, "<arbitrary ");
+			break;
+		}
+	} else {
+		if (raw)
+			fprintf(fp, "%u", type);
+		else
+			fprintf(fp, "%s", tokname);
+	}
 }
 
 /*
@@ -455,6 +780,27 @@
 }
 
 /*
+ * Print XML header.
+ */
+void
+au_print_xml_header(FILE *outfp)
+{
+	
+	fprintf(outfp, "<?xml version='1.0' ?>\n");
+	fprintf(outfp, "<audit>\n");
+}
+
+/*
+ * Print XML footer.
+ */
+void
+au_print_xml_footer(FILE *outfp)
+{
+	
+	fprintf(outfp, "</audit>\n");
+}
+
+/*
  * record byte count       4 bytes
  * version #               1 byte    [2]
  * event type              2 bytes
@@ -495,22 +841,42 @@
 }
 
 static void
-print_header32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_header32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm,
+    int xml)
 {
 
-	print_tok_type(fp, tok->id, "header", raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.hdr32.size, "%u");
-	print_delim(fp, del);
-	print_1_byte(fp, tok->tt.hdr32.version, "%u");
-	print_delim(fp, del);
-	print_event(fp, tok->tt.hdr32.e_type, raw, sfrm);
-	print_delim(fp, del);
-	print_evmod(fp, tok->tt.hdr32.e_mod, raw);
-	print_delim(fp, del);
-	print_sec32(fp, tok->tt.hdr32.s, raw);
-	print_delim(fp, del);
-	print_msec32(fp, tok->tt.hdr32.ms, raw);
+	print_tok_type(fp, tok->id, "header", raw, xml);
+	if (xml) {
+		open_attr(fp, "version");
+		print_1_byte(fp, tok->tt.hdr32.version, "%u");
+		close_attr(fp);
+		open_attr(fp, "event");
+		print_event(fp, tok->tt.hdr32.e_type, raw, sfrm);
+		close_attr(fp);
+		open_attr(fp, "modifier");
+		print_evmod(fp, tok->tt.hdr32.e_mod, raw);
+		close_attr(fp);
+		open_attr(fp, "time");
+		print_sec32(fp, tok->tt.hdr32.s, raw);
+		close_attr(fp);
+		open_attr(fp, "msec");
+		print_msec32(fp, tok->tt.hdr32.ms, 1);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.hdr32.size, "%u");
+		print_delim(fp, del);
+		print_1_byte(fp, tok->tt.hdr32.version, "%u");
+		print_delim(fp, del);
+		print_event(fp, tok->tt.hdr32.e_type, raw, sfrm);
+		print_delim(fp, del);
+		print_evmod(fp, tok->tt.hdr32.e_mod, raw);
+		print_delim(fp, del);
+		print_sec32(fp, tok->tt.hdr32.s, raw);
+		print_delim(fp, del);
+		print_msec32(fp, tok->tt.hdr32.ms, raw);
+	}
 }
 
 /*
@@ -584,25 +950,50 @@
 
 static void
 print_header32_ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    char sfrm)
+    char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "header_ex", raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.hdr32_ex.size, "%u");
-	print_delim(fp, del);
-	print_1_byte(fp, tok->tt.hdr32_ex.version, "%u");
-	print_delim(fp, del);
-	print_event(fp, tok->tt.hdr32_ex.e_type, raw, sfrm);
-	print_delim(fp, del);
-	print_evmod(fp, tok->tt.hdr32_ex.e_mod, raw);
-	print_delim(fp, del);
-	print_ip_ex_address(fp, tok->tt.hdr32_ex.ad_type,
-	    tok->tt.hdr32_ex.addr);
-	print_delim(fp, del);
-	print_sec32(fp, tok->tt.hdr32_ex.s, raw);
-	print_delim(fp, del);
-	print_msec32(fp, tok->tt.hdr32_ex.ms, raw);
+	print_tok_type(fp, tok->id, "header_ex", raw, xml);
+	if (xml) {
+		open_attr(fp, "version");
+		print_1_byte(fp, tok->tt.hdr32_ex.version, "%u");
+		close_attr(fp);
+		open_attr(fp, "event");
+		print_event(fp, tok->tt.hdr32_ex.e_type, raw, sfrm);
+		close_attr(fp);
+		open_attr(fp, "modifier");
+		print_evmod(fp, tok->tt.hdr32_ex.e_mod, raw);
+		close_attr(fp);
+		/*
+		 * No attribute for additional types.
+		 *
+		print_ip_ex_address(fp, tok->tt.hdr32_ex.ad_type,
+		    tok->tt.hdr32_ex.addr);
+		 */
+		open_attr(fp, "time");
+		print_sec32(fp, tok->tt.hdr32_ex.s, raw);
+		close_attr(fp);
+		open_attr(fp, "msec");
+		print_msec32(fp, tok->tt.hdr32_ex.ms, raw);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.hdr32_ex.size, "%u");
+		print_delim(fp, del);
+		print_1_byte(fp, tok->tt.hdr32_ex.version, "%u");
+		print_delim(fp, del);
+		print_event(fp, tok->tt.hdr32_ex.e_type, raw, sfrm);
+		print_delim(fp, del);
+		print_evmod(fp, tok->tt.hdr32_ex.e_mod, raw);
+		print_delim(fp, del);
+		print_ip_ex_address(fp, tok->tt.hdr32_ex.ad_type,
+		    tok->tt.hdr32_ex.addr);
+		print_delim(fp, del);
+		print_sec32(fp, tok->tt.hdr32_ex.s, raw);
+		print_delim(fp, del);
+		print_msec32(fp, tok->tt.hdr32_ex.ms, raw);
+	}
 }
 
 /*
@@ -646,23 +1037,44 @@
 }
 
 static void
-print_header64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_header64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm,
+    int xml)
 {
+	
+	print_tok_type(fp, tok->id, "header", raw, xml);
+	if (xml) {
+		open_attr(fp, "version");
+		print_1_byte(fp, tok->tt.hdr64.version, "%u");
+		close_attr(fp);
+		open_attr(fp, "event");
+		print_event(fp, tok->tt.hdr64.e_type, raw, sfrm);
+		close_attr(fp);
+		open_attr(fp, "modifier");
+		print_evmod(fp, tok->tt.hdr64.e_mod, raw);
+		close_attr(fp);
+		open_attr(fp, "time");
+		print_sec64(fp, tok->tt.hdr64.s, raw);
+		close_attr(fp);
+		open_attr(fp, "msec");
+		print_msec64(fp, tok->tt.hdr64.ms, raw);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.hdr64.size, "%u");
+		print_delim(fp, del);
+		print_1_byte(fp, tok->tt.hdr64.version, "%u");
+		print_delim(fp, del);
+		print_event(fp, tok->tt.hdr64.e_type, raw, sfrm);
+		print_delim(fp, del);
+		print_evmod(fp, tok->tt.hdr64.e_mod, raw);
+		print_delim(fp, del);
+		print_sec64(fp, tok->tt.hdr64.s, raw);
+		print_delim(fp, del);
+		print_msec64(fp, tok->tt.hdr64.ms, raw);
+	}
+}
 
-	print_tok_type(fp, tok->id, "header", raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.hdr64.size, "%u");
-	print_delim(fp, del);
-	print_1_byte(fp, tok->tt.hdr64.version, "%u");
-	print_delim(fp, del);
-	print_event(fp, tok->tt.hdr64.e_type, raw, sfrm);
-	print_delim(fp, del);
-	print_evmod(fp, tok->tt.hdr64.e_mod, raw);
-	print_delim(fp, del);
-	print_sec64(fp, tok->tt.hdr64.s, raw);
-	print_delim(fp, del);
-	print_msec64(fp, tok->tt.hdr64.ms, raw);
-}
 /*
  * record byte count       4 bytes
  * version #               1 byte     [2]
@@ -729,25 +1141,51 @@
 }
 
 static void
-print_header64_ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw, char sfrm)
+print_header64_ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
+    char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "header_ex", raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.hdr64_ex.size, "%u");
-	print_delim(fp, del);
-	print_1_byte(fp, tok->tt.hdr64_ex.version, "%u");
-	print_delim(fp, del);
-	print_event(fp, tok->tt.hdr64_ex.e_type, raw, sfrm);
-	print_delim(fp, del);
-	print_evmod(fp, tok->tt.hdr64_ex.e_mod, raw);
-	print_delim(fp, del);
-	print_ip_ex_address(fp, tok->tt.hdr64_ex.ad_type,
-	    tok->tt.hdr64_ex.addr);
-	print_delim(fp, del);
-	print_sec64(fp, tok->tt.hdr64_ex.s, raw);
-	print_delim(fp, del);
-	print_msec64(fp, tok->tt.hdr64_ex.ms, raw);
+	print_tok_type(fp, tok->id, "header_ex", raw, xml);
+	if (xml) {
+		open_attr(fp, "version");
+		print_1_byte(fp, tok->tt.hdr64_ex.version, "%u");
+		close_attr(fp);
+		open_attr(fp, "event");
+		print_event(fp, tok->tt.hdr64_ex.e_type, raw, sfrm);
+		close_attr(fp);
+		open_attr(fp, "modifier");
+		print_evmod(fp, tok->tt.hdr64_ex.e_mod, raw);
+		close_attr(fp);
+		/*
+		 * No attribute for additional types.
+		 *
+		print_ip_ex_address(fp, tok->tt.hdr64_ex.ad_type,
+		    tok->tt.hdr64_ex.addr);
+		 */
+		open_attr(fp, "time");
+		print_sec64(fp, tok->tt.hdr64_ex.s, raw);
+		close_attr(fp);
+		open_attr(fp, "msec");
+		print_msec64(fp, tok->tt.hdr64_ex.ms, raw);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.hdr64_ex.size, "%u");
+		print_delim(fp, del);
+		print_1_byte(fp, tok->tt.hdr64_ex.version, "%u");
+		print_delim(fp, del);
+		print_event(fp, tok->tt.hdr64_ex.e_type, raw, sfrm);
+		print_delim(fp, del);
+		print_evmod(fp, tok->tt.hdr64_ex.e_mod, raw);
+		print_delim(fp, del);
+		print_ip_ex_address(fp, tok->tt.hdr64_ex.ad_type,
+		    tok->tt.hdr64_ex.addr);
+		print_delim(fp, del);
+		print_sec64(fp, tok->tt.hdr64_ex.s, raw);
+		print_delim(fp, del);
+		print_msec64(fp, tok->tt.hdr64_ex.ms, raw);
+	}
 }
 
 /*
@@ -772,12 +1210,14 @@
 
 static void
 print_trailer_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "trailer", raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.trail.count, "%u");
+	print_tok_type(fp, tok->id, "trailer", raw, xml);
+	if (!xml) {
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.trail.count, "%u");
+	}
 }
 
 /*
@@ -813,16 +1253,28 @@
 
 static void
 print_arg32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "argument", raw);
-	print_delim(fp, del);
-	print_1_byte(fp, tok->tt.arg32.no, "%u");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.arg32.val, "0x%x");
-	print_delim(fp, del);
-	print_string(fp, tok->tt.arg32.text, tok->tt.arg32.len);
+	print_tok_type(fp, tok->id, "argument", raw, xml);
+	if (xml) {
+		open_attr(fp, "arg-num");
+		print_1_byte(fp, tok->tt.arg32.no, "%u");
+		close_attr(fp);
+		open_attr(fp, "value");
+		print_4_bytes(fp, tok->tt.arg32.val, "0x%x");
+		close_attr(fp);
+		open_attr(fp, "desc");
+		print_string(fp, tok->tt.arg32.text, tok->tt.arg32.len);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_1_byte(fp, tok->tt.arg32.no, "%u");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.arg32.val, "0x%x");
+		print_delim(fp, del);
+	}
 }
 
 static int
@@ -852,16 +1304,29 @@
 
 static void
 print_arg64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "argument", raw);
-	print_delim(fp, del);
-	print_1_byte(fp, tok->tt.arg64.no, "%u");
-	print_delim(fp, del);
-	print_8_bytes(fp, tok->tt.arg64.val, "0x%llx");
-	print_delim(fp, del);
-	print_string(fp, tok->tt.arg64.text, tok->tt.arg64.len);
+	print_tok_type(fp, tok->id, "argument", raw, xml);
+	if (xml) {
+		open_attr(fp, "arg-num");
+		print_1_byte(fp, tok->tt.arg64.no, "%u");
+		close_attr(fp);
+		open_attr(fp, "value");
+		print_8_bytes(fp, tok->tt.arg64.val, "0x%llx");
+		close_attr(fp);
+		open_attr(fp, "desc");
+		print_string(fp, tok->tt.arg64.text, tok->tt.arg64.len);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_1_byte(fp, tok->tt.arg64.no, "%u");
+		print_delim(fp, del);
+		print_8_bytes(fp, tok->tt.arg64.val, "0x%llx");
+		print_delim(fp, del);
+		print_string(fp, tok->tt.arg64.text, tok->tt.arg64.len);
+	}
 }
 
 /*
@@ -924,15 +1389,16 @@
 
 static void
 print_arb_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 	char *str;
 	char *format;
 	size_t size;
 	int i;
 
-	print_tok_type(fp, tok->id, "arbitrary", raw);
-	print_delim(fp, del);
+	print_tok_type(fp, tok->id, "arbitrary", raw, xml);
+	if (!xml)
+		print_delim(fp, del);
 
 	switch(tok->tt.arb.howtopr) {
 	case AUP_BINARY:
@@ -964,56 +1430,125 @@
 		return;
 	}
 
-	print_string(fp, str, strlen(str));
-	print_delim(fp, del);
+	if (xml) {
+		open_attr(fp, "print");
+		fprintf(fp, "%s",str);
+		close_attr(fp);
+	} else {
+		print_string(fp, str, strlen(str));
+		print_delim(fp, del);
+	}
 	switch(tok->tt.arb.bu) {
 	case AUR_BYTE:
 	/* case AUR_CHAR: */
 		str = "byte";
 		size = AUR_BYTE_SIZE;
-		print_string(fp, str, strlen(str));
-		print_delim(fp, del);
-		print_1_byte(fp, tok->tt.arb.uc, "%u");
-		print_delim(fp, del);
-		for (i = 0; i<tok->tt.arb.uc; i++)
-			fprintf(fp, format, *(tok->tt.arb.data + (size * i)));
+		if (xml) {
+			open_attr(fp, "type");
+			fprintf(fp, "%u", size);
+			close_attr(fp);
+			open_attr(fp, "count");
+			print_1_byte(fp, tok->tt.arb.uc, "%u");
+			close_attr(fp);
+			fprintf(fp, ">");
+			for (i = 0; i<tok->tt.arb.uc; i++)
+				fprintf(fp, format, *(tok->tt.arb.data +
+				    (size * i)));
+			close_tag(fp, tok->id);
+		} else {
+			print_string(fp, str, strlen(str));
+			print_delim(fp, del);
+			print_1_byte(fp, tok->tt.arb.uc, "%u");
+			print_delim(fp, del);
+			for (i = 0; i<tok->tt.arb.uc; i++)
+				fprintf(fp, format, *(tok->tt.arb.data +
+				    (size * i)));
+		}
 		break;
 
 	case AUR_SHORT:
 		str = "short";
 		size = AUR_SHORT_SIZE;
-		print_string(fp, str, strlen(str));
-		print_delim(fp, del);
-		print_1_byte(fp, tok->tt.arb.uc, "%u");
-		print_delim(fp, del);
-		for (i = 0; i < tok->tt.arb.uc; i++)
-			fprintf(fp, format, *((u_int16_t *)(tok->tt.arb.data +
-			    (size * i))));
+		if (xml) {
+			open_attr(fp, "type");
+			fprintf(fp, "%u", size);
+			close_attr(fp);
+			open_attr(fp, "count");
+			print_1_byte(fp, tok->tt.arb.uc, "%u");
+			close_attr(fp);
+			fprintf(fp, ">");
+			for (i = 0; i < tok->tt.arb.uc; i++)
+				fprintf(fp, format,
+				    *((u_int16_t *)(tok->tt.arb.data +
+				    (size * i))));
+			close_tag(fp, tok->id);
+		} else {
+			print_string(fp, str, strlen(str));
+			print_delim(fp, del);
+			print_1_byte(fp, tok->tt.arb.uc, "%u");
+			print_delim(fp, del);
+			for (i = 0; i < tok->tt.arb.uc; i++)
+				fprintf(fp, format,
+				    *((u_int16_t *)(tok->tt.arb.data +
+				    (size * i))));
+		}
 		break;
 
 	case AUR_INT32:
 	/* case AUR_INT: */
 		str = "int";
 		size = AUR_INT32_SIZE;
-		print_string(fp, str, strlen(str));
-		print_delim(fp, del);
-		print_1_byte(fp, tok->tt.arb.uc, "%u");
-		print_delim(fp, del);
-		for (i = 0; i < tok->tt.arb.uc; i++)
-			fprintf(fp, format, *((u_int32_t *)(tok->tt.arb.data +
-			    (size * i))));
+		if (xml) {
+			open_attr(fp, "type");
+			fprintf(fp, "%u", size);
+			close_attr(fp);
+			open_attr(fp, "count");
+			print_1_byte(fp, tok->tt.arb.uc, "%u");
+			close_attr(fp);
+			fprintf(fp, ">");
+			for (i = 0; i < tok->tt.arb.uc; i++)
+				fprintf(fp, format,
+				    *((u_int32_t *)(tok->tt.arb.data +
+				    (size * i))));
+			close_tag(fp, tok->id);
+		} else {
+			print_string(fp, str, strlen(str));
+			print_delim(fp, del);
+			print_1_byte(fp, tok->tt.arb.uc, "%u");
+			print_delim(fp, del);
+			for (i = 0; i < tok->tt.arb.uc; i++)
+				fprintf(fp, format,
+				    *((u_int32_t *)(tok->tt.arb.data +
+				    (size * i))));
+		}
 		break;
 
 	case AUR_INT64:
 		str = "int64";
 		size = AUR_INT64_SIZE;
-		print_string(fp, str, strlen(str));
-		print_delim(fp, del);
-		print_1_byte(fp, tok->tt.arb.uc, "%u");
-		print_delim(fp, del);
-		for (i = 0; i < tok->tt.arb.uc; i++)
-			fprintf(fp, format, *((u_int64_t *)(tok->tt.arb.data +
-			    (size * i))));
+		if (xml) {
+			open_attr(fp, "type");
+			fprintf(fp, "%u", size);
+			close_attr(fp);
+			open_attr(fp, "count");
+			print_1_byte(fp, tok->tt.arb.uc, "%u");
+			close_attr(fp);
+			fprintf(fp, ">");
+			for (i = 0; i < tok->tt.arb.uc; i++)
+				fprintf(fp, format,
+				    *((u_int64_t *)(tok->tt.arb.data +
+				    (size * i))));
+			close_tag(fp, tok->id);
+		} else {
+			print_string(fp, str, strlen(str));
+			print_delim(fp, del);
+			print_1_byte(fp, tok->tt.arb.uc, "%u");
+			print_delim(fp, del);
+			for (i = 0; i < tok->tt.arb.uc; i++)
+				fprintf(fp, format,
+				    *((u_int64_t *)(tok->tt.arb.data +
+				    (size * i))));
+		}
 		break;
 
 	default:
@@ -1063,22 +1598,44 @@
 
 static void
 print_attr32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "attribute", raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.attr32.mode, "%o");
-	print_delim(fp, del);
-	print_user(fp, tok->tt.attr32.uid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.attr32.gid, raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.attr32.fsid, "%u");
-	print_delim(fp, del);
-	print_8_bytes(fp, tok->tt.attr32.nid, "%lld");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.attr32.dev, "%u");
+	print_tok_type(fp, tok->id, "attribute", raw, xml);
+	if (xml) {
+		open_attr(fp, "mode");
+		print_4_bytes(fp, tok->tt.attr32.mode, "%o");
+		close_attr(fp);
+		open_attr(fp, "uid");
+		print_user(fp, tok->tt.attr32.uid, raw);
+		close_attr(fp);
+		open_attr(fp, "gid");
+		print_group(fp, tok->tt.attr32.gid, raw);
+		close_attr(fp);
+		open_attr(fp, "fsid");
+		print_4_bytes(fp, tok->tt.attr32.fsid, "%u");
+		close_attr(fp);
+		open_attr(fp, "nodeid");
+		print_8_bytes(fp, tok->tt.attr32.nid, "%lld");
+		close_attr(fp);
+		open_attr(fp, "device");
+		print_4_bytes(fp, tok->tt.attr32.dev, "%u");
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.attr32.mode, "%o");
+		print_delim(fp, del);
+		print_user(fp, tok->tt.attr32.uid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.attr32.gid, raw);
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.attr32.fsid, "%u");
+		print_delim(fp, del);
+		print_8_bytes(fp, tok->tt.attr32.nid, "%lld");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.attr32.dev, "%u");
+	}
 }
 
 /*
@@ -1123,22 +1680,44 @@
 
 static void
 print_attr64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "attribute", raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.attr64.mode, "%o");
-	print_delim(fp, del);
-	print_user(fp, tok->tt.attr64.uid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.attr64.gid, raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.attr64.fsid, "%u");
-	print_delim(fp, del);
-	print_8_bytes(fp, tok->tt.attr64.nid, "%lld");
-	print_delim(fp, del);
-	print_8_bytes(fp, tok->tt.attr64.dev, "%llu");
+	print_tok_type(fp, tok->id, "attribute", raw, xml);
+	if (xml) {
+		open_attr(fp, "mode");
+		print_4_bytes(fp, tok->tt.attr64.mode, "%o");
+		close_attr(fp);
+		open_attr(fp, "uid");
+		print_user(fp, tok->tt.attr64.uid, raw);
+		close_attr(fp);
+		open_attr(fp, "gid");
+		print_group(fp, tok->tt.attr64.gid, raw);
+		close_attr(fp);
+		open_attr(fp, "fsid");
+		print_4_bytes(fp, tok->tt.attr64.fsid, "%u");
+		close_attr(fp);
+		open_attr(fp, "nodeid");
+		print_8_bytes(fp, tok->tt.attr64.nid, "%lld");
+		close_attr(fp);
+		open_attr(fp, "device");
+		print_8_bytes(fp, tok->tt.attr64.dev, "%llu");
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.attr64.mode, "%o");
+		print_delim(fp, del);
+		print_user(fp, tok->tt.attr64.uid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.attr64.gid, raw);
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.attr64.fsid, "%u");
+		print_delim(fp, del);
+		print_8_bytes(fp, tok->tt.attr64.nid, "%lld");
+		print_delim(fp, del);
+		print_8_bytes(fp, tok->tt.attr64.dev, "%llu");
+	}
 }
 
 /*
@@ -1163,14 +1742,24 @@
 
 static void
 print_exit_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "exit", raw);
-	print_delim(fp, del);
-	print_errval(fp, tok->tt.exit.status);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.exit.ret, "%u");
+	print_tok_type(fp, tok->id, "exit", raw, xml);
+	if (xml) {
+		open_attr(fp, "errval");
+		print_errval(fp, tok->tt.exit.status);
+		close_attr(fp);
+		open_attr(fp, "retval");
+		print_4_bytes(fp, tok->tt.exit.ret, "%u");
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_errval(fp, tok->tt.exit.status);
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.exit.ret, "%u");
+	}
 }
 
 /*
@@ -1211,16 +1800,25 @@
 
 static void
 print_execarg_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 	int i;
 
-	print_tok_type(fp, tok->id, "exec arg", raw);
+	print_tok_type(fp, tok->id, "exec arg", raw, xml);
 	for (i = 0; i < tok->tt.execarg.count; i++) {
-		print_delim(fp, del);
-		print_string(fp, tok->tt.execarg.text[i],
-		    strlen(tok->tt.execarg.text[i]));
+		if (xml) {
+			fprintf(fp, "<arg>");
+			print_string(fp, tok->tt.execarg.text[i],
+			    strlen(tok->tt.execarg.text[i]));
+			fprintf(fp, "</arg>");
+		} else {
+			print_delim(fp, del);
+			print_string(fp, tok->tt.execarg.text[i],
+			    strlen(tok->tt.execarg.text[i]));
+		}
 	}
+	if (xml)
+		close_tag(fp, tok->id);
 }
 
 /*
@@ -1261,16 +1859,25 @@
 
 static void
 print_execenv_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 	int i;
 
-	print_tok_type(fp, tok->id, "exec env", raw);
+	print_tok_type(fp, tok->id, "exec env", raw, xml);
 	for (i = 0; i< tok->tt.execenv.count; i++) {
-		print_delim(fp, del);
-		print_string(fp, tok->tt.execenv.text[i],
-		    strlen(tok->tt.execenv.text[i]));
+		if (xml) {
+			fprintf(fp, "<env>");
+			print_string(fp, tok->tt.execenv.text[i],
+			    strlen(tok->tt.execenv.text[i]));
+			fprintf(fp, "</env>");
+		} else {
+			print_delim(fp, del);
+			print_string(fp, tok->tt.execenv.text[i],
+			    strlen(tok->tt.execenv.text[i]));
+		}
 	}
+	if (xml)
+		close_tag(fp, tok->id);
 }
 
 /*
@@ -1305,16 +1912,28 @@
 
 static void
 print_file_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "file", raw);
-	print_delim(fp, del);
-	print_sec32(fp, tok->tt.file.s, raw);
-	print_delim(fp, del);
-	print_msec32(fp, tok->tt.file.ms, raw);
-	print_delim(fp, del);
-	print_string(fp, tok->tt.file.name, tok->tt.file.len);
+	print_tok_type(fp, tok->id, "file", raw, xml);
+	if (xml) {
+		open_attr(fp, "time");
+		print_sec32(fp, tok->tt.file.s, raw);
+		close_attr(fp);
+		open_attr(fp, "msec");
+		print_msec32(fp, tok->tt.file.ms, raw);
+		close_attr(fp);
+		fprintf(fp, ">");
+		print_string(fp, tok->tt.file.name, tok->tt.file.len);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_sec32(fp, tok->tt.file.s, raw);
+		print_delim(fp, del);
+		print_msec32(fp, tok->tt.file.ms, raw);
+		print_delim(fp, del);
+		print_string(fp, tok->tt.file.name, tok->tt.file.len);
+	}
 }
 
 /*
@@ -1343,14 +1962,21 @@
 
 static void
 print_newgroups_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 	int i;
 
-	print_tok_type(fp, tok->id, "group", raw);
+	print_tok_type(fp, tok->id, "group", raw, xml);
 	for (i = 0; i < tok->tt.grps.no; i++) {
-		print_delim(fp, del);
-		print_group(fp, tok->tt.grps.list[i], raw);
+		if (xml) {
+			fprintf(fp, "<gid>");
+			print_group(fp, tok->tt.grps.list[i], raw);
+			fprintf(fp, "</gid>");
+			close_tag(fp, tok->id);
+		} else {
+			print_delim(fp, del);
+			print_group(fp, tok->tt.grps.list[i], raw);
+		}
 	}
 }
 
@@ -1373,12 +1999,17 @@
 
 static void
 print_inaddr_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "ip addr", raw);
-	print_delim(fp, del);
-	print_ip_address(fp, tok->tt.inaddr.addr);
+	print_tok_type(fp, tok->id, "ip addr", raw, xml);
+	if (xml) {
+		print_ip_address(fp, tok->tt.inaddr.addr);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_ip_address(fp, tok->tt.inaddr.addr);
+	}
 }
 
 /*
@@ -1412,13 +2043,19 @@
 
 static void
 print_inaddr_ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "ip addr ex", raw);
-	print_delim(fp, del);
-	print_ip_ex_address(fp, tok->tt.inaddr_ex.type,
-	    tok->tt.inaddr_ex.addr);
+	print_tok_type(fp, tok->id, "ip addr ex", raw, xml);
+	if (xml) {
+		print_ip_ex_address(fp, tok->tt.inaddr_ex.type,
+		    tok->tt.inaddr_ex.addr);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_ip_ex_address(fp, tok->tt.inaddr_ex.type,
+		    tok->tt.inaddr_ex.addr);
+	}
 }
 
 /*
@@ -1480,30 +2117,66 @@
 
 static void
 print_ip_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "ip", raw);
-	print_delim(fp, del);
-	print_mem(fp, (u_char *)(&tok->tt.ip.version), sizeof(u_char));
-	print_delim(fp, del);
-	print_mem(fp, (u_char *)(&tok->tt.ip.tos), sizeof(u_char));
-	print_delim(fp, del);
-	print_2_bytes(fp, ntohs(tok->tt.ip.len), "%u");
-	print_delim(fp, del);
-	print_2_bytes(fp, ntohs(tok->tt.ip.id), "%u");
-	print_delim(fp, del);
-	print_2_bytes(fp, ntohs(tok->tt.ip.offset), "%u");
-	print_delim(fp, del);
-	print_mem(fp, (u_char *)(&tok->tt.ip.ttl), sizeof(u_char));
-	print_delim(fp, del);
-	print_mem(fp, (u_char *)(&tok->tt.ip.prot), sizeof(u_char));
-	print_delim(fp, del);
-	print_2_bytes(fp, ntohs(tok->tt.ip.chksm), "%u");
-	print_delim(fp, del);
-	print_ip_address(fp, tok->tt.ip.src);
-	print_delim(fp, del);
-	print_ip_address(fp, tok->tt.ip.dest);
+	print_tok_type(fp, tok->id, "ip", raw, xml);
+	if (xml) {
+		open_attr(fp, "version");
+		print_mem(fp, (u_char *)(&tok->tt.ip.version),
+		    sizeof(u_char));
+		close_attr(fp);
+		open_attr(fp, "service_type");
+		print_mem(fp, (u_char *)(&tok->tt.ip.tos), sizeof(u_char));
+		close_attr(fp);
+		open_attr(fp, "len");
+		print_2_bytes(fp, ntohs(tok->tt.ip.len), "%u");
+		close_attr(fp);
+		open_attr(fp, "id");
+		print_2_bytes(fp, ntohs(tok->tt.ip.id), "%u");
+		close_attr(fp);
+		open_attr(fp, "offset");
+		print_2_bytes(fp, ntohs(tok->tt.ip.offset), "%u");
+		close_attr(fp);
+		open_attr(fp, "time_to_live");
+		print_mem(fp, (u_char *)(&tok->tt.ip.ttl), sizeof(u_char));
+		close_attr(fp);
+		open_attr(fp, "protocol");
+		print_mem(fp, (u_char *)(&tok->tt.ip.prot), sizeof(u_char));
+		close_attr(fp);
+		open_attr(fp, "cksum");
+		print_2_bytes(fp, ntohs(tok->tt.ip.chksm), "%u");
+		close_attr(fp);
+		open_attr(fp, "src_addr");
+		print_ip_address(fp, tok->tt.ip.src);
+		close_attr(fp);
+		open_attr(fp, "dest_addr");
+		print_ip_address(fp, tok->tt.ip.dest);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_mem(fp, (u_char *)(&tok->tt.ip.version),
+		    sizeof(u_char));
+		print_delim(fp, del);
+		print_mem(fp, (u_char *)(&tok->tt.ip.tos), sizeof(u_char));
+		print_delim(fp, del);
+		print_2_bytes(fp, ntohs(tok->tt.ip.len), "%u");
+		print_delim(fp, del);
+		print_2_bytes(fp, ntohs(tok->tt.ip.id), "%u");
+		print_delim(fp, del);
+		print_2_bytes(fp, ntohs(tok->tt.ip.offset), "%u");
+		print_delim(fp, del);
+		print_mem(fp, (u_char *)(&tok->tt.ip.ttl), sizeof(u_char));
+		print_delim(fp, del);
+		print_mem(fp, (u_char *)(&tok->tt.ip.prot), sizeof(u_char));
+		print_delim(fp, del);
+		print_2_bytes(fp, ntohs(tok->tt.ip.chksm), "%u");
+		print_delim(fp, del);
+		print_ip_address(fp, tok->tt.ip.src);
+		print_delim(fp, del);
+		print_ip_address(fp, tok->tt.ip.dest);
+	}
 }
 
 /*
@@ -1528,14 +2201,24 @@
 
 static void
 print_ipc_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "IPC", raw);
-	print_delim(fp, del);
-	print_ipctype(fp, tok->tt.ipc.type, raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.ipc.id, "%u");
+	print_tok_type(fp, tok->id, "IPC", raw, xml);
+	if (xml) {
+		open_attr(fp, "ipc-type");
+		print_ipctype(fp, tok->tt.ipc.type, raw);
+		close_attr(fp);
+		open_attr(fp, "ipc-id");
+		print_4_bytes(fp, tok->tt.ipc.id, "%u");
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_ipctype(fp, tok->tt.ipc.type, raw);
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.ipc.id, "%u");
+	}
 }
 
 /*
@@ -1585,24 +2268,49 @@
 
 static void
 print_ipcperm_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "IPC perm", raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.ipcperm.uid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.ipcperm.gid, raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.ipcperm.puid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.ipcperm.pgid, raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.ipcperm.mode, "%o");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.ipcperm.seq, "%u");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.ipcperm.key, "%u");
+	print_tok_type(fp, tok->id, "IPC perm", raw, xml);
+	if (xml) {
+		open_attr(fp, "uid");
+		print_user(fp, tok->tt.ipcperm.uid, raw);
+		close_attr(fp);
+		open_attr(fp, "gid");
+		print_group(fp, tok->tt.ipcperm.gid, raw);
+		close_attr(fp);
+		open_attr(fp, "creator-uid");
+		print_user(fp, tok->tt.ipcperm.puid, raw);
+		close_attr(fp);
+		open_attr(fp, "creator-gid");
+		print_group(fp, tok->tt.ipcperm.pgid, raw);
+		close_attr(fp);
+		open_attr(fp, "mode");
+		print_4_bytes(fp, tok->tt.ipcperm.mode, "%o");
+		close_attr(fp);
+		open_attr(fp, "seq");
+		print_4_bytes(fp, tok->tt.ipcperm.seq, "%u");
+		close_attr(fp);
+		open_attr(fp, "key");
+		print_4_bytes(fp, tok->tt.ipcperm.key, "%u");
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_user(fp, tok->tt.ipcperm.uid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.ipcperm.gid, raw);
+		print_delim(fp, del);
+		print_user(fp, tok->tt.ipcperm.puid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.ipcperm.pgid, raw);
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.ipcperm.mode, "%o");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.ipcperm.seq, "%u");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.ipcperm.key, "%u");
+	}
 }
 
 /*
@@ -1623,12 +2331,17 @@
 
 static void
 print_iport_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "ip port", raw);
-	print_delim(fp, del);
-	print_2_bytes(fp, ntohs(tok->tt.iport.port), "%#x");
+	print_tok_type(fp, tok->id, "ip port", raw, xml);
+	if (xml) {
+		print_2_bytes(fp, ntohs(tok->tt.iport.port), "%#x");
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_2_bytes(fp, ntohs(tok->tt.iport.port), "%#x");
+	}
 }
 
 /*
@@ -1654,14 +2367,19 @@
 
 static void
 print_opaque_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "opaque", raw);
-	print_delim(fp, del);
-	print_2_bytes(fp, tok->tt.opaque.size, "%u");
-	print_delim(fp, del);
-	print_mem(fp, tok->tt.opaque.data, tok->tt.opaque.size);
+	print_tok_type(fp, tok->id, "opaque", raw, xml);
+	if (xml) {
+		print_mem(fp, tok->tt.opaque.data, tok->tt.opaque.size);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_2_bytes(fp, tok->tt.opaque.size, "%u");
+		print_delim(fp, del);
+		print_mem(fp, tok->tt.opaque.data, tok->tt.opaque.size);
+	}
 }
 
 /*
@@ -1686,12 +2404,17 @@
 
 static void
 print_path_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "path", raw);
-	print_delim(fp, del);
-	print_string(fp, tok->tt.path.path, tok->tt.path.len);
+	print_tok_type(fp, tok->id, "path", raw, xml);
+	if (xml) {
+		print_string(fp, tok->tt.path.path, tok->tt.path.len);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_string(fp, tok->tt.path.path, tok->tt.path.len);
+	}
 }
 
 /*
@@ -1754,28 +2477,57 @@
 
 static void
 print_process32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "process", raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.proc32.auid, raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.proc32.euid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.proc32.egid, raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.proc32.ruid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.proc32.rgid, raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.proc32.pid, "%u");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.proc32.sid, "%u");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.proc32.tid.port, "%u");
-	print_delim(fp, del);
-	print_ip_address(fp, tok->tt.proc32.tid.addr);
+	print_tok_type(fp, tok->id, "process", raw, xml);
+	if (xml) {
+		open_attr(fp, "audit-uid");
+		print_user(fp, tok->tt.proc32.auid, raw);
+		close_attr(fp);
+		open_attr(fp, "uid");
+		print_user(fp, tok->tt.proc32.euid, raw);
+		close_attr(fp);
+		open_attr(fp, "gid");
+		print_group(fp, tok->tt.proc32.egid, raw);
+		close_attr(fp);
+		open_attr(fp, "ruid");
+		print_user(fp, tok->tt.proc32.ruid, raw);
+		close_attr(fp);
+		open_attr(fp, "rgid");
+		print_group(fp, tok->tt.proc32.rgid, raw);
+		close_attr(fp);
+		open_attr(fp, "pid");
+		print_4_bytes(fp, tok->tt.proc32.pid, "%u");
+		close_attr(fp);
+		open_attr(fp, "sid");
+		print_4_bytes(fp, tok->tt.proc32.sid, "%u");
+		close_attr(fp);
+		open_attr(fp, "tid");
+		print_4_bytes(fp, tok->tt.proc32.tid.port, "%u");
+		print_ip_address(fp, tok->tt.proc32.tid.addr);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_user(fp, tok->tt.proc32.auid, raw);
+		print_delim(fp, del);
+		print_user(fp, tok->tt.proc32.euid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.proc32.egid, raw);
+		print_delim(fp, del);
+		print_user(fp, tok->tt.proc32.ruid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.proc32.rgid, raw);
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.proc32.pid, "%u");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.proc32.sid, "%u");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.proc32.tid.port, "%u");
+		print_delim(fp, del);
+		print_ip_address(fp, tok->tt.proc32.tid.addr);
+	}
 }
 
 static int
@@ -1839,29 +2591,59 @@
 
 static void
 print_process32ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "process_ex", raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.proc32_ex.auid, raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.proc32_ex.euid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.proc32_ex.egid, raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.proc32_ex.ruid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.proc32_ex.rgid, raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.proc32_ex.pid, "%u");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.proc32_ex.sid, "%u");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.proc32_ex.tid.port, "%u");
-	print_delim(fp, del);
-	print_ip_ex_address(fp, tok->tt.proc32_ex.tid.type,
-	    tok->tt.proc32_ex.tid.addr);
+	print_tok_type(fp, tok->id, "process_ex", raw, xml);
+	if (xml) {
+		open_attr(fp, "audit-uid");
+		print_user(fp, tok->tt.proc32_ex.auid, raw);
+		close_attr(fp);
+		open_attr(fp, "uid");
+		print_user(fp, tok->tt.proc32_ex.euid, raw);
+		close_attr(fp);
+		open_attr(fp, "gid");
+		print_group(fp, tok->tt.proc32_ex.egid, raw);
+		close_attr(fp);
+		open_attr(fp, "ruid");
+		print_user(fp, tok->tt.proc32_ex.ruid, raw);
+		close_attr(fp);
+		open_attr(fp, "rgid");
+		print_group(fp, tok->tt.proc32_ex.rgid, raw);
+		close_attr(fp);
+		open_attr(fp, "pid");
+		print_4_bytes(fp, tok->tt.proc32_ex.pid, "%u");
+		close_attr(fp);
+		open_attr(fp, "sid");
+		print_4_bytes(fp, tok->tt.proc32_ex.sid, "%u");
+		close_attr(fp);
+		open_attr(fp, "tid");
+		print_4_bytes(fp, tok->tt.proc32_ex.tid.port, "%u");
+		print_ip_ex_address(fp, tok->tt.proc32_ex.tid.type,
+		    tok->tt.proc32_ex.tid.addr);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_user(fp, tok->tt.proc32_ex.auid, raw);
+		print_delim(fp, del);
+		print_user(fp, tok->tt.proc32_ex.euid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.proc32_ex.egid, raw);
+		print_delim(fp, del);
+		print_user(fp, tok->tt.proc32_ex.ruid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.proc32_ex.rgid, raw);
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.proc32_ex.pid, "%u");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.proc32_ex.sid, "%u");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.proc32_ex.tid.port, "%u");
+		print_delim(fp, del);
+		print_ip_ex_address(fp, tok->tt.proc32_ex.tid.type,
+		    tok->tt.proc32_ex.tid.addr);
+	}
 }
 
 /*
@@ -1886,14 +2668,24 @@
 
 static void
 print_return32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "return", raw);
-	print_delim(fp, del);
-	print_retval(fp, tok->tt.ret32.status, raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.ret32.ret, "%u");
+	print_tok_type(fp, tok->id, "return", raw, xml);
+	if (xml) {
+		open_attr(fp ,"errval");
+		print_retval(fp, tok->tt.ret32.status, raw);
+		close_attr(fp);
+		open_attr(fp, "retval");
+		print_4_bytes(fp, tok->tt.ret32.ret, "%u");
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_retval(fp, tok->tt.ret32.status, raw);
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.ret32.ret, "%u");
+	}
 }
 
 static int
@@ -1914,14 +2706,24 @@
 
 static void
 print_return64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "return", raw);
-	print_delim(fp, del);
-	print_retval(fp, tok->tt.ret64.err, raw);
-	print_delim(fp, del);
-	print_8_bytes(fp, tok->tt.ret64.val, "%lld");
+	print_tok_type(fp, tok->id, "return", raw, xml);
+	if (xml) {
+		open_attr(fp, "errval");
+		print_retval(fp, tok->tt.ret64.err, raw);
+		close_attr(fp);
+		open_attr(fp, "retval");
+		print_8_bytes(fp, tok->tt.ret64.val, "%lld");
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_retval(fp, tok->tt.ret64.err, raw);
+		print_delim(fp, del);
+		print_8_bytes(fp, tok->tt.ret64.val, "%lld");
+	}
 }
 
 /*
@@ -1941,12 +2743,19 @@
 
 static void
 print_seq_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "sequence", raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.seq.seqno, "%u");
+	print_tok_type(fp, tok->id, "sequence", raw, xml);
+	if (xml) {
+		open_attr(fp, "seq-num");
+		print_4_bytes(fp, tok->tt.seq.seqno, "%u");
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.seq.seqno, "%u");
+	}
 }
 
 /*
@@ -1979,16 +2788,29 @@
 
 static void
 print_sock_inet32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "socket-inet", raw);
-	print_delim(fp, del);
-	print_2_bytes(fp, tok->tt.sockinet32.family, "%u");
-	print_delim(fp, del);
-	print_2_bytes(fp, ntohs(tok->tt.sockinet32.port), "%u");
-	print_delim(fp, del);
-	print_ip_address(fp, tok->tt.sockinet32.addr);
+	print_tok_type(fp, tok->id, "socket-inet", raw, xml);
+	if (xml) {
+		open_attr(fp, "type");
+		print_2_bytes(fp, tok->tt.sockinet32.family, "%u");
+		close_attr(fp);
+		open_attr(fp, "port");
+		print_2_bytes(fp, ntohs(tok->tt.sockinet32.port), "%u");
+		close_attr(fp);
+		open_attr(fp, "addr");
+		print_ip_address(fp, tok->tt.sockinet32.addr);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_2_bytes(fp, tok->tt.sockinet32.family, "%u");
+		print_delim(fp, del);
+		print_2_bytes(fp, ntohs(tok->tt.sockinet32.port), "%u");
+		print_delim(fp, del);
+		print_ip_address(fp, tok->tt.sockinet32.addr);
+	}
 }
 
 /*
@@ -2014,15 +2836,28 @@
 
 static void
 print_sock_unix_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "socket-unix", raw);
-	print_delim(fp, del);
-	print_2_bytes(fp, tok->tt.sockunix.family, "%u");
-	print_delim(fp, del);
-	print_string(fp, tok->tt.sockunix.path,
-	    strlen(tok->tt.sockunix.path));
+	print_tok_type(fp, tok->id, "socket-unix", raw, xml);
+	if (xml) {
+		open_attr(fp, "type");
+		print_2_bytes(fp, tok->tt.sockunix.family, "%u");
+		close_attr(fp);
+		open_attr(fp, "port");
+		close_attr(fp);
+		open_attr(fp, "addr");
+		print_string(fp, tok->tt.sockunix.path,
+			strlen(tok->tt.sockunix.path));
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_2_bytes(fp, tok->tt.sockunix.family, "%u");
+		print_delim(fp, del);
+		print_string(fp, tok->tt.sockunix.path,
+			strlen(tok->tt.sockunix.path));
+	}
 }
 
 /*
@@ -2066,20 +2901,39 @@
 
 static void
 print_socket_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "socket", raw);
-	print_delim(fp, del);
-	print_2_bytes(fp, tok->tt.socket.type, "%u");
-	print_delim(fp, del);
-	print_2_bytes(fp, ntohs(tok->tt.socket.l_port), "%u");
-	print_delim(fp, del);
-	print_ip_address(fp, tok->tt.socket.l_addr);
-	print_delim(fp, del);
-	print_2_bytes(fp, ntohs(tok->tt.socket.r_port), "%u");
-	print_delim(fp, del);
-	print_ip_address(fp, tok->tt.socket.r_addr);
+	print_tok_type(fp, tok->id, "socket", raw, xml);
+	if (xml) {
+		open_attr(fp, "sock_type");
+		print_2_bytes(fp, tok->tt.socket.type, "%u");
+		close_attr(fp);
+		open_attr(fp, "lport");
+		print_2_bytes(fp, ntohs(tok->tt.socket.l_port), "%u");
+		close_attr(fp);
+		open_attr(fp, "laddr");
+		print_ip_address(fp, tok->tt.socket.l_addr);
+		close_attr(fp);
+		open_attr(fp, "fport");
+		print_2_bytes(fp, ntohs(tok->tt.socket.r_port), "%u");
+		close_attr(fp);
+		open_attr(fp, "faddr");
+		print_ip_address(fp, tok->tt.socket.r_addr);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_2_bytes(fp, tok->tt.socket.type, "%u");
+		print_delim(fp, del);
+		print_2_bytes(fp, ntohs(tok->tt.socket.l_port), "%u");
+		print_delim(fp, del);
+		print_ip_address(fp, tok->tt.socket.l_addr);
+		print_delim(fp, del);
+		print_2_bytes(fp, ntohs(tok->tt.socket.r_port), "%u");
+		print_delim(fp, del);
+		print_ip_address(fp, tok->tt.socket.r_addr);
+	}
 }
 
 /*
@@ -2141,28 +2995,57 @@
 
 static void
 print_subject32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "subject", raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.subj32.auid, raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.subj32.euid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.subj32.egid, raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.subj32.ruid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.subj32.rgid, raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.subj32.pid, "%u");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.subj32.sid, "%u");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.subj32.tid.port, "%u");
-	print_delim(fp, del);
-	print_ip_address(fp, tok->tt.subj32.tid.addr);
+	print_tok_type(fp, tok->id, "subject", raw, xml);
+	if (xml) {
+		open_attr(fp, "audit-uid");
+		print_user(fp, tok->tt.subj32.auid, raw);
+		close_attr(fp);
+		open_attr(fp, "uid");
+		print_user(fp, tok->tt.subj32.euid, raw);
+		close_attr(fp);
+		open_attr(fp, "gid");
+		print_group(fp, tok->tt.subj32.egid, raw);
+		close_attr(fp);
+		open_attr(fp, "ruid");
+		print_user(fp, tok->tt.subj32.ruid, raw);
+		close_attr(fp);
+		open_attr(fp, "rgid");
+		print_group(fp, tok->tt.subj32.rgid, raw);
+		close_attr(fp);
+		open_attr(fp,"pid");
+		print_4_bytes(fp, tok->tt.subj32.pid, "%u");
+		close_attr(fp);
+		open_attr(fp,"sid");
+		print_4_bytes(fp, tok->tt.subj32.sid, "%u");
+		close_attr(fp);
+		open_attr(fp,"tid");
+		print_4_bytes(fp, tok->tt.subj32.tid.port, "%u ");
+		print_ip_address(fp, tok->tt.subj32.tid.addr);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_user(fp, tok->tt.subj32.auid, raw);
+		print_delim(fp, del);
+		print_user(fp, tok->tt.subj32.euid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.subj32.egid, raw);
+		print_delim(fp, del);
+		print_user(fp, tok->tt.subj32.ruid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.subj32.rgid, raw);
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.subj32.pid, "%u");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.subj32.sid, "%u");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.subj32.tid.port, "%u");
+		print_delim(fp, del);
+		print_ip_address(fp, tok->tt.subj32.tid.addr);
+	}
 }
 
 /*
@@ -2224,28 +3107,57 @@
 
 static void
 print_subject64_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "subject", raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.subj64.auid, raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.subj64.euid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.subj64.egid, raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.subj64.ruid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.subj64.rgid, raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.subj64.pid, "%u");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.subj64.sid, "%u");
-	print_delim(fp, del);
-	print_8_bytes(fp, tok->tt.subj64.tid.port, "%llu");
-	print_delim(fp, del);
-	print_ip_address(fp, tok->tt.subj64.tid.addr);
+	print_tok_type(fp, tok->id, "subject", raw, xml);
+	if (xml) {
+		open_attr(fp, "audit-uid");
+		print_user(fp, tok->tt.subj64.auid, raw);
+		close_attr(fp);
+		open_attr(fp, "uid");
+		print_user(fp, tok->tt.subj64.euid, raw);
+		close_attr(fp);
+		open_attr(fp, "gid");
+		print_group(fp, tok->tt.subj64.egid, raw);
+		close_attr(fp);
+		open_attr(fp, "ruid");
+		print_user(fp, tok->tt.subj64.ruid, raw);
+		close_attr(fp);
+		open_attr(fp, "rgid");
+		print_group(fp, tok->tt.subj64.rgid, raw);
+		close_attr(fp);
+		open_attr(fp, "pid");
+		print_4_bytes(fp, tok->tt.subj64.pid, "%u");
+		close_attr(fp);
+		open_attr(fp, "sid");
+		print_4_bytes(fp, tok->tt.subj64.sid, "%u");
+		close_attr(fp);
+		open_attr(fp, "tid");
+		print_8_bytes(fp, tok->tt.subj64.tid.port, "%llu");
+		print_ip_address(fp, tok->tt.subj64.tid.addr);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_user(fp, tok->tt.subj64.auid, raw);
+		print_delim(fp, del);
+		print_user(fp, tok->tt.subj64.euid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.subj64.egid, raw);
+		print_delim(fp, del);
+		print_user(fp, tok->tt.subj64.ruid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.subj64.rgid, raw);
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.subj64.pid, "%u");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.subj64.sid, "%u");
+		print_delim(fp, del);
+		print_8_bytes(fp, tok->tt.subj64.tid.port, "%llu");
+		print_delim(fp, del);
+		print_ip_address(fp, tok->tt.subj64.tid.addr);
+	}
 }
 
 /*
@@ -2322,29 +3234,59 @@
 
 static void
 print_subject32ex_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "subject_ex", raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.subj32_ex.auid, raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.subj32_ex.euid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.subj32_ex.egid, raw);
-	print_delim(fp, del);
-	print_user(fp, tok->tt.subj32_ex.ruid, raw);
-	print_delim(fp, del);
-	print_group(fp, tok->tt.subj32_ex.rgid, raw);
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.subj32_ex.pid, "%u");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.subj32_ex.sid, "%u");
-	print_delim(fp, del);
-	print_4_bytes(fp, tok->tt.subj32_ex.tid.port, "%u");
-	print_delim(fp, del);
-	print_ip_ex_address(fp, tok->tt.subj32_ex.tid.type,
-	    tok->tt.subj32_ex.tid.addr);
+	print_tok_type(fp, tok->id, "subject_ex", raw, xml);
+	if (xml) {
+		open_attr(fp, "audit-uid");
+		print_user(fp, tok->tt.subj32_ex.auid, raw);
+		close_attr(fp);
+		open_attr(fp, "uid");
+		print_user(fp, tok->tt.subj32_ex.euid, raw);
+		close_attr(fp);
+		open_attr(fp, "gid");
+		print_group(fp, tok->tt.subj32_ex.egid, raw);
+		close_attr(fp);
+		open_attr(fp, "ruid");
+		print_user(fp, tok->tt.subj32_ex.ruid, raw);
+		close_attr(fp);
+		open_attr(fp, "rgid");
+		print_group(fp, tok->tt.subj32_ex.rgid, raw);
+		close_attr(fp);
+		open_attr(fp, "pid");
+		print_4_bytes(fp, tok->tt.subj32_ex.pid, "%u");
+		close_attr(fp);
+		open_attr(fp, "sid");
+		print_4_bytes(fp, tok->tt.subj32_ex.sid, "%u");
+		close_attr(fp);
+		open_attr(fp, "tid");
+		print_4_bytes(fp, tok->tt.subj32_ex.tid.port, "%u");
+		print_ip_ex_address(fp, tok->tt.subj32_ex.tid.type,
+		    tok->tt.subj32_ex.tid.addr);
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_user(fp, tok->tt.subj32_ex.auid, raw);
+		print_delim(fp, del);
+		print_user(fp, tok->tt.subj32_ex.euid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.subj32_ex.egid, raw);
+		print_delim(fp, del);
+		print_user(fp, tok->tt.subj32_ex.ruid, raw);
+		print_delim(fp, del);
+		print_group(fp, tok->tt.subj32_ex.rgid, raw);
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.subj32_ex.pid, "%u");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.subj32_ex.sid, "%u");
+		print_delim(fp, del);
+		print_4_bytes(fp, tok->tt.subj32_ex.tid.port, "%u");
+		print_delim(fp, del);
+		print_ip_ex_address(fp, tok->tt.subj32_ex.tid.type,
+		    tok->tt.subj32_ex.tid.addr);
+	}
 }
 
 /*
@@ -2370,12 +3312,17 @@
 
 static void
 print_text_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "text", raw);
-	print_delim(fp, del);
-	print_string(fp, tok->tt.text.text, tok->tt.text.len);
+	print_tok_type(fp, tok->id, "text", raw, xml);
+	if (xml) {
+		print_string(fp, tok->tt.text.text, tok->tt.text.len);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_string(fp, tok->tt.text.text, tok->tt.text.len);
+	}
 }
 
 /*
@@ -2432,20 +3379,39 @@
 
 static void
 print_socketex32_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "socket", raw);
-	print_delim(fp, del);
-	print_2_bytes(fp, tok->tt.socket_ex32.type, "%#x");
-	print_delim(fp, del);
-	print_2_bytes(fp, ntohs(tok->tt.socket_ex32.l_port), "%#x");
-	print_delim(fp, del);
-	print_ip_address(fp, tok->tt.socket_ex32.l_addr);
-	print_delim(fp, del);
-	print_4_bytes(fp, ntohs(tok->tt.socket_ex32.r_port), "%#x");
-	print_delim(fp, del);
-	print_ip_address(fp, tok->tt.socket_ex32.r_addr);
+	print_tok_type(fp, tok->id, "socket", raw, xml);
+	if (xml) {
+		open_attr(fp, "sock_type");
+		print_2_bytes(fp, tok->tt.socket_ex32.type, "%#x");
+		close_attr(fp);
+		open_attr(fp, "lport");
+		print_2_bytes(fp, ntohs(tok->tt.socket_ex32.l_port), "%#x");
+		close_attr(fp);
+		open_attr(fp, "laddr");
+		print_ip_address(fp, tok->tt.socket_ex32.l_addr);
+		close_attr(fp);
+		open_attr(fp, "faddr");
+		print_ip_address(fp, tok->tt.socket_ex32.r_addr);
+		close_attr(fp);
+		open_attr(fp, "fport");
+		print_2_bytes(fp, tok->tt.socket_ex32.type, "%#x");
+		close_attr(fp);
+		close_tag(fp, tok->id);
+	} else {
+		print_delim(fp, del);
+		print_2_bytes(fp, tok->tt.socket_ex32.type, "%#x");
+		print_delim(fp, del);
+		print_2_bytes(fp, ntohs(tok->tt.socket_ex32.l_port), "%#x");
+		print_delim(fp, del);
+		print_ip_address(fp, tok->tt.socket_ex32.l_addr);
+		print_delim(fp, del);
+		print_4_bytes(fp, ntohs(tok->tt.socket_ex32.r_port), "%#x");
+		print_delim(fp, del);
+		print_ip_address(fp, tok->tt.socket_ex32.r_addr);
+	}
 }
 
 static int
@@ -2469,12 +3435,14 @@
 
 static void
 print_invalid_tok(FILE *fp, tokenstr_t *tok, char *del, char raw,
-    __unused char sfrm)
+    __unused char sfrm, int xml)
 {
 
-	print_tok_type(fp, tok->id, "unknown", raw);
-	print_delim(fp, del);
-	print_mem(fp, tok->tt.invalid.data, tok->tt.invalid.length);
+	if (!xml) {
+		print_tok_type(fp, tok->id, "unknown", raw, 0);
+		print_delim(fp, del);
+		print_mem(fp, tok->tt.invalid.data, tok->tt.invalid.length);
+	}
 }
 
 
@@ -2607,7 +3575,7 @@
 }
 
 /*
- * 'prints' the token out to outfp
+ * 'prints' the token out to outfp.
  */
 void
 au_print_tok(FILE *outfp, tokenstr_t *tok, char *del, char raw, char sfrm)
@@ -2615,151 +3583,309 @@
 
 	switch(tok->id) {
 	case AUT_HEADER32:
-		print_header32_tok(outfp, tok, del, raw, sfrm);
+		print_header32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_HEADER32_EX:
+		print_header32_ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_HEADER64:
+		print_header64_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_HEADER64_EX:
+		print_header64_ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_TRAILER:
+		print_trailer_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_ARG32:
+		print_arg32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_ARG64:
+		print_arg64_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_DATA:
+		print_arb_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_ATTR32:
+		print_attr32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_ATTR64:
+		print_attr64_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_EXIT:
+		print_exit_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_EXEC_ARGS:
+		print_execarg_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_EXEC_ENV:
+		print_execenv_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_OTHER_FILE32:
+		print_file_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_NEWGROUPS:
+		print_newgroups_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_IN_ADDR:
+		print_inaddr_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_IN_ADDR_EX:
+		print_inaddr_ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_IP:
+		print_ip_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_IPC:
+		print_ipc_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_IPC_PERM:
+		print_ipcperm_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_IPORT:
+		print_iport_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_OPAQUE:
+		print_opaque_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_PATH:
+		print_path_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_PROCESS32:
+		print_process32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_PROCESS32_EX:
+		print_process32ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_RETURN32:
+		print_return32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_RETURN64:
+		print_return64_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_SEQ:
+		print_seq_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_SOCKET:
+		print_socket_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_SOCKINET32:
+		print_sock_inet32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_SOCKUNIX:
+		print_sock_unix_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_SUBJECT32:
+		print_subject32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_SUBJECT64:
+		print_subject64_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_SUBJECT32_EX:
+		print_subject32ex_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_TEXT:
+		print_text_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	case AUT_SOCKET_EX:
+		print_socketex32_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+		return;
+
+	default:
+		print_invalid_tok(outfp, tok, del, raw, sfrm, AU_PLAIN);
+	}
+}
+
+/*
+ * 'prints' the token out to outfp in XML format.
+ */
+void
+au_print_tok_xml(FILE *outfp, tokenstr_t *tok, char *del, char raw,
+    char sfrm)
+{
+
+	switch(tok->id) {
+	case AUT_HEADER32:
+		print_header32_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_HEADER32_EX:
-		print_header32_ex_tok(outfp, tok, del, raw, sfrm);
+		print_header32_ex_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_HEADER64:
-		print_header64_tok(outfp, tok, del, raw, sfrm);
+		print_header64_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_HEADER64_EX:
-		print_header64_ex_tok(outfp, tok, del, raw, sfrm);
+		print_header64_ex_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_TRAILER:
-		print_trailer_tok(outfp, tok, del, raw, sfrm);
+		print_trailer_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_ARG32:
-		print_arg32_tok(outfp, tok, del, raw, sfrm);
+		print_arg32_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_ARG64:
-		print_arg64_tok(outfp, tok, del, raw, sfrm);
+		print_arg64_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_DATA:
-		print_arb_tok(outfp, tok, del, raw, sfrm);
+		print_arb_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_ATTR32:
-		print_attr32_tok(outfp, tok, del, raw, sfrm);
+		print_attr32_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_ATTR64:
-		print_attr64_tok(outfp, tok, del, raw, sfrm);
+		print_attr64_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_EXIT:
-		print_exit_tok(outfp, tok, del, raw, sfrm);
+		print_exit_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_EXEC_ARGS:
-		print_execarg_tok(outfp, tok, del, raw, sfrm);
+		print_execarg_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_EXEC_ENV:
-		print_execenv_tok(outfp, tok, del, raw, sfrm);
+		print_execenv_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_OTHER_FILE32:
-		print_file_tok(outfp, tok, del, raw, sfrm);
+		print_file_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_NEWGROUPS:
-		print_newgroups_tok(outfp, tok, del, raw, sfrm);
+		print_newgroups_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_IN_ADDR:
-		print_inaddr_tok(outfp, tok, del, raw, sfrm);
+		print_inaddr_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_IN_ADDR_EX:
-		print_inaddr_ex_tok(outfp, tok, del, raw, sfrm);
+		print_inaddr_ex_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_IP:
-		print_ip_tok(outfp, tok, del, raw, sfrm);
+		print_ip_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_IPC:
-		print_ipc_tok(outfp, tok, del, raw, sfrm);
+		print_ipc_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_IPC_PERM:
-		print_ipcperm_tok(outfp, tok, del, raw, sfrm);
+		print_ipcperm_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_IPORT:
-		print_iport_tok(outfp, tok, del, raw, sfrm);
+		print_iport_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_OPAQUE:
-		print_opaque_tok(outfp, tok, del, raw, sfrm);
+		print_opaque_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_PATH:
-		print_path_tok(outfp, tok, del, raw, sfrm);
+		print_path_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_PROCESS32:
-		print_process32_tok(outfp, tok, del, raw, sfrm);
+		print_process32_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_PROCESS32_EX:
-		print_process32ex_tok(outfp, tok, del, raw, sfrm);
+		print_process32ex_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_RETURN32:
-		print_return32_tok(outfp, tok, del, raw, sfrm);
+		print_return32_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_RETURN64:
-		print_return64_tok(outfp, tok, del, raw, sfrm);
+		print_return64_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_SEQ:
-		print_seq_tok(outfp, tok, del, raw, sfrm);
+		print_seq_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_SOCKET:
-		print_socket_tok(outfp, tok, del, raw, sfrm);
+		print_socket_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_SOCKINET32:
-		print_sock_inet32_tok(outfp, tok, del, raw, sfrm);
+		print_sock_inet32_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_SOCKUNIX:
-		print_sock_unix_tok(outfp, tok, del, raw, sfrm);
+		print_sock_unix_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_SUBJECT32:
-		print_subject32_tok(outfp, tok, del, raw, sfrm);
+		print_subject32_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_SUBJECT64:
-		print_subject64_tok(outfp, tok, del, raw, sfrm);
+		print_subject64_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_SUBJECT32_EX:
-		print_subject32ex_tok(outfp, tok, del, raw, sfrm);
+		print_subject32ex_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_TEXT:
-		print_text_tok(outfp, tok, del, raw, sfrm);
+		print_text_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	case AUT_SOCKET_EX:
-		print_socketex32_tok(outfp, tok, del, raw, sfrm);
+		print_socketex32_tok(outfp, tok, del, raw, sfrm, AU_XML);
 		return;
 
 	default:
-		print_invalid_tok(outfp, tok, del, raw, sfrm);
+		print_invalid_tok(outfp, tok, del, raw, sfrm, AU_XML);
 	}
 }
 
--- libbsm/libbsm.3	2006/09/22 11:30:25
+++ libbsm/libbsm.3	2006/10/05 19:57:21
@@ -34,7 +34,7 @@
 .Sh LIBRARY
 .Lb libbsm
 .Sh SYNOPSIS
-.In libbsm.h
+.In bsm/libbsm.h
 .Sh DESCRIPTION
 The
 .Nm
@@ -42,7 +42,9 @@
 both the parsing of existing audit streams, as well as the creation of new
 audit records and streams.
 .Sh INTERFACES
+The
 .Nm
+library
 provides a large number of Audit programming interfaces in several classes:
 event stream interfaces, class interfaces, control interfaces, event
 interfaces, I/O interfaces, mask interfaces, notification interfaces, token
@@ -132,7 +134,7 @@
 audit records for submission to event streams.
 Each interface converts a C type to its
 .Vt token_t
-representation.
+representation:
 .Xr au_to_arg 3 ,
 .Xr au_to_arg32 3 ,
 .Xr au_to_arg64 3 ,
@@ -190,26 +192,31 @@
 .Xr getfauditflags 3 .
 .Sh SEE ALSO
 .Xr au_class 3 ,
+.Xr audit_submit 3 ,
 .Xr au_mask 3 ,
 .Xr au_notify 3 ,
 .Xr au_stream 3 ,
 .Xr au_token 3 ,
 .Xr au_user 3 ,
-.Xr audit_submit 3 ,
 .Xr audit_class 5 ,
 .Xr audit_control 5
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
-This software was created by Robert Watson, Wayne Salamon, and Suresh
-Krishnaswamy for McAfee Research, the security research division of McAfee,
+.An -nosplit
+This software was created by
+.An Robert Watson ,
+.An Wayne Salamon ,
+and
+.An Suresh Krishnaswamy
+for McAfee Research, the security research division of McAfee,
 Inc., under contract to Apple Computer, Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer, Inc., in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
 .Sh BUGS
 Bugs would not be unlikely.
 .Pp
--- man/audit.2	2006/01/29 18:52:45
+++ man/audit.2	2006/10/03 15:12:02
@@ -31,18 +31,22 @@
 .Os
 .Sh NAME
 .Nm audit
-.Nd "Commit a BSM audit record to the audit log"
+.Nd "commit BSM audit record to audit log"
 .Sh SYNOPSIS
 .In bsm/audit.h
 .Ft int
 .Fn audit "const char *record" "u_int length"
 .Sh DESCRIPTION
+The
 .Fn audit
+system call
 submits a completed BSM audit record to the system audit log.
 .Pp
+The
 .Fa record
-is a pointer to the the specific event to be recorded and
-.Vt length
+argument
+is a pointer to the specific event to be recorded and
+.Fa length
 is the size in bytes of the data to be written.
 .Sh RETURN VALUES
 .Rv -std
@@ -57,37 +61,41 @@
 argument is beyond the allocated address space of the process.
 .It Bq Er EINVAL
 The token ID is invalid or
-.Vt length
+.Va length
 is larger than
-.Vt MAXAUDITDATA .
+.Dv MAXAUDITDATA .
 .It Bq Er EPERM
 The process does not have sufficient permission to complete
 the operation.
 .El
 .Sh SEE ALSO
 .Xr auditon 2 ,
+.Xr getaudit 2 ,
+.Xr getaudit_addr 2 ,
 .Xr getauid 2 ,
-.Xr setauid 2 ,
-.Xr getaudit 2 ,
 .Xr setaudit 2 ,
-.Xr getaudit_addr 2 ,
 .Xr setaudit_addr 2 ,
+.Xr setauid 2 ,
 .Xr libbsm 3
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
 .Pp
 This manual page was written by
 .An Tom Rhodes Aq trhodes@FreeBSD.org .
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
 .Sh BUGS
 The
 .Fx
--- man/audit.log.5	2006/08/23 17:24:40
+++ man/audit.log.5	2006/11/05 23:46:36
@@ -25,12 +25,12 @@
 .\"
 .\" $P4$
 .\"
-.Dd May 1, 2005
+.Dd November 5, 2006
 .Dt AUDIT.LOG 5
 .Os
 .Sh NAME
 .Nm audit
-.Nd "Basic Security Module (BSM) File Format"
+.Nd "Basic Security Module (BSM) file format"
 .Sh DESCRIPTION
 The
 .Nm
@@ -41,16 +41,16 @@
 moderately backward and forward compatible way.
 .Pp
 BSM token streams typically begin and end with a
-.Dv file
+.Dq file
 token, which provides time stamp and file name information for the stream;
 when processing a BSM token stream from a stream as opposed to a single file
 source, file tokens may be seen at any point between ordinary records
 identifying when particular parts of the stream begin and end.
 All other tokens will appear in the context of a complete BSM audit record,
 which begins with a
-.Dv header
+.Dq header
 token, and ends with a
-.Dv trailer
+.Dq trailer
 token, which describe the audit record.
 Between these two tokens will appear a variety of data tokens, such as
 process information, file path names, IPC object information, MAC labels,
@@ -68,561 +68,612 @@
 records by hand.
 .Ss File Token
 The
-.Dv file
+.Dq file
 token is used at the beginning and end of an audit log file to indicate
 when the audit log begins and ends.
 It includes a pathname so that, if concatenated together, original file
 boundaries are still observable, and gaps in the audit log can be identified.
 A
-.Dv file
+.Dq file
 token can be created using
 .Xr au_to_file 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Seconds" Ta "4 bytes" Ta "File time stamp"
-.It Li "Microseconds" Ta "4 bytes" Ta "File time stamp"
-.It Li "File name lengh" Ta "2 bytes" Ta "File name of audit trail"
-.It Li "File pathname" Ta "N bytes + 1 nul" Ta "File name of audit trail"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Seconds	4 bytes	File time stamp"
+.It "Microseconds	4 bytes	File time stamp"
+.It "File name lengh	2 bytes	File name of audit trail"
+.It "File pathname	N bytes + 1 NUL	File name of audit trail"
 .El
 .Ss Header Token
 The
-.Dv header
+.Dq header
 token is used to mark the beginning of a complete audit record, and includes
 the length of the total record in bytes, a version number for the record
 layout, the event type and subtype, and the time at which the event occurred.
 A 32-bit
-.Dv header
+.Dq header
 token can be created using
 .Xr au_to_header32 3 ;
 a 64-bit
-.Dv header
+.Dq header
 token can be created using
 .Xr au_to_header64 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Record Byte Count" Ta "4 bytes" Ta "Number of bytes in record"
-.It Li "Version Number" Ta "2 bytes" Ta "Record version number"
-.It Li "Event Type" Ta "2 bytes" Ta "Event type"
-.It Li "Event Modifier" Ta "2 bytes" Ta "Event sub-type"
-.It Li "Seconds" Ta "4/8 bytes" Ta "Record time stamp (32/64-bits)"
-.It Li "Nanoseconds" Ta "4/8 byets" Ta "Record time stamp (32/64-bits)"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Record Byte Count	4 bytes	Number of bytes in record"
+.It "Version Number	2 bytes	Record version number"
+.It "Event Type	2 bytes	Event type"
+.It "Event Modifier	2 bytes	Event sub-type"
+.It "Seconds	4/8 bytes	Record time stamp (32/64-bits)"
+.It "Nanoseconds	4/8 bytes	Record time stamp (32/64-bits)"
 .El
 .Ss Expanded Header Token
 The
-.Dv expanded header
+.Dq expanded header
 token is an expanded version of the
-.Dv header
+.Dq header
 token, with the addition of a machine IPv4 or IPv6 address.
 A 32-bit extended
-.Dv header
+.Dq header
 token can be created using
 .Xr au_to_header32_ex 3 ;
 a 64-bit extended
-.Dv header
+.Dq header
 token can be created using
 .Xr au_to_header64_ex 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Record Byte Count" Ta "4 bytes" Ta "Number of bytes in record"
-.It Li "Version Number" Ta "2 bytes" Ta "Record version number"
-.It Li "Event Type" Ta "2 bytes" Ta "Event type"
-.It Li "Event Modifier" Ta "2 bytes" Ta "Event sub-type"
-.It Li "Address Type/Length" Ta "1 byte" Ta "Host address type and length"
-.It Li "Machine Address" Ta "4/16 bytes" Ta "IPv4 or IPv6 address"
-.It Li "Seconds" Ta "4/8 bytes" Ta "Record time stamp (32/64-bits)"
-.It Li "Nanoseconds" Ta "4/8 byets" Ta "Record time stamp (32/64-bits)"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Record Byte Count	4 bytes	Number of bytes in record"
+.It "Version Number	2 bytes	Record version number"
+.It "Event Type	2 bytes	Event type"
+.It "Event Modifier	2 bytes	Event sub-type"
+.It "Address Type/Length	1 byte	Host address type and length"
+.It "Machine Address	4/16 bytes	IPv4 or IPv6 address"
+.It "Seconds	4/8 bytes	Record time stamp (32/64-bits)"
+.It "Nanoseconds	4/8 bytes	Record time stamp (32/64-bits)"
 .El
 .Ss Trailer Token
 The
-.Dv trailer
+.Dq trailer
 terminates a BSM audit record, and contains a magic number,
 .Dv TRAILER_PAD_MAGIC
 and length that can be used to validate that the record was read properly.
 A
-.Dv trailer
+.Dq trailer
 token can be created using
 .Xr au_to_trailer 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Trailer Magic" Ta "2 bytes" Ta "Trailer magic number"
-.It Li "Record Byte Count" Ta "4 bytes" Ta "Number of bytes in record"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Trailer Magic	2 bytes	Trailer magic number"
+.It "Record Byte Count	4 bytes	Number of bytes in record"
 .El
 .Ss Arbitrary Data Token
 The
-.Dv arbitrary data
+.Dq arbitrary data
 token contains a byte stream of opaque (untyped) data.
 The size of the data is calculated as the size of each unit of data
 multipled by the number of units of data.
 A
-.Dv How to print
+.Dq How to print
 field is present to specify how to print the data, but interpretation of
 that field is not currently defined.
 An
-.Dv arbitrary data
+.Dq arbitrary data
 token can be created using
 .Xr au_to_data 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "How to Print" Ta "1 byte" Ta "User-defined printing information"
-.It Li "Basic Unit" Ta "1 byte" Ta "Size of a unit in bytes"
-.It Li "Unit Count" Ta "1 byte" Ta "Number of units of data present"
-.It Li "Data Items" Ta "Variable" Ta "User data"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "How to Print	1 byte	User-defined printing information"
+.It "Basic Unit	1 byte	Size of a unit in bytes"
+.It "Unit Count	1 byte	Number of units of data present"
+.It "Data Items	Variable	User data"
 .El
 .Ss in_addr Token
 The
-.Dv in_addr
+.Dq in_addr
 token holds a network byte order IPv4 or IPv6 address.
 An
-.Dv in_addr
+.Dq in_addr
 token can be created using
 .Xr au_to_in_addr 3
 for an IPv4 address, or
 .Xr au_to_in_addr_ex 3
 for an IPv6 address.
 .Pp
-See the BUGS section for information on the storage of this token.
+See the
+.Sx BUGS
+section for information on the storage of this token.
 .Pp
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "IP Address Type" Ta "1 byte" Ta "Type of address"
-.It Li "IP Address" Ta "4/16 bytes" Ta "IPv4 or IPv6 address"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "IP Address Type	1 byte	Type of address"
+.It "IP Address	4/16 bytes	IPv4 or IPv6 address"
 .El
 .Ss Expanded in_addr Token
 The
-.Dv expanded in_addr
+.Dq expanded in_addr
 token ...
 .Pp
-See the BUGS section for information on the storage of this token.
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
+See the
+.Sx BUGS
+section for information on the storage of this token.
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
 .It XXXX
 .El
 .Ss ip Token
 The
-.Dv ip
+.Dq ip
 token contains an IP packet header in network byte order.
 An
-.Dv ip
+.Dq ip
 token can be created using
 .Xr au_to_ip 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Version and IHL" Ta "1 byte" Ta "Version and IP header length"
-.It Li "Type of Service" Ta "1 byte" Ta "IP TOS field"
-.It Li "Length" Ta "2 bytes" Ta "IP packet length in network byte order"
-.It Li "ID" Ta "2 bytes" Ta "IP header ID for reassembly"
-.It Li "Offset" Ta "2 bytes" Ta "IP fragment offset and flags, network byte order"
-.It Li "TTL" Ta "1 byte" Ta "IP Time-to-Live"
-.It Li "Protocol" Ta "1 byte" Ta "IP protocol number"
-.It Li "Checksum" Ta "2 bytes" Ta "IP header checksum, network byte order"
-.It Li "Source Address" Ta "4 bytes" Ta "IPv4 source address"
-.It Li "Destination Address" Ta "4 bytes" Ta "IPv4 destination address"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Version and IHL	1 byte	Version and IP header length"
+.It "Type of Service	1 byte	IP TOS field"
+.It "Length	2 bytes	IP packet length in network byte order"
+.It "ID	2 bytes	IP header ID for reassembly"
+.It "Offset	2 bytes	IP fragment offset and flags, network byte order"
+.It "TTL	1 byte	IP Time-to-Live"
+.It "Protocol	1 byte	IP protocol number"
+.It "Checksum	2 bytes	IP header checksum, network byte order"
+.It "Source Address	4 bytes	IPv4 source address"
+.It "Destination Address	4 bytes	IPv4 destination address"
 .El
 .Ss Expanded ip Token
 The
-.Dv expanded ip
+.Dq expanded ip
 token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
 .It XXXX
 .El
 .Ss iport Token
 The
-.Dv iport
+.Dq iport
 token stores an IP port number in network byte order.
 An
-.Dv iport
+.Dq iport
 token can be created using
 .Xr au_to_iport 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Port Number" Ta "2 bytes" Ta "Port number in network byte order"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Port Number	2 bytes	Port number in network byte order"
 .El
 .Ss Path Token
 The
-.Dv path
+.Dq path
 token contains a pathname.
 A
-.Dv path
+.Dq path
 token can be created using
 .Xr au_to_path 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Path Length" Ta "2 bytes" Ta "Length of path in bytes"
-.It Li "Path" Ta "N bytes + 1 nul" Ta "Path name"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Path Length	2 bytes	Length of path in bytes"
+.It "Path	N bytes + 1 NUL	Path name"
 .El
 .Ss path_attr Token
 The
-.Dv path_attr
-token contains a set of nul-terminated path names.
+.Dq path_attr
+token contains a set of NUL-terminated path names.
 The
 .Xr libbsm 3
 API cannot currently create a
-.Dv path_attr
+.Dq path_attr
 token.
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Count" Ta "2 bytes" Ta "Number of nul-terminated string(s) in token"
-.It Li "Path" Ta "Variable" Ta "count nul-terminated string(s)"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Count	2 bytes	Number of NUL-terminated string(s) in token"
+.It "Path	Variable	count NUL-terminated string(s)"
 .El
 .Ss Process Token
 The
-.Dv process
+.Dq process
 token contains a description of the security properties of a process
 involved as the target of an auditable event, such as the destination for
 signal delivery.
 It should not be confused with the
-.Dv subject
+.Dq subject
 token, which describes the subject performing an auditable event.
 This includes both the traditional
 .Ux
 security properties, such as user IDs and group IDs, but also audit
 information such as the audit user ID and session.
 A
-.Dv process
+.Dq process
 token can be created using
 .Xr au_to_process32 3
 or
 .Xr au_to_process64 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Audit ID" Ta "4 bytes" Ta "Audit user ID"
-.It Li "Effective User ID" Ta "4 bytes" Ta "Effective user ID"
-.It Li "Effective Group ID "Ta "4 bytes" Ta "Effective group ID"
-.It Li "Real User ID" Ta "4 bytes" Ta "Real user ID"
-.It Li "Real Group ID" Ta "4 bytes" Ta "Real group ID"
-.It Li "Process ID" Ta "4 bytes" Ta "Process ID"
-.It Li "Session ID" Ta "4 bytes" Ta "Audit session ID"
-.It Li "Terminal Port ID" Ta "4/8 bytes" Ta "Terminal port ID (32/64-bits)"
-.It Li "Terminal Machine Address" Ta "4 bytes" Ta "IP address of machine"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Audit ID	4 bytes	Audit user ID"
+.It "Effective User ID	4 bytes	Effective user ID"
+.It "Effective Group ID	4 bytes	Effective group ID"
+.It "Real User ID	4 bytes	Real user ID"
+.It "Real Group ID	4 bytes	Real group ID"
+.It "Process ID	4 bytes	Process ID"
+.It "Session ID	4 bytes	Audit session ID"
+.It "Terminal Port ID	4/8 bytes	Terminal port ID (32/64-bits)"
+.It "Terminal Machine Address	4 bytes	IP address of machine"
 .El
 .Ss Expanded Process Token
 The
-.Dv expanded process
+.Dq expanded process
 token contains the contents of the
-.Dv process
+.Dq process
 token, with the addition of a machine address type and variable length
 address storage capable of containing IPv6 addresses.
 An
-.Dv expanded process
+.Dq expanded process
 token can be created using
 .Xr au_to_process32_ex 3
 or
 .Xr au_to_process64_ex 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Audit ID" Ta "4 bytes" Ta "Audit user ID"
-.It Li "Effective User ID" Ta "4 bytes" Ta "Effective user ID"
-.It Li "Effective Group ID "Ta "4 bytes" Ta "Effective group ID"
-.It Li "Real User ID" Ta "4 bytes" Ta "Real user ID"
-.It Li "Real Group ID" Ta "4 bytes" Ta "Real group ID"
-.It Li "Process ID" Ta "4 bytes" Ta "Process ID"
-.It Li "Session ID" Ta "4 bytes" Ta "Audit session ID"
-.It Li "Terminal Port ID" Ta "4/8 bytes" Ta "Terminal port ID (32/64-bits)"
-.It Li "Terminal Address Type/Length" Ta "1 byte" "Length of machine address"
-.It Li "Terminal Machine Address" Ta "4 bytes" Ta "IPv4 or IPv6 address of machine"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Audit ID	4 bytes	Audit user ID"
+.It "Effective User ID	4 bytes	Effective user ID"
+.It "Effective Group ID	4 bytes	Effective group ID"
+.It "Real User ID	4 bytes	Real user ID"
+.It "Real Group ID	4 bytes	Real group ID"
+.It "Process ID	4 bytes	Process ID"
+.It "Session ID	4 bytes	Audit session ID"
+.It "Terminal Port ID	4/8 bytes	Terminal port ID (32/64-bits)"
+.It "Terminal Address Type/Length	1 byte	Length of machine address"
+.It "Terminal Machine Address	4 bytes	IPv4 or IPv6 address of machine"
 .El
 .Ss Return Token
 The
-.Dv return
+.Dq return
 token contains a system call or library function return condition, including
 return value and error number associated with the global variable
 .Er errno .
-A 
-.Dv return
+A
+.Dq return
 token can be created using
 .Xr au_to_return32 3
 or
 .Xr au_to_return64 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Error Number" Ta "1 byte" Ta "Errno value, or 0 if undefined"
-.It Li "Return Value" Ta "4/8 bytes" Ta "Return value (32/64-bits)"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Error Number	1 byte	Errno value, or 0 if undefined"
+.It "Return Value	4/8 bytes	Return value (32/64-bits)"
 .El
 .Ss Subject Token
 The
-.Dv subject
+.Dq subject
 token contains information on the subject performing the operation described
 by an audit record, and includes similar information to that found in the
-.Dv process
+.Dq process
 and
-.Dv expanded process
+.Dq expanded process
 tokens.
 However, those tokens are used where the process being described is the
 target of the operation, not the authorizing party.
 A
-.Dv subject
+.Dq subject
 token can be created using
 .Xr au_to_subject32 3
 and
 .Xr au_to_subject64 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Audit ID" Ta "4 bytes" Ta "Audit user ID"
-.It Li "Effective User ID" Ta "4 bytes" Ta "Effective user ID"
-.It Li "Effective Group ID "Ta "4 bytes" Ta "Effective group ID"
-.It Li "Real User ID" Ta "4 bytes" Ta "Real user ID"
-.It Li "Real Group ID" Ta "4 bytes" Ta "Real group ID"
-.It Li "Process ID" Ta "4 bytes" Ta "Process ID"
-.It Li "Session ID" Ta "4 bytes" Ta "Audit session ID"
-.It Li "Terminal Port ID" Ta "4/8 bytes" Ta "Terminal port ID (32/64-bits)"
-.It Li "Terminal Machine Address" Ta "4 bytes" Ta "IP address of machine"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Audit ID	4 bytes	Audit user ID"
+.It "Effective User ID	4 bytes	Effective user ID"
+.It "Effective Group ID	4 bytes	Effective group ID"
+.It "Real User ID	4 bytes	Real user ID"
+.It "Real Group ID	4 bytes	Real group ID"
+.It "Process ID	4 bytes	Process ID"
+.It "Session ID	4 bytes	Audit session ID"
+.It "Terminal Port ID	4/8 bytes	Terminal port ID (32/64-bits)"
+.It "Terminal Machine Address	4 bytes	IP address of machine"
 .El
 .Ss Expanded Subject Token
 The
-.Dv expanded subject
+.Dq expanded subject
 token consists of the same elements as the
-.Dv subject
+.Dq subject
 token, with the addition of type/length and variable size machine address
 information in the terminal ID.
 An
-.Dv expanded subject
+.Dq expanded subject
 token can be created using
 .Xr au_to_subject32_ex 3
 or
 .Xr au_to_subject64_ex 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Audit ID" Ta "4 bytes" Ta "Audit user ID"
-.It Li "Effective User ID" Ta "4 bytes" Ta "Effective user ID"
-.It Li "Effective Group ID "Ta "4 bytes" Ta "Effective group ID"
-.It Li "Real User ID" Ta "4 bytes" Ta "Real user ID"
-.It Li "Real Group ID" Ta "4 bytes" Ta "Real group ID"
-.It Li "Process ID" Ta "4 bytes" Ta "Process ID"
-.It Li "Session ID" Ta "4 bytes" Ta "Audit session ID"
-.It Li "Terminal Port ID" Ta "4/8 bytes" Ta "Terminal port ID (32/64-bits)"
-.It Li "Terminal Address Type/Length" Ta "1 byte" "Length of machine address"
-.It Li "Terminal Machine Address" Ta "4 bytes" Ta "IPv4 or IPv6 address of machine"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Audit ID	4 bytes	Audit user ID"
+.It "Effective User ID	4 bytes	Effective user ID"
+.It "Effective Group ID	4 bytes	Effective group ID"
+.It "Real User ID	4 bytes	Real user ID"
+.It "Real Group ID	4 bytes	Real group ID"
+.It "Process ID	4 bytes	Process ID"
+.It "Session ID	4 bytes	Audit session ID"
+.It "Terminal Port ID	4/8 bytes	Terminal port ID (32/64-bits)"
+.It "Terminal Address Type/Length	1 byte	Length of machine address"
+.It "Terminal Machine Address	4 bytes	IPv4 or IPv6 address of machine"
 .El
 .Ss System V IPC Token
 The
-.Dv System V IPC
-token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Object ID type" Ta "1 byte" Ta "Object ID"
-.It Li "Object ID" Ta "4 bytes" Ta "Object ID"
+.Dq System V IPC
+token contains the System V IPC message handle, semaphore handle or shared
+memory handle.
+A System V IPC token may be created using
++.Xr au_to_ipc 3 .
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Object ID type	1 byte	Object ID"
+.It "Object ID	4 bytes	Object ID"
 .El
 .Ss Text Token
 The
-.Dv text
-token contains a single nul-terminated text string.
+.Dq text
+token contains a single NUL-terminated text string.
 A
-.Dv text
+.Dq text
 token may be created using
 .Xr au_to_text 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Text Length" Ta "2 bytes" Ta "Length of text string including nul"
-.It Li "Text" Ta "N bytes + 1 nul" Ta "Text string including nul"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Text Length	2 bytes	Length of text string including NUL"
+.It "Text	N bytes + 1 NUL	Text string including NUL"
 .El
 .Ss Attribute Token
 The
-.Dv attribute
+.Dq attribute
 token describes the attributes of a file associated with the audit event.
 As files may be identified by 0, 1, or many path names, a path name is not
 included with the attribute block for a file; optional
-.Dv path
+.Dq path
 tokens may also be present in an audit record indicating which path, if any,
 was used to reach the object.
 An
-.Dv attribute
+.Dq attribute
 token can be created using
 .Xr au_to_attr32 3
 or
 .Xr au_to_attr64 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "File Access Mode" Ta "1 byte" Ta "mode_t associated with file"
-.It Li "Owner User ID" Ta "4 bytes" Ta "uid_t associated with file"
-.It Li "Owner Group ID" Ta "4 bytes" Ta "gid_t associated with file"
-.It Li "File System ID" Ta "4 bytes" Ta "fsid_t associated with file"
-.It Li "File System Node ID" Ta "8 bytes" Ta "ino_t associated with file"
-.It Li "Device" Ta "4/8 bytes" Ta "Device major/minor number (32/64-bit)"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "File Access Mode	1 byte	mode_t associated with file"
+.It "Owner User ID	4 bytes	uid_t associated with file"
+.It "Owner Group ID	4 bytes	gid_t associated with file"
+.It "File System ID	4 bytes	fsid_t associated with file"
+.It "File System Node ID	8 bytes	ino_t associated with file"
+.It "Device	4/8 bytes	Device major/minor number (32/64-bit)"
 .El
 .Ss Groups Token
 The
-.Dv groups
+.Dq groups
 token contains a list of group IDs associated with the audit event.
 A
-.Dv groups
+.Dq groups
 token can be created using
 .Xr au_to_groups 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Number of Groups" Ta "2 bytes" Ta "Number of groups in token"
-.It Li "Group List" Ta "N * 4 bytes" Ta "List of N group IDs"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Number of Groups	2 bytes	Number of groups in token"
+.It "Group List	N * 4 bytes	List of N group IDs"
 .El
 .Ss System V IPC Permission Token
 The
-.Dv System V IPC permission
-token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li XXXXX
+.Dq System V IPC permission
+token contains a System V IPC access permissions.
+A System V IPC permission token may be created using
+.Xr au_to_ipc_perm 3 .
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It Li "Owner user ID" Ta "4 bytes" Ta "User ID of IPC owner"
+.It Li "Owner group ID" Ta "4 bytes" Ta "Group ID of IPC owner"
+.It Li "Creator user ID" Ta "4 bytes" Ta "User ID of IPC creator"
+.It Li "Creator group ID" Ta "4 bytes" Ta "Group ID of IPC creator"
+.It Li "Access mode" Ta "4 bytes" Ta "Access mode"
+.It Li "Sequnce number" Ta "4 bytes" Ta "Sequnce number"
+.It Li "Key" Ta "4 bytes" Ta "IPC key"
 .El
 .Ss Arg Token
 The
-.Dv arg
-token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li XXXXX
+.Dq arg
+token contains informations about arguments of the system call.
+Depending on the size of the desired argument value, an Arg token may be
+created using
+.Xr au_to_arg32 3
+or
+.Xr au_to_arg64 3 .
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It Li "Argument ID" Ta "1 byte" Ta "Argument ID"
+.It Li "Argument value" Ta "4/8 bytes" Ta "Argument value"
+.It Li "Length" Ta "2 bytes" Ta "Length of the text"
+.It Li "Text" Ta "N bytes + 1 nul" Ta "The string including nul"
 .El
 .Ss exec_args Token
 The
-.Dv exec_args
-token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li XXXXX
+.Dq exec_args
+token contains informations about arguements of the exec() system call.
+An exec_args token may be created using
+.Xr au_to_exec_args 3 .
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It Li "Count" Ta "4 bytes" Ta "Number of arguments"
+.It Li "Text" Ta "* bytes" Ta "Count null-terminated strings"
 .El
 .Ss exec_env Token
 The
-.Dv exec_env
-token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li XXXXX
+.Dq exec_env
+token contains current eviroment variables to an exec() system call.
+An exec_args token may be created using
+.Xr au_to_exec_env 3 .
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It Li "Count ID" Ta "4 bytes" Ta "Number of variables"
+.It Li "Text" Ta "* bytes" Ta "Count nul-terminated strings"
 .El
 .Ss Exit Token
 The
-.Dv exit
+.Dq exit
 token contains process exit/return code information.
 An
-.Dv exit
+.Dq exit
 token can be created using
 .Xr au_to_exit 3 .
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Status" Ta "4 bytes" Ta "Process status on exit"
-.It Li "Return Value" ta "4 bytes" Ta "Process return value on exit"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Status	4 bytes	Process status on exit"
+.It "Return Value	4 bytes	Process return value on exit"
 .El
 .Ss Socket Token
 The
-.Dv socket
-token ...
+.Dq socket
+token contains informations about UNIX domain and Internet sockets.
+Each token has four or eight fields.
+Depend on type of socket a socket token may be created using
+.Xr au_to_sock_unix 3 ,
+.Xr au_to_sock_inet32 3 or
+.Xr au_to_sock_inet128 3 .
 .Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
 .It Sy "Field" Ta Sy Bytes Ta Sy Description
 .It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li XXXXX
+.It Li "Socket family" Ta "2 bytes" Ta "Socket family"
+.It Li "Local port" Ta "2 bytes" Ta "Local port"
+.It Li "Socket address" Ta "4 bytes" Ta "Socket address"
+.El
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
++.It Li "Socket domain" Ta "4 bytes" Ta "Socket domain"
++.It Li "Socket family" Ta "2 bytes" Ta "Socket family"
++.It Li "Address type" Ta "1 byte" Ta "Address type (IPv4/IPv6)"
++.It Li "Local port" Ta "2 bytes" Ta "Local port"
++.It Li "Local IP address" Ta "4/16 bytes" Ta "Local IP address"
++.It Li "Remote port" Ta "2 bytes" Ta "Remote port"
++.It Li "Remote IP address" Ta "4/16 bytes" Ta "Remote IP address"
 .El
 .Ss Expanded Socket Token
 The
-.Dv expanded socket
+.Dq expanded socket
 token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li XXXXX
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It XXXXX
 .El
 .Ss Seq Token
 The
-.Dv seq
+.Dq seq
 token contains a unique and monotonically increasing audit event sequence ID.
 Due to the limited range of 32 bits, serial number arithmetic and caution
 should be used when comparing sequence numbers.
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li "Sequence Number" Ta "4 bytes" Ta "Audit event sequence number"
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It "Sequence Number	4 bytes	Audit event sequence number"
 .El
 .Ss privilege Token
 The
-.Dv privilege
+.Dq privilege
 token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li XXXXX
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It XXXXX
 .El
 .Ss Use-of-auth Token
 The
-.Dv use-of-auth
+.Dq use-of-auth
 token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li XXXXX
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It XXXXX
 .El
 .Ss Command Token
 The
-.Dv command
+.Dq command
 token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li XXXXX
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It XXXXX
 .El
 .Ss ACL Token
 The
-.Dv ACL
+.Dq ACL
 token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li XXXXX
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It XXXXX
 .El
 .Ss Zonename Token
 The
-.Dv zonename
+.Dq zonename
 token ...
-.Bl -column -offset ind ".Sy Field Name Width XX" ".Sy XX Bytes XXXX" ".Sy Description"
-.It Sy "Field" Ta Sy Bytes Ta Sy Description
-.It Li "Token ID" Ta "1 byte" Ta "Token ID"
-.It Li XXXXX
+.Bl -column -offset 3n ".No Terminal Address Type/Length" ".No N bytes + 1 NUL"
+.It Sy "Field	Bytes	Description"
+.It "Token ID	1 byte	Token ID"
+.It XXXXX
 .El
 .Sh SEE ALSO
+.Xr auditreduce 1 ,
+.Xr praudit 1 ,
 .Xr libbsm 3 ,
+.Xr audit 4 ,
+.Xr auditpipe 4 ,
 .Xr audit 8
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
 .Pp
 This manual page was written by
 .An Robert Watson Aq rwatson@FreeBSD.org .
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
 .Sh BUGS
 The
-.Dv How to print
+.Dq How to print
 field in the
-.Dv arbitrary data
+.Dq arbitrary data
 token has undefined values.
 .Pp
 The
-.Dv in_addr
+.Dq in_addr
 and
-.Dv in_addr_ex
+.Dq in_addr_ex
 token layout documented here appears to be in conflict with the
 .Xr libbsm 3
 implementations of
--- man/audit_class.5	2006/02/05 11:09:12
+++ man/audit_class.5	2006/10/05 11:59:05
@@ -1,18 +1,18 @@
 .\" Copyright (c) 2004 Apple Computer, Inc.
 .\" All rights reserved.
-.\" 
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" 1.  Redistributions of source code must retain the above copyright
-.\"     notice, this list of conditions and the following disclaimer. 
+.\"     notice, this list of conditions and the following disclaimer.
 .\" 2.  Redistributions in binary form must reproduce the above copyright
 .\"     notice, this list of conditions and the following disclaimer in the
-.\"     documentation and/or other materials provided with the distribution. 
+.\"     documentation and/or other materials provided with the distribution.
 .\" 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 .\"     its contributors may be used to endorse or promote products derived
-.\"     from this software without specific prior written permission. 
-.\" 
+.\"     from this software without specific prior written permission.
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -32,17 +32,17 @@
 .Os
 .Sh NAME
 .Nm audit_class
-.Nd "contains audit event class descriptions"
+.Nd "audit event class descriptions"
 .Sh DESCRIPTION
 The
-.Nm 
+.Nm
 file contains descriptions of the auditable event classes on the system.
 Each auditable event is a member of an event class.
-Each line maps an audit event 
+Each line maps an audit event
 mask (bitmap) to a class and a description.
 Entries are of the form:
 .Pp
-.Dl classmask:eventclass:description
+.D1 Ar classmask Ns : Ns Ar eventclass Ns : Ns Ar description
 .Pp
 Example entries in this file are:
 .Bd -literal -offset indent
@@ -54,18 +54,27 @@
 0xffffffff:all:all flags set
 .Ed
 .Sh FILES
-.Bl -tag -width "/etc/security/audit_class" -compact
+.Bl -tag -width ".Pa /etc/security/audit_class" -compact
 .It Pa /etc/security/audit_class
 .El
+.Sh SEE ALSO
+.Xr audit 4 ,
+.Xr audit_control 5 ,
+.Xr audit_event 5 ,
+.Xr audit_user 5
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- man/audit_control.5	2006/09/23 17:41:51
+++ man/audit_control.5	2006/10/05 11:59:05
@@ -1,19 +1,19 @@
 .\" Copyright (c) 2004 Apple Computer, Inc.
 .\" Copyright (c) 2006 Robert N. M. Watson
 .\" All rights reserved.
-.\" 
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" 1.  Redistributions of source code must retain the above copyright
-.\"     notice, this list of conditions and the following disclaimer. 
+.\"     notice, this list of conditions and the following disclaimer.
 .\" 2.  Redistributions in binary form must reproduce the above copyright
 .\"     notice, this list of conditions and the following disclaimer in the
-.\"     documentation and/or other materials provided with the distribution. 
+.\"     documentation and/or other materials provided with the distribution.
 .\" 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 .\"     its contributors may be used to endorse or promote products derived
-.\"     from this software without specific prior written permission. 
-.\" 
+.\"     from this software without specific prior written permission.
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -33,18 +33,18 @@
 .Os
 .Sh NAME
 .Nm audit_control
-.Nd "contains audit system parameters"
+.Nd "audit system parameters"
 .Sh DESCRIPTION
 The
 .Nm
 file contains several audit system parameters.
 Each line of this file is of the form:
 .Pp
-.Dl parameter:value
+.D1 Ar parameter Ns : Ns Ar value
 .Pp
 The parameters are:
-.Bl -tag -width Ds
-.It Pa dir
+.Bl -tag -width indent
+.It Va dir
 The directory where audit log files are stored.
 There may be more than one of these entries.
 Changes to this entry can only be enacted by restarting the
@@ -53,7 +53,7 @@
 .Xr audit 1
 for a description of how to restart the audit system.
 .It Va flags
-Specifies which audit event classes are audited for all users.  
+Specifies which audit event classes are audited for all users.
 .Xr audit_user 5
 describes how to audit events for individual users.
 See the information below for the format of the audit flags.
@@ -76,73 +76,85 @@
 .El
 .Sh AUDIT FLAGS
 Audit flags are a comma-delimited list of audit classes as defined in the
-.Pa audit_class
+.Xr audit_class 5
 file.
-See
-.Xr audit_class 5
-for details.
 Event classes may be preceded by a prefix which changes their interpretation.
 The following prefixes may be used for each class:
 .Pp
-.Bl -tag -width Ds -compact -offset indent
+.Bl -tag -width indent -compact -offset indent
 .It (none)
-Record both successful and failed events
-.It +
-Record successful events
-.It -
-Record failed events
-.It ^
-Record neither successful nor failed events
-.It ^+
-Do not record successful events
-.It ^-
-Do not record failed events
+Record both successful and failed events.
+.It Li +
+Record successful events.
+.It Li -
+Record failed events.
+.It Li ^
+Record neither successful nor failed events.
+.It Li ^+
+Do not record successful events.
+.It Li ^-
+Do not record failed events.
 .El
 .Sh AUDIT POLICY FLAGS
 The policy flags field is a comma-delimited list of policy flags from the
 following list:
 .Pp
-.Bl -tag -width zonename -compact -offset indent
-.It cnt
+.Bl -tag -width ".Cm zonename" -compact -offset indent
+.It Cm cnt
 Allow processes to continue running even though events are not being audited.
 If not set, processes will be suspended when the audit store space is
 exhausted.
 Currently, this is not a recoverable state.
-.It ahlt
-Fail stop the system if unable to audit an event--this consists of first
+.It Cm ahlt
+Fail stop the system if unable to audit an event\[em]this consists of first
 draining pending records to disk, and then halting the operating system.
-.It argv
+.It Cm argv
 Audit command line arguments to
 .Xr execve 2 .
-.It arge
+.It Cm arge
 Audit environmental variable arguments to
 .Xr execve 2 .
-.It seq
+.It Cm seq
 Include a unique audit sequence number token in generated audit records (not
-implemented on FreeBSD or Darwin).
-.It group
+implemented on
+.Fx
+or Darwin).
+.It Cm group
 Include supplementary groups list in generated audit records (not implemented
-on FreeBSD or Darwin; supplementary groups are never included in records on
+on
+.Fx
+or Darwin; supplementary groups are never included in records on
 these systems).
-.It trail
-Append a trailer token to each audit record (not implemented on FreeBSD or
+.It Cm trail
+Append a trailer token to each audit record (not implemented on
+.Fx
+or
 Darwin; trailers are always included in records on these systems).
-.It path
-Include secondary file paths in audit records (not implemented on FreeBSD or
+.It Cm path
+Include secondary file paths in audit records (not implemented on
+.Fx
+or
 Darwin; secondary paths are never included in records on these systems).
-.It zonename
-Include a zone ID token with each audit record (not implemented on FreeBSD or
-Darwin; FreeBSD audit records do not currently include the jail ID or name.)
-.It perzone
-Enable auditing for each local zone (not implemented on FreeBSD or Darwin; on
-FreeBSD, audit records are collected from all jails and placed in a single
-global trail, and only limited audit controls are permitted within a jail.)
+.It Cm zonename
+Include a zone ID token with each audit record (not implemented on
+.Fx
+or
+Darwin;
+.Fx
+audit records do not currently include the jail ID or name).
+.It Cm perzone
+Enable auditing for each local zone (not implemented on
+.Fx
+or Darwin; on
+.Fx ,
+audit records are collected from all jails and placed in a single
+global trail, and only limited audit controls are permitted within a jail).
 .El
 .Pp
 It is recommended that installations set the
-.Dv cnt
+.Cm cnt
 flag but not
-.Dv ahlt
+.Cm ahlt
 flag unless it is intended that audit logs exceeding available disk space
 halt the system.
 .Sh DEFAULT
@@ -169,23 +181,29 @@
 The trail file will not be automatically rotated by the audit daemon based on
 file size.
 .Sh FILES
-.Bl -tag -width "/etc/security/audit_control" -compact
+.Bl -tag -width ".Pa /etc/security/audit_control" -compact
 .It Pa /etc/security/audit_control
 .El
 .Sh SEE ALSO
+.Xr audit 4 ,
 .Xr audit_class 5 ,
+.Xr audit_event 5 ,
 .Xr audit_user 5 ,
 .Xr audit 8 ,
 .Xr auditd 8
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- man/audit_event.5	2006/02/05 11:09:12
+++ man/audit_event.5	2006/10/05 11:59:05
@@ -1,18 +1,18 @@
 .\" Copyright (c) 2004 Apple Computer, Inc.
 .\" All rights reserved.
-.\" 
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" 1.  Redistributions of source code must retain the above copyright
-.\"     notice, this list of conditions and the following disclaimer. 
+.\"     notice, this list of conditions and the following disclaimer.
 .\" 2.  Redistributions in binary form must reproduce the above copyright
 .\"     notice, this list of conditions and the following disclaimer in the
-.\"     documentation and/or other materials provided with the distribution. 
+.\"     documentation and/or other materials provided with the distribution.
 .\" 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 .\"     its contributors may be used to endorse or promote products derived
-.\"     from this software without specific prior written permission. 
-.\" 
+.\"     from this software without specific prior written permission.
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -32,24 +32,23 @@
 .Os
 .Sh NAME
 .Nm audit_event
-.Nd "contains audit event descriptions"
+.Nd "audit event descriptions"
 .Sh DESCRIPTION
 The
-.Nm 
+.Nm
 file contains descriptions of the auditable events on the system.
 Each line maps an audit event number to a name, a description, and a class.
 Entries are of the form:
 .Pp
-.Dl eventnum:eventname:description:eventclass
+.Sm off
+.D1 Ar eventnum : eventname : description : eventclass
+.Sm on
 .Pp
 Each
-.Vt eventclass
+.Ar eventclass
 should have a corresponding entry in the
-.Pa audit_class
+.Xr audit_class 5
 file.
-See 
-.Xr audit_class 5
-for details.
 .Pp
 Example entries in this file are:
 .Bd -literal -offset indent
@@ -59,20 +58,27 @@
 3:AUE_OPEN:open(2):fa
 .Ed
 .Sh FILES
-.Bl -tag -width "/etc/security/audit_event" -compact
+.Bl -tag -width ".Pa /etc/security/audit_event" -compact
 .It Pa /etc/security/audit_event
 .El
 .Sh SEE ALSO
-.Xr audit_class 5
+.Xr audit 4 ,
+.Xr audit_class 5 ,
+.Xr audit_control 5 ,
+.Xr audit_user 5
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- man/audit_user.5	2006/02/05 11:09:12
+++ man/audit_user.5	2006/10/05 18:04:15
@@ -1,18 +1,18 @@
 .\" Copyright (c) 2004 Apple Computer, Inc.
 .\" All rights reserved.
-.\" 
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" 1.  Redistributions of source code must retain the above copyright
-.\"     notice, this list of conditions and the following disclaimer. 
+.\"     notice, this list of conditions and the following disclaimer.
 .\" 2.  Redistributions in binary form must reproduce the above copyright
 .\"     notice, this list of conditions and the following disclaimer in the
-.\"     documentation and/or other materials provided with the distribution. 
+.\"     documentation and/or other materials provided with the distribution.
 .\" 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 .\"     its contributors may be used to endorse or promote products derived
-.\"     from this software without specific prior written permission. 
-.\" 
+.\"     from this software without specific prior written permission.
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -32,26 +32,26 @@
 .Os
 .Sh NAME
 .Nm audit_user
-.Nd "specifies events to be audited for the given users"
+.Nd "events to be audited for given users"
 .Sh DESCRIPTION
 The
-.Nm 
+.Nm
 file specifies which audit event classes are to be audited for the given users.
 If specified, these flags are combined with the system-wide audit flags in the
-.Pa audit_control
+.Xr audit_control 5
 file to determine which classes of events to audit for that user.
 These settings take effect when the user logs in.
 .Pp
 Each line maps a user name to a list of classes that should be audited and a
-list of classes that should not be audited. 
+list of classes that should not be audited.
 Entries are of the form:
 .Pp
-.Dl username:alwaysaudit:neveraudit
+.D1 Ar username Ns : Ns Ar alwaysaudit Ns : Ns Ar neveraudit
 .Pp
 In the format above,
-.Vt alwaysaudit
+.Ar alwaysaudit
 is a set of event classes that are always audited, and
-.Vt neveraudit
+.Ar neveraudit
 is a set of event classes that should not be audited.
 These sets can indicate
 the inclusion or exclusion of multiple classes, and whether to audit successful
@@ -67,27 +67,54 @@
 .Ed
 .Pp
 These settings would cause login/logout and administrative events that
-succeed on behalf of user root to be audited.
+succeed on behalf of user
+.Dq Li root
+to be audited.
 No failure events are audited.
 For the user
-.Em jdoe ,
+.Dq Li jdoe ,
 failed file creation events are audited, administrative events are
 audited, and successful file write events are never audited.
+.Sh IMPLEMENTATION NOTES
+Per-user and global audit preselection configuration are evaluated at time of
+login, so users must log out and back in again for audit changes relating to
+preselection to take effect.
+.Pp
+Audit record preselection occurs with respect to the audit identifier
+associated with a process, rather than with respect to the UNIX user or group
+ID.
+The audit identifier is set as part of the user credential context as part of
+login, and typically does not change as a result of running setuid or setgid
+applications, such as
+.Xr su 1 .
+This has the advantage that events that occur after running
+.Xr su 1
+can be audited to the original authenticated user, as required by CAPP, but
+may be surprising if not expected.
 .Sh FILES
-.Bl -tag -width "/etc/security/audit_user" -compact
+.Bl -tag -width ".Pa /etc/security/audit_user" -compact
 .It Pa /etc/security/audit_user
 .El
 .Sh SEE ALSO
-.Xr audit_control 5
+.Xr login 1 ,
+.Xr su 1 ,
+.Xr audit 4 ,
+.Xr audit_class 5 ,
+.Xr audit_control 5 ,
+.Xr audit_event 5
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- man/audit_warn.5	2006/02/04 18:09:36
+++ man/audit_warn.5	2006/10/05 11:59:05
@@ -1,18 +1,18 @@
 .\" Copyright (c) 2004 Apple Computer, Inc.
 .\" All rights reserved.
-.\" 
+.\"
 .\" Redistribution and use in source and binary forms, with or without
 .\" modification, are permitted provided that the following conditions
 .\" are met:
 .\" 1.  Redistributions of source code must retain the above copyright
-.\"     notice, this list of conditions and the following disclaimer. 
+.\"     notice, this list of conditions and the following disclaimer.
 .\" 2.  Redistributions in binary form must reproduce the above copyright
 .\"     notice, this list of conditions and the following disclaimer in the
-.\"     documentation and/or other materials provided with the distribution. 
+.\"     documentation and/or other materials provided with the distribution.
 .\" 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 .\"     its contributors may be used to endorse or promote products derived
-.\"     from this software without specific prior written permission. 
-.\" 
+.\"     from this software without specific prior written permission.
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -34,36 +34,43 @@
 .Nm audit_warn
 .Nd "alert when audit daemon issues warnings"
 .Sh DESCRIPTION
-.Nm 
-runs when 
+The
+.Nm
+script
+runs when
 .Xr auditd 8
-generates warning messages.  
+generates warning messages.
 .Pp
-The default 
+The default
 .Nm
 is a script whose first parameter is the type of warning; the script
-appends its arguments to 
+appends its arguments to
 .Pa /etc/security/audit_messages .
 Administrators may replace this script: a more comprehensive one would take
 different actions based on the type of warning.
 For example, a low-space warning
-could result in an email message being sent to the administrator.  
+could result in an email message being sent to the administrator.
 .Sh FILES
-.Bl -tag -width "/etc/security/audit_warn" -compact
+.Bl -tag -width ".Pa /etc/security/audit_messages" -compact
 .It Pa /etc/security/audit_warn
 .It Pa /etc/security/audit_messages
 .El
 .Sh SEE ALSO
+.Xr audit 4 ,
 .Xr auditd 8
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- man/auditctl.2	2006/05/01 21:54:35
+++ man/auditctl.2	2006/10/03 15:12:02
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -30,7 +30,7 @@
 .Os
 .Sh NAME
 .Nm auditctl
-.Nd "Configure system audit parameters"
+.Nd "configure system audit parameters"
 .Sh SYNOPSIS
 .In bsm/audit.h
 .Ft int
@@ -39,40 +39,41 @@
 The
 .Fn auditctl
 system call directs the kernel to open a new audit trail log file.
-.Fn auditctl
-requires appropriate privilege.
+It requires an appropriate privilege.
 In the
 .Fx
 implementation,
 .Fn auditctl
 opens new files, but
-.Fn auditon
+.Xr auditon 2
 is used to disable the audit log.
 In the Mac OS X implementation, passing
-.Va NULL
+.Dv NULL
 to
 .Fn auditctl
 will disable the audit log.
 .Sh RETURN VALUES
-.Nm
-returns 0 on success, or returns -1 on failure, providing additional error
-information via
-.Va errno .
+.Rv -std
 .Sh SEE ALSO
+.Xr auditon 2 ,
 .Xr libbsm 3 ,
 .Xr auditd 8
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
 .Pp
 This manual page was written by
 .An Robert Watson Aq rwatson@FreeBSD.org .
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- man/auditon.2	2006/09/09 10:08:59
+++ man/auditon.2	2006/10/03 15:12:02
@@ -32,30 +32,40 @@
 .Os
 .Sh NAME
 .Nm auditon
-.Nd "Configure system audit parameters"
+.Nd "configure system audit parameters"
 .Sh SYNOPSIS
 .In bsm/audit.h
 .Ft int
 .Fn auditon "int cmd" "void *data" "u_int length"
 .Sh DESCRIPTION
 The
-.Nm
+.Fn auditon
 system call is used to manipulate various audit control operations.
-.Ft *data
+The
+.Fa data
+argument
 should point to a structure whose type depends on the command.
-.Ft length
-specifies the size of the 
-.Em data 
+The
+.Fa length
+argument
+specifies the size of
+.Fa *data
 in bytes.
-.Ft cmd
+The
+.Fa cmd
+argument
 may be any of the following:
 .Bl -tag -width ".It Dv A_GETPINFO_ADDR"
 .It Dv A_SETPOLICY
 Set audit policy flags.
-.Ft *data
-must point to a long value set to one of the audit 
+The
+.Fa data
+argument
+must point to a
+.Vt long
+value set to one of the audit
 policy control values defined in
-.Pa audit.h .
+.In bsm/audit.h .
 Currently, only
 .Dv AUDIT_CNT
 and
@@ -76,24 +86,28 @@
 .Er ENOSYS .
 .It Dv A_SETKMASK
 Set the kernel preselection masks (success and failure).
-.Ft *data
+The
+.Fa data
+argument
 must point to a
-.Ft au_mask_t
+.Vt au_mask_t
 structure containing the mask values.
 These masks are used for non-attributable audit event preselection.
 .It Dv A_SETQCTRL
 Set kernel audit queue parameters.
-.Ft *data
+The
+.Fa data
+argument
 must point to a
-.Ft au_qctrl_t
+.Vt au_qctrl_t
 structure containing the
 kernel audit queue control settings:
-.Va high water ,
-.Va low water ,
-.Va output buffer size ,
-.Va percent min free disk space ,
+.Dq "high water" ,
+.Dq "low water" ,
+.Dq "output buffer size" ,
+.Dq "percent min free disk space" ,
 and
-.Em delay
+.Dq delay
 (not currently used).
 .It Dv A_SETSTAT
 Return
@@ -106,8 +120,12 @@
 .Er ENOSYS .
 .It Dv A_SETCOND
 Set the current auditing condition.
-.Ft *data
-must point to a long value containing the new
+The
+.Fa data
+argument
+must point to a
+.Vt long
+value containing the new
 audit condition, one of
 .Dv AUC_AUDITING ,
 .Dv AUC_NOAUDIT ,
@@ -115,43 +133,54 @@
 .Dv AUC_DISABLED .
 .It Dv A_SETCLASS
 Set the event class preselection mask for an audit event.
-.Ft *data
+The
+.Fa data
+argument
 must point to a
-.Ft au_evclass_map_t
+.Vt au_evclass_map_t
 structure containing the audit event and mask.
 .It Dv A_SETPMASK
 Set the preselection masks for a process.
-.Ft *data
+The
+.Fa data
+argument
 must point to a
-.Ft auditpinfo_t
-structure that contains the given process's audit 
+.Vt auditpinfo_t
+structure that contains the given process's audit
 preselection masks for both success and failure.
 .It Dv A_SETFSIZE
 Set the maximum size of the audit log file.
-.Ft *data
+The
+.Fa data
+argument
 must point to a
-.Ft au_fstat_t
+.Vt au_fstat_t
 structure with the
-.Ft af_filesz
-field set to the maximum audit log file size. A value of 0
+.Va af_filesz
+field set to the maximum audit log file size.
+A value of 0
 indicates no limit to the size.
 .It Dv A_SETKAUDIT
 Return
 .Er ENOSYS .
 .It Dv A_GETCLASS
 Return the event to class mapping for the designated audit event.
-.Ft *data
-must point to a 
-.Ft au_evclass_map_t
+The
+.Fa data
+argument
+must point to a
+.Vt au_evclass_map_t
 structure.
 .It Dv A_GETKAUDIT
 Return
 .Er ENOSYS .
 .It Dv A_GETPINFO
 Return the audit settings for a process.
-.Ft *data
+The
+.Fa data
+argument
 must point to a
-.Ft auditpinfo_t
+.Vt auditpinfo_t
 structure which will be set to contain
 the audit ID, preselection mask, terminal ID, and audit session
 ID of the given process.
@@ -160,15 +189,21 @@
 .Er ENOSYS .
 .It Dv A_GETKMASK
 Return the current kernel preselection masks.
-.Ft *data
+The
+.Fa data
+argument
 must point to a
-.Ft au_mask_t
-structure which will be set to 
+.Vt au_mask_t
+structure which will be set to
 the current kernel preselection masks for non-attributable events.
 .It Dv A_GETPOLICY
 Return the current audit policy setting.
-.Ft *data
-must point to a long value which will be set to
+The
+.Fa data
+argument
+must point to a
+.Vt long
+value which will be set to
 one of the current audit policy flags.
 Currently, only
 .Dv AUDIT_CNT
@@ -177,22 +212,28 @@
 are implemented.
 .It Dv A_GETQCTRL
 Return the current kernel audit queue control parameters.
-.Ft *data
-must point to a 
-.Ft au_qctrl_t
+The
+.Fa data
+argument
+must point to a
+.Vt au_qctrl_t
 structure which will be set to the current
 kernel audit queue control parameters.
 .It Dv A_GETFSIZE
 Returns the maximum size of the audit log file.
-.Ft *data
+The
+.Fa data
+argument
 must point to a
-.Ft au_fstat_t
-structure. The
-.Ft af_filesz
+.Vt au_fstat_t
+structure.
+The
+.Va af_filesz
 field will be set to the maximum audit log file size.
 A value of 0 indicates no limit to the size.
 The
-.Ft af_currsz
+.Va af_currsz
+field
 will be set to the current audit log file size.
 .It Dv A_GETCWD
 .\" [COMMENTED OUT]: Valid description, not yet implemented.
@@ -212,16 +253,24 @@
 .Er ENOSYS .
 .It Dv A_GETCOND
 Return the current auditing condition.
-.Ft *data
-must point to a long value which will be set to
+The
+.Fa data
+argument
+must point to a
+.Vt long
+value which will be set to
 the current audit condition, either
 .Dv AUC_AUDITING
 or
 .Dv AUC_NOAUDIT .
 .It Dv A_SENDTRIGGER
 Send a trigger to the audit daemon.
-.Fr *data
-must point to a long value set to one of the acceptable
+The
+.Fa data
+argument
+must point to a
+.Vt long
+value set to one of the acceptable
 trigger values:
 .Dv AUDIT_TRIGGER_LOW_SPACE
 (low disk space where the audit log resides),
@@ -264,17 +313,26 @@
 .Sh SEE ALSO
 .Xr audit 2 ,
 .Xr auditctl 2 ,
+.Xr getaudit 2 ,
+.Xr getaudit_addr 2 ,
 .Xr getauid 2 ,
-.Xr setauid 2 ,
-.Xr getaudit 2 ,
 .Xr setaudit 2 ,
-.Xr getaudit_addr 2 ,
 .Xr setaudit_addr 2 ,
+.Xr setauid 2 ,
 .Xr libbsm 3
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
@@ -284,8 +342,3 @@
 .An Robert Watson Aq rwatson@FreeBSD.org ,
 and
 .An Wayne Salamon Aq wsalamon@FreeBSD.org .
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2003.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- man/getaudit.2	2006/02/04 17:01:41
+++ man/getaudit.2	2006/10/03 15:12:02
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -31,7 +31,7 @@
 .Sh NAME
 .Nm getaudit ,
 .Nm getaudit_addr
-.Nd "Retrieve audit session state"
+.Nd "retrieve audit session state"
 .Sh SYNOPSIS
 .In bsm/audit.h
 .Ft int
@@ -39,42 +39,47 @@
 .Ft int
 .Fn getaudit_addr "auditinfo_addr_t *auditinfo_addr" "u_int length"
 .Sh DESCRIPTION
+The
 .Fn getaudit
+system call
 retrieves the active audit session state for the current process via the
 .Vt auditinfo_t
 pointed to by
-.Va auditinfo .
+.Fa auditinfo .
+The
 .Fn getaudit_addr
+system call
 retrieves extended state via
-.Va auditinfo_addr
+.Fa auditinfo_addr
 and
-.Va length .
+.Fa length .
 .Pp
-This system call requires appropriate privilege to complete.
+These system calls require an appropriate privilege to complete.
 .Sh RETURN VALUES
-.Nm
-returns 0 on success, or returns -1 on failure, providing additional error
-information via
-.Va errno .
+.Rv -std getaudit getaudit_addr
 .Sh SEE ALSO
 .Xr audit 2 ,
 .Xr auditon 2 ,
 .Xr getauid 2 ,
+.Xr setaudit 2 ,
 .Xr setauid 2 ,
-.Xr setaudit 2 ,
 .Xr libbsm 3
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
 .Pp
 This manual page was written by
 .An Robert Watson Aq rwatson@FreeBSD.org .
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- man/getauid.2	2006/02/04 17:01:41
+++ man/getauid.2	2006/10/03 15:12:02
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -30,45 +30,48 @@
 .Os
 .Sh NAME
 .Nm getauid
-.Nd "Retrieve audit session ID"
+.Nd "retrieve audit session ID"
 .Sh SYNOPSIS
 .In bsm/audit.h
 .Ft int
 .Fn getauid "au_id_t *auid"
 .Sh DESCRIPTION
-.Nm
+The
+.Fn getauid
+system call
 retrieves the active audit session ID for the current process via the
 .Vt au_id_t
 pointed to by
-.Va auid .
+.Fa auid .
 .Pp
-This system call requires appropriate privilege to complete.
+This system call requires an appropriate privilege to complete.
 .Sh RETURN VALUES
-.Nm
-returns 0 on success, or returns -1 on failure, providing additional error
-information via
-.Va errno .
+.Rv -std
 .Sh SEE ALSO
 .Xr audit 2 ,
 .Xr auditon 2 ,
-.Xr setauid 2 ,
 .Xr getaudit 2 ,
+.Xr getaudit_addr 2 ,
 .Xr setaudit 2 ,
-.Xr getaudit_addr 2 ,
 .Xr setaudit_addr 2 ,
+.Xr setauid 2 ,
 .Xr libbsm 3
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
 .Pp
 This manual page was written by
 .An Robert Watson Aq rwatson@FreeBSD.org .
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- man/setaudit.2	2006/02/04 17:01:41
+++ man/setaudit.2	2006/10/03 15:12:02
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -31,51 +31,55 @@
 .Sh NAME
 .Nm setaudit ,
 .Nm setaudit_addr
-.Nd "Set audit session state"
+.Nd "set audit session state"
 .Sh SYNOPSIS
 .In bsm/audit.h
 .Ft int
 .Fn setaudit "auditinfo_t *auditinfo"
 .Ft int
-.Fn setaudit_addr "auditinfo_addr_t *auditinfo" "u_int length"
+.Fn setaudit_addr "auditinfo_addr_t *auditinfo_addr" "u_int length"
 .Sh DESCRIPTION
-.Nm
+The
+.Fn setaudit
+system call
 sets the active audit session state for the current process via the
 .Vt auditinfo_t
 pointed to by
-.Va auditinfo .
+.Fa auditinfo .
+The
 .Fn setaudit_addr
+system call
 sets extended state via
-.Va auditinfo_addr
+.Fa auditinfo_addr
 and
-.Va length .
+.Fa length .
 .Pp
-This system call requires appropriate privilege to complete.
+These system calls require an appropriate privilege to complete.
 .Sh RETURN VALUES
-.Nm
-returns 0 on success, or returns -1 on failure, providing additional error
-information via
-.Va errno .
+.Rv -std setaudit setaudit_addr
 .Sh SEE ALSO
 .Xr audit 2 ,
 .Xr auditon 2 ,
 .Xr getaudit 2 ,
 .Xr getauid 2 ,
 .Xr setauid 2 ,
-.Xr getaudit 2 ,
 .Xr libbsm 3
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
 .Pp
 This manual page was written by
 .An Robert Watson Aq rwatson@FreeBSD.org .
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
--- man/setauid.2	2006/02/04 17:01:41
+++ man/setauid.2	2006/10/03 15:12:02
@@ -10,7 +10,7 @@
 .\" 2. Redistributions in binary form must reproduce the above copyright
 .\"    notice, this list of conditions and the following disclaimer in the
 .\"    documentation and/or other materials provided with the distribution.
-.\" 
+.\"
 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -30,45 +30,48 @@
 .Os
 .Sh NAME
 .Nm setauid
-.Nd "Set audit session ID"
+.Nd "set audit session ID"
 .Sh SYNOPSIS
 .In bsm/audit.h
 .Ft int
 .Fn setauid "au_id_t *auid"
 .Sh DESCRIPTION
-.Nm
+The
+.Fn setauid
+system call
 sets the active audit session ID for the current process from the
 .Vt au_id_t
 pointed to by
-.Va auid .
+.Fa auid .
 .Pp
-This system call requires appropriate privilege to complete.
+This system call requires an appropriate privilege to complete.
 .Sh RETURN VALUES
-.Nm
-returns 0 on success, or returns -1 on failure, providing additional error
-information via
-.Va errno .
+.Rv -std
 .Sh SEE ALSO
 .Xr audit 2 ,
 .Xr auditon 2 ,
+.Xr getaudit 2 ,
+.Xr getaudit_addr 2 ,
 .Xr getauid 2 ,
-.Xr getaudit 2 ,
 .Xr setaudit 2 ,
-.Xr getaudit_addr 2 ,
 .Xr setaudit_addr 2 ,
 .Xr libbsm 3
+.Sh HISTORY
+The OpenBSM implementation was created by McAfee Research, the security
+division of McAfee Inc., under contract to Apple Computer Inc.\& in 2004.
+It was subsequently adopted by the TrustedBSD Project as the foundation for
+the OpenBSM distribution.
 .Sh AUTHORS
+.An -nosplit
 This software was created by McAfee Research, the security research division
 of McAfee, Inc., under contract to Apple Computer Inc.
-Additional authors include Wayne Salamon, Robert Watson, and SPARTA Inc.
+Additional authors include
+.An Wayne Salamon ,
+.An Robert Watson ,
+and SPARTA Inc.
 .Pp
 The Basic Security Module (BSM) interface to audit records and audit event
 stream format were defined by Sun Microsystems.
 .Pp
 This manual page was written by
 .An Robert Watson Aq rwatson@FreeBSD.org .
-.Sh HISTORY
-The OpenBSM implementation was created by McAfee Research, the security
-division of McAfee Inc., under contract to Apple Computer Inc. in 2004.
-It was subsequently adopted by the TrustedBSD Project as the foundation for
-the OpenBSM distribution.
